Merge branch 'master' into hotfix_checbox_css
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2024-11-26 22:14:22 +00:00
commit aab98e3c45
5 changed files with 66 additions and 26 deletions

View File

@ -60,7 +60,7 @@ globals:
reference: Reference reference: Reference
agency: Agency agency: Agency
warehouseOut: Warehouse Out warehouseOut: Warehouse Out
wareHouseIn: Warehouse In warehouseIn: Warehouse In
landed: Landed landed: Landed
shipped: Shipped shipped: Shipped
totalEntries: Total entries totalEntries: Total entries

View File

@ -149,7 +149,12 @@ onMounted(() => {
}); });
async function fetchClientAddress(id, formData = {}) { async function fetchClientAddress(id, formData = {}) {
const { data } = await axios.get(`Clients/${id}`, { const { data } = await axios.get(`Clients/${id}`, {
params: { filter: { include: { relation: 'addresses' } } }, params: {
filter: {
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
include: { relation: 'addresses' },
},
},
}); });
addressesList.value = data.addresses; addressesList.value = data.addresses;
formData.addressId = data.defaultAddressFk; formData.addressId = data.defaultAddressFk;
@ -191,7 +196,7 @@ const getDateColor = (date) => {
urlCreate: 'Orders/new', urlCreate: 'Orders/new',
title: t('module.cerateOrder'), title: t('module.cerateOrder'),
onDataSaved: (url) => { onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`); tableRef.redirect(`${url}/catalog`);
}, },
formInitialData: { formInitialData: {
active: true, active: true,
@ -253,22 +258,27 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)" @update:model-value="() => fetchAgencies(data)"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive && data.addressId === scope.opt.id
"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection> <QItemSection>
<QItemLabel <QItemLabel>
:class="{ {{ scope.opt.nickname }}
'color-vn-label': !scope.opt?.isActive, </QItemLabel>
}" <QItemLabel caption>
> {{ `${scope.opt.street}, ${scope.opt.city}` }}
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel> </QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -273,7 +273,7 @@ const fetchAddresses = async (formData) => {
const filter = { const filter = {
fields: ['nickname', 'street', 'city', 'id', 'isActive'], fields: ['nickname', 'street', 'city', 'id', 'isActive'],
order: 'nickname ASC', order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, { const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
@ -646,7 +646,22 @@ function setReference(data) {
@update:model-value="() => fetchAvailableAgencies(data)" @update:model-value="() => fetchAvailableAgencies(data)"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
selectedClient?.defaultAddressFk === scope.opt.id
"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection> <QItemSection>
<QItemLabel <QItemLabel
:class="{ :class="{

View File

@ -14,6 +14,8 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const warehousesOptionsOut = ref([]);
const warehousesOptionsIn = ref([]);
</script> </script>
<template> <template>
<FetchData <FetchData
@ -21,6 +23,18 @@ const agenciesOptions = ref([]);
@on-fetch="(data) => (agenciesOptions = data)" @on-fetch="(data) => (agenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptionsOut = data)"
auto-load
:filter="{ where: { isOrigin: TRUE } }"
/>
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptionsIn = data)"
auto-load
:filter="{ where: { isDestiny: TRUE } }"
/>
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel" auto-load> <FormModel :url-update="`Travels/${route.params.id}`" model="Travel" auto-load>
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
@ -39,11 +53,12 @@ const agenciesOptions = ref([]);
<VnInputDate v-model="data.shipped" :label="t('globals.shipped')" /> <VnInputDate v-model="data.shipped" :label="t('globals.shipped')" />
<VnInputDate v-model="data.landed" :label="t('globals.landed')" /> <VnInputDate v-model="data.landed" :label="t('globals.landed')" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('globals.warehouseOut')" :label="t('globals.warehouseOut')"
v-model="data.warehouseOutFk" v-model="data.warehouseOutFk"
:options="agenciesOptions" :options="warehousesOptionsOut"
option-value="id" option-value="id"
option-label="name" option-label="name"
map-options map-options
@ -52,7 +67,7 @@ const agenciesOptions = ref([]);
<VnSelect <VnSelect
:label="t('globals.warehouseIn')" :label="t('globals.warehouseIn')"
v-model="data.warehouseInFk" v-model="data.warehouseInFk"
:options="agenciesOptions" :options="warehousesOptionsIn"
option-value="id" option-value="id"
option-label="name" option-label="name"
map-options map-options
@ -89,7 +104,7 @@ const agenciesOptions = ref([]);
<i18n> <i18n>
es: es:
raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados (incluido 0). Si se deja vacio, la fecha no cambiará raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados.
en: en:
raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days (including 0). If left empty, the date will stay the same. raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days.
</i18n> </i18n>

View File

@ -44,8 +44,8 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
<TravelDescriptorMenuItems :travel="entity" /> <TravelDescriptorMenuItems :travel="entity" />
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('globals.warehouseIn')" :value="entity.warehouseIn.name" /> <VnLv :label="t('globals.warehouseIn')" :value="entity.warehouseIn?.name" />
<VnLv :label="t('globals.warehouseOut')" :value="entity.warehouseOut.name" /> <VnLv :label="t('globals.warehouseOut')" :value="entity.warehouseOut?.name" />
<VnLv :label="t('globals.shipped')" :value="toDate(entity.shipped)" /> <VnLv :label="t('globals.shipped')" :value="toDate(entity.shipped)" />
<VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" /> <VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" />
<VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" /> <VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" />