From b13bcea3319f260f5f9eed75fc490f3a620c64d5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 22 Apr 2025 17:43:29 +0200 Subject: [PATCH 01/23] feat: add VnMultiCheck component for multi-selection functionality --- src/components/VnTable/VnTable.vue | 30 ++++++++++++++- src/components/common/VnMultiCheck.vue | 51 ++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/components/common/VnMultiCheck.vue diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 7e9ab85cb..6af2ccf7e 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({ @@ -157,6 +158,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); @@ -638,6 +640,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); +}; + +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/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 From bcdb89d1a76e8f4fd6ec9819ed18385ec685f2ce Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Apr 2025 11:21:14 +0200 Subject: [PATCH 03/23] fix: refactor createTicket function to use formData directly and remove unused reactive state --- src/pages/Ticket/Card/ExpeditionNewTicket.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pages/Ticket/Card/ExpeditionNewTicket.vue b/src/pages/Ticket/Card/ExpeditionNewTicket.vue index 6ecadfe6d..aec8049af 100644 --- a/src/pages/Ticket/Card/ExpeditionNewTicket.vue +++ b/src/pages/Ticket/Card/ExpeditionNewTicket.vue @@ -1,5 +1,4 @@ diff --git a/src/components/common/VnMultiCheck.vue b/src/components/common/VnMultiCheck.vue index 1d4898503..19b93ffa9 100644 --- a/src/components/common/VnMultiCheck.vue +++ b/src/components/common/VnMultiCheck.vue @@ -4,47 +4,60 @@ import VnCheckbox from './VnCheckbox.vue'; import axios from 'axios'; import { toRaw } from 'vue'; import { useI18n } from 'vue-i18n'; - +import { useRoute } from 'vue-router'; +const route = useRoute(); const { t } = useI18n(); const model = defineModel({ type: [Boolean] }); const props = defineProps({ + expand: { + type: Boolean, + default: false, + }, url: { type: String, default: null, required: true, }, + searchUrl: { + type: [String, Boolean], + default: 'table', + }, }); const value = ref(false); const rows = ref(0); -defineEmits(['update:selected', 'select:all']); -const onClick = async () => { +const onClick = () => { if (value.value) { + const { filter } = JSON.parse(route.query[props.searchUrl]); + filter.limit = 0; + const params = { + params: { filter: JSON.stringify(filter) }, + }; axios - .get(props.url, { - params: { - filter: null, - }, + .get(props.url, params) + .then(({ data }) => { + rows.value = data; }) - .then((response) => { - rows.value = response.data; - console.log(response.data); - }) - .catch((error) => { - console.error(error); - }); + .catch(console.error); } }; +defineEmits(['update:selected', 'select:all']);