From 9a631a61f90711e281244ddcb7ae2b8d93c96a55 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 3 Jan 2025 10:46:43 +0100 Subject: [PATCH 1/9] fix: refs #8197 redirection --- src/components/common/VnSection.vue | 14 ++++++++++++-- src/components/ui/VnSearchbar.vue | 1 + src/pages/Order/Card/OrderSummary.vue | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue index e69e586b5..f55826a22 100644 --- a/src/components/common/VnSection.vue +++ b/src/components/common/VnSection.vue @@ -4,6 +4,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnTableFilter from '../VnTable/VnTableFilter.vue'; import { onBeforeMount, computed } from 'vue'; import { useArrayData } from 'src/composables/useArrayData'; +import { useRoute } from 'vue-router'; const $props = defineProps({ section: { @@ -40,8 +41,17 @@ const $props = defineProps({ }, }); -const sectionValue = computed(() => $props.section ?? $props.dataKey); +const route = useRoute(); let arrayData; +const sectionValue = computed(() => $props.section ?? $props.dataKey); +const isMainSection = computed(() => { + const isSame = sectionValue.value == route.name; + if (!isSame && arrayData) { + arrayData.reset(['userParams', 'userFilter']); + } + return isSame; +}); + onBeforeMount(() => { if ($props.dataKey) arrayData = useArrayData($props.dataKey, { @@ -74,6 +84,6 @@ onBeforeMount(() => { - + diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 4e284d8e4..a2d3b9ee1 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -126,6 +126,7 @@ async function search() { delete filter.params.search; } await arrayData.applyFilter(filter); + searchText.value = undefined; } 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 6/9] 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 '-'; +}