From d714788923600edb3a4ec412e9b2b4c40f75c1ac Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 08:29:55 +0200 Subject: [PATCH 1/6] test: fix intermitent e2e --- test/cypress/integration/invoiceIn/invoiceInList.spec.js | 3 +-- test/cypress/integration/parking/parkingList.spec.js | 2 +- test/cypress/support/commands.js | 4 ---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js index 5e2a5aa4c..b2fa10d52 100644 --- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js @@ -5,12 +5,11 @@ describe('InvoiceInList', () => { ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)'; const summaryHeaders = '.summaryBody .header-link'; - const screen = '.q-page-container > .q-drawer-container > .fullscreen'; beforeEach(() => { + cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/invoice-in/list`); - cy.get(screen).click(); }); it('should redirect on clicking a invoice', () => { diff --git a/test/cypress/integration/parking/parkingList.spec.js b/test/cypress/integration/parking/parkingList.spec.js index 3ac46f8cd..b78a660d1 100644 --- a/test/cypress/integration/parking/parkingList.spec.js +++ b/test/cypress/integration/parking/parkingList.spec.js @@ -8,9 +8,9 @@ describe('ParkingList', () => { const summaryHeader = '.summaryBody .header'; beforeEach(() => { + cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/parking/list`); - cy.closeSideMenu(); }); it('should redirect on clicking a parking', () => { diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 055cb8021..240a97908 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -221,10 +221,6 @@ Cypress.Commands.add('openLeftMenu', (element) => { if (element) cy.waitForElement(element); cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click(); }); -Cypress.Commands.add('closeSideMenu', (element) => { - if (element) cy.waitForElement(element); - cy.get('.fullscreen.q-drawer__backdrop:not(.hidden)').click(); -}); Cypress.Commands.add('clearSearchbar', (element) => { if (element) cy.waitForElement(element); From 0384123564bcc165e1ddc1b29a806753863f9ae4 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 12:24:33 +0200 Subject: [PATCH 2/6] fix: vntable filter where --- src/components/common/VnInput.vue | 7 ++++++- src/components/common/VnSelect.vue | 13 ++++++++++--- src/components/ui/VnFilterPanel.vue | 22 ++++++++++++++++++---- src/pages/Customer/CustomerList.vue | 2 ++ 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 4cd964012..33b97e29d 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -93,7 +93,12 @@ const inputRules = [ name="close" size="xs" v-if="hover && value && !$attrs.disabled && $props.clearable" - @click="value = null" + @click=" + () => { + value = null; + emit('remove'); + } + " > diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 52cb68438..3e5cd4216 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -61,6 +61,10 @@ const $props = defineProps({ type: Boolean, default: false, }, + useLike: { + type: Boolean, + default: true, + }, }); const { t } = useI18n(); @@ -114,11 +118,14 @@ async function fetchFilter(val) { if (!$props.url || !dataRef.value) return; const { fields, sortBy, limit } = $props; - let key = optionLabel.value; + let key = optionFilter.value ?? optionLabel.value; - if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value; + if (new RegExp(/\d/g).test(val)) key = optionValue.value; - const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where }; + const defaultWhere = $props.useLike + ? { [key]: { like: `%${val}%` } } + : { [key]: val }; + const where = { ...defaultWhere, ...$props.where }; const fetchOptions = { where, order: sortBy, limit }; if (fields) fetchOptions.fields = fields; return dataRef.value.fetch(fetchOptions); diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 9eff3d322..16217946b 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -10,7 +10,7 @@ const { t } = useI18n(); const $props = defineProps({ modelValue: { type: Object, - default: () => {} + default: () => {}, }, dataKey: { type: String, @@ -58,7 +58,14 @@ const $props = defineProps({ }, }); -const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']); +const emit = defineEmits([ + 'update:modelValue', + 'refresh', + 'clear', + 'search', + 'init', + 'remove', +]); const arrayData = useArrayData($props.dataKey, { exprBuilder: $props.exprBuilder, @@ -67,9 +74,9 @@ const arrayData = useArrayData($props.dataKey, { }); const route = useRoute(); const store = arrayData.store; -const userParams = ref({}) +const userParams = ref({}); onMounted(() => { - userParams.value = $props.modelValue ?? {} + userParams.value = $props.modelValue ?? {}; emit('init', { params: userParams.value }); }); @@ -92,6 +99,11 @@ watch( (val) => setUserParams(val) ); +watch( + () => $props.modelValue, + (val) => (userParams.value = val ?? {}) +); + const isLoading = ref(false); async function search(evt) { if (evt && $props.disableSubmitEvent) return; @@ -145,6 +157,7 @@ async function clearFilters() { isLoading.value = false; emit('clear'); + emit('update:modelValue', userParams.value); } const tagsList = computed(() => { @@ -168,6 +181,7 @@ async function remove(key) { userParams.value[key] = undefined; search(); emit('remove', key); + emit('update:modelValue', userParams.value); } function formatValue(value) { diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index ccd53e8b2..32980bc29 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -65,6 +65,8 @@ const columns = computed(() => [ url: 'Workers/activeWithInheritedRole', fields: ['id', 'name'], where: { role: 'salesPerson' }, + optionFilter: 'firstName', + useLike: false, }, create: true, columnField: { From 2961c813a514cabe54acac3656ae9d73d10a23a0 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 12:41:25 +0200 Subject: [PATCH 4/6] build: increase version 2430 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4668d2d56..71d80d401 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.28.1", + "version": "24.30.1", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", From 22f42ca7f926e546a6ddb670d9d47fbaecaa829a Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 14:55:32 +0200 Subject: [PATCH 5/6] feat(VnTable): add slots for columns --- src/components/VnTable/VnTable.vue | 38 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 493f1480e..9ddc858fb 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -175,7 +175,7 @@ function columnName(col) { } function getColAlign(col) { - return 'text-' + (col.align ?? 'left') + return 'text-' + (col.align ?? 'left'); } defineExpose({ reload, @@ -310,13 +310,15 @@ defineExpose({ class="no-margin q-px-xs" :class="getColAlign(col)" > - + + + From 6d12c0f00c8347f47e01a5c4db52dbca724c756c Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 2 Jul 2024 15:01:43 +0200 Subject: [PATCH 6/6] feat(VnTable): add selected funcitionality --- src/components/VnTable/VnTable.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 9ddc858fb..56d1cbe8f 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -59,6 +59,10 @@ const $props = defineProps({ type: Boolean, default: false, }, + hasSubtoolbar: { + type: Boolean, + default: true, + }, }); const { t } = useI18n(); const stateStore = useStateStore(); @@ -177,9 +181,12 @@ function columnName(col) { function getColAlign(col) { return 'text-' + (col.align ?? 'left'); } + +const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); defineExpose({ reload, redirect: redirectFn, + selected, });