From aee23c75e86dae184798c64f8642e84e59993c32 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 4 Oct 2024 14:31:39 +0200 Subject: [PATCH] fix: order module --- src/pages/Order/Card/OrderCatalog.vue | 1 + src/pages/Order/Card/OrderCatalogFilter.vue | 1 + .../Order/Card/OrderCatalogItemDialog.vue | 21 +++++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/pages/Order/Card/OrderCatalog.vue b/src/pages/Order/Card/OrderCatalog.vue index 68bf9511f..b13e8661d 100644 --- a/src/pages/Order/Card/OrderCatalog.vue +++ b/src/pages/Order/Card/OrderCatalog.vue @@ -130,4 +130,5 @@ function extractValueTags(items) { es: You can search items by name or id: Puedes buscar items por nombre o id + Search items: Buscar items diff --git a/src/pages/Order/Card/OrderCatalogFilter.vue b/src/pages/Order/Card/OrderCatalogFilter.vue index 354c44747..6de43e86a 100644 --- a/src/pages/Order/Card/OrderCatalogFilter.vue +++ b/src/pages/Order/Card/OrderCatalogFilter.vue @@ -247,6 +247,7 @@ function addOrder(value, field, params) { rounded emit-value use-input + sort-by="name ASC" :disable="!selectedCategoryFk" @update:model-value=" (value) => { diff --git a/src/pages/Order/Card/OrderCatalogItemDialog.vue b/src/pages/Order/Card/OrderCatalogItemDialog.vue index 46a50c021..09a25fcb8 100644 --- a/src/pages/Order/Card/OrderCatalogItemDialog.vue +++ b/src/pages/Order/Card/OrderCatalogItemDialog.vue @@ -20,8 +20,10 @@ const props = defineProps({ const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 }))); const descriptorData = useArrayData('orderData'); - +const isLoading = ref(false); const addToOrder = async () => { + if (isLoading.value) return; + isLoading.value = true; const items = (fields.value || []).filter((item) => Number(item.quantity) > 0); await axios.post('/OrderRows/addToOrder', { items, @@ -30,6 +32,10 @@ const addToOrder = async () => { notify(t('globals.dataSaved'), 'positive'); emit('added'); descriptorData.fetch({}); + isLoading.value = false; +}; +const canAddToOrder = () => { + return (fields.value || []).some((item) => Number(item.quantity) > 0); }; @@ -68,7 +74,11 @@ const addToOrder = async () => {
- + {{ t('globals.add') }}
@@ -81,3 +91,10 @@ const addToOrder = async () => { width: 200px; } + + +es: + noAmount: La cantidad no puede ser 0 +en: + noAmount: Amount can not be 0 +