From aaee96d6bb4ddcb693d9801b50b1af9fcc42e712 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 26 Jun 2024 15:09:26 +0200 Subject: [PATCH 1/8] refs #7366 VnTable --- src/i18n/locale/en.yml | 10 ++ src/i18n/locale/es.yml | 10 ++ src/pages/Travel/TravelList.vue | 245 +++++++++++++++++--------------- 3 files changed, 147 insertions(+), 118 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index fbab06966..5ebd50649 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -1144,6 +1144,16 @@ travel: basicData: Basic data history: Log thermographs: Thermograph + travelList: + tableVisibleColumns: + id: Id + ref: Reference + agency: Agency + shipped: Shipped + landed: Landed + warehouseIn: Warehouse in + warehouseOut: Warehouse out + totalEntries: Total entries summary: confirmed: Confirmed entryId: Entry Id diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index fec78d5e6..cecca86da 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -1132,6 +1132,16 @@ travel: basicData: Datos básicos history: Historial thermographs: Termógrafos + travelList: + tableVisibleColumns: + id: Id + ref: Referencia + agency: Agencia + shipped: Enviado + landed: Llegada + warehouseIn: Almacén de salida + warehouseOut: Almacén de entrada + totalEntries: Total de entradas summary: confirmed: Confirmado entryId: Id entrada diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index e6696b26f..eca79d690 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -2,19 +2,12 @@ import { onMounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; -import VnPaginate from 'src/components/ui/VnPaginate.vue'; -import CardList from 'src/components/ui/CardList.vue'; -import VnLv from 'src/components/ui/VnLv.vue'; -import TravelSummary from './Card/TravelSummary.vue'; -import TravelFilter from './TravelFilter.vue'; -import FetchData from 'components/FetchData.vue'; -import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; - import { useStateStore } from 'stores/useStateStore'; -import { toDate } from 'src/filters/index'; +import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; -import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js'; -import RightMenu from 'src/components/common/RightMenu.vue'; + +import { computed } from 'vue'; +import TravelSummary from './Card/TravelSummary.vue'; const router = useRouter(); const { t } = useI18n(); @@ -47,118 +40,134 @@ const getWarehouseName = (id) => { onMounted(async () => { stateStore.rightDrawer = true; }); + +const columns = computed(() => [ + { + align: 'left', + name: 'id', + label: t('travel.travelList.tableVisibleColumns.id'), + isId: true, + field: 'id', + cardVisible: true, + }, + { + align: 'left', + name: 'ref', + label: t('travel.travelList.tableVisibleColumns.ref'), + field: 'ref', + component: 'input', + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'agencyModeFk', + label: t('travel.travelList.tableVisibleColumns.agency'), + field: 'agencyModeFk', + component: 'select', + attrs: { + url: 'agencyModes', + fields: ['id', 'name'], + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'shipped', + label: t('travel.travelList.tableVisibleColumns.shipped'), + field: 'shipped', + component: 'date', + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'landed', + label: t('travel.travelList.tableVisibleColumns.landed'), + field: 'landed', + component: 'date', + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'warehouseInFk', + label: t('travel.travelList.tableVisibleColumns.warehouseIn'), + field: 'warehouseInFk', + component: 'select', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'warehouseOutFk', + label: t('travel.travelList.tableVisibleColumns.warehouseOut'), + field: 'warehouseOutFk', + component: 'select', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + }, + cardVisible: true, + create: true, + }, + { + align: 'left', + name: 'totalEntries', + label: t('travel.travelList.tableVisibleColumns.totalEntries'), + field: 'totalEntries', + component: 'input', + cardVisible: true, + create: true, + }, + { + align: 'right', + label: '', + name: 'tableActions', + actions: [ + { + title: t('Clone'), + icon: 'vn:ticket', + action: cloneTravel, + isPrimary: true, + }, + { + title: t('Add entry'), + icon: 'preview', + action: (row) => viewSummary(row.id, TravelSummary), + }, + ], + }, +]); From 95a9805a842cc802059c33f65534cf32b3d60878 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 27 Jun 2024 09:53:42 +0200 Subject: [PATCH 2/8] refs #7366 fix icons actions --- src/pages/Travel/TravelList.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index eca79d690..1e616a937 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -132,14 +132,14 @@ const columns = computed(() => [ actions: [ { title: t('Clone'), - icon: 'vn:ticket', + icon: 'vn:clone', action: cloneTravel, isPrimary: true, }, { title: t('Add entry'), - icon: 'preview', - action: (row) => viewSummary(row.id, TravelSummary), + icon: 'contact_support', + action: redirectCreateEntryView, }, ], }, From 99628d2cf83a7869a41387f556888ecf37a9766a Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 27 Jun 2024 10:08:17 +0200 Subject: [PATCH 3/8] refs #7366 remove code --- src/pages/Travel/TravelList.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 1e616a937..e77c95ac2 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -7,19 +7,13 @@ import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { computed } from 'vue'; -import TravelSummary from './Card/TravelSummary.vue'; const router = useRouter(); const { t } = useI18n(); const stateStore = useStateStore(); -const { viewSummary } = useSummaryDialog(); const warehouses = ref([]); -const navigateToTravelId = (id) => { - router.push({ path: `/travel/${id}` }); -}; - const cloneTravel = (travelData) => { const stringifiedTravelData = JSON.stringify(travelData); redirectToCreateView(stringifiedTravelData); From 4dd1ed3a3dba69f8f06034b160055feadae79ed4 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 27 Jun 2024 10:12:04 +0200 Subject: [PATCH 4/8] refs #7366 remove summary --- src/pages/Travel/TravelList.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index e77c95ac2..2b2af9dbf 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; import { useStateStore } from 'stores/useStateStore'; import VnTable from 'components/VnTable/VnTable.vue'; -import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { computed } from 'vue'; From 3965608a188ed72b2d2bd8cd8deeb58b77691ddf Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 1 Jul 2024 12:15:05 +0200 Subject: [PATCH 5/8] refs #7366 fix travelList --- src/pages/Travel/TravelList.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 2b2af9dbf..a1d008302 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -134,6 +134,11 @@ const columns = computed(() => [ icon: 'contact_support', action: redirectCreateEntryView, }, + { + title: t('View Summary'), + icon: 'preview', + action: (row) => viewSummary(row.id, TravelSummary), + }, ], }, ]); From 0c31755fdb3835a14bea2800c39dc040a441d164 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 1 Jul 2024 12:21:18 +0200 Subject: [PATCH 6/8] refs #7366 fix summary --- src/pages/Travel/TravelList.vue | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index a1d008302..872e6c06d 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -4,15 +4,13 @@ import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; import { useStateStore } from 'stores/useStateStore'; import VnTable from 'components/VnTable/VnTable.vue'; - +import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { computed } from 'vue'; - +const { viewSummary } = useSummaryDialog(); const router = useRouter(); const { t } = useI18n(); const stateStore = useStateStore(); -const warehouses = ref([]); - const cloneTravel = (travelData) => { const stringifiedTravelData = JSON.stringify(travelData); redirectToCreateView(stringifiedTravelData); @@ -26,10 +24,6 @@ const redirectCreateEntryView = (travelData) => { router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); }; -const getWarehouseName = (id) => { - return warehouses.value.find((warehouse) => warehouse.id === id).name; -}; - onMounted(async () => { stateStore.rightDrawer = true; }); From 31cd266ec7a6c7494b8f9c1a3f66bba392a13338 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 1 Jul 2024 12:44:09 +0200 Subject: [PATCH 7/8] refs #7366 fix component --- src/pages/Travel/TravelList.vue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 872e6c06d..980840b46 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -6,6 +6,8 @@ import { useStateStore } from 'stores/useStateStore'; import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { computed } from 'vue'; +import TravelSummary from './Card/TravelSummary.vue'; +import { dashIfEmpty, toDate } from 'src/filters'; const { viewSummary } = useSummaryDialog(); const router = useRouter(); const { t } = useI18n(); @@ -43,6 +45,9 @@ const columns = computed(() => [ label: t('travel.travelList.tableVisibleColumns.ref'), field: 'ref', component: 'input', + columnField: { + component: null, + }, cardVisible: true, create: true, }, @@ -56,6 +61,9 @@ const columns = computed(() => [ url: 'agencyModes', fields: ['id', 'name'], }, + columnField: { + component: null, + }, cardVisible: true, create: true, }, @@ -65,8 +73,12 @@ const columns = computed(() => [ label: t('travel.travelList.tableVisibleColumns.shipped'), field: 'shipped', component: 'date', + columnField: { + component: null, + }, cardVisible: true, create: true, + format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)), }, { align: 'left', @@ -74,8 +86,12 @@ const columns = computed(() => [ label: t('travel.travelList.tableVisibleColumns.landed'), field: 'landed', component: 'date', + columnField: { + component: null, + }, cardVisible: true, create: true, + format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)), }, { align: 'left', @@ -87,6 +103,9 @@ const columns = computed(() => [ url: 'warehouses', fields: ['id', 'name'], }, + columnField: { + component: null, + }, cardVisible: true, create: true, }, @@ -100,6 +119,9 @@ const columns = computed(() => [ url: 'warehouses', fields: ['id', 'name'], }, + columnField: { + component: null, + }, cardVisible: true, create: true, }, @@ -109,6 +131,9 @@ const columns = computed(() => [ label: t('travel.travelList.tableVisibleColumns.totalEntries'), field: 'totalEntries', component: 'input', + columnField: { + component: null, + }, cardVisible: true, create: true, }, From ad2265fe7c6d4db98c02653b3d3be9eaf49653a1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 Jul 2024 08:43:23 +0200 Subject: [PATCH 8/8] refs #7366 fix travel migration --- src/composables/useArrayData.js | 1 - src/pages/Travel/Card/TravelCard.vue | 6 +++++- src/pages/Travel/Card/TravelSummary.vue | 2 -- src/pages/Travel/TravelList.vue | 27 ++++++++++++++++++++----- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index f6f476f87..cdf965417 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -21,7 +21,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { onMounted(() => { setOptions(); store.skip = 0; - const query = route.query; const searchUrl = store.searchUrl; if (query[searchUrl]) { diff --git a/src/pages/Travel/Card/TravelCard.vue b/src/pages/Travel/Card/TravelCard.vue index bf7e6d57a..a3c1430e9 100644 --- a/src/pages/Travel/Card/TravelCard.vue +++ b/src/pages/Travel/Card/TravelCard.vue @@ -33,8 +33,12 @@ const filter = { diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index 88ddee9a2..7900688cb 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -12,8 +12,6 @@ import FetchData from 'src/components/FetchData.vue'; import { toDate, toCurrency } from 'src/filters'; import axios from 'axios'; -onUpdated(() => summaryRef.value.fetch()); - const $props = defineProps({ id: { type: Number, diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 980840b46..78844d4b6 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -2,17 +2,27 @@ import { onMounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; +import { useRoute } from 'vue-router'; import { useStateStore } from 'stores/useStateStore'; import VnTable from 'components/VnTable/VnTable.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { computed } from 'vue'; import TravelSummary from './Card/TravelSummary.vue'; +import VnSearchbar from 'components/ui/VnSearchbar.vue'; import { dashIfEmpty, toDate } from 'src/filters'; const { viewSummary } = useSummaryDialog(); const router = useRouter(); const { t } = useI18n(); const stateStore = useStateStore(); - +const route = useRoute(); +const tableRef = ref(); +const $props = defineProps({ + id: { + type: Number, + default: 0, + }, +}); +const entityId = computed(() => $props.id || route.params.id); const cloneTravel = (travelData) => { const stringifiedTravelData = JSON.stringify(travelData); redirectToCreateView(stringifiedTravelData); @@ -164,16 +174,21 @@ const columns = computed(() => [