From f918bbd53963e9ad4c0029491addfa03d92bac5b Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 18 Dec 2024 08:47:29 +0100 Subject: [PATCH] fix: modified bottom button to show it when no data in the table and refactored add sale function --- src/components/VnTable/VnTable.vue | 48 +++++++++++++--------------- src/css/app.scss | 3 +- src/pages/Ticket/Card/TicketSale.vue | 7 +++- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 9ab080276..d6117a117 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -54,8 +54,8 @@ const $props = defineProps({ default: true, }, bottom: { - type: Object, - default: null, + type: Boolean, + default: false, }, cardClass: { type: String, @@ -575,29 +575,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) { /> - +
+ + + {{ createForm.title }} + +
diff --git a/src/css/app.scss b/src/css/app.scss index abb388be9..fa798d543 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -149,7 +149,8 @@ select:-webkit-autofill { .q-card, .q-table, .q-table__bottom, -.q-drawer { +.q-drawer, +.bottomButton { background-color: var(--vn-section-color); } diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 19cfdee2c..8e3c99aa4 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -54,6 +54,7 @@ const transfer = ref({ }); const tableRef = ref([]); const canProceed = ref(); +const isLoading = ref(false); watch( () => route.params.id, @@ -213,6 +214,9 @@ const updateQuantity = async ({ quantity, id }) => { }; const addSale = async (sale) => { + if (isLoading.value) return; + + isLoading.value = true; const params = { barcode: sale.itemFk, quantity: sale.quantity, @@ -233,7 +237,7 @@ const addSale = async (sale) => { sale.item = newSale.item; notify('globals.dataSaved', 'positive'); - window.location.reload(); + arrayData.fetch({}); }; const updateConcept = async (sale) => { @@ -466,6 +470,7 @@ const addRow = (original = null) => { }; const endNewRow = (row) => { + if (!row) return; if (row.itemFk && row.quantity) { row.isNew = false; }