refactor: refs #8372 update FormModelPopup to use props for save and continue logic #1477

Merged
jorgep merged 5 commits from 8372-warmfix-saveAndContinue into test 2025-02-24 12:37:45 +00:00
1 changed files with 10 additions and 4 deletions
Showing only changes of commit 659d87020f - Show all commits

View File

@ -1,6 +1,7 @@
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, useAttrs, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
import FormModel from 'components/FormModel.vue';
@ -22,17 +23,22 @@ const props = defineProps({
});
const { t } = useI18n();
const attrs = useAttrs();
const state = useState();
const formModelRef = ref(null);
const closeButton = ref(null);
const isSaveAndContinue = ref(props.showSaveAndContinueBtn);
const isLoading = computed(() => formModelRef.value?.isLoading);
const reset = computed(() => formModelRef.value?.reset);
const onDataSaved = (formData, requestResponse) => {
const onDataSaved = async (formData, requestResponse) => {
Review

Revisado con Pablo para que haga lo que hacía antes

Revisado con Pablo para que haga lo que hacía antes
if (!isSaveAndContinue.value) closeButton.value?.click();
emit('onDataSaved', formData, requestResponse);
if (isSaveAndContinue.value) {
await nextTick();
state.set(attrs.model, attrs.formInitialData);
}
isSaveAndContinue.value = props.showSaveAndContinueBtn;
emit('onDataSaved', formData, requestResponse);
};
const onClick = async (saveAndContinue) => {