refactor: add required validation to quotation selection and enhance button disable logic in credit and debit note forms

This commit is contained in:
puriphatt 2025-02-20 13:46:06 +07:00
parent a6a997e55f
commit ea1c1b71fc
5 changed files with 8 additions and 3 deletions

View file

@ -29,6 +29,7 @@ const quotationId = defineModel<string>('quotationId', {
<section class="col-12 row q-col-gutter-sm">
<SelectQuotation
for="select-quotation"
required
class="col"
v-model:value="quotationId"
:label="$t('general.select', { msg: $t('quotation.title') })"

View file

@ -29,6 +29,7 @@ const quotationId = defineModel<string>('quotationId', {
<section class="col-12 row q-col-gutter-sm">
<SelectQuotation
for="select-quotation"
required
class="col"
v-model:value="quotationId"
:label="$t('general.select', { msg: $t('quotation.title') })"

View file

@ -807,6 +807,7 @@ onMounted(async () => {
<!-- @click="submit" -->
<SaveButton
v-if="!readonly"
:disabled="taskListGroup.length === 0"
type="submit"
@click.stop="(e) => refForm?.submit(e)"
:label="$t('creditNote.label.submit')"

View file

@ -44,8 +44,8 @@ const detail = defineModel<string>('detail');
outlined
dense
class="col"
v-model="detail"
:rules="[(val: string) => !!val || $t('form.error.required')]"
:model-value="readonly ? detail || '-' : detail"
@update:model-value="(v) => (detail = v?.toString())"
></q-input>
</main>
</q-expansion-item>

View file

@ -987,7 +987,6 @@ onMounted(async () => {
/>
<!-- #TODO add openProductDialog at @add-product-->
<ProductExpansion
v-if="view === null"
:readonly
@ -1179,6 +1178,9 @@ onMounted(async () => {
<SaveButton
v-if="!readonly && pageState.mode === 'create'"
:disabled="
selectedWorkerItem.length === 0 && productService.length === 0
"
@click="submit"
:label="true ? $t('debitNote.label.submit') : $t('general.save')"
:icon="