From 67c257ce0eda180dc7a88bd7691797a7f0445d9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= <carlosap@verdnatura.es>
Date: Thu, 28 Nov 2024 19:24:13 +0100
Subject: [PATCH 01/10] fix: translations travel

---
 src/i18n/locale/en.yml                    | 2 +-
 src/i18n/locale/es.yml                    | 2 +-
 src/pages/Travel/Card/TravelBasicData.vue | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index e2e0e4238..31a6931a4 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -766,7 +766,7 @@ travel:
         thermographs: Thermographs
         hb: HB
     basicData:
-        daysInForward: Days in forward
+        daysInForward: Automatic movement (Raid)
         isRaid: Raid
     thermographs:
         temperature: Temperature
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 58ddc98ef..ccc21e225 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -760,7 +760,7 @@ travel:
         thermographs: Termógrafos
         hb: HB
     basicData:
-        daysInForward: Días redada
+        daysInForward: Desplazamiento automatico (redada)
         isRaid: Redada
     thermographs:
         temperature: Temperatura
diff --git a/src/pages/Travel/Card/TravelBasicData.vue b/src/pages/Travel/Card/TravelBasicData.vue
index fd02b28cd..4b9aa28ed 100644
--- a/src/pages/Travel/Card/TravelBasicData.vue
+++ b/src/pages/Travel/Card/TravelBasicData.vue
@@ -104,7 +104,7 @@ const warehousesOptionsIn = ref([]);
 
 <i18n>
 es:
-    raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados.
+    raidDays: El travel se desplaza automáticamente cada día para estar desde hoy al número de días indicado. Si se deja vacio no se moverá
 en:
-    raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days.
+    raidDays: The travel adjusts itself daily to match the number of days set, starting from today. If left blank, it won’t move
 </i18n>

From d364e30cf0a87cb2e311fcaf357be0e7dbf6b565 Mon Sep 17 00:00:00 2001
From: alexm <alexm@verdnatura.es>
Date: Fri, 29 Nov 2024 09:38:58 +0100
Subject: [PATCH 02/10] feat(SupplierAccount): add autoBic when change
 bankEntity

---
 src/components/CrudModel.vue                 |  4 +--
 src/components/common/VnSelect.vue           | 21 +++++++++++--
 src/pages/Supplier/Card/SupplierAccounts.vue | 33 ++++++++++++++++++--
 3 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue
