Auto-select Quantity tab when editing item for new custorder
also be a little smarter on error when user selects an item
This commit is contained in:
parent
43bbc2a29e
commit
ddb05afe6b
|
@ -489,6 +489,7 @@
|
|||
<div class="card-content">
|
||||
|
||||
<b-tabs type="is-boxed is-toggle"
|
||||
v-model="itemDialogTabIndex"
|
||||
:animated="false">
|
||||
|
||||
<b-tab-item label="Product">
|
||||
|
@ -816,6 +817,7 @@
|
|||
items: ${json.dumps(order_items)|n},
|
||||
editingItem: null,
|
||||
showingItemDialog: false,
|
||||
itemDialogTabIndex: 0,
|
||||
productIsKnown: true,
|
||||
productUUID: null,
|
||||
productDisplay: null,
|
||||
|
@ -1105,7 +1107,7 @@
|
|||
})
|
||||
},
|
||||
|
||||
submitBatchData(params, callback) {
|
||||
submitBatchData(params, success, failure) {
|
||||
let url = ${json.dumps(request.current_route_url())|n}
|
||||
|
||||
let headers = {
|
||||
|
@ -1115,8 +1117,17 @@
|
|||
|
||||
## TODO: should find a better way to handle CSRF token
|
||||
this.$http.post(url, params, {headers: headers}).then((response) => {
|
||||
if (callback) {
|
||||
callback(response)
|
||||
if (response.data.error) {
|
||||
this.$buefy.toast.open({
|
||||
message: response.data.error,
|
||||
type: 'is-danger',
|
||||
duration: 2000, // 2 seconds
|
||||
})
|
||||
if (failure) {
|
||||
failure(response)
|
||||
}
|
||||
} else if (success) {
|
||||
success(response)
|
||||
}
|
||||
}, response => {
|
||||
this.$buefy.toast.open({
|
||||
|
@ -1377,6 +1388,7 @@
|
|||
this.productPriceNeedsConfirmation = false
|
||||
% endif
|
||||
|
||||
this.itemDialogTabIndex = 0
|
||||
this.showingItemDialog = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.productAutocomplete.focus()
|
||||
|
@ -1405,6 +1417,7 @@
|
|||
this.productPriceNeedsConfirmation = row.price_needs_confirmation
|
||||
% endif
|
||||
|
||||
this.itemDialogTabIndex = 1
|
||||
this.showingItemDialog = true
|
||||
},
|
||||
|
||||
|
@ -1492,6 +1505,8 @@
|
|||
% if product_price_may_be_questionable:
|
||||
this.productPriceNeedsConfirmation = false
|
||||
% endif
|
||||
}, response => {
|
||||
this.clearProduct()
|
||||
})
|
||||
} else {
|
||||
this.clearProduct()
|
||||
|
|
|
@ -560,7 +560,11 @@ class CustomerOrderView(MasterView):
|
|||
return self.handler.uom_choices_for_product(product)
|
||||
|
||||
def info_for_product(self, batch, data, product):
|
||||
try:
|
||||
info = self.handler.get_product_info(batch, product)
|
||||
except Exception as error:
|
||||
return {'error': six.text_type(error)}
|
||||
else:
|
||||
info['url'] = self.request.route_url('products.view', uuid=info['uuid'])
|
||||
return info
|
||||
|
||||
|
|
Loading…
Reference in a new issue