0
0
Fork 0

feat: add Options style in AddressList from OrderCreate

This commit is contained in:
Javier Segarra 2024-11-26 12:17:33 +01:00
parent c3510aea60
commit 63536ea0f5
1 changed files with 27 additions and 6 deletions

View File

@ -149,7 +149,12 @@ onMounted(() => {
});
async function fetchClientAddress(id, formData = {}) {
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;
formData.addressId = data.defaultAddressFk;
@ -191,7 +196,7 @@ const getDateColor = (date) => {
urlCreate: 'Orders/new',
title: t('module.cerateOrder'),
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
@ -240,12 +245,28 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)"
>
<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>
<QItemLabel>
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}</QItemLabel
>
{{ scope.opt.nickname }}
</QItemLabel>
<QItemLabel caption>
{{ `${scope.opt.street}, ${scope.opt.city}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>