Add basic "price needs confirmation" support for custorder
This commit is contained in:
parent
93b752f436
commit
8b044dbb22
4 changed files with 214 additions and 11 deletions
|
@ -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) {
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<%def name="render_buefy_form()">
|
||||
<div class="form">
|
||||
<${form.component} ref="mainForm"
|
||||
% if master.has_perm('confirm_price'):
|
||||
@confirm-price="showConfirmPrice"
|
||||
% endif
|
||||
% if master.has_perm('change_status'):
|
||||
@change-status="showChangeStatus"
|
||||
% endif
|
||||
|
@ -18,6 +21,45 @@
|
|||
<%def name="page_content()">
|
||||
${parent.page_content()}
|
||||
|
||||
% if master.has_perm('confirm_price'):
|
||||
<b-modal has-modal-card
|
||||
:active.sync="confirmPriceShowDialog">
|
||||
<div class="modal-card">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Confirm Price</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<p>
|
||||
Please provide a note</span>:
|
||||
</p>
|
||||
<b-input v-model="confirmPriceNote"
|
||||
ref="confirmPriceNoteField"
|
||||
type="textarea" rows="2">
|
||||
</b-input>
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<b-button type="is-primary"
|
||||
@click="confirmPriceSave()"
|
||||
:disabled="confirmPriceSaveDisabled"
|
||||
icon-pack="fas"
|
||||
icon-left="check">
|
||||
{{ confirmPriceSubmitText }}
|
||||
</b-button>
|
||||
<b-button @click="confirmPriceShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
${h.form(master.get_action_url('confirm_price', instance), ref='confirmPriceForm')}
|
||||
${h.csrf_token(request)}
|
||||
${h.hidden('note', **{':value': 'confirmPriceNote'})}
|
||||
${h.end_form()}
|
||||
% endif
|
||||
|
||||
% if master.has_perm('change_status'):
|
||||
<b-modal :active.sync="showChangeStatusDialog">
|
||||
<div class="card">
|
||||
|
@ -190,6 +232,41 @@
|
|||
|
||||
${form.component_studly}Data.notesData = ${json.dumps(notes_data)|n}
|
||||
|
||||
% if master.has_perm('confirm_price'):
|
||||
|
||||
ThisPageData.confirmPriceShowDialog = false
|
||||
ThisPageData.confirmPriceNote = null
|
||||
ThisPageData.confirmPriceSubmitting = false
|
||||
|
||||
ThisPage.computed.confirmPriceSaveDisabled = function() {
|
||||
if (this.confirmPriceSubmitting) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
ThisPage.computed.confirmPriceSubmitText = function() {
|
||||
if (this.confirmPriceSubmitting) {
|
||||
return "Working, please wait..."
|
||||
}
|
||||
return "Confirm Price"
|
||||
}
|
||||
|
||||
ThisPage.methods.showConfirmPrice = function() {
|
||||
this.confirmPriceNote = null
|
||||
this.confirmPriceShowDialog = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.confirmPriceNoteField.focus()
|
||||
})
|
||||
}
|
||||
|
||||
ThisPage.methods.confirmPriceSave = function() {
|
||||
this.confirmPriceSubmitting = true
|
||||
this.$refs.confirmPriceForm.submit()
|
||||
}
|
||||
|
||||
% endif
|
||||
|
||||
% if master.has_perm('change_status'):
|
||||
|
||||
ThisPageData.orderItemStatuses = ${json.dumps(enum.CUSTORDER_ITEM_STATUS)|n}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue