From 1e9e5e647d5bb0af8ea8b89ffd502754cb9ab027 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Feb 2025 10:05:13 +0100 Subject: [PATCH 1/7] fix: refs #6919 update customer data retrieval to use useArrayData for improved reactivity --- src/pages/Customer/components/CustomerSamplesCreate.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index 8d241441d..7624a3f98 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -39,7 +39,7 @@ const optionsSamplesVisible = ref([]); const sampleType = ref({ hasPreview: false }); const initialData = reactive({}); const entityId = computed(() => route.params.id); -const customer = computed(() => state.get('Customer')); +const customer = computed(() => useArrayData('Customer').store?.data); const filterEmailUsers = { where: { userFk: user.value.id } }; const filterClientsAddresses = { include: [ @@ -65,9 +65,9 @@ const filterSamplesVisible = { defineEmits(['confirm', ...useDialogPluginComponent.emits]); onBeforeMount(async () => { - initialData.clientFk = customer.value.id; - initialData.recipient = customer.value.email; - initialData.recipientId = customer.value.id; + initialData.clientFk = customer.value?.id; + initialData.recipient = customer.value?.email; + initialData.recipientId = customer.value?.id; }); const setEmailUser = (data) => { From 5e8ad9df11e5550ec4c4345021a374a8ce0409bf Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Feb 2025 10:13:09 +0100 Subject: [PATCH 2/7] feat: refs #6919 add useArrayData import to CustomerSamplesCreate for improved data handling --- src/pages/Customer/components/CustomerSamplesCreate.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index 7624a3f98..1294a5d25 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -18,6 +18,7 @@ import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue'; import FormPopup from 'src/components/FormPopup.vue'; +import { useArrayData } from 'src/composables/useArrayData'; const { dialogRef, onDialogOK } = useDialogPluginComponent(); From 09b613cac19ed233ecfeb3a2012f53bcc52488aa Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Feb 2025 11:03:14 +0100 Subject: [PATCH 3/7] refactor: refs #8372 update FormModelPopup to use props for save and continue logic --- src/components/FormModelPopup.vue | 13 +++++++------ src/components/VnTable/VnTable.vue | 8 -------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index 672eeff7a..db9974422 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -6,7 +6,7 @@ import FormModel from 'components/FormModel.vue'; const emit = defineEmits(['onDataSaved', 'onDataCanceled']); -defineProps({ +const props = defineProps({ title: { type: String, default: '', @@ -25,10 +25,14 @@ const { t } = useI18n(); const formModelRef = ref(null); const closeButton = ref(null); -const isSaveAndContinue = ref(false); +const isSaveAndContinue = ref(props.showSaveAndContinueBtn); +const isLoading = computed(() => formModelRef.value?.isLoading); +const reset = computed(() => formModelRef.value?.reset); + const onDataSaved = (formData, requestResponse) => { - if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click(); + if (!isSaveAndContinue.value) closeButton.value?.click(); emit('onDataSaved', formData, requestResponse); + isSaveAndContinue.value = props.showSaveAndContinueBtn; }; const onClick = async (saveAndContinue) => { @@ -36,9 +40,6 @@ const onClick = async (saveAndContinue) => { await formModelRef.value.save(); }; -const isLoading = computed(() => formModelRef.value?.isLoading); -const reset = computed(() => formModelRef.value?.reset); - defineExpose({ isLoading, onDataSaved, diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 105010140..7ff56860f 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -961,14 +961,6 @@ function cardClick(_, row) { transition-show="scale" transition-hide="scale" :full-width="createComplement?.isFullWidth ?? false" - @before-hide=" - () => { - if (createRef.isSaveAndContinue) { - showForm = true; - createForm.formInitialData = { ...create.formInitialData }; - } - } - " data-cy="vn-table-create-dialog" > Date: Mon, 24 Feb 2025 11:06:20 +0100 Subject: [PATCH 4/7] refactor: refs #8372 simplify cancel btn click --- src/components/FormModelPopup.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index db9974422..e87de5c65 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -75,10 +75,7 @@ defineExpose({ data-cy="FormModelPopup_cancel" v-close-popup z-max - @click=" - isSaveAndContinue = false; - emit('onDataCanceled'); - " + @click="emit('onDataCanceled')" /> Date: Mon, 24 Feb 2025 11:43:29 +0100 Subject: [PATCH 5/7] refactor: refs #8372 prueba --- src/components/FormModelPopup.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index e87de5c65..33041d29a 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -63,6 +63,7 @@ defineExpose({

{{ title }}

{{ subtitle }}

+
Date: Mon, 24 Feb 2025 11:44:00 +0100 Subject: [PATCH 6/7] chore: refs #8372 rollback --- src/components/FormModelPopup.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index 33041d29a..e87de5c65 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -63,7 +63,6 @@ defineExpose({

{{ title }}

{{ subtitle }}

-
Date: Mon, 24 Feb 2025 13:20:59 +0100 Subject: [PATCH 7/7] refactor: refs #8372 update FormModelPopup to enhance save and continue logic with state management --- src/components/FormModelPopup.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index e87de5c65..85943e91e 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -1,6 +1,7 @@