From 85f94fa1f4363e7e5a6df6c4f8d33d76a1bf0a0d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 10 Jul 2024 10:41:39 +0200 Subject: [PATCH] feat: salesTicketTable --- src/pages/Monitor/SalesTicketsTable.vue | 447 +++++++++++------------- 1 file changed, 199 insertions(+), 248 deletions(-) diff --git a/src/pages/Monitor/SalesTicketsTable.vue b/src/pages/Monitor/SalesTicketsTable.vue index 6e4a99e71..f11de9ee3 100644 --- a/src/pages/Monitor/SalesTicketsTable.vue +++ b/src/pages/Monitor/SalesTicketsTable.vue @@ -6,7 +6,6 @@ import { useRouter } from 'vue-router'; import FetchData from 'components/FetchData.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; -import VnPaginate from 'components/ui/VnPaginate.vue'; import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; @@ -15,6 +14,7 @@ import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; +import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { toDateFormat, toTimeFormat } from 'src/filters/date.js'; @@ -103,7 +103,10 @@ const columns = computed(() => [ name: 'problems', align: 'left', sortable: true, - columnFilter: null, + columnFilter: false, + attrs: { + style: 'max-width: 50px', + }, }, { label: t('salesTicketsTable.identifier'), @@ -112,10 +115,8 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, + component: 'input', + attrs: { dense: true, }, @@ -128,10 +129,7 @@ const columns = computed(() => [ field: 'nickname', sortable: true, columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, + component: 'input', attrs: { dense: true, }, @@ -144,7 +142,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnSelect, + component: 'select', filterParamKey: 'salesPersonFk', type: 'select', filterValue: null, @@ -163,9 +161,9 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnInputDate, + component: 'date', filterParamKey: 'shippedDate', - type: 'date', + filterValue: null, event: getInputEvents, attrs: { @@ -188,10 +186,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnInput, - type: 'text', - filterValue: null, - event: getInputEvents, + component: 'input', attrs: { dense: true, }, @@ -213,7 +208,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnSelect, + component: 'select', filterParamKey: 'provinceFk', type: 'select', filterValue: null, @@ -232,7 +227,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnSelect, + component: 'select', filterParamKey: 'stateFk', type: 'select', filterValue: null, @@ -252,7 +247,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnInput, + component: 'input', type: 'text', filterValue: null, event: getInputEvents, @@ -267,7 +262,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnSelect, + component: 'select', filterParamKey: 'zoneFk', type: 'select', filterValue: null, @@ -287,7 +282,7 @@ const columns = computed(() => [ align: 'left', sortable: true, columnFilter: { - component: VnInput, + component: 'input', type: 'text', filterValue: null, event: getInputEvents, @@ -297,9 +292,33 @@ const columns = computed(() => [ }, }, { - name: 'rowActions', - align: 'left', - sortable: true, + align: 'right', + name: 'tableActions', + label: '', + actions: [ + { + title: t('salesTicketsTable.goToLines'), + icon: 'vn:lines', + color: 'priamry', + action: (row) => redirectToSales(row.id), + isPrimary: true, + attrs: { + flat: true, + dense: true, + }, + }, + { + title: t('salesTicketsTable.preview'), + icon: 'preview', + color: 'priamry', + action: (row) => viewSummary(row.id, TicketSummary), + isPrimary: true, + attrs: { + flat: true, + dense: true, + }, + }, + ], }, ]); @@ -357,12 +376,12 @@ const redirectToSales = (id) => { window.open(url, '_blank'); }; -onMounted(async () => { - const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions'); - allColumnNames.value = filteredColumns.map((col) => col.name); - params = fetchParams(); - await paginateRef.value.addFilter(null, params); -}); +// onMounted(async () => { +// const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions'); +// allColumnNames.value = filteredColumns.map((col) => col.name); +// params = fetchParams(); +// await paginateRef.value.addFilter(null, params); +// });