From 479f2a8e53ffe91a5c7842758e37912acb9505fc Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 17 Sep 2024 08:31:02 +0200 Subject: [PATCH 01/78] feat: refs #7884 added new filter field --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Entry/MyEntries.vue | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index f99244d42..27c904aaf 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -50,6 +50,7 @@ globals: summary: basicData: Basic data daysOnward: Days onward + daysAgo: Days ago today: Today yesterday: Yesterday dateFormat: en-GB diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 360627fda..e0614caaf 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -49,6 +49,7 @@ globals: summary: basicData: Datos básicos daysOnward: Días adelante + daysAgo: Días atras today: Hoy yesterday: Ayer dateFormat: es-ES diff --git a/src/pages/Entry/MyEntries.vue b/src/pages/Entry/MyEntries.vue index 1c56427f4..17b1f91c5 100644 --- a/src/pages/Entry/MyEntries.vue +++ b/src/pages/Entry/MyEntries.vue @@ -78,7 +78,13 @@ const columns = computed(() => [ { align: 'left', label: t('globals.daysOnward'), - name: 'days', + name: 'daysOnward', + visible: false, + }, + { + align: 'left', + label: t('globals.daysAgo'), + name: 'daysAgo', visible: false, }, { From 566d657f70d45934a4aa8b3368379d2c985ac6de Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 18 Sep 2024 08:23:15 +0200 Subject: [PATCH 02/78] feat: refs #7884 added default params and chip translations --- src/components/ui/VnFilterPanel.vue | 7 ++++++- src/pages/Entry/MyEntries.vue | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 637180c22..4f71fdea9 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -252,7 +252,7 @@ function sanitizer(params) { >
- {{ chip.label }}: + {{ t(`${chip.label}`) }}: "{{ formatValue(chip.value) }}"
@@ -286,6 +286,9 @@ function sanitizer(params) { +en: + daysOnward: Days onward + daysAgo: Days ago es: No filters applied: No se han aplicado filtros Applied filters: Filtros aplicados @@ -294,4 +297,6 @@ es: Search: Buscar Yes: Si No: No + daysOnward: Días Adelante + daysAgo: Días Atrás diff --git a/src/pages/Entry/MyEntries.vue b/src/pages/Entry/MyEntries.vue index 17b1f91c5..b95c73847 100644 --- a/src/pages/Entry/MyEntries.vue +++ b/src/pages/Entry/MyEntries.vue @@ -9,6 +9,11 @@ import VnTable from 'components/VnTable/VnTable.vue'; const { t } = useI18n(); const quasar = useQuasar(); +const params = { + daysOnward: 7, + daysAgo: 3, +}; + const columns = computed(() => [ { align: 'left', @@ -120,6 +125,7 @@ const printBuys = (rowId) => { data-key="myEntriesList" url="Entries/filter" :columns="columns" + :user-params="params" default-mode="card" order="shipped DESC" auto-load From 271e33a999d54cf06788aa41dce6164658aaf6ab Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 20 Sep 2024 11:57:15 +0200 Subject: [PATCH 03/78] feat: formatLocation when field is null --- src/components/common/VnLocation.vue | 40 +++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index b6cbfbafd..c3b07c72c 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -12,14 +12,46 @@ const props = defineProps({ default: null, }, }); +const formatLocation = (obj, properties) => { + // Crear un array con las propiedades del objeto + const parts = properties.map((prop) => { + if (typeof prop === 'string') { + return obj[prop]; + } else if (typeof prop === 'function') { + return prop(obj); + } + return null; + }); + + // Filtrar los valores que no son null o undefined + const filteredParts = parts.filter( + (part) => part !== null && part !== undefined && part !== '' + ); + + // Unir los valores filtrados con el formato deseado + return filteredParts.join(', '); +}; + +const locationProperties = [ + 'postcode', + (obj) => + obj.city + ? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}` + : null, + (obj) => obj.country?.name, +]; const modelValue = ref( - props.location - ? `${props.location?.postcode} - ${props.location?.city}(${props.location?.province?.name}), ${props.location?.country?.name}` - : null + props.location ? formatLocation(props.location, locationProperties) : null ); function showLabel(data) { - return `${data.code} - ${data.town}(${data.province}), ${data.country}`; + const dataProperties = [ + 'code', + (obj) => (obj.town ? `${obj.town}(${obj.province})` : null), + 'country', + ]; + return formatLocation(data, dataProperties); } + const handleModelValue = (data) => { emit('update:model-value', data); }; From b822c7722bb3176120c87aa74abbb7c2c33ec88d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 20 Sep 2024 13:45:43 +0200 Subject: [PATCH 04/78] feat: formatLocation when field is null --- src/components/common/VnLocation.vue | 68 +++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index 8256ec5b0..c1b921915 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -2,21 +2,68 @@ import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import VnSelectDialog from 'components/common/VnSelectDialog.vue'; import { useI18n } from 'vue-i18n'; - +import { ref } from 'vue'; const { t } = useI18n(); -const value = defineModel({ type: [String, Number, Object] }); +const emit = defineEmits(['update:model-value', 'update:options']); + +const props = defineProps({ + location: { + type: Object, + default: null, + }, +}); +const formatLocation = (obj, properties) => { + const parts = properties.map((prop) => { + if (typeof prop === 'string') { + return obj[prop]; + } else if (typeof prop === 'function') { + return prop(obj); + } + return null; + }); + + const filteredParts = parts.filter( + (part) => part !== null && part !== undefined && part !== '' + ); + + return filteredParts.join(', '); +}; + +const locationProperties = [ + 'postcode', + (obj) => + obj.city + ? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}` + : null, + (obj) => obj.country?.name, +]; + +const modelValue = ref( + props.location ? formatLocation(props.location, locationProperties) : null +); + +const handleModelValue = (data) => { + emit('update:model-value', data); +}; function showLabel(data) { - return `${data.code} - ${data.town}(${data.province}), ${data.country}`; + const dataProperties = [ + 'code', + (obj) => (obj.town ? `${obj.town}(${obj.province})` : null), + 'country', + ]; + return formatLocation(data, dataProperties); } -