Merge branch 'test' into warmFix_8688-fixAgencyFilters
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
gitea/salix-front/pipeline/pr-test This commit is unstable
Details
This commit is contained in:
commit
742a1da581
|
@ -16,7 +16,6 @@ const filter = {
|
||||||
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
|
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
|
||||||
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
@ -65,7 +64,8 @@ const columns = computed(() => [
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="Mandates"
|
data-key="Mandates"
|
||||||
url="Mandates"
|
url="Mandates"
|
||||||
:filter="filter"
|
:user-filter="filter"
|
||||||
|
:filter="{ where: { clientFk: route.params.id } }"
|
||||||
auto-load
|
auto-load
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
|
|
|
@ -146,9 +146,8 @@ async function deleteEntry() {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
ref="entryDescriptorRef"
|
|
||||||
:url="`Entries/${entityId}`"
|
:url="`Entries/${entityId}`"
|
||||||
:userFilter="entryFilter"
|
:filter="entryFilter"
|
||||||
title="supplier.nickname"
|
title="supplier.nickname"
|
||||||
data-key="Entry"
|
data-key="Entry"
|
||||||
width="lg-width"
|
width="lg-width"
|
||||||
|
|
|
@ -283,7 +283,11 @@ onBeforeMount(async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSection :data-key="dataKey" prefix="entry">
|
<VnSection
|
||||||
|
:data-key="dataKey"
|
||||||
|
prefix="entry"
|
||||||
|
:array-data-props="{ url: 'Entries/filter' }"
|
||||||
|
>
|
||||||
<template #advanced-menu>
|
<template #advanced-menu>
|
||||||
<EntryFilter :data-key="dataKey" />
|
<EntryFilter :data-key="dataKey" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -156,9 +156,7 @@ const columns = computed(() => [
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (!route.query) return;
|
if (!route.query) return;
|
||||||
if (route.query?.createForm) {
|
if (route.query?.createForm) {
|
||||||
const query = JSON.parse(route.query?.createForm);
|
await onClientSelected(JSON.parse(route.query?.createForm));
|
||||||
formInitialData.value = query;
|
|
||||||
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
|
|
||||||
} else if (route.query?.table) {
|
} else if (route.query?.table) {
|
||||||
const query = JSON.parse(route.query?.table);
|
const query = JSON.parse(route.query?.table);
|
||||||
const clientFk = query?.clientFk;
|
const clientFk = query?.clientFk;
|
||||||
|
@ -177,7 +175,6 @@ watch(
|
||||||
tableRef.value.create.formInitialData = formInitialData.value;
|
tableRef.value.create.formInitialData = formInitialData.value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
async function onClientSelected({ clientFk }, formData = {}) {
|
async function onClientSelected({ clientFk }, formData = {}) {
|
||||||
|
@ -191,13 +188,17 @@ async function onClientSelected({ clientFk }, formData = {}) {
|
||||||
addressOptions.value = data;
|
addressOptions.value = data;
|
||||||
formData.defaultAddressFk = data[0].client.defaultAddressFk;
|
formData.defaultAddressFk = data[0].client.defaultAddressFk;
|
||||||
formData.addressId = formData.defaultAddressFk;
|
formData.addressId = formData.defaultAddressFk;
|
||||||
|
formInitialData.value = { ...formData, clientFk };
|
||||||
formInitialData.value = { addressId: formData.addressId, clientFk };
|
|
||||||
await fetchAgencies(formData);
|
await fetchAgencies(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAgencies({ landed, addressId }) {
|
async function fetchAgencies(formData) {
|
||||||
if (!landed || !addressId) return (agencyList.value = []);
|
const { landed, addressId } = formData;
|
||||||
|
if (!landed || !addressId) {
|
||||||
|
formData.defaultAddressFk = formInitialData.value.defaultAddressFk;
|
||||||
|
|
||||||
|
return (agencyList.value = []);
|
||||||
|
}
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: {
|
params: {
|
||||||
|
@ -220,6 +221,11 @@ const getDateColor = (date) => {
|
||||||
if (difference == 0) return 'bg-warning';
|
if (difference == 0) return 'bg-warning';
|
||||||
if (difference < 0) return 'bg-success';
|
if (difference < 0) return 'bg-success';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isDefaultAddress = (opt, data) => {
|
||||||
|
const addressId = data.defaultAddressFk ?? data.addressId;
|
||||||
|
return addressId === opt.id && opt.isActive;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -310,10 +316,7 @@ const getDateColor = (date) => {
|
||||||
>
|
>
|
||||||
<QItemSection style="min-width: min-content" avatar>
|
<QItemSection style="min-width: min-content" avatar>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="
|
v-if="isDefaultAddress(scope.opt, data)"
|
||||||
scope.opt.isActive &&
|
|
||||||
data.defaultAddressFk === scope.opt.id
|
|
||||||
"
|
|
||||||
size="sm"
|
size="sm"
|
||||||
color="grey"
|
color="grey"
|
||||||
name="star"
|
name="star"
|
||||||
|
|
|
@ -54,8 +54,7 @@ onBeforeMount(() => {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (!route.query) return;
|
if (!route.query) return;
|
||||||
if (route.query?.createForm) {
|
if (route.query?.createForm) {
|
||||||
formInitialData.value = JSON.parse(route.query?.createForm);
|
await onClientSelected(JSON.parse(route.query?.createForm));
|
||||||
await onClientSelected(formInitialData.value);
|
|
||||||
} else if (route.query?.table) {
|
} else if (route.query?.table) {
|
||||||
const query = route.query?.table;
|
const query = route.query?.table;
|
||||||
const clientId = +JSON.parse(query)?.clientFk;
|
const clientId = +JSON.parse(query)?.clientFk;
|
||||||
|
@ -273,12 +272,18 @@ const fetchAddresses = async (formData) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { data } = await getAddresses(formData.clientId);
|
const { data } = await getAddresses(formData.clientId);
|
||||||
formInitialData.value = { clientId: formData.clientId };
|
|
||||||
if (!data) return;
|
if (!data) {
|
||||||
|
formInitialData.value = { clientId: formData.clientId };
|
||||||
|
return;
|
||||||
|
}
|
||||||
addressesOptions.value = data;
|
addressesOptions.value = data;
|
||||||
selectedClient.value = data[0].client;
|
selectedClient.value = data[0].client;
|
||||||
formData.addressId = selectedClient.value.defaultAddressFk;
|
formData.addressId = selectedClient.value.defaultAddressFk;
|
||||||
formInitialData.value.addressId = formData.addressId;
|
formInitialData.value = {
|
||||||
|
clientId: formData.clientId,
|
||||||
|
addressId: formData.addressId,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
watch(
|
watch(
|
||||||
() => route.query.table,
|
() => route.query.table,
|
||||||
|
|
Loading…
Reference in New Issue