fix: add loading overlay for expensive calls in orders/create

This commit is contained in:
Lance Edgar 2025-01-15 14:55:27 -06:00
parent e7a5f6c09e
commit 13d576295e

View file

@ -81,6 +81,7 @@
</template>
<div class="panel-block">
<b-loading v-model="customerLoading" :is-full-page="false" />
<div style="width: 100%;">
<div style="display: flex; flex-direction: row;">
@ -143,7 +144,7 @@
icon-pack="fas"
icon-left="redo"
:disabled="refreshingCustomer">
{{ refreshingCustomer ? "Refreshing" : "Refresh" }}
{{ refreshingCustomer ? "Working, please wait..." : "Refresh" }}
</b-button>
</div>
</b-field>
@ -348,6 +349,7 @@
>
<div class="card">
<div class="card-content">
<b-loading v-model="editItemLoading" :is-full-page="false" />
<${b}-tabs :animated="false"
% if request.use_oruga:
@ -829,6 +831,7 @@
batchTotalPriceDisplay: ${json.dumps(normalized_batch['total_price_display'])|n},
customerPanelOpen: false,
customerLoading: false,
customerIsKnown: ${json.dumps(customer_is_known)|n},
customerID: ${json.dumps(customer_id)|n},
customerName: ${json.dumps(customer_name)|n},
@ -853,6 +856,7 @@
editItemRow: null,
editItemShowDialog: false,
editItemLoading: false,
itemDialogSaving: false,
% if request.use_oruga:
itemDialogTab: 'product',
@ -1132,6 +1136,7 @@
},
customerChanged(customerID, callback) {
this.customerLoading = true
const params = {}
if (customerID) {
@ -1149,7 +1154,9 @@
if (callback) {
callback()
}
this.customerLoading = false
}, response => {
this.customerLoading = false
this.$buefy.toast.open({
message: "Update failed: " + (response.data.error || "(unknown error)"),
type: 'is-danger',
@ -1159,9 +1166,9 @@
},
refreshCustomer() {
this.refreshingContact = true
this.refreshingCustomer = true
this.customerChanged(this.customerID, () => {
this.refreshingContact = false
this.refreshingCustomer = false
this.$buefy.toast.open({
message: "Customer info has been refreshed.",
type: 'is-success',
@ -1321,6 +1328,7 @@
productChanged(productID) {
if (productID) {
this.editItemLoading = true
const params = {
action: 'get_product_info',
product_id: productID,
@ -1364,8 +1372,11 @@
this.refreshProductDescription += 1
this.refreshTotalPrice += 1
this.editItemLoading = false
}, response => {
this.clearProduct()
this.editItemLoading = false
})
} else {
this.clearProduct()
@ -1514,6 +1525,7 @@
itemDialogAttemptSave() {
this.itemDialogSaving = true
this.editItemLoading = true
const params = {
order_qty: this.productQuantity,
@ -1551,9 +1563,11 @@
this.batchTotalPriceDisplay = response.data.batch.total_price_display
this.itemDialogSaving = false
this.editItemLoading = false
this.editItemShowDialog = false
}, response => {
this.itemDialogSaving = false
this.editItemLoading = false
})
},