From 531f4bb8cd621a42ea226a879a30d6b24923ab32 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 13 Jun 2024 14:14:46 -0300 Subject: [PATCH] Avoid firing request if quantity does not change --- src/filters/toPercentage.js | 1 - src/pages/Ticket/Card/TicketSale.vue | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/filters/toPercentage.js b/src/filters/toPercentage.js index e2b49ce22..9b5e953c0 100644 --- a/src/filters/toPercentage.js +++ b/src/filters/toPercentage.js @@ -1,7 +1,6 @@ import { useI18n } from 'vue-i18n'; export default function (value, fractionSize = 2) { - console.log('toPercentage value: ', value); if (value == null || value === '') return; const { locale } = useI18n(); diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index a093beafa..4ae710d17 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -195,11 +195,13 @@ const addSale = async (sale) => { }; const changeQuantity = (sale) => { - console.log('edit.quantity', edit.value.quantity); - console.log('sale.quantity', sale.quantity); - if (!sale.itemFk || sale.quantity == null) return; + if ( + !sale.itemFk || + sale.quantity == null || + edit.value?.oldQuantity === sale.quantity + ) + return; if (!sale.id) return addSale(sale); - updateQuantity(sale); }; @@ -566,7 +568,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); v-model.number="row.quantity" @keyup.enter="changeQuantity(row)" @blur="changeQuantity(row)" - @focus="edit.quantity = row.quantity" + @focus="edit.oldQuantity = row.quantity" /> {{ row.quantity }}