From 56a6f240714bdb73f6b6883009242b228df1e47b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 29 Apr 2024 14:21:39 +0200 Subject: [PATCH] feat: family filter --- .../Ticket/Negative/TicketLackFilter.vue | 54 +++++++++++++++++-- src/pages/Ticket/locale/en.yml | 1 + src/pages/Ticket/locale/es.yml | 1 + 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/pages/Ticket/Negative/TicketLackFilter.vue b/src/pages/Ticket/Negative/TicketLackFilter.vue index 0ac034d0d..aaa8ba7fb 100644 --- a/src/pages/Ticket/Negative/TicketLackFilter.vue +++ b/src/pages/Ticket/Negative/TicketLackFilter.vue @@ -23,15 +23,40 @@ const defaultParams = { }; const warehouses = ref(); +const categoriesOptions = ref([]); +const itemTypesRef = ref(null); +const itemTypesFilter = { + fields: ['id', 'name', 'categoryFk'], + include: 'category', + order: 'name ASC', + where: {}, +}; const handleWarehouses = async (data) => { warehouses.value = data; defaultParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id; }; + +const onCategoryChange = async (categoryFk, search) => { + if (!categoryFk) { + itemTypesFilter.where.categoryFk = null; + delete itemTypesFilter.where.categoryFk; + } else { + itemTypesFilter.where.categoryFk = categoryFk; + } + search(); + await itemTypesRef.value.fetch(); +}; diff --git a/src/pages/Ticket/locale/en.yml b/src/pages/Ticket/locale/en.yml index e6deffd6e..105956903 100644 --- a/src/pages/Ticket/locale/en.yml +++ b/src/pages/Ticket/locale/en.yml @@ -11,6 +11,7 @@ negative: warehouseFk: 'Warehouse' producer: 'Producer' category: 'category' + categoryFk: 'Family' warehouse: 'warehouse' lack: 'Negative' inkFk: 'inkFk' diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index 87536de79..dad3f6364 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -12,6 +12,7 @@ negative: warehouseFk: 'Almacen' producer: 'Producer' category: 'Categoria' + categoryFk: 'Familia' warehouse: 'Almacen' lack: 'Negativo' inkFk: 'Color'