Add project picker to invoice edit

This commit is contained in:
Hillel Coren 2021-11-28 15:34:43 +02:00
parent 65701a7748
commit 6d91f5f730
2 changed files with 30 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
// Package imports:
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/ui/app/forms/project_picker.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:native_pdf_view/native_pdf_view.dart';
@ -714,10 +715,25 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
),
),
),
] else if (!invoice.isInvoice) ...[
] else ...[
SizedBox(width: kTableColumnGap),
Expanded(child: SizedBox()),
],
],
),
Row(
children: [
if (company
.isModuleEnabled(EntityType.project))
Expanded(
child: ProjectPicker(
clientId: invoice.clientId,
projectId: invoice.projectId,
onChanged: (projectId) {
viewModel.onChanged(invoice.rebuild(
(b) => b..projectId = projectId));
},
)),
if (invoice.isInvoice) ...[
SizedBox(width: kTableColumnGap),
Expanded(
@ -740,6 +756,9 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
),
),
),
] else ...[
SizedBox(width: kTableColumnGap),
Expanded(child: SizedBox()),
],
],
)

View File

@ -15,6 +15,7 @@ import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
import 'package:invoiceninja_flutter/ui/app/forms/design_picker.dart';
import 'package:invoiceninja_flutter/ui/app/forms/discount_field.dart';
import 'package:invoiceninja_flutter/ui/app/forms/project_picker.dart';
import 'package:invoiceninja_flutter/ui/app/forms/user_picker.dart';
import 'package:invoiceninja_flutter/ui/app/invoice/tax_rate_dropdown.dart';
import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart';
@ -411,6 +412,15 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
onSelected: (value) => viewModel
.onChanged(invoice.rebuild((b) => b..designId = value?.id)),
),
if (company.isModuleEnabled(EntityType.project))
ProjectPicker(
clientId: invoice.clientId,
projectId: invoice.projectId,
onChanged: (projectId) {
viewModel.onChanged(
invoice.rebuild((b) => b..projectId = projectId));
},
),
DecoratedFormField(
key: ValueKey('__exchange_rate_${invoice.clientId}__'),
label: localization.exchangeRate,