fix: refs #8372 correct isSaveAndContinue reference and streamline save logic in FormModelPopup

This commit is contained in:
Jorge Penadés 2025-02-18 16:23:30 +01:00
parent 4ccae7981c
commit e758df4a4c
1 changed files with 8 additions and 9 deletions

View File

@ -27,10 +27,15 @@ const formModelRef = ref(null);
const closeButton = ref(null);
const isSaveAndContinue = ref(false);
const onDataSaved = (formData, requestResponse) => {
if (closeButton.value && isSaveAndContinue) closeButton.value.click();
if (closeButton.value && isSaveAndContinue.value) closeButton.value.click();
emit('onDataSaved', formData, requestResponse);
};
const onClick = async () => {
isSaveAndContinue.value = true;
formModelRef.value.save();
};
const isLoading = computed(() => formModelRef.value?.isLoading);
const reset = computed(() => formModelRef.value?.reset);
@ -78,10 +83,7 @@ defineExpose({
:flat="showSaveAndContinueBtn"
:label="t('globals.save')"
:title="t('globals.save')"
@click="
formModelRef.save();
isSaveAndContinue = false;
"
@click="onClick"
color="primary"
class="q-ml-sm"
:disabled="isLoading"
@ -99,10 +101,7 @@ defineExpose({
:loading="isLoading"
data-cy="FormModelPopup_isSaveAndContinue"
z-max
@click="
isSaveAndContinue = true;
formModelRef.save();
"
@click="onClick"
/>
</div>
</template>