From 2537e58ff3839f7ab901ca6c31bd0de7a617892e Mon Sep 17 00:00:00 2001
From: jorgep <jorgep@verdnatura.es>
Date: Fri, 20 Sep 2024 09:56:04 +0200
Subject: [PATCH 1/3] fix: refs #7524 dynamic fetch

---
 .../Travel/Card/TravelThermographsForm.vue    | 35 +++++--------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue
index 7f40873b1..c61e8c46f 100644
--- a/src/pages/Travel/Card/TravelThermographsForm.vue
+++ b/src/pages/Travel/Card/TravelThermographsForm.vue
@@ -28,18 +28,8 @@ const route = useRoute();
 const router = useRouter();
 const state = useState();
 const { notify } = useNotify();
-
-const thermographFilter = {
-    fields: ['thermographFk'],
-    where: {
-        travelFk: null,
-    },
-    order: 'thermographFk ASC',
-};
-const fetchTravelThermographsRef = ref(null);
 const allowedContentTypes = ref('');
 const user = state.getUser();
-const thermographsOptions = ref([]);
 const dmsTypesOptions = ref([]);
 const companiesOptions = ref([]);
 const warehousesOptions = ref([]);
@@ -166,26 +156,13 @@ const updateThermograph = async () => {
         console.error('Error creating thermograph');
     }
 };
-
-const onThermographCreated = async (data) => {
-    await fetchTravelThermographsRef.value.fetch();
-    thermographForm.thermographId = data.thermographId;
-};
 </script>
-
 <template>
     <FetchData
         url="DmsContainers/allowedContentTypes"
         @on-fetch="(data) => (allowedContentTypes = data.join(', '))"
         auto-load
     />
-    <FetchData
-        ref="fetchTravelThermographsRef"
-        url="TravelThermographs"
-        @on-fetch="(data) => (thermographsOptions = data)"
-        :filter="thermographFilter"
-        auto-load
-    />
     <FetchData
         url="DmsTypes"
         :filter="{ order: 'name' }"
@@ -239,15 +216,22 @@ const onThermographCreated = async (data) => {
                     <VnSelectDialog
                         :label="t('travel.thermographs.thermograph')"
                         v-model="thermographForm.thermographId"
-                        :options="thermographsOptions"
+                        url="TravelThermographs"
                         option-value="thermographFk"
                         option-label="thermographFk"
+                        :fields="['thermographFk']"
+                        :where="{ travelFk: null }"
+                        sort-by="thermographFk ASC"
                         :disable="viewAction === 'edit'"
                         :tooltip="t('New thermograph')"
                     >
                         <template #form>
                             <CreateThermographForm
-                                @on-data-saved="onThermographCreated($event, data)"
+                                @on-data-saved="
+                                    (data) =>
+                                        (thermographForm.thermographId =
+                                            data.thermographFk)
+                                "
                             />
                         </template>
                     </VnSelectDialog>
@@ -323,7 +307,6 @@ const onThermographCreated = async (data) => {
         </QForm>
     </QPage>
 </template>
-
 <i18n>
 es:
     Select files: Selecciona ficheros

From 3b709c20cf13389c85880a7165d240f9eb45a1e0 Mon Sep 17 00:00:00 2001
From: jorgep <jorgep@verdnatura.es>
Date: Fri, 20 Sep 2024 10:05:28 +0200
Subject: [PATCH 2/3] fix: refs #7524 use id

---
 src/pages/Travel/Card/TravelThermographsForm.vue | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue
index c61e8c46f..d8dc6edc8 100644
--- a/src/pages/Travel/Card/TravelThermographsForm.vue
+++ b/src/pages/Travel/Card/TravelThermographsForm.vue
@@ -228,9 +228,7 @@ const updateThermograph = async () => {
                         <template #form>
                             <CreateThermographForm
                                 @on-data-saved="
-                                    (data) =>
-                                        (thermographForm.thermographId =
-                                            data.thermographFk)
+                                    (data) => (thermographForm.thermographId = data.id)
                                 "
                             />
                         </template>

From b2cc74d890770aa0aa1c204bf36cdee06d828ca5 Mon Sep 17 00:00:00 2001
From: jorgep <jorgep@verdnatura.es>
Date: Fri, 20 Sep 2024 10:27:24 +0200
Subject: [PATCH 3/3] fix: refs #7524 use id

---
 src/pages/Travel/Card/TravelThermographsForm.vue | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue
index d8dc6edc8..4f16b0a49 100644
--- a/src/pages/Travel/Card/TravelThermographsForm.vue
+++ b/src/pages/Travel/Card/TravelThermographsForm.vue
@@ -156,6 +156,10 @@ const updateThermograph = async () => {
         console.error('Error creating thermograph');
     }
 };
+
+const onThermographCreated = async (data) => {
+    thermographForm.thermographId = data.id;
+};
 </script>
 <template>
     <FetchData