Make past item lookup optional for custorders

This commit is contained in:
Lance Edgar 2022-09-06 16:44:26 -05:00
parent 2950827c63
commit f7a019ed83
3 changed files with 25 additions and 0 deletions

View file

@ -97,6 +97,15 @@
</b-checkbox>
</b-field>
<b-field>
<b-checkbox name="rattail.custorders.allow_past_item_reorder"
v-model="simpleSettings['rattail.custorders.allow_past_item_reorder']"
native-value="true"
@input="settingsNeedSaved = true">
Allow re-order via past item lookup
</b-checkbox>
</b-field>
</div>
</%def>

View file

@ -485,12 +485,14 @@
@click="showAddItemDialog()">
Add Item
</b-button>
% if allow_past_item_reorder:
<b-button v-if="contactUUID"
icon-pack="fas"
icon-left="fas fa-plus"
@click="showAddPastItem()">
Add Past Item
</b-button>
% endif
</div>
<b-modal :active.sync="showingItemDialog">
@ -851,6 +853,7 @@
@selected="productLookupSelected">
</tailbone-product-lookup>
% if allow_past_item_reorder:
<b-modal :active.sync="pastItemsShowDialog">
<div class="card">
<div class="card-content">
@ -953,6 +956,7 @@
</div>
</div>
</b-modal>
% endif
<b-table v-if="items.length"
:data="items"
@ -1121,10 +1125,12 @@
showingItemDialog: false,
itemDialogSaving: false,
itemDialogTabIndex: 0,
% if allow_past_item_reorder:
pastItemsShowDialog: false,
pastItemsLoading: false,
pastItems: [],
pastItemsSelected: null,
% endif
productIsKnown: true,
productUUID: null,
productDisplay: null,
@ -1503,9 +1509,11 @@
contactChanged(uuid, callback) {
% if allow_past_item_reorder:
// clear out the past items cache
this.pastItemsSelected = null
this.pastItems = []
% endif
let params
if (!uuid) {
@ -1837,6 +1845,8 @@
})
},
% if allow_past_item_reorder:
showAddPastItem() {
this.pastItemsSelected = null
@ -1888,6 +1898,8 @@
this.showingItemDialog = true
},
% endif
showEditItemDialog(row) {
this.editingItem = row

View file

@ -349,6 +349,7 @@ class CustomerOrderView(MasterView):
'default_uom_choices': self.batch_handler.uom_choices_for_product(None),
'default_uom': None,
'allow_item_discounts': self.batch_handler.allow_item_discounts(),
'allow_past_item_reorder': self.batch_handler.allow_past_item_reorder(),
})
if self.batch_handler.allow_case_orders():
@ -986,6 +987,9 @@ class CustomerOrderView(MasterView):
{'section': 'rattail.custorders',
'option': 'allow_item_discounts',
'type': bool},
{'section': 'rattail.custorders',
'option': 'allow_past_item_reorder',
'type': bool},
]
@classmethod