Add "full lookup" product search modal for new custorder page

This commit is contained in:
Lance Edgar 2022-02-08 12:21:24 -06:00
parent 025cabd1ad
commit 072f5da69d
4 changed files with 403 additions and 13 deletions

View file

@ -1,5 +1,6 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/create.mako" />
<%namespace name="product_lookup" file="/products/lookup.mako" />
<%def name="extra_styles()">
${parent.extra_styles()}
@ -54,6 +55,7 @@
<%def name="render_this_page_template()">
${parent.render_this_page_template()}
${product_lookup.tailbone_product_lookup_template()}
<script type="text/x-template" id="customer-order-creator-template">
<div>
@ -524,6 +526,15 @@
@input="productChanged">
</tailbone-autocomplete>
</b-field>
<b-button type="is-primary"
v-if="!productUUID"
@click="productFullLookup()"
icon-pack="fas"
icon-left="search">
Full Lookup
</b-button>
<b-button v-if="productUUID"
type="is-primary"
tag="a" target="_blank"
@ -822,6 +833,11 @@
</div>
</b-modal>
<tailbone-product-lookup ref="productLookup"
@canceled="productLookupCanceled"
@selected="productLookupSelected">
</tailbone-product-lookup>
<b-modal :active.sync="pastItemsShowDialog">
<div class="card">
<div class="card-content">
@ -1017,6 +1033,7 @@
<%def name="make_this_page_component()">
${parent.make_this_page_component()}
${product_lookup.tailbone_product_lookup_component()}
<script type="text/javascript">
const CustomerOrderCreator = {
@ -1096,7 +1113,6 @@
productIsKnown: true,
productUUID: null,
productDisplay: null,
productUPC: null,
productKey: null,
productKeyField: ${json.dumps(product_key_field)|n},
productKeyLabel: ${json.dumps(product_key_label)|n},
@ -1716,6 +1732,22 @@
}
},
productFullLookup() {
this.showingItemDialog = false
let term = this.$refs.productAutocomplete.getUserInput()
this.$refs.productLookup.showDialog(term)
},
productLookupCanceled() {
this.showingItemDialog = true
},
productLookupSelected(selected) {
this.clearProduct()
this.productChanged(selected.uuid)
this.showingItemDialog = true
},
copyPendingProductAttrs(from, to) {
to.upc = from.upc
to.item_id = from.item_id
@ -1738,7 +1770,6 @@
this.productIsKnown = true
this.productUUID = null
this.productDisplay = null
this.productUPC = null
this.productKey = null
this.productSize = null
this.productCaseQuantity = null
@ -1794,7 +1825,6 @@
this.productIsKnown = true
this.productUUID = selected.uuid
this.productDisplay = selected.full_description
this.productUPC = selected.upc_pretty || selected.upc
this.productKey = selected.key
this.productSize = selected.size
this.productCaseQuantity = selected.case_quantity
@ -1833,7 +1863,6 @@
}
this.productDisplay = row.product_full_description
this.productUPC = row.product_upc_pretty || row.product_upc
this.productKey = row.product_key
this.productSize = row.product_size
this.productCaseQuantity = row.case_quantity
@ -1886,7 +1915,6 @@
clearProduct() {
this.productUUID = null
this.productDisplay = null
this.productUPC = null
this.productKey = null
this.productSize = null
this.productCaseQuantity = null
@ -1936,7 +1964,6 @@
// 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
this.productSize = response.data.size