From f3835a1d8355dc2749de74b8d12244e7ca3711a0 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 3 Jan 2025 15:31:00 +0100 Subject: [PATCH 1/8] fix: refs #8197 vnPaginate when change :id --- src/components/ui/VnPaginate.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index a2ccd5d92..ee6937add 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -2,6 +2,7 @@ import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useArrayData } from 'composables/useArrayData'; +import { onBeforeRouteUpdate } from 'vue-router'; const { t } = useI18n(); @@ -110,6 +111,13 @@ onMounted(async () => { mounted.value = true; }); +// onBeforeRouteUpdate((to, from, next) => { +// if (to.name === from.name && to.path !== from.path) { +// arrayData.reset(['data']); +// } +// next(); +// }); + onBeforeUnmount(() => { arrayData.resetPagination(); }); From cc4295e7223c19be0891e3a8343a55ccad015b51 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 3 Jan 2025 15:40:19 +0100 Subject: [PATCH 2/8] feat: refs #8197 keepData in VnSection --- src/components/common/VnSection.vue | 5 +++++ src/components/ui/VnPaginate.vue | 9 ++------- src/composables/useArrayData.js | 1 + src/stores/useArrayDataStore.js | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue index 76856ef94..846717dc8 100644 --- a/src/components/common/VnSection.vue +++ b/src/components/common/VnSection.vue @@ -38,6 +38,10 @@ const $props = defineProps({ type: Boolean, default: true, }, + keepData: { + type: Boolean, + default: true, + }, }); const sectionValue = computed(() => $props.section ?? $props.dataKey); @@ -46,6 +50,7 @@ onBeforeMount(() => { if ($props.dataKey) arrayData = useArrayData($props.dataKey, { searchUrl: 'table', + keepData: $props.keepData, ...$props.arrayDataProps, navigate: $props.redirect, }); diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index ee6937add..5abb0d96c 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -111,14 +111,9 @@ onMounted(async () => { mounted.value = true; }); -// onBeforeRouteUpdate((to, from, next) => { -// if (to.name === from.name && to.path !== from.path) { -// arrayData.reset(['data']); -// } -// next(); -// }); - onBeforeUnmount(() => { + console.log('store.keepData: ', store.keepData); + if (!store.keepData) arrayData.reset(['data']); arrayData.resetPagination(); }); diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 1a91cc50b..720a1ec88 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { 'searchUrl', 'navigate', 'mapKey', + 'keepData', ]; if (typeof userOptions === 'object') { for (const option in userOptions) { diff --git a/src/stores/useArrayDataStore.js b/src/stores/useArrayDataStore.js index e0d8b7929..8d62fdb4a 100644 --- a/src/stores/useArrayDataStore.js +++ b/src/stores/useArrayDataStore.js @@ -18,6 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => { navigate: null, page: 1, mapKey: 'id', + keepData: false, }; function get(key) { From 1a8368c4cee7b4f65cbdd427428eb25f171ec1c2 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 6 Jan 2025 18:31:19 +0100 Subject: [PATCH 3/8] fix(VnDmsList): refs #8197 add mapKey --- src/components/common/VnDmsList.vue | 3 ++- src/components/ui/VnPaginate.vue | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index 52dd6ef79..3a143cb52 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -297,7 +297,8 @@ defineExpose({ ref="dmsRef" :data-key="$props.model" :url="$props.model" - :filter="dmsFilter" + map-key="dmsFk" + :user-filter="dmsFilter" :order="['dmsFk DESC']" :auto-load="true" @on-fetch="setData" diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 5abb0d96c..0111366f5 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -2,7 +2,6 @@ import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useArrayData } from 'composables/useArrayData'; -import { onBeforeRouteUpdate } from 'vue-router'; const { t } = useI18n(); @@ -112,7 +111,6 @@ onMounted(async () => { }); onBeforeUnmount(() => { - console.log('store.keepData: ', store.keepData); if (!store.keepData) arrayData.reset(['data']); arrayData.resetPagination(); }); From af7c6a0aafa40afec7f9da818e4e342207727843 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 6 Jan 2025 18:59:48 +0100 Subject: [PATCH 4/8] test: refs #8197 fix e2e --- src/components/common/VnBtnSelect.vue | 1 + src/components/common/VnModule.vue | 15 +++++++-------- .../integration/ticket/ticketExpedition.spec.js | 4 +++- .../integration/vnComponent/VnBreadcrumbs.spec.js | 1 + 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/common/VnBtnSelect.vue b/src/components/common/VnBtnSelect.vue index b0616a6b2..3d96a55a6 100644 --- a/src/components/common/VnBtnSelect.vue +++ b/src/components/common/VnBtnSelect.vue @@ -14,6 +14,7 @@ defineProps({ hide-dropdown-icon focus-on-mount @update:model-value="promise" + data-cy="vnBtnSelect_select" /> diff --git a/src/components/common/VnModule.vue b/src/components/common/VnModule.vue index 505b3a8b5..038ee1d60 100644 --- a/src/components/common/VnModule.vue +++ b/src/components/common/VnModule.vue @@ -20,16 +20,15 @@ const hasContent = ref(); let observer; onMounted(() => { - if (teleportRef.value) { - const checkContent = () => { - hasContent.value = teleportRef.value.innerHTML.trim() !== ''; - }; + if (!teleportRef.value) return; + const checkContent = () => { + hasContent.value = teleportRef.value?.innerHTML?.trim() !== ''; + }; - observer = new MutationObserver(checkContent); - observer.observe(teleportRef.value, { childList: true, subtree: true }); + observer = new MutationObserver(checkContent); + observer.observe(teleportRef.value, { childList: true, subtree: true }); - checkContent(); - } + checkContent(); }); diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js index d4afd401f..d74a122a1 100644 --- a/test/cypress/integration/ticket/ticketExpedition.spec.js +++ b/test/cypress/integration/ticket/ticketExpedition.spec.js @@ -16,7 +16,9 @@ describe('Ticket expedtion', () => { cy.wait('@show'); cy.selectRows([1, 2]); - cy.selectOption('[data-cy="change-state"]', 'Perdida'); + + cy.dataCy('change-state').click(); + cy.selectOption('[data-cy="vnBtnSelect_select"]', 'Perdida'); cy.wait('@add'); cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => { diff --git a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js index e996a65d5..9e6553ca6 100644 --- a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js +++ b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js @@ -16,6 +16,7 @@ describe('VnBreadcrumbs', () => { cy.visit('#/customer/list'); cy.get('.q-breadcrumbs__el').should('have.length', 2); + cy.writeSearchbar('{enter}'); cy.get(firstCard).click(); cy.get(`${lastBreadcrumb} > .q-icon`).should('have.text', 'launch'); }); From b0cb3597dee7be7735b52bebdf5ad1682f2f569d Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 7 Jan 2025 07:11:04 +0100 Subject: [PATCH 5/8] feat: refs #8246 added new field in list --- src/pages/Zone/ZoneList.vue | 58 +++++++++++++++++++++++++++++++++++- src/pages/Zone/locale/en.yml | 1 + src/pages/Zone/locale/es.yml | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue index 2a5d290ef..e4a1774fe 100644 --- a/src/pages/Zone/ZoneList.vue +++ b/src/pages/Zone/ZoneList.vue @@ -17,6 +17,7 @@ import VnInputTime from 'src/components/common/VnInputTime.vue'; import RightMenu from 'src/components/common/RightMenu.vue'; import ZoneFilterPanel from './ZoneFilterPanel.vue'; import ZoneSearchbar from './Card/ZoneSearchbar.vue'; +import FetchData from 'src/components/FetchData.vue'; const { t } = useI18n(); const router = useRouter(); @@ -25,6 +26,7 @@ const { viewSummary } = useSummaryDialog(); const { openConfirmationModal } = useVnConfirm(); const tableRef = ref(); const warehouseOptions = ref([]); +const validAddresses = ref([]); const tableFilter = { include: [ @@ -34,6 +36,32 @@ const tableFilter = { fields: ['id', 'name'], }, }, + { + relation: 'address', + scope: { + fields: ['id', 'nickname', 'provinceFk', 'postalCode'], + include: [ + { + relation: 'province', + scope: { + fields: ['id', 'name'], + }, + }, + { + relation: 'postcode', + scope: { + fields: ['code', 'townFk'], + include: { + relation: 'town', + scope: { + fields: ['id', 'name'], + }, + }, + }, + }, + ], + }, + }, ], }; @@ -95,7 +123,14 @@ const columns = computed(() => [ label: t('list.close'), cardVisible: true, format: (row) => toTimeFormat(row.hour), - hidden: true, + columnFilter: false, + }, + { + align: 'left', + name: 'addressFk', + label: t('list.addressFk'), + cardVisible: true, + columnFilter: false, }, { align: 'right', @@ -129,9 +164,27 @@ const handleClone = (id) => { () => clone(id) ); }; + +function showValidAddresses(row) { + if (row.addressFk) { + const isValid = validAddresses.value.some( + (address) => address.addressFk === row.addressFk + ); + if (isValid) + return `${row.address?.nickname}, + ${row.address?.postcode?.town?.name} (${row.address?.province?.name})`; + else return '-'; + } + return '-'; +}