Add designs templates
This commit is contained in:
parent
891de33673
commit
dafaa2c81d
|
|
@ -19,6 +19,7 @@ import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/dialogs/error_dialog.dart';
|
import 'package:invoiceninja_flutter/ui/app/dialogs/error_dialog.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/design_picker.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/multiselect.dart';
|
import 'package:invoiceninja_flutter/ui/app/multiselect.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/files.dart';
|
import 'package:invoiceninja_flutter/utils/files.dart';
|
||||||
|
|
@ -42,6 +43,8 @@ import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
||||||
|
|
||||||
|
import '../../redux/design/design_selectors.dart';
|
||||||
|
|
||||||
class ClientPdfView extends StatefulWidget {
|
class ClientPdfView extends StatefulWidget {
|
||||||
const ClientPdfView({
|
const ClientPdfView({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
|
@ -68,15 +71,7 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
String? _endDate = convertDateTimeToSqlDate();
|
String? _endDate = convertDateTimeToSqlDate();
|
||||||
String _status = kStatementStatusAll;
|
String _status = kStatementStatusAll;
|
||||||
String? _pdfString;
|
String? _pdfString;
|
||||||
|
String? _designId;
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
//final state = widget.viewModel.state;
|
|
||||||
//final settings = state.dashboardUIState.settings;
|
|
||||||
//_dateRange = settings.dateRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
|
|
@ -188,7 +183,25 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
final localization = AppLocalization.of(context)!;
|
final localization = AppLocalization.of(context)!;
|
||||||
final client = widget.viewModel.client!;
|
final client = widget.viewModel.client!;
|
||||||
|
|
||||||
final datePicker = Flexible(
|
final designPicker = Expanded(
|
||||||
|
child: IgnorePointer(
|
||||||
|
ignoring: _isLoading,
|
||||||
|
child: DesignPicker(
|
||||||
|
initialValue: _designId,
|
||||||
|
onSelected: (design) {
|
||||||
|
setState(() {
|
||||||
|
_designId = design?.id;
|
||||||
|
loadPDF();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
label: localization.design,
|
||||||
|
showBlank: true,
|
||||||
|
entityType: EntityType.client,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final datePicker = Expanded(
|
||||||
child: AppDropdownButton<DateRange>(
|
child: AppDropdownButton<DateRange>(
|
||||||
labelText: localization.dateRange,
|
labelText: localization.dateRange,
|
||||||
blankValue: null,
|
blankValue: null,
|
||||||
|
|
@ -213,7 +226,7 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final statusPicker = Flexible(
|
final statusPicker = Expanded(
|
||||||
child: AppDropdownButton<String>(
|
child: AppDropdownButton<String>(
|
||||||
labelText: localization.status,
|
labelText: localization.status,
|
||||||
blankValue: null,
|
blankValue: null,
|
||||||
|
|
@ -236,7 +249,7 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
.toList()),
|
.toList()),
|
||||||
);
|
);
|
||||||
|
|
||||||
final sectionPicker = Flexible(
|
final sectionPicker = Expanded(
|
||||||
child: DropDownMultiSelect(
|
child: DropDownMultiSelect(
|
||||||
onChanged: (List<dynamic> selected) {
|
onChanged: (List<dynamic> selected) {
|
||||||
//_selectedOptions = selected;
|
//_selectedOptions = selected;
|
||||||
|
|
@ -399,6 +412,7 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
body: Column(
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Material(
|
Material(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -406,6 +420,11 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
child: isDesktop(context)
|
child: isDesktop(context)
|
||||||
? Row(
|
? Row(
|
||||||
children: [
|
children: [
|
||||||
|
if (hasDesignTemplatesForEntityType(
|
||||||
|
state.designState.map, EntityType.client)) ...[
|
||||||
|
designPicker,
|
||||||
|
SizedBox(width: 16),
|
||||||
|
],
|
||||||
datePicker,
|
datePicker,
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
statusPicker,
|
statusPicker,
|
||||||
|
|
@ -417,9 +436,7 @@ class _ClientPdfViewState extends State<ClientPdfView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_dateRange == DateRange.custom)
|
if (_dateRange == DateRange.custom)
|
||||||
Container(
|
Material(
|
||||||
width: double.infinity,
|
|
||||||
color: Theme.of(context).colorScheme.background,
|
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
loadPdf();
|
loadPdf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,7 +144,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
|
||||||
];
|
];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final activitySelector =
|
final activityPicker =
|
||||||
_activityId == null || (kIsWeb && state.prefState.enableNativeBrowser)
|
_activityId == null || (kIsWeb && state.prefState.enableNativeBrowser)
|
||||||
? SizedBox()
|
? SizedBox()
|
||||||
: Expanded(
|
: Expanded(
|
||||||
|
|
@ -177,7 +178,7 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final designSelector = _activityId != null ||
|
final designPicker = _activityId != null ||
|
||||||
(kIsWeb && state.prefState.enableNativeBrowser) ||
|
(kIsWeb && state.prefState.enableNativeBrowser) ||
|
||||||
!hasDesignTemplatesForEntityType(
|
!hasDesignTemplatesForEntityType(
|
||||||
state.designState.map, invoice.entityType!)
|
state.designState.map, invoice.entityType!)
|
||||||
|
|
@ -279,8 +280,8 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
|
||||||
Material(
|
Material(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (supportsDesignTemplates()) designSelector,
|
if (supportsDesignTemplates()) designPicker,
|
||||||
activitySelector,
|
activityPicker,
|
||||||
if (invoice.isInvoice && _activityId == null) deliveryNote,
|
if (invoice.isInvoice && _activityId == null) deliveryNote,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue