perf: orderList
gitea/salix-front/pipeline/pr-test There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2025-02-17 23:27:22 +01:00
parent df794391ec
commit e6e21b61bd
1 changed files with 27 additions and 5 deletions

View File

@ -152,11 +152,23 @@ onMounted(() => {
});
async function fetchClientAddress(id, formData = {}) {
const { data } = await axios.get(
`Clients/${id}/addresses?filter[order]=isActive DESC`
);
const { data } = await axios.get(`Clients/${id}/addresses`, {
params: {
filter: JSON.stringify({
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
},
},
],
order: ['isActive DESC'],
}),
},
});
addressOptions.value = data;
formData.addressId = data.defaultAddressFk;
formData.addressId = data[0].client.defaultAddressFk;
fetchAgencies(formData);
}
@ -164,7 +176,13 @@ async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
const { data } = await axios.get('Agencies/landsThatDay', {
params: { addressFk: addressId, landed },
params: {
filter: JSON.stringify({
order: ['agencyMode DESC', 'agencyModeFk ASC'],
}),
addressFk: addressId,
landed,
},
});
agencyList.value = data;
}
@ -255,6 +273,7 @@ const getDateColor = (date) => {
</template>
</VnSelect>
<VnSelect
:disable="!data.clientFk"
v-model="data.addressId"
:options="addressOptions"
:label="t('module.address')"
@ -281,6 +300,9 @@ const getDateColor = (date) => {
{{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel>
<QItemLabel caption>
{{ `#${scope.opt?.id}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>