diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 7e9ab85cb..1a4d5e552 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -33,7 +33,8 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue'; import VnTableFilter from './VnTableFilter.vue'; import { getColAlign } from 'src/composables/getColAlign'; import RightMenu from '../common/RightMenu.vue'; -import VnScroll from '../common/VnScroll.vue' +import VnScroll from '../common/VnScroll.vue'; +import VnMultiCheck from '../common/VnMultiCheck.vue'; const arrayData = useArrayData(useAttrs()['data-key']); const $props = defineProps({ @@ -113,6 +114,10 @@ const $props = defineProps({ type: Object, default: () => ({}), }, + multiCheck: { + type: Object, + default: () => ({}), + }, crudModel: { type: Object, default: () => ({}), @@ -157,6 +162,7 @@ const CARD_MODE = 'card'; const TABLE_MODE = 'table'; const mode = ref(CARD_MODE); const selected = ref([]); +const selectAll = ref(false); const hasParams = ref(false); const CrudModelRef = ref({}); const showForm = ref(false); @@ -195,10 +201,10 @@ const onVirtualScroll = ({ to }) => { handleScroll(); const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle'); if (virtualScrollContainer) { - virtualScrollContainer.dispatchEvent(new CustomEvent('scroll')); - if (vnScrollRef.value) { - vnScrollRef.value.updateScrollContainer(virtualScrollContainer); - } + virtualScrollContainer.dispatchEvent(new CustomEvent('scroll')); + if (vnScrollRef.value) { + vnScrollRef.value.updateScrollContainer(virtualScrollContainer); + } } }; @@ -341,11 +347,11 @@ function handleOnDataSaved(_) { else $props.create.onDataSaved(_); } function handleScroll() { - if ($props.crudModel.disableInfiniteScroll) return; - const tMiddle = tableRef.value.$el.querySelector('.q-table__middle'); - const { scrollHeight, scrollTop, clientHeight } = tMiddle; - const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40; - if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate(); + if ($props.crudModel.disableInfiniteScroll) return; + const tMiddle = tableRef.value.$el.querySelector('.q-table__middle'); + const { scrollHeight, scrollTop, clientHeight } = tMiddle; + const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40; + if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate(); } function handleSelection({ evt, added, rows: selectedRows }, rows) { if (evt?.shiftKey && added) { @@ -638,6 +644,23 @@ const rowCtrlClickFunction = computed(() => { }; return () => {}; }); +const handleMultiCheck = (value) => { + if (value) { + selected.value = tableRef.value.rows; + } else { + selected.value = []; + } + emit('update:selected', selected.value); +}; + +const handleSelectedAll = (data) => { + if (data) { + selected.value = data; + } else { + selected.value = []; + } + emit('update:selected', selected.value); +}; @@ -661,7 +684,7 @@ const rowCtrlClickFunction = computed(() => { emit('onFetch', ...args)" :search-url="searchUrl" @@ -679,9 +702,9 @@ const rowCtrlClickFunction = computed(() => { ref="tableRef" v-bind="table" :class="[ - 'vnTable', - table ? 'selection-cell' : '', - $props.footer ? 'last-row-sticky' : '', + 'vnTable', + table ? 'selection-cell' : '', + $props.footer ? 'last-row-sticky' : '', ]" wrap-cells :columns="splittedColumns.columns" @@ -700,6 +723,18 @@ const rowCtrlClickFunction = computed(() => { :hide-selected-banner="true" :data-cy > + + {{ $attrs['url'] }} + + + @@ -1098,10 +1133,10 @@ const rowCtrlClickFunction = computed(() => { - diff --git a/src/components/common/VnMultiCheck.vue b/src/components/common/VnMultiCheck.vue new file mode 100644 index 000000000..19b93ffa9 --- /dev/null +++ b/src/components/common/VnMultiCheck.vue @@ -0,0 +1,80 @@ + + + + + + + + + + {{ t('Select all', { rows: rows.length }) }} + + + + + + + + +en: + Select all: 'Select all ({rows})' +fr: + Select all: 'Sélectionner tout ({rows})' +es: + Select all: 'Seleccionar todo ({rows})' +de: + Select all: 'Alle auswählen ({rows})' +it: + Select all: 'Seleziona tutto ({rows})' +pt: + Select all: 'Selecionar tudo ({rows})' + diff --git a/src/pages/Customer/Notifications/CustomerNotifications.vue b/src/pages/Customer/Notifications/CustomerNotifications.vue index cbbd6d205..02792182c 100644 --- a/src/pages/Customer/Notifications/CustomerNotifications.vue +++ b/src/pages/Customer/Notifications/CustomerNotifications.vue @@ -100,6 +100,9 @@ const columns = computed(() => [ 'row-key': 'id', selection: 'multiple', }" + :multi-check="{ + expand: true, + }" v-model:selected="selected" :right-search="true" :columns="columns" diff --git a/src/pages/Customer/Notifications/CustomerNotificationsCampaignConsumption.vue b/src/pages/Customer/Notifications/CustomerNotificationsCampaignConsumption.vue index f637c7e0a..141a02bfc 100644 --- a/src/pages/Customer/Notifications/CustomerNotificationsCampaignConsumption.vue +++ b/src/pages/Customer/Notifications/CustomerNotificationsCampaignConsumption.vue @@ -98,7 +98,9 @@ onMounted(async () => { - {{ t('Campaign consumption') }} + {{ + t('Campaign consumption', { rows: $props.clients.length }) + }} { valentinesDay: Valentine's Day mothersDay: Mother's Day allSaints: All Saints' Day + Campaign consumption: Campaign consumption ({rows}) es: params: valentinesDay: Día de San Valentín mothersDay: Día de la Madre allSaints: Día de Todos los Santos - Campaign consumption: Consumo campaña + Campaign consumption: Consumo campaña ({rows}) Campaign: Campaña From: Desde To: Hasta diff --git a/test/cypress/integration/item/ItemFixedPrice.spec.js b/test/cypress/integration/item/ItemFixedPrice.spec.js index 41230f570..2b92c861e 100644 --- a/test/cypress/integration/item/ItemFixedPrice.spec.js +++ b/test/cypress/integration/item/ItemFixedPrice.spec.js @@ -54,7 +54,7 @@ describe('Handle Items FixedPrice', () => { }); it('should edit all items', () => { - cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); + cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click(); cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled'); cy.dataCy('FixedPriceToolbarEditBtn').click(); cy.dataCy('EditFixedPriceSelectOption').type(grouping); @@ -65,7 +65,7 @@ describe('Handle Items FixedPrice', () => { }); it('should remove all items', () => { - cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click(); + cy.get('.bg-header > :nth-child(1) [data-cy="vnCheckbox"]').click(); cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled'); cy.dataCy('crudModelDefaultRemoveBtn').click(); cy.dataCy('VnConfirm_confirm').click();