Merge pull request 'fix: refs #8227 warnfix' (!1385) from 8227-warmfixRoute into test
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1385
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Alex Moreno 2025-02-14 09:45:37 +00:00
commit bf08509b52
2 changed files with 36 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
@ -7,7 +7,7 @@ import VnLv from 'components/ui/VnLv.vue';
import useCardDescription from 'composables/useCardDescription';
import { dashIfEmpty, toDate } from 'src/filters';
import RouteDescriptorMenu from 'pages/Route/Card/RouteDescriptorMenu.vue';
import axios from 'axios';
const $props = defineProps({
id: {
type: Number,
@ -18,10 +18,24 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
const zone = ref();
const zoneId = ref();
const entityId = computed(() => {
return $props.id || route.params.id;
});
const getZone = async () => {
const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id },
};
const { data } = await axios.get('Tickets/findOne', {
params: {
filter: JSON.stringify(filter),
},
});
zoneId.value = data.zoneFk;
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
zone.value = zoneData.name;
};
const filter = {
fields: [
@ -38,7 +52,6 @@ const filter = {
'started',
'finished',
'cost',
'zoneFk',
'isOk',
],
include: [
@ -47,7 +60,13 @@ const filter = {
relation: 'vehicle',
scope: { fields: ['id', 'm3'] },
},
{ relation: 'zone', scope: { fields: ['id', 'name'] } },
{
relation: 'ticket',
scope: {
fields: ['id', 'name', 'zoneFk'],
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
},
},
{
relation: 'worker',
scope: {
@ -65,6 +84,9 @@ const filter = {
};
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
onMounted(async () => {
getZone();
});
</script>
<template>
@ -81,11 +103,11 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
<template #body="{ entity }">
<VnLv :label="t('Date')" :value="toDate(entity?.dated)" />
<VnLv :label="t('Agency')" :value="entity?.agencyMode?.name" />
<VnLv :label="t('Zone')" :value="entity?.zone?.name" />
<VnLv :label="t('Zone')" :value="zone" />
<VnLv
:label="t('Volume')"
:value="`${dashIfEmpty(entity?.m3)} / ${dashIfEmpty(
entity?.vehicle?.m3
entity?.vehicle?.m3,
)} `"
/>
<VnLv :label="t('Description')" :value="entity?.description" />

View File

@ -43,7 +43,6 @@ const routeFilter = {
'started',
'finished',
'cost',
'zoneFk',
'isOk',
],
include: [
@ -52,7 +51,13 @@ const routeFilter = {
relation: 'vehicle',
scope: { fields: ['id', 'm3'] },
},
{ relation: 'zone', scope: { fields: ['id', 'name'] } },
{
relation: 'ticket',
scope: {
fields: ['id', 'name', 'zoneFk'],
include: { relation: 'zone', scope: { fields: ['id', 'name'] } },
},
},
{
relation: 'worker',
scope: {