Add basic "price needs confirmation" support for custorder

This commit is contained in:
Lance Edgar 2021-10-18 18:28:28 -05:00
parent 93b752f436
commit 8b044dbb22
4 changed files with 214 additions and 11 deletions

View file

@ -500,7 +500,8 @@
</b-radio>
</div>
<div v-show="productIsKnown">
<div v-show="productIsKnown"
style="padding-left: 5rem;">
<b-field grouped>
<b-field label="Description" horizontal expanded>
@ -544,8 +545,28 @@
</b-button>
</b-field>
<div v-if="productUUID">
<b-field grouped
v-if="productUUID">
<b-field label="Unit Price">
<span :class="productPriceNeedsConfirmation ? 'has-background-warning' : ''">
$4.20 / EA
</span>
</b-field>
<b-field label="Last Changed">
<span>2021-01-01</span>
</b-field>
</b-field>
<b-checkbox v-model="productPriceNeedsConfirmation"
size="is-small">
This price is questionable and should be confirmed
by someone before order proceeds.
</b-checkbox>
</div>
</div>
<br />
<div class="field">
<b-radio v-model="productIsKnown" disabled
:native-value="false">
@ -619,7 +640,9 @@
</b-table-column>
<b-table-column field="total_price_display" label="Total">
{{ props.row.total_price_display }}
<span :class="props.row.price_needs_confirmation ? 'has-background-warning' : ''">
{{ props.row.total_price_display }}
</span>
</b-table-column>
<b-table-column field="vendor_display" label="Vendor">
@ -742,6 +765,7 @@
defaultUOM: defaultUOM,
productUOM: defaultUOM,
productCaseSize: null,
productPriceNeedsConfirmation: false,
## TODO: should find a better way to handle CSRF token
csrftoken: ${json.dumps(request.session.get_csrf_token() or request.session.new_csrf_token())|n},
@ -1271,6 +1295,7 @@
this.productQuantity = 1
this.productUnitChoices = this.defaultUnitChoices
this.productUOM = this.defaultUOM
this.productPriceNeedsConfirmation = false
this.showingItemDialog = true
this.$nextTick(() => {
this.$refs.productDescriptionAutocomplete.focus()
@ -1287,6 +1312,7 @@
this.productQuantity = row.order_quantity
this.productUnitChoices = row.order_uom_choices
this.productUOM = row.order_uom
this.productPriceNeedsConfirmation = row.price_needs_confirmation
this.showingItemDialog = true
},
@ -1319,6 +1345,7 @@
this.productDisplay = null
this.productUPC = null
this.productUnitChoices = this.defaultUnitChoices
this.productPriceNeedsConfirmation = false
if (autofocus) {
this.$nextTick(() => {
this.$refs.productUPCInput.focus()
@ -1358,6 +1385,7 @@
this.productUPC = response.data.upc_pretty
this.productDisplay = response.data.full_description
this.setProductUnitChoices(response.data.uom_choices)
this.productPriceNeedsConfirmation = false
}
})
},
@ -1379,6 +1407,7 @@
this.productUPC = response.data.upc_pretty
this.productDisplay = response.data.full_description
this.setProductUnitChoices(response.data.uom_choices)
this.productPriceNeedsConfirmation = false
})
} else {
this.clearProduct()
@ -1392,6 +1421,7 @@
product_uuid: this.productUUID,
order_quantity: this.productQuantity,
order_uom: this.productUOM,
price_needs_confirmation: this.productPriceNeedsConfirmation,
}
if (this.editingItem) {