diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 8e458df97..616dec38d 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -1,7 +1,7 @@ globals: lang: es: Spanish - en: English + en: English language: Language quantity: Quantity entity: Entity @@ -721,6 +721,7 @@ travel: destination: Destination thermograph: Thermograph travelFileDescription: 'Travel id { travelId }' + carrier: Carrier components: topbar: {} itemsFilterPanel: diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index f59821f28..e44cf2b9b 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -691,6 +691,7 @@ travel: destination: Destino thermograph: Termógrafo travelFileDescription: 'Id envío { travelId }' + carrier: Transportista components: topbar: {} itemsFilterPanel: diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index 689711a74..cf009a6ca 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -136,6 +136,12 @@ const thermographsTableColumns = computed(() => { name: 'temperatureFk', align: 'left', }, + { + label: t('travel.thermographs.carrier'), + field: (row) => row.agencyMode?.name, + name: 'agencyModeFk', + align: 'left', + }, { label: t('globals.maxTemperature'), field: 'maxTemperature', @@ -214,17 +220,25 @@ const getTravelEntries = async (id) => { const getTravelThermographs = async (id) => { const filter = { - include: { - relation: 'warehouse', - scope: { - fields: ['id', 'name'], + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['id', 'name'], + }, }, - }, + { + relation: 'warehouse', + scope: { + fields: ['id', 'name'], + }, + }, + ], where: { travelFk: id }, }; const { data } = await axios.get('TravelThermographs', { - params: { filter: JSON.parse(JSON.stringify(filter)) }, + params: { filter }, }); thermographs.value = data; }; diff --git a/src/pages/Travel/Card/TravelThermographs.vue b/src/pages/Travel/Card/TravelThermographs.vue index 85781a6a4..0e11588f1 100644 --- a/src/pages/Travel/Card/TravelThermographs.vue +++ b/src/pages/Travel/Card/TravelThermographs.vue @@ -12,6 +12,7 @@ import axios from 'axios'; import useNotify from 'src/composables/useNotify.js'; import { toDate, toCelsius } from 'src/filters'; import { downloadFile } from 'src/composables/downloadFile'; +import { useArrayData } from 'src/composables/useArrayData'; const route = useRoute(); const quasar = useQuasar(); @@ -19,16 +20,25 @@ const router = useRouter(); const { t } = useI18n(); const { notify } = useNotify(); +const travel = computed(() => useArrayData('Travel').store.data); const thermographPaginateRef = ref(); const warehouses = ref([]); const thermographFilter = { - include: { - relation: 'warehouse', - scope: { - fields: ['id', 'name'], + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['id', 'name'], + }, }, - }, + { + relation: 'warehouse', + scope: { + fields: ['id', 'name'], + }, + }, + ], where: { travelFk: route.params.id }, order: ['created'], }; @@ -47,6 +57,12 @@ const TableColumns = computed(() => { name: 'temperatureFk', align: 'left', }, + { + label: t('travel.thermographs.carrier'), + field: (row) => row.agencyMode?.name, + name: 'agencyModeFk', + align: 'left', + }, { label: t('globals.maxTemperature'), field: 'maxTemperature', @@ -117,6 +133,8 @@ const redirectToThermographForm = (action, id) => { if (action === 'edit' && id) { routeDetails.query = { travelThermographFk: id }; + } else if (action === 'create') { + routeDetails.query = { agencyModeFk: travel.value?.agencyModeFk }; } router.push(routeDetails); }; diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue index 9788c9a99..5955ac9f9 100644 --- a/src/pages/Travel/Card/TravelThermographsForm.vue +++ b/src/pages/Travel/Card/TravelThermographsForm.vue @@ -39,6 +39,7 @@ const warehousesOptions = ref([]); const temperaturesOptions = ref([]); const thermographForm = ref({}); const inputFileRef = ref(null); +const agencyModeOptions = ref([]); onBeforeMount(async () => { if (props.viewAction === 'create') { @@ -49,8 +50,8 @@ onBeforeMount(async () => { if (route.query.thermographData) { const thermographData = JSON.parse(route.query.thermographData); - for (let key in thermographForm) { - thermographForm[key] = thermographData[key]; + for (let key in thermographForm.value) { + thermographForm.value[key] = thermographData[key]; } } }); @@ -72,6 +73,7 @@ const setCreateDefaultParams = async () => { thermographForm.value.reference = route.params.id; thermographForm.value.dmsTypeId = dataResponse.id; thermographForm.value.state = 'Ok'; + thermographForm.value.agencyModeFk = +route.query.agencyModeFk; thermographForm.value.description = t('travel.thermographs.travelFileDescription', { travelId: route.params.id, }).toUpperCase(); @@ -98,6 +100,7 @@ const setEditDefaultParams = async () => { thermographForm.value.minTemperature = data.minTemperature; thermographForm.value.temperatureFk = data.temperatureFk; thermographForm.value.travelThermographFk = data.id; + thermographForm.value.agencyModeFk = data.agencyModeFk; } }; @@ -159,6 +162,12 @@ const onThermographCreated = async (data) => { auto-load url="Temperatures" /> + + { /> + + + + { option-value="id" option-label="name" /> - - { option-value="id" option-label="code" /> + + { option-value="id" option-label="name" /> - - { v-model="thermographForm.temperatureFk" :required="true" /> + +