From 0adbd3e6d24c6efab9ab108cf42c606b0ee8d66b Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 5 Jul 2024 11:29:06 -0300 Subject: [PATCH 1/4] Ticket advance filter --- src/composables/useArrayData.js | 18 ++- src/pages/Ticket/TicketAdvance.vue | 19 ++- src/pages/Ticket/TicketAdvanceFilter.vue | 172 +++++++++++++++++++++++ 3 files changed, 200 insertions(+), 9 deletions(-) create mode 100644 src/pages/Ticket/TicketAdvanceFilter.vue diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 0fcbbbb48..d1d708f9b 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -177,10 +177,20 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { delete store.userParams[param]; delete params[param]; if (store.filter?.where) { - const key = Object.keys(exprBuilder ? exprBuilder(param) : param); - if (key[0]) delete store.filter.where[key[0]]; - if (Object.keys(store.filter.where).length === 0) { - delete store.filter.where; + let key; + if (exprBuilder) { + const result = exprBuilder(param); + if (result !== undefined && result !== null) + key = Object.keys(result); + } else { + if (typeof param === 'object' && param !== null) + key = Object.keys(param); + } + if (key && key[0]) { + delete store.filter.where[key[0]]; + if (Object.keys(store.filter.where).length === 0) { + delete store.filter.where; + } } } } diff --git a/src/pages/Ticket/TicketAdvance.vue b/src/pages/Ticket/TicketAdvance.vue index 8b0a426dd..bb9a8c8a8 100644 --- a/src/pages/Ticket/TicketAdvance.vue +++ b/src/pages/Ticket/TicketAdvance.vue @@ -9,6 +9,8 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnProgress from 'src/components/common/VnProgressModal.vue'; +import RightMenu from 'src/components/common/RightMenu.vue'; +import TicketAdvanceFilter from './TicketAdvanceFilter.vue'; import { dashIfEmpty, toCurrency } from 'src/filters'; import { useVnConfirm } from 'composables/useVnConfirm'; @@ -42,9 +44,9 @@ const exprBuilder = (param, value) => { case 'notMovableLines': case 'futureZoneFk': return { [param]: value }; - case 'ipt': + case 'iptColFilter': return { ipt: { like: `%${value}%` } }; - case 'futureIpt': + case 'futureIptColFilter': return { futureIpt: { like: `%${value}%` } }; } }; @@ -55,6 +57,7 @@ const arrayData = useArrayData('AdvanceTickets', { url: 'Tickets/getTicketsAdvance', userParams: userParams, exprBuilder: exprBuilder, + limit: 0, }); const { store } = arrayData; const tickets = computed(() => @@ -110,7 +113,7 @@ const ticketColumns = computed(() => [ sortable: true, columnFilter: { component: VnSelect, - filterParamKey: 'ipt', + filterParamKey: 'iptColFilter', type: 'select', filterValue: null, event: getInputEvents, @@ -194,7 +197,7 @@ const ticketColumns = computed(() => [ sortable: true, columnFilter: { component: VnSelect, - filterParamKey: 'futureIpt', + filterParamKey: 'futureIptColFilter', type: 'select', filterValue: null, event: getInputEvents, @@ -451,7 +454,8 @@ onMounted(async () => { userParams.dateFuture = tomorrow; userParams.dateToAdvance = today; userParams.warehouseFk = user.value.warehouseFk; - await arrayData.addFilter({ userParams }); + const filter = { limit: 0 }; + await arrayData.addFilter({ filter, userParams }); }); @@ -521,6 +525,11 @@ onMounted(async () => { + + + +import { ref } from 'vue'; +import { useI18n } from 'vue-i18n'; + +import FetchData from 'components/FetchData.vue'; +import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; +import VnSelect from 'components/common/VnSelect.vue'; +import VnInputDate from 'src/components/common/VnInputDate.vue'; + +import axios from 'axios'; +import { onMounted } from 'vue'; + +const { t } = useI18n(); +const props = defineProps({ + dataKey: { + type: String, + required: true, + }, + exprBuilder: { + type: Function, + default: null, + }, +}); + +const warehousesOptions = ref([]); +const itemPackingTypes = ref([]); + +const getItemPackingTypes = async () => { + try { + const filter = { + where: { isActive: true }, + }; + const { data } = await axios.get('ItemPackingTypes', { + params: { filter: JSON.stringify(filter) }, + }); + itemPackingTypes.value = data.map((ipt) => ({ + description: t(ipt.description), + code: ipt.code, + })); + } catch (error) { + console.error(error); + } +}; + +onMounted(async () => await getItemPackingTypes()); + + + + + +en: + iptInfo: IPT + params: + dateFuture: Origin date + dateToAdvance: Destination date + futureIpt: Origin IPT + ipt: Destination IPT + itemPackingTypes: 100% movable + warehouseFk: Warehouse +es: + Horizontal: Horizontal + Vertical: Vertical + iptInfo: Encajado + params: + dateFuture: Origin date + dateToAdvance: Destination date + futureIpt: Origin IPT + ipt: Destination IPT + itemPackingTypes: 100% movable + warehouseFk: Warehouse + From 1cfa2edc01ec031dfc8a7749428df7f5ce17b4a9 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 5 Jul 2024 21:18:41 +0200 Subject: [PATCH 2/4] fix: i18n --- src/pages/Ticket/TicketAdvanceFilter.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue index beb321538..7b95595a4 100644 --- a/src/pages/Ticket/TicketAdvanceFilter.vue +++ b/src/pages/Ticket/TicketAdvanceFilter.vue @@ -163,10 +163,10 @@ es: Vertical: Vertical iptInfo: Encajado params: - dateFuture: Origin date - dateToAdvance: Destination date - futureIpt: Origin IPT - ipt: Destination IPT - itemPackingTypes: 100% movable - warehouseFk: Warehouse + dateFuture: fecha origen + dateToAdvance: Fecha destino + futureIpt: IPT Origen + ipt: IPT destino + itemPackingTypes: 100% movible + warehouseFk: Almacén From 7393e51a940bb7a80aff2d92fb66c344acfe0e2b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 8 Jul 2024 12:41:00 +0200 Subject: [PATCH 3/4] fix: when param not exists --- src/pages/Ticket/TicketAdvanceFilter.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue index 7b95595a4..c4548763a 100644 --- a/src/pages/Ticket/TicketAdvanceFilter.vue +++ b/src/pages/Ticket/TicketAdvanceFilter.vue @@ -124,6 +124,7 @@ onMounted(async () => await getItemPackingTypes()); :label="t('params.itemPackingTypes')" v-model="params.itemPackingTypes" toggle-indeterminate + :false-value="null" @update:model-value="searchFn()" /> From be86b690796e5f72c42df805fd7efb383ee47cd1 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 15 Jul 2024 11:53:10 +0200 Subject: [PATCH 4/4] fix: ticket menu order and i18n --- src/i18n/locale/en.yml | 13 ++-- src/pages/Ticket/Card/TicketComponents.vue | 4 +- src/router/modules/ticket.js | 79 ++++++++++++++++------ 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 8fa79962a..6943252c9 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -197,6 +197,12 @@ globals: autonomous: Autonomous suppliers: Suppliers supplier: Supplier + expedition: Expedition + services: Service + components: Components + pictures: Pictures + packages: Packages + tracking: Tracking labeler: Labeler supplierCreate: New supplier accounts: Accounts @@ -553,15 +559,8 @@ ticket: observation: Notes ticketAdvance: Advance tickets futureTickets: Future tickets - expedition: Expedition purchaseRequest: Purchase request weeklyTickets: Weekly tickets - saleTracking: Sale tracking - services: Service - tracking: Tracking - components: Components - pictures: Pictures - packages: Packages list: nickname: Nickname state: State diff --git a/src/pages/Ticket/Card/TicketComponents.vue b/src/pages/Ticket/Card/TicketComponents.vue index 47a1f0aa1..3954b5a62 100644 --- a/src/pages/Ticket/Card/TicketComponents.vue +++ b/src/pages/Ticket/Card/TicketComponents.vue @@ -111,7 +111,7 @@ const columns = computed(() => [ const getBase = computed(() => { let sum = 0; - for (let sale of ticketComponents.value) { + for (let sale of components.value) { for (let saleComponent of sale.components) { if (saleComponent.component.componentType.isBase) { sum += sale.quantity * saleComponent.value; @@ -123,7 +123,7 @@ const getBase = computed(() => { const getTotal = computed(() => { let total = 0; - for (let sale of ticketComponents.value) { + for (let sale of components.value) { for (let saleComponent of sale.components) { total += sale.quantity * saleComponent.value; } diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index c6121e836..c507553d6 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -21,7 +21,10 @@ export default { 'TicketPurchaseRequest', 'TicketTracking', 'TicketNotes', + 'TicketPicture', 'TicketVolume', + 'TicketComponents', + 'TicketPackage', 'TicketService', 'TicketSaleTracking', 'TicketBoxing', @@ -146,13 +149,40 @@ export default { component: () => import('src/pages/Ticket/Card/TicketLog.vue'), }, { - path: 'boxing', - name: 'TicketBoxing', + path: 'observation', + name: 'TicketNotes', meta: { - title: 'boxing', + title: 'notes', + icon: 'vn:notes', + }, + component: () => import('src/pages/Ticket/Card/TicketNotes.vue'), + }, + { + path: 'picture', + name: 'TicketPicture', + meta: { + title: 'pictures', + icon: 'vn:photo', + }, + component: () => import('src/pages/Ticket/Card/TicketPicture.vue'), + }, + { + path: 'volume', + name: 'TicketVolume', + meta: { + title: 'volume', + icon: 'vn:volume', + }, + component: () => import('src/pages/Ticket/Card/TicketVolume.vue'), + }, + { + path: 'expedition', + name: 'TicketExpedition', + meta: { + title: 'expedition', icon: 'vn:package', }, - component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'), + component: () => import('src/pages/Ticket/Card/TicketExpedition.vue'), }, { path: 'service', @@ -164,23 +194,33 @@ export default { component: () => import('src/pages/Ticket/Card/TicketService.vue'), }, { - path: 'volume', - name: 'TicketVolume', + path: 'package', + name: 'TicketPackage', meta: { - title: 'volume', - icon: 'vn:volume', + title: 'packages', + icon: 'vn:bin', }, - component: () => import('src/pages/Ticket/Card/TicketVolume.vue'), + component: () => import('src/pages/Ticket/Card/TicketPackage.vue'), + }, + { + path: 'components', + name: 'TicketComponents', + meta: { + title: 'components', + icon: 'vn:components', + }, + component: () => import('src/pages/Ticket/Card/TicketComponents.vue'), }, { - path: 'observation', - name: 'TicketNotes', + path: 'sale-tracking', + name: 'TicketSaleTracking', meta: { - title: 'notes', - icon: 'vn:notes', + title: 'saleTracking', + icon: 'assignment', }, - component: () => import('src/pages/Ticket/Card/TicketNotes.vue'), + component: () => + import('src/pages/Ticket/Card/TicketSaleTracking.vue'), }, { path: 'dms', @@ -192,14 +232,13 @@ export default { component: () => import('src/pages/Ticket/Card/TicketDms.vue'), }, { - path: 'sale-tracking', - name: 'TicketSaleTracking', + path: 'boxing', + name: 'TicketBoxing', meta: { - title: 'saleTracking', - icon: 'vn:buyrequest', + title: 'boxing', + icon: 'science', }, - component: () => - import('src/pages/Ticket/Card/TicketSaleTracking.vue'), + component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'), }, { path: 'sms',