feat: creditNote => add validation rules
This commit is contained in:
parent
5e2100eb8d
commit
a5a64b30dc
2 changed files with 22 additions and 8 deletions
|
|
@ -30,6 +30,7 @@ import { storeToRefs } from 'pinia';
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
import { dialogWarningClose } from 'src/stores/utils';
|
import { dialogWarningClose } from 'src/stores/utils';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { QForm } from 'quasar';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -39,6 +40,7 @@ const configStore = useConfigStore();
|
||||||
const { data: config } = storeToRefs(configStore);
|
const { data: config } = storeToRefs(configStore);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const refForm = ref<InstanceType<typeof QForm>>();
|
||||||
const creditNoteData = ref<CreditNote>();
|
const creditNoteData = ref<CreditNote>();
|
||||||
const quotationData = ref<CreditNote['quotation']>();
|
const quotationData = ref<CreditNote['quotation']>();
|
||||||
const view = ref<CreditNoteStatus | null>(null);
|
const view = ref<CreditNoteStatus | null>(null);
|
||||||
|
|
@ -556,6 +558,7 @@ onMounted(async () => {
|
||||||
@click="i.handler()"
|
@click="i.handler()"
|
||||||
/>
|
/>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<DocumentExpansion
|
<DocumentExpansion
|
||||||
readonly
|
readonly
|
||||||
:registered-branch-id="quotationData?.registeredBranchId"
|
:registered-branch-id="quotationData?.registeredBranchId"
|
||||||
|
|
@ -567,12 +570,20 @@ onMounted(async () => {
|
||||||
@goto-quotation="goToQuotation"
|
@goto-quotation="goToQuotation"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<q-form
|
||||||
|
ref="refForm"
|
||||||
|
greedy
|
||||||
|
@submit.prevent
|
||||||
|
@validation-success="submit"
|
||||||
|
>
|
||||||
<CreditNoteExpansion
|
<CreditNoteExpansion
|
||||||
v-if="view === null"
|
v-if="view === null"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
v-model:reason="currentFormData.reason"
|
v-model:reason="currentFormData.reason"
|
||||||
v-model:detail="currentFormData.detail"
|
v-model:detail="currentFormData.detail"
|
||||||
/>
|
/>
|
||||||
|
</q-form>
|
||||||
|
|
||||||
<ProductExpansion
|
<ProductExpansion
|
||||||
v-if="view === null"
|
v-if="view === null"
|
||||||
creditNote
|
creditNote
|
||||||
|
|
@ -634,7 +645,6 @@ onMounted(async () => {
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- TODO: bind additional file -->
|
|
||||||
<AdditionalFileExpansion
|
<AdditionalFileExpansion
|
||||||
v-if="view !== CreditNoteStatus.Success"
|
v-if="view !== CreditNoteStatus.Success"
|
||||||
:readonly="false"
|
:readonly="false"
|
||||||
|
|
@ -731,9 +741,11 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||||
</MainButton>
|
</MainButton>
|
||||||
|
<!-- @click="submit" -->
|
||||||
<SaveButton
|
<SaveButton
|
||||||
v-if="!readonly"
|
v-if="!readonly"
|
||||||
@click="submit"
|
type="submit"
|
||||||
|
@click.stop="(e) => refForm?.submit(e)"
|
||||||
:label="$t('creditNote.label.submit')"
|
:label="$t('creditNote.label.submit')"
|
||||||
icon="mdi-account-multiple-check-outline"
|
icon="mdi-account-multiple-check-outline"
|
||||||
solid
|
solid
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ const detail = defineModel<string>('detail');
|
||||||
{ label: $t('creditNote.label.reasonReturn'), value: 'Return' },
|
{ label: $t('creditNote.label.reasonReturn'), value: 'Return' },
|
||||||
{ label: $t('creditNote.label.reasonCanceled'), value: 'Canceled' },
|
{ label: $t('creditNote.label.reasonCanceled'), value: 'Canceled' },
|
||||||
]"
|
]"
|
||||||
|
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
||||||
></SelectInput>
|
></SelectInput>
|
||||||
<q-input
|
<q-input
|
||||||
:readonly
|
:readonly
|
||||||
|
|
@ -44,6 +45,7 @@ const detail = defineModel<string>('detail');
|
||||||
dense
|
dense
|
||||||
class="col"
|
class="col"
|
||||||
v-model="detail"
|
v-model="detail"
|
||||||
|
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
||||||
></q-input>
|
></q-input>
|
||||||
</main>
|
</main>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue