Merge pull request '#8246: Added new field in list' (!1176) from 8246-ZoneAddressFk into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1176 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
1bc0a6dcdf
|
@ -17,6 +17,7 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
||||||
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -25,6 +26,7 @@ const { viewSummary } = useSummaryDialog();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const warehouseOptions = ref([]);
|
const warehouseOptions = ref([]);
|
||||||
|
const validAddresses = ref([]);
|
||||||
|
|
||||||
const tableFilter = {
|
const tableFilter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -34,6 +36,32 @@ const tableFilter = {
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
relation: 'address',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'postcode',
|
||||||
|
scope: {
|
||||||
|
fields: ['code', 'townFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'town',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,7 +123,14 @@ const columns = computed(() => [
|
||||||
label: t('list.close'),
|
label: t('list.close'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toTimeFormat(row.hour),
|
format: (row) => toTimeFormat(row.hour),
|
||||||
hidden: true,
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'addressFk',
|
||||||
|
label: t('list.addressFk'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -129,9 +164,27 @@ const handleClone = (id) => {
|
||||||
() => clone(id)
|
() => clone(id)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function showValidAddresses(row) {
|
||||||
|
if (row.addressFk) {
|
||||||
|
const isValid = validAddresses.value.some(
|
||||||
|
(address) => address.addressFk === row.addressFk
|
||||||
|
);
|
||||||
|
if (isValid)
|
||||||
|
return `${row.address?.nickname},
|
||||||
|
${row.address?.postcode?.town?.name} (${row.address?.province?.name})`;
|
||||||
|
else return '-';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="RoadmapAddresses"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (validAddresses = data)"
|
||||||
|
/>
|
||||||
<ZoneSearchbar />
|
<ZoneSearchbar />
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -153,6 +206,9 @@ const handleClone = (id) => {
|
||||||
redirect="zone"
|
redirect="zone"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
>
|
>
|
||||||
|
<template #column-addressFk="{ row }">
|
||||||
|
{{ showValidAddresses(row) }}
|
||||||
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
|
|
@ -32,6 +32,7 @@ list:
|
||||||
warehouse: Warehouse
|
warehouse: Warehouse
|
||||||
createZone: Create zone
|
createZone: Create zone
|
||||||
zoneSummary: Summary
|
zoneSummary: Summary
|
||||||
|
addressFk: Address
|
||||||
create:
|
create:
|
||||||
name: Name
|
name: Name
|
||||||
closingHour: Closing hour
|
closingHour: Closing hour
|
||||||
|
|
|
@ -33,6 +33,7 @@ list:
|
||||||
isVolumetric: Volumétrico
|
isVolumetric: Volumétrico
|
||||||
createZone: Crear zona
|
createZone: Crear zona
|
||||||
zoneSummary: Resumen
|
zoneSummary: Resumen
|
||||||
|
addressFk: Consignatario
|
||||||
create:
|
create:
|
||||||
closingHour: Hora de cierre
|
closingHour: Hora de cierre
|
||||||
itemMaxSize: Medida máxima
|
itemMaxSize: Medida máxima
|
||||||
|
|
Loading…
Reference in New Issue