Merge pull request 'fix: refs #7353 sales person filter and locale' (!724) from 7353-hotfix-fixFilter into master
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #724
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-09-18 07:19:45 +00:00
commit aa33e42701
1 changed files with 10 additions and 3 deletions

View File

@ -11,7 +11,7 @@ import FetchData from 'src/components/FetchData.vue';
import { dateRange } from 'src/filters'; import { dateRange } from 'src/filters';
defineProps({ dataKey: { type: String, required: true } }); defineProps({ dataKey: { type: String, required: true } });
const { t } = useI18n(); const { t, te } = useI18n();
const warehouses = ref(); const warehouses = ref();
const groupedStates = ref(); const groupedStates = ref();
@ -26,6 +26,12 @@ const handleScopeDays = (params, days, callback) => {
} }
if (callback) callback(); if (callback) callback();
}; };
const getLocale = (label) => {
const param = label.split('.').at(-1);
const globalLocale = `globals.params.${param}`;
return te(globalLocale) ? t(globalLocale) : t(`params.${param}`);
};
</script> </script>
<template> <template>
<FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" /> <FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" />
@ -43,10 +49,11 @@ const handleScopeDays = (params, days, callback) => {
:hidden-tags="['from', 'to', 'search']" :hidden-tags="['from', 'to', 'search']"
:custom-tags="['scopeDays']" :custom-tags="['scopeDays']"
:unremovable-params="['from', 'to', 'scopeDays']" :unremovable-params="['from', 'to', 'scopeDays']"
search-url="saleMonitorTickets"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong v-text="`${t(`params.${tag.label}`)}:`" /> <strong v-text="`${getLocale(tag.label)}:`" />
<span v-text="formatFn(tag.value)" /> <span v-text="formatFn(tag.value)" />
</div> </div>
</template> </template>
@ -110,7 +117,7 @@ const handleScopeDays = (params, days, callback) => {
url="Workers/search" url="Workers/search"
:params="{ departmentCodes: ['VT'] }" :params="{ departmentCodes: ['VT'] }"
is-outlined is-outlined
option-value="code" option-value="id"
option-label="name" option-label="name"
:no-one="true" :no-one="true"
> >