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-checkbox>
</b-field> </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> </div>
</%def> </%def>

View file

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