From 45d9322892fd940d40969b29b0a82865ba30493e Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 2 Sep 2024 11:24:06 +0200 Subject: [PATCH] feat: refs #7553 added icons, descriptors and missing columns in TicketList and minor changes --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + .../Ticket/Card/TicketDescriptorMenu.vue | 1 - src/pages/Ticket/Card/TicketSale.vue | 2 +- src/pages/Ticket/Card/TicketSummary.vue | 46 ++-- src/pages/Ticket/TicketList.vue | 251 ++++++++++++++---- src/pages/Ticket/locale/en.yml | 5 + src/pages/Ticket/locale/es.yml | 5 + 8 files changed, 241 insertions(+), 71 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 65b8e68bc..b6abdb807 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -618,6 +618,7 @@ ticket: landed: Landed consigneePhone: Consignee phone consigneeMobile: Consignee mobile + consigneeAddress: Consignee address clientPhone: Client phone clientMobile: Client mobile consignee: Consignee diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3f12c0e41..e2ef436b4 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -624,6 +624,7 @@ ticket: landed: Entregado consigneePhone: Tel. consignatario consigneeMobile: Móv. consignatario + consigneeAddress: Dir. consignatario clientPhone: Tel. cliente clientMobile: Móv. cliente consignee: Consignatario diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue index d8efe08c1..ae88e1b7b 100644 --- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue +++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue @@ -493,7 +493,6 @@ async function handleInvoiceOutData() { diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index b269c75d4..f2c5228b4 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -615,7 +615,7 @@ async function save(item) { diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue index 643390c7d..c1321b0d9 100644 --- a/src/pages/Ticket/Card/TicketSummary.vue +++ b/src/pages/Ticket/Card/TicketSummary.vue @@ -243,6 +243,15 @@ async function changeState(value) { + + @@ -316,7 +325,7 @@ async function changeState(value) { round icon="vn:claims" v-if="props.row.claim" - class="link" + color="primary" :to="{ name: 'ClaimCard', params: { @@ -324,17 +333,17 @@ async function changeState(value) { }, }" > - {{ t('ticket.summary.claim') }}: - {{ props.row.claim.claimFk }} + + {{ t('ticket.summary.claim') }}: + {{ props.row.claim.claimFk }} + - {{ t('ticket.summary.claim') }}: - {{ props.row.claimBeginning.claimFk }} + + {{ t('ticket.summary.claim') }}: + {{ props.row.claimBeginning.claimFk }} + - {{ t('ticket.summary.visible') }}: - {{ props.row.visible }} + + {{ t('ticket.summary.visible') }}: + {{ props.row.visible }} + {{ t('ticket.summary.reserved') }} @@ -369,7 +378,7 @@ async function changeState(value) { {{ t('ticket.summary.itemShortage') }} @@ -378,10 +387,9 @@ async function changeState(value) { - {{ props.row }} {{ t('ticket.summary.hasComponentLack') }} diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index 12df8a2d3..e05e783d9 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -17,6 +17,9 @@ import RightMenu from 'src/components/common/RightMenu.vue'; import TicketFilter from './TicketFilter.vue'; import VnInput from 'src/components/common/VnInput.vue'; import FetchData from 'src/components/FetchData.vue'; +import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue'; +import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue'; +import { toTimeFormat } from 'src/filters/date'; const { t } = useI18n(); const { viewSummary } = useSummaryDialog(); @@ -47,16 +50,9 @@ const amountToReturn = ref(); const columns = computed(() => [ { align: 'left', - name: 'stateFk', - label: t('ticketList.state'), - columnFilter: { - name: 'stateFk', - component: 'select', - attrs: { - url: 'States', - fields: ['id', 'name'], - }, - }, + name: 'statusIcons', + hidden: true, + format: () => '', }, { align: 'left', @@ -67,40 +63,6 @@ const columns = computed(() => [ }, isId: true, }, - { - align: 'left', - name: 'nickname', - label: t('ticketList.nickname'), - isTitle: true, - }, - - { - align: 'left', - name: 'shipped', - cardVisible: true, - label: t('ticketList.shipped'), - columnFilter: { - component: 'date', - alias: 't', - inWhere: true, - }, - format: ({ shipped }) => toDate(shipped), - }, - { - align: 'left', - name: 'zoneFk', - label: t('ticketList.zone'), - columnFilter: { - component: 'select', - attrs: { - url: 'Zones', - fields: ['id', 'name'], - }, - alias: 't', - inWhere: true, - }, - format: (row, dashIfEmpty) => dashIfEmpty(row.zoneName), - }, { align: 'left', label: t('ticketList.salesPerson'), @@ -118,6 +80,77 @@ const columns = computed(() => [ }, format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson), }, + { + align: 'left', + name: 'shippedDate', + cardVisible: true, + label: t('ticketList.shipped'), + columnFilter: { + component: 'date', + alias: 't', + inWhere: true, + }, + format: ({ shippedDate }) => toDate(shippedDate), + }, + { + align: 'left', + name: 'shipped', + label: t('ticketList.hour'), + format: (row) => toTimeFormat(row.shipped), + }, + { + align: 'left', + name: 'zoneLanding', + label: t('ticketList.closure'), + format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)), + }, + { + align: 'left', + name: 'nickname', + label: t('ticketList.nickname'), + }, + { + align: 'left', + name: 'province', + label: t('ticketList.province'), + columnClass: 'expand', + }, + { + align: 'left', + name: 'stateFk', + label: t('ticketList.state'), + columnFilter: { + name: 'stateFk', + component: 'select', + attrs: { + url: 'States', + fields: ['id', 'name'], + }, + }, + columnClass: 'expand', + }, + { + align: 'left', + name: 'zoneFk', + label: t('ticketList.zone'), + columnFilter: { + component: 'select', + attrs: { + url: 'Zones', + fields: ['id', 'name'], + }, + alias: 't', + inWhere: true, + }, + columnClass: 'expand', + format: (row, dashIfEmpty) => dashIfEmpty(row.zoneName), + }, + { + align: 'left', + name: 'warehouse', + label: t('ticketList.warehouse'), + columnClass: 'expand', + }, { align: 'left', name: 'totalWithVat', @@ -133,15 +166,27 @@ const columns = computed(() => [ align: 'right', name: 'tableActions', actions: [ + { + title: t('ticketList.toLines'), + icon: 'list', + isPrimary: true, + action: (row) => redirectToLines(row.id), + }, { title: t('ticketList.summary'), icon: 'preview', + isPrimary: true, action: (row) => viewSummary(row.id, TicketSummary), }, ], }, ]); +function redirectToLines(id) { + const url = `#/ticket/${id}/sale`; + window.open(url, '_blank'); +} + const onClientSelected = async (formData) => { await fetchClient(formData); await fetchAddresses(formData); @@ -213,6 +258,21 @@ const getColor = (row) => { return row?.classColor ? `bg-${row.classColor}` : 'bg-orange'; }; +const getDateColor = (date) => { + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + const timeTicket = new Date(date); + timeTicket.setHours(0, 0, 0, 0); + const comparation = today - timeTicket; + return comparation < 0 ? 'bg-success' : 'bg-warning'; +}; + +const getTotalColor = () => { + // const total = row.totalWithVat; + // return total > 0 && total < 50 ? 'bg-warning' : ''; + return 'bg-warning'; +}; + onMounted(() => (stateStore.rightDrawer = true)); async function makeInvoice(ticket) { @@ -387,7 +447,7 @@ function setReference(data) { formInitialData: {}, }" default-mode="table" - order="shipped DESC" + :order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']" :columns="columns" :user-params="userParams" :right-search="false" @@ -399,6 +459,101 @@ function setReference(data) { selection: 'multiple', }" > + + + + + + + - diff --git a/src/pages/Ticket/locale/en.yml b/src/pages/Ticket/locale/en.yml index ddd33128e..115a5ebf7 100644 --- a/src/pages/Ticket/locale/en.yml +++ b/src/pages/Ticket/locale/en.yml @@ -258,3 +258,8 @@ ticketList: compensation: Compensation creditCard: Credit card transfers: Transfers + province: Province + warehouse: Warehouse + hour: Hour + closure: Closure + toLines: Go to lines diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index 97fd63060..1deda4bc4 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -261,3 +261,8 @@ ticketList: compensation: Compensación creditCard: Tarjeta de crédito transfers: Transferencias + province: Provincia + warehouse: Almacén + hour: Hora + closure: Cierre + toLines: Ir a lineas