Adjust account conf form checkbox

This commit is contained in:
William Buezas 2024-09-27 08:59:04 -03:00
parent 4111dd8669
commit baaff90aef
2 changed files with 16 additions and 22 deletions

View File

@ -82,7 +82,7 @@ const props = defineProps({
} }
}); });
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved', 'onDataFetched']);
const { t } = useI18n(); const { t } = useI18n();
const jApi = inject('jApi'); const jApi = inject('jApi');
@ -133,6 +133,7 @@ const fetchFormData = async () => {
formData.value = { ...modelInfo.value.data[0] }; formData.value = { ...modelInfo.value.data[0] };
loading.value = false; loading.value = false;
emit('onDataFetched', formData.value);
}; };
const onSubmitSuccess = () => { const onSubmitSuccess = () => {
@ -200,10 +201,7 @@ defineExpose({
</script> </script>
<template> <template>
<QCard <QCard class="form-container" v-bind="$attrs">
class="form-container"
v-bind="$attrs"
>
<QForm <QForm
v-if="!loading" v-if="!loading"
ref="addressFormRef" ref="addressFormRef"
@ -213,14 +211,8 @@ defineExpose({
<span v-if="title" class="text-h6 text-bold"> <span v-if="title" class="text-h6 text-bold">
{{ title }} {{ title }}
</span> </span>
<slot <slot name="form" :data="formData" />
name="form" <slot name="extraForm" :data="formData" />
:data="formData"
/>
<slot
name="extraForm"
:data="formData"
/>
<component <component
v-if="isHeaderMounted" v-if="isHeaderMounted"
:is="showBottomActions ? 'div' : Teleport" :is="showBottomActions ? 'div' : Teleport"
@ -254,24 +246,21 @@ defineExpose({
<slot name="actions" :data="formData" /> <slot name="actions" :data="formData" />
</component> </component>
</QForm> </QForm>
<QSpinner <QSpinner v-else color="primary" size="3em" :thickness="2" />
v-else
color="primary"
size="3em"
:thickness="2"
/>
</QCard> </QCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.no-form-container { .no-form-container {
padding: 0 !important; padding: 0 !important;
box-shadow: none; box-shadow: none;
border: none; border: none;
} }
.form-container { .form-container {
width: 100%; width: 100%;
height: max-content; height: max-content;
padding: 0 !important; padding: 32px;
max-width: 544px; max-width: 544px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -280,7 +269,6 @@ defineExpose({
.form { .form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 32px;
width: 100%; width: 100%;
} }
</style> </style>

View File

@ -53,6 +53,10 @@ const updateUserNickname = async nickname => {
} }
}; };
const formatMailData = data => {
data.isToBeMailed = Boolean(data.isToBeMailed);
};
onMounted(() => fetchLanguagesSql()); onMounted(() => fetchLanguagesSql());
</script> </script>
@ -116,18 +120,20 @@ onMounted(() => fetchLanguagesSql());
</template> </template>
<template #extraForm> <template #extraForm>
<VnForm <VnForm
class="no-form-container" class="no-form-container q-mt-md"
ref="vnFormRef2" ref="vnFormRef2"
:pks="pks" :pks="pks"
table="myClient" table="myClient"
schema="hedera" schema="hedera"
:fetch-form-data-sql="fetchConfigDataSql" :fetch-form-data-sql="fetchConfigDataSql"
:default-actions="false" :default-actions="false"
@on-data-fetched="$event => formatMailData($event)"
> >
<template #form="{ data }"> <template #form="{ data }">
<QCheckbox <QCheckbox
v-model="data.isToBeMailed" v-model="data.isToBeMailed"
:label="t('isToBeMailed')" :label="t('isToBeMailed')"
:toggle-indeterminate="false"
@update:model-value="vnFormRef2.submit()" @update:model-value="vnFormRef2.submit()"
dense dense
/> />