index 1234ce123..b770e591f 100644
--- a/src/components/CrudModel.vue
+++ b/src/components/CrudModel.vue
@@ -176,8 +176,8 @@ async function saveChanges(data) {
     const changes = data || getChanges();
     try {
         await axios.post($props.saveUrl || $props.url + '/crud', changes);
-    } catch (e) {
-        return (isLoading.value = false);
+    } finally {
+        isLoading.value = false;
     }
     originalData.value = JSON.parse(JSON.stringify(formData.value));
     if (changes.creates?.length) await vnPaginateRef.value.fetch();
diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index f24f054a5..14005e1cc 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -284,9 +284,9 @@ async function onScroll({ to, direction, from, index }) {
         :loading="isLoading"
         @virtual-scroll="onScroll"
     >
-        <template v-if="isClearable" #append>
+        <template #append>
             <QIcon
-                v-show="value"
+                v-show="isClearable && value"
                 name="close"
                 @click.stop="
                     () => {
@@ -299,7 +299,22 @@ async function onScroll({ to, direction, from, index }) {
             />
         </template>
         <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
-            <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
+            <div v-if="slotName == 'append'">
+                <QIcon
+                    v-show="isClearable && value"
+                    name="close"
+                    @click.stop="
+                        () => {
+                            value = null;
+                            emit('remove');
+                        }
+                    "
+                    class="cursor-pointer"
+                    size="xs"
+                />
+                <slot name="append" v-if="$slots.append" v-bind="slotData ?? {}" />
+            </div>
+            <slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
         </template>
     </QSelect>
 </template>
diff --git a/src/pages/Supplier/Card/SupplierAccounts.vue b/src/pages/Supplier/Card/SupplierAccounts.vue
index 428ab05c2..c2934830a 100644
--- a/src/pages/Supplier/Card/SupplierAccounts.vue
+++ b/src/pages/Supplier/Card/SupplierAccounts.vue
@@ -24,13 +24,14 @@ const supplier = ref(null);
 const supplierAccountRef = ref(null);
 const wireTransferFk = ref(null);
 const bankEntitiesOptions = ref([]);
+const filteredBankEntitiesOptions = ref([]);
 
 const onBankEntityCreated = async (dataSaved, rowData) => {
     await bankEntitiesRef.value.fetch();
     rowData.bankEntityFk = dataSaved.id;
 };
 
-const onChangesSaved = () => {
+const onChangesSaved = async () => {
     if (supplier.value.payMethodFk !== wireTransferFk.value)
         quasar
             .dialog({
@@ -55,12 +56,35 @@ const setWireTransfer = async () => {
     await axios.patch(`Suppliers/${route.params.id}`, params);
     notify('globals.dataSaved', 'positive');
 };
+
+function findBankFk(value, row) {
+    row.bankEntityFk = null;
+    if (!value) return;
+
+    const bankEntityFk = bankEntitiesOptions.value.find((b) => b.id == value.slice(4, 8));
+    if (bankEntityFk) row.bankEntityFk = bankEntityFk.id;
+}
+
+function bankEntityFilter(val, update) {
+    update(() => {
+        const needle = val.toLowerCase();
+        filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
+            (bank) =>
+                bank.bic.toLowerCase().startsWith(needle) ||
+                bank.name.toLowerCase().includes(needle)
+        );
+    });
+}
 </script>
 <template>
     <FetchData
         ref="bankEntitiesRef"
         url="BankEntities"
-        @on-fetch="(data) => (bankEntitiesOptions = data)"
+        @on-fetch="
+            (data) => {
+                (bankEntitiesOptions = data), (filteredBankEntitiesOptions = data);
+            }
+        "
         auto-load
     />
     <FetchData
@@ -98,6 +122,7 @@ const setWireTransfer = async () => {
                     <VnInput
                         :label="t('supplier.accounts.iban')"
                         v-model="row.iban"
+                        @update:model-value="(value) => findBankFk(value, row)"
                         :required="true"
                     >
                         <template #append>
@@ -109,7 +134,9 @@ const setWireTransfer = async () => {
                     <VnSelectDialog
                         :label="t('worker.create.bankEntity')"
                         v-model="row.bankEntityFk"
-                        :options="bankEntitiesOptions"
+                        :options="filteredBankEntitiesOptions"
+                        :default-filter="false"
+                        @filter="(val, update) => bankEntityFilter(val, update)"
                         option-label="bic"
                         option-value="id"
                         hide-selected

From f1fc5edac30b753285f25fed6890ce518ec0481f Mon Sep 17 00:00:00 2001
From: alexm <alexm@verdnatura.es>
Date: Fri, 29 Nov 2024 09:39:42 +0100
Subject: [PATCH 03/10] chore: duplicate isLoading.value = false;

---
 src/components/CrudModel.vue | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue
index b770e591f..b1c7606e6 100644
--- a/src/components/CrudModel.vue
+++ b/src/components/CrudModel.vue
@@ -183,7 +183,6 @@ async function saveChanges(data) {
     if (changes.creates?.length) await vnPaginateRef.value.fetch();
 
     hasChanges.value = false;
-    isLoading.value = false;
     emit('saveChanges', data);
     quasar.notify({
         type: 'positive',

From 8428c7a20500ccb6b547a3af0d1928b26b530d2b Mon Sep 17 00:00:00 2001
From: guillermo <guillermo@verdnatura.es>
Date: Fri, 29 Nov 2024 09:48:09 +0100
Subject: [PATCH 04/10] fix: refs #7920 Changed shelving option value

---
 src/pages/Ticket/Card/TicketSaleTracking.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue
index 03e2336eb..7a33df795 100644
--- a/src/pages/Ticket/Card/TicketSaleTracking.vue
+++ b/src/pages/Ticket/Card/TicketSaleTracking.vue
@@ -471,7 +471,7 @@ const qCheckBoxController = (sale, action) => {
                         url="Shelvings"
                         hide-selected
                         option-label="code"
-                        option-value="code"
+                        option-value="id"
                         v-model="row.shelvingFk"
                         @update:model-value="updateShelving(row)"
                         style="max-width: 120px"

From 67d6d4ef4571b3c130bd64fb5d8213a55057fe62 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Fri, 29 Nov 2024 10:05:09 +0100
Subject: [PATCH 05/10] fix: hotfix webAccess

---
 src/pages/Customer/Card/CustomerWebAccess.vue | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue
index eec127fde..85615e668 100644
--- a/src/pages/Customer/Card/CustomerWebAccess.vue
+++ b/src/pages/Customer/Card/CustomerWebAccess.vue
@@ -27,7 +27,7 @@ async function hasCustomerRole() {
     <FormModel
         :url-update="`Clients/${route.params.id}/updateUser`"
         :filter="filter"
-        model="customer"
+        url="VnUsers/preview"
         :mapper="
             ({ active, name, email }) => {
                 return {
@@ -41,7 +41,7 @@ async function hasCustomerRole() {
         auto-load
     >
         <template #form="{ data, validate }">
-            <QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
+            <QCheckbox :label="t('Enable web access')" v-model="data.active" />
             <VnInput :label="t('User')" clearable v-model="data.name" />
             <VnInput
                 :label="t('Recovery email')"

From 068b2dc9aa29b873dcd7407ef157bf3123922035 Mon Sep 17 00:00:00 2001
From: alexm <alexm@verdnatura.es>
Date: Fri, 29 Nov 2024 10:36:22 +0100
Subject: [PATCH 06/10] fix: e2e

---
 test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
index 3c839c1c7..e996a65d5 100644
--- a/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/vnBreadcrumbs.spec.js
@@ -3,6 +3,7 @@ describe('VnBreadcrumbs', () => {
     const firstCard = '.q-infinite-scroll > :nth-child(1)';
     const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
     beforeEach(() => {
+        cy.viewport(1920, 1080);
         cy.login('developer');
         cy.visit('/');
     });

From 514d54b222883e14a293c3da4ca2ab171c154b05 Mon Sep 17 00:00:00 2001
From: carlossa <carlossa@verdnatura.es>
Date: Fri, 29 Nov 2024 12:20:53 +0100
Subject: [PATCH 07/10] fix: hotfix-accountWeb

---
 src/pages/Customer/Card/CustomerWebAccess.vue | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue
index 85615e668..9d2e43262 100644
--- a/src/pages/Customer/Card/CustomerWebAccess.vue
+++ b/src/pages/Customer/Card/CustomerWebAccess.vue
@@ -27,7 +27,7 @@ async function hasCustomerRole() {
     <FormModel
         :url-update="`Clients/${route.params.id}/updateUser`"
         :filter="filter"
-        url="VnUsers/preview"
+        model="customer"
         :mapper="
             ({ active, name, email }) => {
                 return {
@@ -41,14 +41,14 @@ async function hasCustomerRole() {
         auto-load
     >
         <template #form="{ data, validate }">
-            <QCheckbox :label="t('Enable web access')" v-model="data.active" />
-            <VnInput :label="t('User')" clearable v-model="data.name" />
+            <QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
+            <VnInput :label="t('User')" clearable v-model="data.account.name" />
             <VnInput
                 :label="t('Recovery email')"
                 :rules="validate('client.email')"
                 clearable
                 type="email"
-                v-model="data.email"
+                data.account.name
                 class="q-mt-sm"
                 :info="t('This email is used for user to regain access their account')"
             />

From 940fe5c2b94c1fe5871eb829abe7adf9841e03f3 Mon Sep 17 00:00:00 2001
From: Javier Segarra <jsegarra@verdnatura.es>
Date: Fri, 29 Nov 2024 13:21:19 +0100
Subject: [PATCH 08/10] fix: #6943 CustomerAddressCreate

---
 .../components/CustomerAddressCreate.vue        | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/pages/Customer/components/CustomerAddressCreate.vue b/src/pages/Customer/components/CustomerAddressCreate.vue
index f4a188243..6cf42b20e 100644
--- a/src/pages/Customer/components/CustomerAddressCreate.vue
+++ b/src/pages/Customer/components/CustomerAddressCreate.vue
@@ -18,8 +18,6 @@ const router = useRouter();
 
 const formInitialData = reactive({ isDefaultAddress: false });
 
-const urlCreate = ref('');
-
 const agencyModes = ref([]);
 const incoterms = ref([]);
 const customsAgents = ref([]);
@@ -40,13 +38,18 @@ function handleLocation(data, location) {
     data.countryFk = countryFk;
 }
 
-function onAgentCreated(requestResponse, data) {
-    customsAgents.value.push(requestResponse);
-    data.customsAgentFk = requestResponse.id;
+function onAgentCreated({ id, fiscalName }, data) {
+    customsAgents.value.push({ id, fiscalName });
+    data.customsAgentFk = id;
 }
 </script>
 
 <template>
+    <FetchData
+        @on-fetch="(data) => (customsAgents = data)"
+        auto-load
+        url="CustomsAgents"
+    />
     <FetchData
         @on-fetch="(data) => (agencyModes = data)"
         auto-load
@@ -57,7 +60,7 @@ function onAgentCreated(requestResponse, data) {
     <FormModel
         :form-initial-data="formInitialData"
         :observe-form-changes="false"
-        :url-create="urlCreate"
+        :url-create="`Clients/${route.params.id}/createAddress`"
         @on-data-saved="toCustomerAddress()"
         model="client"
     >
@@ -141,7 +144,7 @@ function onAgentCreated(requestResponse, data) {
                     <template #form>
                         <CustomerNewCustomsAgent
                             @on-data-saved="
-                                (_, requestResponse) =>
+                                (requestResponse, _) =>
                                     onAgentCreated(requestResponse, data)
                             "
                         />

From 51460c1138957fbc3067262b5f5964695998378a Mon Sep 17 00:00:00 2001
From: Javier Segarra <jsegarra@verdnatura.es>
Date: Fri, 29 Nov 2024 13:27:36 +0100
Subject: [PATCH 09/10] fix: #6943 use v-model

---
 src/pages/Customer/Card/CustomerWebAccess.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue
index 9d2e43262..ea901c65a 100644
--- a/src/pages/Customer/Card/CustomerWebAccess.vue
+++ b/src/pages/Customer/Card/CustomerWebAccess.vue
@@ -48,7 +48,7 @@ async function hasCustomerRole() {
                 :rules="validate('client.email')"
                 clearable
                 type="email"
-                data.account.name
+                v-model="data.account.email"
                 class="q-mt-sm"
                 :info="t('This email is used for user to regain access their account')"
             />

From 2e1a5ecdd986b8922efb3f999d09c343a6f36c4f Mon Sep 17 00:00:00 2001
From: Javier Segarra <jsegarra@verdnatura.es>
Date: Fri, 29 Nov 2024 13:29:15 +0100
Subject: [PATCH 10/10] fix: #6943 CustomerAddressCreate

---
 src/pages/Customer/components/CustomerAddressCreate.vue | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/pages/Customer/components/CustomerAddressCreate.vue b/src/pages/Customer/components/CustomerAddressCreate.vue
index 6cf42b20e..bc4d6a128 100644
--- a/src/pages/Customer/components/CustomerAddressCreate.vue
+++ b/src/pages/Customer/components/CustomerAddressCreate.vue
@@ -144,8 +144,7 @@ function onAgentCreated({ id, fiscalName }, data) {
                     <template #form>
                         <CustomerNewCustomsAgent
                             @on-data-saved="
-                                (requestResponse, _) =>
-                                    onAgentCreated(requestResponse, data)
+                                (requestResponse) => onAgentCreated(requestResponse, data)
                             "
                         />
                     </template>