From 7ef10bb7a9d09244de7f13e9eae9ac693c96e384 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Wed, 20 Dec 2023 12:23:39 +0100
Subject: [PATCH 1/5] refs #6420 change url

---
 src/pages/Claim/Card/ClaimSummary.vue | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 64d7b721b..88559e016 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -205,17 +205,29 @@ function openDialog(dmsId) {
                 </VnLv>
             </QCard>
             <QCard class="vn-one">
-                <a class="header" :href="claimUrl + 'note/index'">
+                <a class="header" :href="`#/claim/${entityId}/notes`">
                     {{ t('claim.summary.notes') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
                 <!-- Use VnNotes and maybe VirtualScroll-->
             </QCard>
             <QCard class="vn-max" v-if="salesClaimed.length > 0">
-                <a class="header" :href="claimUrl + 'note/index'">
+                <a class="header" :href="`#/claim/${entityId}/notes`">
                     {{ t('claim.summary.details') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
+                <q-virtual-scroll
+                    :scroll-target="scrollTarget"
+                    :items="heavyList"
+                    separator
+                    v-slot="{ item, index }"
+                >
+                    <q-item :key="index" dense>
+                        <q-item-section>
+                            <q-item-label> #{{ index }} - {{ item.label }} </q-item-label>
+                        </q-item-section>
+                    </q-item>
+                </q-virtual-scroll>
                 <QTable :columns="detailsColumns" :rows="salesClaimed" flat>
                     <template #header="props">
                         <QTr :props="props">
-- 
2.40.1


From 6f78e1a173b1688e428c50896793db5b6383b7b9 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Wed, 27 Dec 2023 13:58:30 +0100
Subject: [PATCH 2/5] refs #6420 importClaimNotes

---
 src/pages/Claim/Card/ClaimSummary.vue | 58 ++++++++++++++++-----------
 1 file changed, 34 insertions(+), 24 deletions(-)

diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 88559e016..6bc0a8b66 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -1,5 +1,5 @@
 <script setup>
-import { onMounted, ref, computed } from 'vue';
+import { onMounted, ref, computed, watch } from 'vue';
 import { useRoute } from 'vue-router';
 import { useI18n } from 'vue-i18n';
 import { toDate, toCurrency } from 'src/filters';
@@ -9,6 +9,7 @@ import { getUrl } from 'src/composables/getUrl';
 import { useSession } from 'src/composables/useSession';
 import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
 import VnLv from 'src/components/ui/VnLv.vue';
+import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
 
 const route = useRoute();
 const { t } = useI18n();
@@ -26,12 +27,35 @@ const entityId = computed(() => $props.id || route.params.id);
 
 const claimUrl = ref();
 const salixUrl = ref();
+const claimDmsRef = ref();
+const claimDmsFilter = ref({
+    include: [
+        {
+            relation: 'dms',
+        },
+    ],
+    where: { claimFk: entityId.value },
+});
+const claimObservationsRef = ref();
+const claimObservationsFilter = ref({
+    include: [
+        {
+            relation: 'observation',
+        },
+    ],
+    where: { claimFk: entityId.value },
+});
 
 onMounted(async () => {
     salixUrl.value = await getUrl('');
     claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
 });
 
+watch(entityId, async (id) => {
+    claimDmsFilter.value.where = { claimFk: id };
+    await claimDmsRef.value.fetch();
+});
+
 const detailsColumns = ref([
     {
         name: 'item',
@@ -131,18 +155,9 @@ const developmentColumns = ref([
 const claimDms = ref([]);
 const multimediaDialog = ref();
 const multimediaSlide = ref();
-const claimDmsFilter = ref({
-    include: [
-        {
-            relation: 'dms',
-        },
-    ],
-    where: { claimFk: entityId.value },
-});
 
 function setClaimDms(data) {
-    if (!data) return;
-
+    claimDms.value = [];
     data.forEach((media) => {
         claimDms.value.push({
             isVideo: media.dms.contentType == 'video/mp4',
@@ -152,6 +167,11 @@ function setClaimDms(data) {
     });
 }
 
+const claimObservations = ref([]);
+function setClaimObservations(data) {
+    claimObservations.value = [];
+}
+
 function openDialog(dmsId) {
     multimediaSlide.value = dmsId;
     multimediaDialog.value = true;
@@ -165,6 +185,7 @@ function openDialog(dmsId) {
         @on-fetch="(data) => setClaimDms(data)"
         limit="20"
         auto-load
+        ref="claimDmsRef"
     />
     <CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`">
         <template #header="{ entity: { claim } }">
@@ -209,25 +230,14 @@ function openDialog(dmsId) {
                     {{ t('claim.summary.notes') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
-                <!-- Use VnNotes and maybe VirtualScroll-->
+                <ClaimNotes />
+                <QVirtualScroll :items="observations" separator> </QVirtualScroll>
             </QCard>
             <QCard class="vn-max" v-if="salesClaimed.length > 0">
                 <a class="header" :href="`#/claim/${entityId}/notes`">
                     {{ t('claim.summary.details') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
-                <q-virtual-scroll
-                    :scroll-target="scrollTarget"
-                    :items="heavyList"
-                    separator
-                    v-slot="{ item, index }"
-                >
-                    <q-item :key="index" dense>
-                        <q-item-section>
-                            <q-item-label> #{{ index }} - {{ item.label }} </q-item-label>
-                        </q-item-section>
-                    </q-item>
-                </q-virtual-scroll>
                 <QTable :columns="detailsColumns" :rows="salesClaimed" flat>
                     <template #header="props">
                         <QTr :props="props">
-- 
2.40.1


From 7ae05f23fccee0345990f0a7554a78a60cb128a7 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Thu, 4 Jan 2024 14:38:33 +0100
Subject: [PATCH 3/5] refs #6420 notes

---
 src/components/ui/VnNotes.vue         | 2 +-
 src/components/ui/VnPaginate.vue      | 8 +++++++-
 src/pages/Claim/Card/ClaimNotes.vue   | 6 +++++-
 src/pages/Claim/Card/ClaimSummary.vue | 8 +++++---
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index f02551575..b9a009a32 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -28,7 +28,7 @@ async function insert() {
 }
 </script>
 <template>
-    <div class="column items-center">
+    <div class="column items-center full-height">
         <VnPaginate
             :data-key="$props.url"
             :url="$props.url"
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index c75761462..7470a4d74 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -168,7 +168,13 @@ async function onLoad(...params) {
             </QCard>
         </div>
     </div>
-    <QInfiniteScroll v-if="store.data" @load="onLoad" :offset="offset" class="full-width">
+    <QInfiniteScroll
+        v-if="store.data"
+        @load="onLoad"
+        :offset="offset"
+        class="full-width full-height"
+        style="overflow: auto"
+    >
         <slot name="body" :rows="store.data"></slot>
         <div v-if="isLoading" class="info-row q-pa-md text-center">
             <QSpinner color="orange" size="md" />
diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue
index 84d350e38..35ecb0451 100644
--- a/src/pages/Claim/Card/ClaimNotes.vue
+++ b/src/pages/Claim/Card/ClaimNotes.vue
@@ -8,6 +8,10 @@ const state = useState();
 const user = state.getUser();
 const id = route.params.id;
 
+const $props = defineProps({
+    addNote: { type: Boolean, default: true },
+});
+
 const claimFilter = {
     where: { claimFk: id },
     fields: ['created', 'workerFk', 'text'],
@@ -27,7 +31,7 @@ const body = {
 <template>
     <div class="column items-center">
         <VnNotes
-            :add-note="true"
+            :add-note="$props.addNote"
             :id="id"
             url="claimObservations"
             :filter="claimFilter"
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 6bc0a8b66..9f2fa20d6 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -225,13 +225,15 @@ function openDialog(dmsId) {
                     </template>
                 </VnLv>
             </QCard>
-            <QCard class="vn-one">
+            <QCard class="vn-max">
                 <a class="header" :href="`#/claim/${entityId}/notes`">
                     {{ t('claim.summary.notes') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
-                <ClaimNotes />
-                <QVirtualScroll :items="observations" separator> </QVirtualScroll>
+                <ClaimNotes :add-note="false" style="height: 600px" />
+                <!-- <QVirtualScroll :items="observations" separator
+                    >
+                </QVirtualScroll> -->
             </QCard>
             <QCard class="vn-max" v-if="salesClaimed.length > 0">
                 <a class="header" :href="`#/claim/${entityId}/notes`">
-- 
2.40.1


From 63b1c53ca98e0dc9d1e9c022501f187b18da04bf Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Mon, 8 Jan 2024 14:17:40 +0100
Subject: [PATCH 4/5] refs #6420 scss fix

---
 src/components/ui/VnNotes.vue         |  5 +++++
 src/pages/Claim/Card/ClaimSummary.vue | 28 +++++++++------------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index b9a009a32..84b1b890d 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -115,6 +115,11 @@ async function insert() {
 <style lang="scss" scoped>
 .q-card {
     max-width: 80em;
+
+    &__section {
+        overflow-x: hidden;
+        word-wrap: break-word;
+    }
 }
 .q-dialog .q-card {
     width: 400px;
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index 76a7e8d43..fc7bd03b7 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -36,15 +36,6 @@ const claimDmsFilter = ref({
     ],
     where: { claimFk: entityId.value },
 });
-const claimObservationsRef = ref();
-const claimObservationsFilter = ref({
-    include: [
-        {
-            relation: 'observation',
-        },
-    ],
-    where: { claimFk: entityId.value },
-});
 
 onMounted(async () => {
     salixUrl.value = await getUrl('');
@@ -167,11 +158,6 @@ function setClaimDms(data) {
     });
 }
 
-const claimObservations = ref([]);
-function setClaimObservations(data) {
-    claimObservations.value = [];
-}
-
 function openDialog(dmsId) {
     multimediaSlide.value = dmsId;
     multimediaDialog.value = true;
@@ -225,15 +211,12 @@ function openDialog(dmsId) {
                     </template>
                 </VnLv>
             </QCard>
-            <QCard class="vn-max">
+            <QCard class="vn-max claimVnNotes">
                 <a class="header" :href="`#/claim/${entityId}/notes`">
                     {{ t('claim.summary.notes') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
-                <ClaimNotes :add-note="false" style="height: 600px" />
-                <!-- <QVirtualScroll :items="observations" separator
-                    >
-                </QVirtualScroll> -->
+                <ClaimNotes :add-note="false" style="height: 350px" order="created ASC" />
             </QCard>
             <QCard class="vn-max" v-if="salesClaimed.length > 0">
                 <a class="header" :href="`#/claim/${entityId}/notes`">
@@ -386,6 +369,13 @@ function openDialog(dmsId) {
         </template>
     </CardSummary>
 </template>
+<style lang="scss">
+.claimVnNotes {
+    .q-card {
+        max-width: 100%;
+    }
+}
+</style>
 <style lang="scss" scoped>
 .q-dialog__inner--minimized > div {
     max-width: 80%;
-- 
2.40.1


From b83a773278e5f58aa5534f2633616db631191b19 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Tue, 9 Jan 2024 14:55:52 +0100
Subject: [PATCH 5/5] refs #6420 fix pr

---
 src/components/ui/VnNotes.vue         | 1 -
 src/components/ui/VnPaginate.vue      | 3 +--
 src/pages/Claim/Card/ClaimSummary.vue | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index 84b1b890d..88348e45a 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -117,7 +117,6 @@ async function insert() {
     max-width: 80em;
 
     &__section {
-        overflow-x: hidden;
         word-wrap: break-word;
     }
 }
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index 7470a4d74..3b530dbb1 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -172,8 +172,7 @@ async function onLoad(...params) {
         v-if="store.data"
         @load="onLoad"
         :offset="offset"
-        class="full-width full-height"
-        style="overflow: auto"
+        class="full-width full-height overflow-auto"
     >
         <slot name="body" :rows="store.data"></slot>
         <div v-if="isLoading" class="info-row q-pa-md text-center">
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue
index fc7bd03b7..906a41bca 100644
--- a/src/pages/Claim/Card/ClaimSummary.vue
+++ b/src/pages/Claim/Card/ClaimSummary.vue
@@ -219,7 +219,7 @@ function openDialog(dmsId) {
                 <ClaimNotes :add-note="false" style="height: 350px" order="created ASC" />
             </QCard>
             <QCard class="vn-max" v-if="salesClaimed.length > 0">
-                <a class="header" :href="`#/claim/${entityId}/notes`">
+                <a class="header" :href="`#/claim/${entityId}/lines`">
                     {{ t('claim.summary.details') }}
                     <QIcon name="open_in_new" color="primary" />
                 </a>
-- 
2.40.1