From 09b613cac19ed233ecfeb3a2012f53bcc52488aa Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Feb 2025 11:03:14 +0100 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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 @@