From bb761abe75c63b63c8841e43d31097a06ccfafb6 Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 26 Sep 2025 00:32:55 +0200 Subject: [PATCH] Refactor CreateProductDialog and MerchantStore for improved product handling - Updated CreateProductDialog to use `model-value` for Checkbox components, enhancing reactivity and consistency. - Modified MerchantStore to only add active products to the market store, improving product visibility and management. These changes streamline the product creation and management processes, ensuring better user experience and data integrity. --- .../market/components/CreateProductDialog.vue | 15 ++++++++------- src/modules/market/components/MerchantStore.vue | 10 ++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/modules/market/components/CreateProductDialog.vue b/src/modules/market/components/CreateProductDialog.vue index b1f07c5..7e192d8 100644 --- a/src/modules/market/components/CreateProductDialog.vue +++ b/src/modules/market/components/CreateProductDialog.vue @@ -89,8 +89,9 @@
@@ -141,8 +142,8 @@
@@ -461,13 +462,13 @@ watch(() => props.isOpen, async (isOpen) => { use_autoreply: false, autoreply_message: '' } - + // Reset form with appropriate initial values resetForm({ values: initialValues }) - + // Wait for reactivity await nextTick() - + // Clear any previous errors createError.value = null } diff --git a/src/modules/market/components/MerchantStore.vue b/src/modules/market/components/MerchantStore.vue index 6bbcd80..1438b73 100644 --- a/src/modules/market/components/MerchantStore.vue +++ b/src/modules/market/components/MerchantStore.vue @@ -523,10 +523,12 @@ const loadStallProducts = async () => { })) stallProducts.value = enrichedProducts - // Also add them to the market store so they appear in the main market - enrichedProducts.forEach(product => { - marketStore.addProduct(product) - }) + // Only add active products to the market store so they appear in the main market + enrichedProducts + .filter(product => product.active) + .forEach(product => { + marketStore.addProduct(product) + }) } catch (error) { console.error('Failed to load products:', error) stallProducts.value = []