Misc. improvements for customer order views
This commit is contained in:
parent
8af247a7f6
commit
d0a7a241b4
4 changed files with 143 additions and 23 deletions
|
@ -30,9 +30,10 @@
|
|||
<div class="buttons">
|
||||
<b-button type="is-primary"
|
||||
@click="submitOrder()"
|
||||
:disabled="submittingOrder"
|
||||
icon-pack="fas"
|
||||
icon-left="fas fa-upload">
|
||||
Submit this Order
|
||||
{{ submitOrderButtonText }}
|
||||
</b-button>
|
||||
<b-button @click="startOverEntirely()"
|
||||
icon-pack="fas"
|
||||
|
@ -176,12 +177,14 @@
|
|||
|
||||
<div class="panel-block">
|
||||
<div>
|
||||
<b-button type="is-primary"
|
||||
icon-pack="fas"
|
||||
icon-left="fas fa-plus"
|
||||
@click="showAddItemDialog()">
|
||||
Add Item
|
||||
</b-button>
|
||||
<div class="buttons">
|
||||
<b-button type="is-primary"
|
||||
icon-pack="fas"
|
||||
icon-left="fas fa-plus"
|
||||
@click="showAddItemDialog()">
|
||||
Add Item
|
||||
</b-button>
|
||||
</div>
|
||||
<b-modal :active.sync="showingItemDialog">
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
|
@ -288,8 +291,8 @@
|
|||
</div>
|
||||
</b-modal>
|
||||
|
||||
<b-table
|
||||
:data="items">
|
||||
<b-table v-if="items.length"
|
||||
:data="items">
|
||||
<template slot-scope="props">
|
||||
|
||||
<b-table-column field="product_upc_pretty" label="UPC">
|
||||
|
@ -403,6 +406,8 @@
|
|||
|
||||
## 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},
|
||||
|
||||
submittingOrder: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -515,6 +520,13 @@
|
|||
itemDialogSaveButtonText() {
|
||||
return this.editingItem ? "Update Item" : "Add Item"
|
||||
},
|
||||
|
||||
submitOrderButtonText() {
|
||||
if (this.submittingOrder) {
|
||||
return "Working, please wait..."
|
||||
}
|
||||
return "Submit this Order"
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.customerStatusType) {
|
||||
|
@ -607,9 +619,12 @@
|
|||
},
|
||||
|
||||
submitOrder() {
|
||||
this.submittingOrder = true
|
||||
|
||||
let params = {
|
||||
action: 'submit_new_order',
|
||||
}
|
||||
|
||||
this.submitBatchData(params, response => {
|
||||
if (response.data.error) {
|
||||
this.$buefy.toast.open({
|
||||
|
@ -617,6 +632,7 @@
|
|||
type: 'is-danger',
|
||||
duration: 2000, // 2 seconds
|
||||
})
|
||||
this.submittingOrder = false
|
||||
} else {
|
||||
if (response.data.next_url) {
|
||||
location.href = response.data.next_url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue