Save default terms/footer
This commit is contained in:
parent
5fba7023b9
commit
d03dd6e976
|
|
@ -242,6 +242,8 @@ abstract class InvoiceEntity extends Object
|
|||
frequencyId: kFrequencyMonthly,
|
||||
remainingCycles: -1,
|
||||
dueDateDays: 'terms',
|
||||
saveDefaultTerms: false,
|
||||
saveDefaultFooter: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -603,6 +605,12 @@ abstract class InvoiceEntity extends Object
|
|||
@BuiltValueField(compare: false)
|
||||
BuiltList<ActivityEntity> get activities;
|
||||
|
||||
@BuiltValueField(serialize: false)
|
||||
bool get saveDefaultTerms;
|
||||
|
||||
@BuiltValueField(serialize: false)
|
||||
bool get saveDefaultFooter;
|
||||
|
||||
bool get isApproved {
|
||||
if (isQuote &&
|
||||
[
|
||||
|
|
@ -1481,6 +1489,8 @@ abstract class InvoiceEntity extends Object
|
|||
..projectId = ''
|
||||
..expenseId = ''
|
||||
..vendorId = ''
|
||||
..saveDefaultTerms = false
|
||||
..saveDefaultFooter = false
|
||||
..autoBillEnabled = false
|
||||
..subscriptionId = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -1531,6 +1531,10 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
@override
|
||||
final BuiltList<ActivityEntity> activities;
|
||||
@override
|
||||
final bool saveDefaultTerms;
|
||||
@override
|
||||
final bool saveDefaultFooter;
|
||||
@override
|
||||
final int loadedAt;
|
||||
@override
|
||||
final bool isChanged;
|
||||
|
|
@ -1617,6 +1621,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
this.invitations,
|
||||
this.documents,
|
||||
this.activities,
|
||||
this.saveDefaultTerms,
|
||||
this.saveDefaultFooter,
|
||||
this.loadedAt,
|
||||
this.isChanged,
|
||||
this.createdAt,
|
||||
|
|
@ -1720,6 +1726,10 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
documents, 'InvoiceEntity', 'documents');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
activities, 'InvoiceEntity', 'activities');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
saveDefaultTerms, 'InvoiceEntity', 'saveDefaultTerms');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
saveDefaultFooter, 'InvoiceEntity', 'saveDefaultFooter');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
createdAt, 'InvoiceEntity', 'createdAt');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -1801,6 +1811,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
lineItems == other.lineItems &&
|
||||
invitations == other.invitations &&
|
||||
documents == other.documents &&
|
||||
saveDefaultTerms == other.saveDefaultTerms &&
|
||||
saveDefaultFooter == other.saveDefaultFooter &&
|
||||
isChanged == other.isChanged &&
|
||||
createdAt == other.createdAt &&
|
||||
updatedAt == other.updatedAt &&
|
||||
|
|
@ -1833,9 +1845,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), projectId.hashCode), expenseId.hashCode), vendorId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode),
|
||||
remainingCycles.hashCode),
|
||||
dueDateDays.hashCode),
|
||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), projectId.hashCode), expenseId.hashCode), vendorId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode), remainingCycles.hashCode), dueDateDays.hashCode),
|
||||
invoiceId.hashCode),
|
||||
recurringId.hashCode),
|
||||
autoBillEnabled.hashCode),
|
||||
|
|
@ -1844,6 +1854,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
lineItems.hashCode),
|
||||
invitations.hashCode),
|
||||
documents.hashCode),
|
||||
saveDefaultTerms.hashCode),
|
||||
saveDefaultFooter.hashCode),
|
||||
isChanged.hashCode),
|
||||
createdAt.hashCode),
|
||||
updatedAt.hashCode),
|
||||
|
|
@ -1920,6 +1932,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
|||
..add('invitations', invitations)
|
||||
..add('documents', documents)
|
||||
..add('activities', activities)
|
||||
..add('saveDefaultTerms', saveDefaultTerms)
|
||||
..add('saveDefaultFooter', saveDefaultFooter)
|
||||
..add('loadedAt', loadedAt)
|
||||
..add('isChanged', isChanged)
|
||||
..add('createdAt', createdAt)
|
||||
|
|
@ -2210,6 +2224,16 @@ class InvoiceEntityBuilder
|
|||
set activities(ListBuilder<ActivityEntity> activities) =>
|
||||
_$this._activities = activities;
|
||||
|
||||
bool _saveDefaultTerms;
|
||||
bool get saveDefaultTerms => _$this._saveDefaultTerms;
|
||||
set saveDefaultTerms(bool saveDefaultTerms) =>
|
||||
_$this._saveDefaultTerms = saveDefaultTerms;
|
||||
|
||||
bool _saveDefaultFooter;
|
||||
bool get saveDefaultFooter => _$this._saveDefaultFooter;
|
||||
set saveDefaultFooter(bool saveDefaultFooter) =>
|
||||
_$this._saveDefaultFooter = saveDefaultFooter;
|
||||
|
||||
int _loadedAt;
|
||||
int get loadedAt => _$this._loadedAt;
|
||||
set loadedAt(int loadedAt) => _$this._loadedAt = loadedAt;
|
||||
|
|
@ -2321,6 +2345,8 @@ class InvoiceEntityBuilder
|
|||
_invitations = $v.invitations.toBuilder();
|
||||
_documents = $v.documents.toBuilder();
|
||||
_activities = $v.activities.toBuilder();
|
||||
_saveDefaultTerms = $v.saveDefaultTerms;
|
||||
_saveDefaultFooter = $v.saveDefaultFooter;
|
||||
_loadedAt = $v.loadedAt;
|
||||
_isChanged = $v.isChanged;
|
||||
_createdAt = $v.createdAt;
|
||||
|
|
@ -2424,6 +2450,8 @@ class InvoiceEntityBuilder
|
|||
invitations: invitations.build(),
|
||||
documents: documents.build(),
|
||||
activities: activities.build(),
|
||||
saveDefaultTerms: BuiltValueNullFieldError.checkNotNull(saveDefaultTerms, 'InvoiceEntity', 'saveDefaultTerms'),
|
||||
saveDefaultFooter: BuiltValueNullFieldError.checkNotNull(saveDefaultFooter, 'InvoiceEntity', 'saveDefaultFooter'),
|
||||
loadedAt: loadedAt,
|
||||
isChanged: isChanged,
|
||||
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'InvoiceEntity', 'createdAt'),
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ class CreditRepository {
|
|||
Credentials credentials,
|
||||
InvoiceEntity credit,
|
||||
EntityAction action,
|
||||
bool saveDefaultTerms,
|
||||
bool saveDefaultFooter,
|
||||
) async {
|
||||
credit = credit.rebuild((b) => b..documents.clear());
|
||||
final data = serializers.serializeWith(InvoiceEntity.serializer, credit);
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ class InvoiceRepository {
|
|||
Credentials credentials,
|
||||
InvoiceEntity invoice, {
|
||||
EntityAction action,
|
||||
bool saveDefaultTerms,
|
||||
bool saveDefaultFooter,
|
||||
}) async {
|
||||
invoice = invoice.rebuild((b) => b..documents.clear());
|
||||
final data = serializers.serializeWith(InvoiceEntity.serializer, invoice);
|
||||
|
|
@ -99,10 +97,10 @@ class InvoiceRepository {
|
|||
url += '&cancel=true';
|
||||
}
|
||||
|
||||
if (saveDefaultTerms) {
|
||||
if (invoice.saveDefaultTerms) {
|
||||
url += '&save_default_terms=true';
|
||||
}
|
||||
if (saveDefaultFooter) {
|
||||
if (invoice.saveDefaultFooter) {
|
||||
url += '&save_default_footer=true';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ class PurchaseOrderRepository {
|
|||
Credentials credentials,
|
||||
InvoiceEntity purchaseOrder,
|
||||
EntityAction action,
|
||||
bool saveDefaultTerms,
|
||||
bool saveDefaultFooter,
|
||||
) async {
|
||||
purchaseOrder = purchaseOrder.rebuild((b) => b..documents.clear());
|
||||
final data =
|
||||
|
|
@ -96,10 +94,10 @@ class PurchaseOrderRepository {
|
|||
url += '&accept=true';
|
||||
}
|
||||
|
||||
if (saveDefaultTerms) {
|
||||
if (purchaseOrder.saveDefaultTerms) {
|
||||
url += '&save_default_terms=true';
|
||||
}
|
||||
if (saveDefaultFooter) {
|
||||
if (purchaseOrder.saveDefaultFooter) {
|
||||
url += '&save_default_footer=true';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ class QuoteRepository {
|
|||
Credentials credentials,
|
||||
InvoiceEntity quote,
|
||||
EntityAction action,
|
||||
bool saveDefaultTerms,
|
||||
bool saveDefaultFooter,
|
||||
) async {
|
||||
quote = quote.rebuild((b) => b..documents.clear());
|
||||
final data = serializers.serializeWith(InvoiceEntity.serializer, quote);
|
||||
|
|
@ -98,10 +96,10 @@ class QuoteRepository {
|
|||
url += '&approve=true';
|
||||
}
|
||||
|
||||
if (saveDefaultTerms) {
|
||||
if (quote.saveDefaultTerms) {
|
||||
url += '&save_default_terms=true';
|
||||
}
|
||||
if (saveDefaultFooter) {
|
||||
if (quote.saveDefaultFooter) {
|
||||
url += '&save_default_footer=true';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,15 +201,11 @@ class SaveCreditRequest implements StartSaving {
|
|||
@required this.completer,
|
||||
@required this.credit,
|
||||
@required this.action,
|
||||
@required this.saveDefaultTerms,
|
||||
@required this.saveDefaultFooter,
|
||||
});
|
||||
|
||||
final Completer completer;
|
||||
final InvoiceEntity credit;
|
||||
final EntityAction action;
|
||||
final bool saveDefaultTerms;
|
||||
final bool saveDefaultFooter;
|
||||
}
|
||||
|
||||
class SaveCreditSuccess implements StopSaving, PersistData, PersistUI {
|
||||
|
|
|
|||
|
|
@ -302,8 +302,7 @@ Middleware<AppState> _saveCredit(CreditRepository repository) {
|
|||
.replace(action.credit.lineItems.where((item) => !item.isEmpty)));
|
||||
|
||||
repository
|
||||
.saveData(store.state.credentials, updatedCredit, action.action,
|
||||
action.saveDefaultTerms, action.saveDefaultFooter)
|
||||
.saveData(store.state.credentials, updatedCredit, action.action)
|
||||
.then((InvoiceEntity credit) {
|
||||
if (action.credit.isNew) {
|
||||
store.dispatch(AddCreditSuccess(credit));
|
||||
|
|
|
|||
|
|
@ -202,15 +202,11 @@ class SaveInvoiceRequest implements StartSaving {
|
|||
@required this.completer,
|
||||
@required this.invoice,
|
||||
@required this.entityAction,
|
||||
@required this.saveDefaultTerms,
|
||||
@required this.saveDefaultFooter,
|
||||
});
|
||||
|
||||
final Completer completer;
|
||||
final InvoiceEntity invoice;
|
||||
final EntityAction entityAction;
|
||||
final bool saveDefaultTerms;
|
||||
final bool saveDefaultFooter;
|
||||
}
|
||||
|
||||
class SaveInvoiceSuccess implements StopSaving, PersistUI {
|
||||
|
|
|
|||
|
|
@ -384,8 +384,6 @@ Middleware<AppState> _saveInvoice(InvoiceRepository repository) {
|
|||
store.state.credentials,
|
||||
updatedInvoice,
|
||||
action: action.entityAction,
|
||||
saveDefaultTerms: action.saveDefaultTerms,
|
||||
saveDefaultFooter: action.saveDefaultFooter,
|
||||
)
|
||||
.then((InvoiceEntity invoice) {
|
||||
if (action.invoice.isNew) {
|
||||
|
|
|
|||
|
|
@ -181,15 +181,11 @@ class SavePurchaseOrderRequest implements StartSaving {
|
|||
@required this.completer,
|
||||
@required this.purchaseOrder,
|
||||
@required this.action,
|
||||
@required this.saveDefaultTerms,
|
||||
@required this.saveDefaultFooter,
|
||||
});
|
||||
|
||||
final Completer completer;
|
||||
final InvoiceEntity purchaseOrder;
|
||||
final EntityAction action;
|
||||
final bool saveDefaultTerms;
|
||||
final bool saveDefaultFooter;
|
||||
}
|
||||
|
||||
class SavePurchaseOrderSuccess implements StopSaving, PersistData, PersistUI {
|
||||
|
|
|
|||
|
|
@ -419,8 +419,11 @@ Middleware<AppState> _savePurchaseOrder(PurchaseOrderRepository repository) {
|
|||
action.purchaseOrder.lineItems.where((item) => !item.isEmpty)));
|
||||
|
||||
repository
|
||||
.saveData(store.state.credentials, updatedPurchaseOrder, action.action,
|
||||
action.saveDefaultTerms, action.saveDefaultFooter)
|
||||
.saveData(
|
||||
store.state.credentials,
|
||||
updatedPurchaseOrder,
|
||||
action.action,
|
||||
)
|
||||
.then((InvoiceEntity purchaseOrder) {
|
||||
if (action.purchaseOrder.isNew) {
|
||||
store.dispatch(AddPurchaseOrderSuccess(purchaseOrder));
|
||||
|
|
|
|||
|
|
@ -201,15 +201,11 @@ class SaveQuoteRequest implements StartSaving {
|
|||
@required this.completer,
|
||||
@required this.quote,
|
||||
@required this.action,
|
||||
@required this.saveDefaultTerms,
|
||||
@required this.saveDefaultFooter,
|
||||
});
|
||||
|
||||
final Completer completer;
|
||||
final InvoiceEntity quote;
|
||||
final EntityAction action;
|
||||
final bool saveDefaultTerms;
|
||||
final bool saveDefaultFooter;
|
||||
}
|
||||
|
||||
class SaveQuoteSuccess implements StopSaving, PersistData, PersistUI {
|
||||
|
|
|
|||
|
|
@ -342,8 +342,7 @@ Middleware<AppState> _saveQuote(QuoteRepository repository) {
|
|||
.replace(action.quote.lineItems.where((item) => !item.isEmpty)));
|
||||
|
||||
repository
|
||||
.saveData(store.state.credentials, updatedQuote, action.action,
|
||||
action.saveDefaultTerms, action.saveDefaultFooter)
|
||||
.saveData(store.state.credentials, updatedQuote, action.action)
|
||||
.then((InvoiceEntity quote) {
|
||||
if (action.quote.isNew) {
|
||||
store.dispatch(AddQuoteSuccess(quote));
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _CreditEditState extends State<CreditEdit>
|
|||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class CreditEditVM extends AbstractInvoiceEditVM {
|
|||
InvoiceEntity invoice,
|
||||
int invoiceItemIndex,
|
||||
InvoiceEntity origInvoice,
|
||||
Function(BuildContext, [bool, bool, EntityAction]) onSavePressed,
|
||||
Function(BuildContext, [EntityAction]) onSavePressed,
|
||||
Function(List<InvoiceItemEntity>, String, String) onItemsAdded,
|
||||
bool isSaving,
|
||||
Function(BuildContext) onCancelPressed,
|
||||
|
|
@ -84,8 +84,7 @@ class CreditEditVM extends AbstractInvoiceEditVM {
|
|||
invoice: credit,
|
||||
invoiceItemIndex: state.creditUIState.editingItemIndex,
|
||||
origInvoice: store.state.creditState.map[credit.id],
|
||||
onSavePressed: (BuildContext context,
|
||||
[saveDefaultTerms, saveDefaultFooter, EntityAction action]) {
|
||||
onSavePressed: (BuildContext context, [EntityAction action]) {
|
||||
Debouncer.runOnComplete(() {
|
||||
final credit = store.state.creditUIState.editing;
|
||||
final localization = navigatorKey.localization;
|
||||
|
|
@ -111,8 +110,6 @@ class CreditEditVM extends AbstractInvoiceEditVM {
|
|||
completer: completer,
|
||||
credit: credit,
|
||||
action: action,
|
||||
saveDefaultTerms: saveDefaultTerms,
|
||||
saveDefaultFooter: saveDefaultFooter,
|
||||
));
|
||||
return completer.future.then((savedCredit) {
|
||||
showToast(credit.isNew
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ class _InvoiceEditState extends State<InvoiceEdit>
|
|||
context: context,
|
||||
message: AppLocalization.of(context).cancelInvoice,
|
||||
callback: (_) {
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
});
|
||||
} else {
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
|
||||
bool _showTasksTable = false;
|
||||
bool _showSaveDefault = false;
|
||||
bool _saveDefaultTerms = false;
|
||||
bool _saveDefaultFooter = false;
|
||||
FocusNode _focusNode;
|
||||
|
||||
final _invoiceNumberController = TextEditingController();
|
||||
|
|
@ -124,9 +122,6 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
_saveDefaultTerms = false;
|
||||
_saveDefaultFooter = false;
|
||||
|
||||
_controllers = [
|
||||
_invoiceNumberController,
|
||||
_poNumberController,
|
||||
|
|
@ -219,7 +214,7 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
|
||||
void _onSavePressed(BuildContext context) {
|
||||
final viewModel = widget.entityViewModel;
|
||||
viewModel.onSavePressed(context, _saveDefaultTerms, _saveDefaultFooter);
|
||||
viewModel.onSavePressed(context);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -694,7 +689,7 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
SizedBox(height: 8),
|
||||
CheckboxListTile(
|
||||
dense: true,
|
||||
value: _saveDefaultTerms,
|
||||
value: invoice.saveDefaultTerms,
|
||||
title: Text(
|
||||
localization.saveAsDefaultTerms),
|
||||
controlAffinity:
|
||||
|
|
@ -703,9 +698,9 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
.colorScheme
|
||||
.secondary,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_saveDefaultTerms = value;
|
||||
});
|
||||
viewModel.onChanged(invoice.rebuild(
|
||||
(b) =>
|
||||
b..saveDefaultTerms = value));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
@ -727,7 +722,7 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
SizedBox(height: 8),
|
||||
CheckboxListTile(
|
||||
dense: true,
|
||||
value: _saveDefaultFooter,
|
||||
value: invoice.saveDefaultFooter,
|
||||
title: Text(
|
||||
localization.saveAsDefaultFooter),
|
||||
controlAffinity:
|
||||
|
|
@ -736,9 +731,9 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
.colorScheme
|
||||
.secondary,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_saveDefaultFooter = value;
|
||||
});
|
||||
viewModel.onChanged(invoice.rebuild(
|
||||
(b) => b
|
||||
..saveDefaultFooter = value));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ abstract class AbstractInvoiceEditVM {
|
|||
final InvoiceEntity invoice;
|
||||
final int invoiceItemIndex;
|
||||
final InvoiceEntity origInvoice;
|
||||
final Function(BuildContext, [bool, bool, EntityAction]) onSavePressed;
|
||||
final Function(BuildContext, [EntityAction]) onSavePressed;
|
||||
final Function(List<InvoiceItemEntity>, String, String) onItemsAdded;
|
||||
final bool isSaving;
|
||||
final Function(BuildContext) onCancelPressed;
|
||||
|
|
@ -81,7 +81,7 @@ class InvoiceEditVM extends AbstractInvoiceEditVM {
|
|||
InvoiceEntity invoice,
|
||||
int invoiceItemIndex,
|
||||
InvoiceEntity origInvoice,
|
||||
Function(BuildContext, [bool, bool, EntityAction]) onSavePressed,
|
||||
Function(BuildContext, [EntityAction]) onSavePressed,
|
||||
Function(List<InvoiceItemEntity>, String, String) onItemsAdded,
|
||||
bool isSaving,
|
||||
Function(BuildContext) onCancelPressed,
|
||||
|
|
@ -112,8 +112,7 @@ class InvoiceEditVM extends AbstractInvoiceEditVM {
|
|||
invoice: invoice,
|
||||
invoiceItemIndex: state.invoiceUIState.editingItemIndex,
|
||||
origInvoice: store.state.invoiceState.map[invoice.id],
|
||||
onSavePressed: (BuildContext context,
|
||||
[saveDefaultTerms, saveDefaultFooter, EntityAction action]) {
|
||||
onSavePressed: (BuildContext context, [EntityAction action]) {
|
||||
Debouncer.runOnComplete(() {
|
||||
final invoice = store.state.invoiceUIState.editing;
|
||||
final localization = navigatorKey.localization;
|
||||
|
|
@ -164,8 +163,6 @@ class InvoiceEditVM extends AbstractInvoiceEditVM {
|
|||
completer: completer,
|
||||
invoice: invoice,
|
||||
entityAction: action,
|
||||
saveDefaultFooter: saveDefaultFooter,
|
||||
saveDefaultTerms: saveDefaultTerms,
|
||||
));
|
||||
return completer.future.then((savedInvoice) {
|
||||
showToast(invoice.isNew
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _PurchaseOrderEditState extends State<PurchaseOrderEdit>
|
|||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class PurchaseOrderEditVM extends AbstractInvoiceEditVM {
|
|||
InvoiceEntity purchaseOrder,
|
||||
int invoiceItemIndex,
|
||||
InvoiceEntity origInvoice,
|
||||
Function(BuildContext, [bool, bool, EntityAction]) onSavePressed,
|
||||
Function(BuildContext, [EntityAction]) onSavePressed,
|
||||
Function(List<InvoiceItemEntity>, String, String) onItemsAdded,
|
||||
bool isSaving,
|
||||
Function(BuildContext) onCancelPressed,
|
||||
|
|
@ -84,8 +84,7 @@ class PurchaseOrderEditVM extends AbstractInvoiceEditVM {
|
|||
purchaseOrder: purchaseOrder,
|
||||
invoiceItemIndex: state.purchaseOrderUIState.editingItemIndex,
|
||||
origInvoice: store.state.purchaseOrderState.map[purchaseOrder.id],
|
||||
onSavePressed: (BuildContext context,
|
||||
[saveDefaultTerms, saveDefaultFooter, EntityAction action]) {
|
||||
onSavePressed: (BuildContext context, [EntityAction action]) {
|
||||
Debouncer.runOnComplete(() {
|
||||
final purchaseOrder = store.state.purchaseOrderUIState.editing;
|
||||
final localization = navigatorKey.localization;
|
||||
|
|
@ -110,8 +109,6 @@ class PurchaseOrderEditVM extends AbstractInvoiceEditVM {
|
|||
completer: completer,
|
||||
purchaseOrder: purchaseOrder,
|
||||
action: action,
|
||||
saveDefaultTerms: saveDefaultTerms,
|
||||
saveDefaultFooter: saveDefaultFooter,
|
||||
));
|
||||
return completer.future.then((savedPurchaseOrder) {
|
||||
showToast(purchaseOrder.isNew
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _QuoteEditState extends State<QuoteEdit>
|
|||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class QuoteEditVM extends AbstractInvoiceEditVM {
|
|||
InvoiceEntity invoice,
|
||||
int invoiceItemIndex,
|
||||
InvoiceEntity origInvoice,
|
||||
Function(BuildContext, [bool, bool, EntityAction]) onSavePressed,
|
||||
Function(BuildContext, [EntityAction]) onSavePressed,
|
||||
Function(List<InvoiceItemEntity>, String, String) onItemsAdded,
|
||||
bool isSaving,
|
||||
Function(BuildContext) onCancelPressed,
|
||||
|
|
@ -84,8 +84,7 @@ class QuoteEditVM extends AbstractInvoiceEditVM {
|
|||
invoice: quote,
|
||||
invoiceItemIndex: state.quoteUIState.editingItemIndex,
|
||||
origInvoice: store.state.quoteState.map[quote.id],
|
||||
onSavePressed: (BuildContext context,
|
||||
[saveDefaultTerms, saveDefaultFooter, EntityAction action]) {
|
||||
onSavePressed: (BuildContext context, [EntityAction action]) {
|
||||
Debouncer.runOnComplete(() {
|
||||
final quote = store.state.quoteUIState.editing;
|
||||
final localization = navigatorKey.localization;
|
||||
|
|
@ -110,8 +109,6 @@ class QuoteEditVM extends AbstractInvoiceEditVM {
|
|||
completer: completer,
|
||||
quote: quote,
|
||||
action: action,
|
||||
saveDefaultTerms: saveDefaultTerms,
|
||||
saveDefaultFooter: saveDefaultFooter,
|
||||
));
|
||||
return completer.future.then((savedQuote) {
|
||||
showToast(quote.isNew
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class _RecurringInvoiceEditState extends State<RecurringInvoiceEdit>
|
|||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context, false, false, action);
|
||||
widget.viewModel.onSavePressed(context, action);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Reference in New Issue