Correct invoice line items
This commit is contained in:
parent
d2cef33679
commit
0e4856fbd0
|
|
@ -159,6 +159,10 @@ class _EntityDropdownState extends State<EntityDropdown> {
|
|||
);
|
||||
},
|
||||
onSuggestionSelected: (entityId) {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
|
||||
final entity = _entityMap[entityId];
|
||||
_textController.text = _entityMap[entityId].listDisplayName;
|
||||
widget.onSelected(entity);
|
||||
|
|
|
|||
|
|
@ -59,18 +59,16 @@ class CreditEditItemsVM extends EntityEditItemsVM {
|
|||
);
|
||||
|
||||
factory CreditEditItemsVM.fromStore(Store<AppState> store) {
|
||||
final AppState state = store.state;
|
||||
final credit = state.creditUIState.editing;
|
||||
|
||||
return CreditEditItemsVM(
|
||||
state: state,
|
||||
company: state.company,
|
||||
invoice: credit,
|
||||
invoiceItemIndex: state.creditUIState.editingItemIndex,
|
||||
state: store.state,
|
||||
company: store.state.company,
|
||||
invoice: store.state.creditUIState.editing,
|
||||
invoiceItemIndex: store.state.creditUIState.editingItemIndex,
|
||||
onRemoveInvoiceItemPressed: (index) =>
|
||||
store.dispatch(DeleteCreditItem(index)),
|
||||
onDoneInvoiceItemPressed: () => store.dispatch(EditCreditItem()),
|
||||
onChangedInvoiceItem: (creditItem, index) {
|
||||
final credit = store.state.creditUIState.editing;
|
||||
if (index == credit.lineItems.length) {
|
||||
store.dispatch(AddCreditItem(creditItem: creditItem));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -197,6 +197,9 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
|||
);
|
||||
},
|
||||
onSuggestionSelected: (suggestion) {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
final item = lineItems[index];
|
||||
final product = productState.map[suggestion];
|
||||
final updatedItem = item.rebuild((b) => b
|
||||
|
|
|
|||
|
|
@ -82,14 +82,12 @@ class InvoiceEditItemsVM extends EntityEditItemsVM {
|
|||
);
|
||||
|
||||
factory InvoiceEditItemsVM.fromStore(Store<AppState> store) {
|
||||
final AppState state = store.state;
|
||||
final invoice = state.invoiceUIState.editing;
|
||||
|
||||
return InvoiceEditItemsVM(
|
||||
state: state,
|
||||
company: state.company,
|
||||
invoice: invoice,
|
||||
invoiceItemIndex: state.invoiceUIState.editingItemIndex,
|
||||
state: store.state,
|
||||
company: store.state.company,
|
||||
invoice: store.state.invoiceUIState.editing,
|
||||
invoiceItemIndex: store.state.invoiceUIState.editingItemIndex,
|
||||
addLineItem: () =>
|
||||
store.dispatch(AddInvoiceItem(invoiceItem: InvoiceItemEntity())),
|
||||
deleteLineItem: null,
|
||||
|
|
@ -97,6 +95,7 @@ class InvoiceEditItemsVM extends EntityEditItemsVM {
|
|||
store.dispatch(DeleteInvoiceItem(index)),
|
||||
onDoneInvoiceItemPressed: () => store.dispatch(EditInvoiceItem()),
|
||||
onChangedInvoiceItem: (invoiceItem, index) {
|
||||
final invoice = store.state.invoiceUIState.editing;
|
||||
if (index == invoice.lineItems.length) {
|
||||
store.dispatch(AddInvoiceItem(invoiceItem: invoiceItem));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -59,18 +59,16 @@ class QuoteEditItemsVM extends EntityEditItemsVM {
|
|||
);
|
||||
|
||||
factory QuoteEditItemsVM.fromStore(Store<AppState> store) {
|
||||
final AppState state = store.state;
|
||||
final quote = state.quoteUIState.editing;
|
||||
|
||||
return QuoteEditItemsVM(
|
||||
state: state,
|
||||
company: state.company,
|
||||
invoice: quote,
|
||||
invoiceItemIndex: state.quoteUIState.editingItemIndex,
|
||||
state: store.state,
|
||||
company: store.state.company,
|
||||
invoice: store.state.quoteUIState.editing,
|
||||
invoiceItemIndex: store.state.quoteUIState.editingItemIndex,
|
||||
onRemoveInvoiceItemPressed: (index) =>
|
||||
store.dispatch(DeleteQuoteItem(index)),
|
||||
onDoneInvoiceItemPressed: () => store.dispatch(EditQuoteItem()),
|
||||
onChangedInvoiceItem: (quoteItem, index) {
|
||||
final quote = store.state.quoteUIState.editing;
|
||||
if (index == quote.lineItems.length) {
|
||||
store.dispatch(AddQuoteItem(quoteItem: quoteItem));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue