Move some custorder logic to handler; allow force-swap of product selection

This commit is contained in:
Lance Edgar 2021-11-03 19:19:20 -05:00
parent b0fa559760
commit 4d33e3dcbe
3 changed files with 24 additions and 60 deletions

View file

@ -511,7 +511,7 @@
<tailbone-autocomplete ref="productAutocomplete"
v-model="productUUID"
placeholder="Enter UPC or brand, description etc."
:initial-label="productDisplay"
:assigned-label="productDisplay"
serviceUrl="${url('{}.product_autocomplete'.format(route_prefix))}"
@input="productChanged">
</tailbone-autocomplete>
@ -1368,12 +1368,18 @@
productChanged(uuid) {
if (uuid) {
this.productUUID = uuid
let params = {
action: 'get_product_info',
uuid: this.productUUID,
uuid: uuid,
}
// nb. it is possible for the handler to "swap"
// the product selection, i.e. user chooses a "per
// LB" item but the handler only allows selling by
// the "case" item. so we do not assume the uuid
// received above is the correct one, but just use
// whatever came back from handler
this.submitBatchData(params, response => {
this.productUUID = response.data.uuid
this.productUPC = response.data.upc_pretty
this.productKey = response.data.key
this.productDisplay = response.data.full_description