From b02199eb07e63ac60ece266ab3139fdc74fba6ed Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 24 Oct 2024 12:03:49 +0200 Subject: [PATCH 1/4] fix: reload window when price is recalculated --- src/pages/Ticket/Card/TicketSale.vue | 1 + src/pages/Ticket/Card/TicketSaleMoreActions.vue | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index f179257f7..3e89e96bf 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -476,6 +476,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); :ticket-config="ticketConfig" @get-mana="getMana()" @update-discounts="updateDiscount" + @re-calculated-price="resetChanges" /> { const calculateSalePrice = async () => { if (!props.sales) return; + console.log('CALLED'); await axios.post(`Sales/recalculatePrice`, props.sales); notify(t('globals.dataSaved'), 'positive'); + emit('reCalculatedPrice', props.sales); }; const changeMultipleDiscount = () => { From c9e82f2caf728a475440d6faf4a0d447edc51129 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 24 Oct 2024 12:04:54 +0200 Subject: [PATCH 2/4] refactor: deleted log --- src/pages/Ticket/Card/TicketSaleMoreActions.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue index a35e21f3f..43ba39b91 100644 --- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue +++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue @@ -105,7 +105,6 @@ const showSmsDialog = (template) => { const calculateSalePrice = async () => { if (!props.sales) return; - console.log('CALLED'); await axios.post(`Sales/recalculatePrice`, props.sales); notify(t('globals.dataSaved'), 'positive'); emit('reCalculatedPrice', props.sales); From 994237260ed24fef644c6fdc5c4091a52607f89d Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 25 Oct 2024 06:48:09 +0200 Subject: [PATCH 3/4] refactor: changed name of emitted event --- src/pages/Ticket/Card/TicketSale.vue | 2 +- src/pages/Ticket/Card/TicketSaleMoreActions.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 3e89e96bf..798d629c7 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -476,7 +476,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); :ticket-config="ticketConfig" @get-mana="getMana()" @update-discounts="updateDiscount" - @re-calculated-price="resetChanges" + @refresh-table="resetChanges" /> { await axios.post(`Sales/recalculatePrice`, props.sales); notify(t('globals.dataSaved'), 'positive'); - emit('reCalculatedPrice', props.sales); + emit('refreshTable', props.sales); }; const changeMultipleDiscount = () => { From 5b24aa457074fbf0f153dadfe49c4b15c805e0cb Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 25 Oct 2024 12:58:23 +0200 Subject: [PATCH 4/4] fix: performance addEventListeners --- src/boot/mainShortcutMixin.js | 38 ----------------------------- src/boot/quasar.js | 2 -- src/components/VnTable/VnColumn.vue | 2 +- src/components/VnTable/VnFilter.vue | 2 +- src/layouts/MainLayout.vue | 37 ++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 42 deletions(-) delete mode 100644 src/boot/mainShortcutMixin.js diff --git a/src/boot/mainShortcutMixin.js b/src/boot/mainShortcutMixin.js deleted file mode 100644 index 8e5f147db..000000000 --- a/src/boot/mainShortcutMixin.js +++ /dev/null @@ -1,38 +0,0 @@ -import routes from 'src/router/modules'; -import { useRouter } from 'vue-router'; - -let isNotified = false; - -export default { - created: function () { - const router = useRouter(); - const keyBindingMap = routes - .filter((route) => route.meta.keyBinding) - .reduce((map, route) => { - map['Key' + route.meta.keyBinding.toUpperCase()] = route.path; - return map; - }, {}); - - const handleKeyDown = (event) => { - const { ctrlKey, altKey, code } = event; - - if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) { - event.preventDefault(); - router.push(keyBindingMap[code]); - isNotified = true; - } - }; - - const handleKeyUp = (event) => { - const { ctrlKey, altKey } = event; - - // Resetea la bandera cuando se sueltan las teclas ctrl o alt - if (!ctrlKey || !altKey) { - isNotified = false; - } - }; - - window.addEventListener('keydown', handleKeyDown); - window.addEventListener('keyup', handleKeyUp); - }, -}; diff --git a/src/boot/quasar.js b/src/boot/quasar.js index 5db6edd24..f39d1f0be 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -1,13 +1,11 @@ import { boot } from 'quasar/wrappers'; import qFormMixin from './qformMixin'; -import mainShortcutMixin from './mainShortcutMixin'; import keyShortcut from './keyShortcut'; import useNotify from 'src/composables/useNotify.js'; const { notify } = useNotify(); export default boot(({ app }) => { app.mixin(qFormMixin); - app.mixin(mainShortcutMixin); app.directive('shortcut', keyShortcut); app.config.errorHandler = function (err) { console.error(err); diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index ed34e9eee..9e9bfad69 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -1,5 +1,5 @@