From aa15a31b395bb8411af759dbfef5e3975fe95c48 Mon Sep 17 00:00:00 2001
From: Jon <jon@verdnatura.es>
Date: Tue, 25 Feb 2025 13:48:18 +0100
Subject: [PATCH 1/4] feat: refs #8045 modified icon and route to redirect from
 CardDescriptor

---
 src/components/ui/CardDescriptor.vue | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue
index 6f122ecd2..72d255906 100644
--- a/src/components/ui/CardDescriptor.vue
+++ b/src/components/ui/CardDescriptor.vue
@@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
 import { useArrayData } from 'composables/useArrayData';
 import { useSummaryDialog } from 'src/composables/useSummaryDialog';
 import { useState } from 'src/composables/useState';
-import { useRoute } from 'vue-router';
+import { useRoute, useRouter } from 'vue-router';
 import { useClipboard } from 'src/composables/useClipboard';
 import VnMoreOptions from './VnMoreOptions.vue';
 
@@ -42,6 +42,7 @@ const $props = defineProps({
 
 const state = useState();
 const route = useRoute();
+const router = useRouter();
 const { t } = useI18n();
 const { copyText } = useClipboard();
 const { viewSummary } = useSummaryDialog();
@@ -111,11 +112,15 @@ function copyIdText(id) {
 
 const emit = defineEmits(['onFetch']);
 
-const iconModule = computed(() => route.matched[1].meta.icon);
-const toModule = computed(() =>
-    route.matched[1].path.split('/').length > 2
-        ? route.matched[1].redirect
-        : route.matched[1].children[0].redirect,
+const iconModule = computed(
+    () =>
+        router.options.routes[1].children.find((r) => r.name === $props.dataKey).meta
+            .icon,
+);
+const toModule = computed(
+    () =>
+        router.options.routes[1].children.find((r) => r.name === $props.dataKey)
+            .children[0].redirect,
 );
 </script>
 
@@ -123,8 +128,8 @@ const toModule = computed(() =>
     <div class="descriptor">
         <template v-if="entity && !isLoading">
             <div class="header bg-primary q-pa-sm justify-between">
-                <slot name="header-extra-action"
-                    ><QBtn
+                <slot name="header-extra-action">
+                    <QBtn
                         round
                         flat
                         dense
@@ -132,13 +137,13 @@ const toModule = computed(() =>
                         :icon="iconModule"
                         color="white"
                         class="link"
-                        :to="$attrs['to-module'] ?? toModule"
+                        :to="toModule"
                     >
                         <QTooltip>
                             {{ t('globals.goToModuleIndex') }}
                         </QTooltip>
-                    </QBtn></slot
-                >
+                    </QBtn>
+                </slot>
                 <QBtn
                     @click.stop="viewSummary(entity.id, $props.summary, $props.width)"
                     round

From d64ac223e32d375035c3f9d172902487ad23b9cd Mon Sep 17 00:00:00 2001
From: Jon <jon@verdnatura.es>
Date: Fri, 28 Feb 2025 07:53:20 +0100
Subject: [PATCH 2/4] feat: refs #8045 added new logic to show the correct icon
 and the correct path to redirect

---
 src/components/ui/CardDescriptor.vue | 49 +++++++++++++++++++---------
 1 file changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue
index fa733baa5..59d362463 100644
--- a/src/components/ui/CardDescriptor.vue
+++ b/src/components/ui/CardDescriptor.vue
@@ -51,6 +51,9 @@ let store;
 let entity;
 const isLoading = ref(false);
 const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
+const DESCRIPTOR_PROXY = 'DescriptorProxy';
+const moduleName = ref();
+const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
 defineExpose({ getData });
 
 onBeforeMount(async () => {
@@ -77,15 +80,18 @@ onBeforeMount(async () => {
     );
 });
 
-const routeName = computed(() => {
-    const DESCRIPTOR_PROXY = 'DescriptorProxy';
-
+function getName() {
     let name = $props.dataKey;
     if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
         name = name.split(DESCRIPTOR_PROXY)[0];
     }
-    return `${name}Summary`;
+    return name;
+}
+const routeName = computed(() => {
+    let routeName = getName();
+    return `${routeName}Summary`;
 });
+
 async function getData() {
     store.url = $props.url;
     store.filter = $props.filter ?? {};
@@ -121,16 +127,27 @@ function copyIdText(id) {
 
 const emit = defineEmits(['onFetch']);
 
-const iconModule = computed(
-    () =>
-        router.options.routes[1].children.find((r) => r.name === $props.dataKey).meta
-            .icon,
-);
-const toModule = computed(
-    () =>
-        router.options.routes[1].children.find((r) => r.name === $props.dataKey)
-            .children[0].redirect,
-);
+const iconModuleV = computed(() => {
+    moduleName.value = getName();
+    if (isSameModuleName) {
+        return router.options.routes[1].children.find((r) => r.name === moduleName.value)
+            ?.meta?.icon;
+    } else {
+        return route.matched[1].meta.icon;
+    }
+});
+
+const toModuleV = computed(() => {
+    moduleName.value = getName();
+    if (isSameModuleName) {
+        return router.options.routes[1].children.find((r) => r.name === moduleName.value)
+            ?.children[0]?.redirect;
+    } else {
+        return route.matched[1].path.split('/').length > 2
+            ? route.matched[1].redirect
+            : route.matched[1].children[0].redirect;
+    }
+});
 </script>
 
 <template>
@@ -143,10 +160,10 @@ const toModule = computed(
                         flat
                         dense
                         size="md"
-                        :icon="iconModule"
+                        :icon="iconModuleV"
                         color="white"
                         class="link"
-                        :to="toModule"
+                        :to="toModuleV"
                     >
                         <QTooltip>
                             {{ t('globals.goToModuleIndex') }}

From 01b7b2adeb0abbb1c1804e394dfe62b0bbbf7a12 Mon Sep 17 00:00:00 2001
From: Jon <jon@verdnatura.es>
Date: Mon, 3 Mar 2025 08:26:02 +0100
Subject: [PATCH 3/4] refactor: refs #8045 modified icon and module const

---
 src/components/ui/CardDescriptor.vue | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue
index 59d362463..744f84e6d 100644
--- a/src/components/ui/CardDescriptor.vue
+++ b/src/components/ui/CardDescriptor.vue
@@ -127,7 +127,7 @@ function copyIdText(id) {
 
 const emit = defineEmits(['onFetch']);
 
-const iconModuleV = computed(() => {
+const iconModule = computed(() => {
     moduleName.value = getName();
     if (isSameModuleName) {
         return router.options.routes[1].children.find((r) => r.name === moduleName.value)
@@ -137,7 +137,7 @@ const iconModuleV = computed(() => {
     }
 });
 
-const toModuleV = computed(() => {
+const toModule = computed(() => {
     moduleName.value = getName();
     if (isSameModuleName) {
         return router.options.routes[1].children.find((r) => r.name === moduleName.value)
@@ -160,10 +160,10 @@ const toModuleV = computed(() => {
                         flat
                         dense
                         size="md"
-                        :icon="iconModuleV"
+                        :icon="iconModule"
                         color="white"
                         class="link"
-                        :to="toModuleV"
+                        :to="toModule"
                     >
                         <QTooltip>
                             {{ t('globals.goToModuleIndex') }}
@@ -252,7 +252,6 @@ const toModuleV = computed(() => {
             </div>
             <slot name="after" />
         </template>
-        <!-- Skeleton -->
         <SkeletonDescriptor v-if="!entity || isLoading" />
     </div>
     <QInnerLoading

From dfddab0892b11d5c1f8c5cf72fad4d34df7898b2 Mon Sep 17 00:00:00 2001
From: alexm <alexm@verdnatura.es>
Date: Fri, 7 Mar 2025 13:19:31 +0100
Subject: [PATCH 4/4] test: skip route extended list tests in Cypress

---
 test/cypress/integration/route/routeExtendedList.spec.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
index da35066c3..5fda93b25 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -1,4 +1,4 @@
-describe('Route extended list', () => {
+describe.skip('Route extended list', () => {
     const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
 
     const selectors = {