refactor: 05 => add disabledSubmit prop to DialogForm and improve handling in QuotationForm

This commit is contained in:
puriphatt 2025-02-03 10:14:51 +07:00
parent d268764024
commit e2bd6a6334
3 changed files with 4 additions and 0 deletions

View file

@ -23,6 +23,7 @@ defineProps<{
hideDelete?: boolean; hideDelete?: boolean;
hideBtn?: boolean; hideBtn?: boolean;
readonly?: boolean; readonly?: boolean;
disabledSubmit?: boolean;
saveAmount?: number; saveAmount?: number;
submitLabel?: string; submitLabel?: string;
@ -235,6 +236,7 @@ const currentTab = defineModel<string>('currentTab');
id="btn-form-submit" id="btn-form-submit"
type="submit" type="submit"
solid solid
:disabled="disabledSubmit"
:icon="submitIcon" :icon="submitIcon"
:label="submitLabel" :label="submitLabel"
:amount="saveAmount" :amount="saveAmount"

View file

@ -823,6 +823,7 @@ function convertToTable(nodes: Node[]) {
return []; return [];
}; };
const list = nodes.flatMap(_recursive).map((v) => v.value); const list = nodes.flatMap(_recursive).map((v) => v.value);
if (list.length === 0) return;
quotationFormData.value.paySplitCount = Math.max( quotationFormData.value.paySplitCount = Math.max(
...list.map((v) => v.installmentNo || 0), ...list.map((v) => v.installmentNo || 0),

View file

@ -428,6 +428,7 @@ watch(
<template> <template>
<div> <div>
<DialogForm <DialogForm
:disabled-submit="countCheckedProducts(nodes) === 0"
bg-color="var(--surface-2)" bg-color="var(--surface-2)"
v-model:modal="model" v-model:modal="model"
:title="$t('general.list', { msg: $t('productService.title') })" :title="$t('general.list', { msg: $t('productService.title') })"