feat: refs #8725 init

This commit is contained in:
Javier Segarra 2025-03-05 23:20:23 +01:00
parent 7d07256591
commit 4641adbae3
3 changed files with 18 additions and 4 deletions

View File

@ -119,7 +119,9 @@ const defaultButtons = computed(() => ({
color: 'primary',
icon: 'save',
label: 'globals.save',
click: async () => await save(),
click: async () => {
submitForm();
},
type: 'submit',
},
reset: {
@ -132,6 +134,14 @@ const defaultButtons = computed(() => ({
...$props.defaultButtons,
}));
const submitForm = () => {
myForm.value.validate().then((success) => {
if (success) {
save();
}
});
};
onMounted(async () => {
nextTick(() => (componentIsRendered.value = true));
@ -312,6 +322,7 @@ async function onKeyup(evt) {
}
defineExpose({
myForm,
save,
isLoading,
hasChanges,
@ -325,7 +336,7 @@ defineExpose({
<QForm
ref="myForm"
v-if="formData"
@submit.prevent
@submit.prevent="save"
@keyup.prevent="onKeyup"
@reset="reset"
class="q-pa-md"

View File

@ -43,7 +43,7 @@ const onDataSaved = async (formData, requestResponse) => {
const onClick = async (saveAndContinue) => {
isSaveAndContinue.value = saveAndContinue;
await formModelRef.value.save();
formModelRef.value.myForm.submit();
};
defineExpose({
@ -61,6 +61,7 @@ defineExpose({
:default-actions="false"
v-bind="$attrs"
@on-data-saved="onDataSaved"
@submit.prevent
>
<template #form="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
@ -87,7 +88,7 @@ defineExpose({
:flat="showSaveAndContinueBtn"
:label="t('globals.save')"
:title="t('globals.save')"
@click="onClick(false)"
type="submit"
color="primary"
class="q-ml-sm"
:disabled="isLoading"

View File

@ -112,6 +112,7 @@ async function acceptPropagate({ isEqualizated }) {
v-model="data.sageTaxTypeFk"
data-cy="sageTaxTypeFk"
:required="data.isTaxDataChecked"
:rules="[(val) => val !== null || 'Please type your age']"
/>
<VnSelect
:label="t('Sage transaction type')"
@ -122,6 +123,7 @@ async function acceptPropagate({ isEqualizated }) {
data-cy="sageTransactionTypeFk"
v-model="data.sageTransactionTypeFk"
:required="data.isTaxDataChecked"
:rules="[(val) => val !== null || 'Please type your age']"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">