feat: add disabled submit functionality to OcrDialog and enhance request list handling
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s

This commit is contained in:
puriphatt 2025-07-08 11:39:57 +07:00
parent 088f829146
commit 7679c076a7
3 changed files with 36 additions and 3 deletions

View file

@ -22,6 +22,7 @@ type Props = {
autoSave?: boolean; autoSave?: boolean;
data?: Data; data?: Data;
hideBtn?: boolean; hideBtn?: boolean;
disabledSubmit?: boolean;
}; };
type HandleProps = { type HandleProps = {
@ -109,6 +110,7 @@ async function change(e: Event) {
hide-delete hide-delete
hide-btn hide-btn
edit edit
:disabledSubmit
:title :title
:is-edit :is-edit
:readonly :readonly

View file

@ -24,6 +24,7 @@ import {
EmployeePassportPayload, EmployeePassportPayload,
EmployeeVisaPayload, EmployeeVisaPayload,
} from 'stores/employee/types'; } from 'stores/employee/types';
import { canAccess } from 'src/stores/utils';
type Data = { type Data = {
id: string; id: string;
@ -50,6 +51,8 @@ defineEmits<{
}>(); }>();
const group = ref('passport'); const group = ref('passport');
const refFormEmployeePassport = ref();
const refFormEmployeeVisa = ref();
const requestListStore = useRequestList(); const requestListStore = useRequestList();
@ -474,6 +477,13 @@ function changeCustomerTab(opts: { tab: 'customer' | 'employee' }) {
<q-td> <q-td>
<span class="row justify-end no-wrap"> <span class="row justify-end no-wrap">
<OcrDialog <OcrDialog
:disabled-submit="
group === 'passport'
? !refFormEmployeePassport
: group === 'visa'
? !refFormEmployeeVisa
: undefined
"
@submit=" @submit="
(file, meta) => { (file, meta) => {
$emit( $emit(
@ -500,7 +510,13 @@ function changeCustomerTab(opts: { tab: 'customer' | 'employee' }) {
> >
<template #trigger="{ browse }"> <template #trigger="{ browse }">
<MainButton <MainButton
v-if="!!state.isEdit" v-if="
!!state.isEdit &&
(props.row.documentType === 'passport' ||
props.row.documentType === 'visa'
? canAccess('customer', 'edit')
: true)
"
iconOnly iconOnly
icon="mdi-tray-arrow-up" icon="mdi-tray-arrow-up"
color="var(--positive-bg)" color="var(--positive-bg)"
@ -513,6 +529,7 @@ function changeCustomerTab(opts: { tab: 'customer' | 'employee' }) {
</template> </template>
<template #body="{ metadata, isRunning }"> <template #body="{ metadata, isRunning }">
<FormEmployeePassport <FormEmployeePassport
ref="refFormEmployeePassport"
v-if="group === 'passport' && metadata" v-if="group === 'passport' && metadata"
:title="$t('customerEmployee.form.group.passport')" :title="$t('customerEmployee.form.group.passport')"
dense dense
@ -545,6 +562,7 @@ function changeCustomerTab(opts: { tab: 'customer' | 'employee' }) {
<FormEmployeeVisa <FormEmployeeVisa
v-if="group === 'visa' && metadata" v-if="group === 'visa' && metadata"
ref="refFormEmployeeVisa"
:title="$t('customerEmployee.form.group.visa')" :title="$t('customerEmployee.form.group.visa')"
ocr ocr
dense dense

View file

@ -52,25 +52,38 @@ function responsiblePerson(quotation: QuotationFull) {
workflowTemplateStepId: string; workflowTemplateStepId: string;
}[] = []; }[] = [];
const userIds = new Set<string>();
const groupKeys = new Set<string>();
for (const v of productServiceList) { for (const v of productServiceList) {
const tempStep = v.service?.workflow?.step; const tempStep = v.service?.workflow?.step;
if (tempStep) { if (tempStep) {
tempStep.forEach((lhs) => { tempStep.forEach((lhs) => {
for (const rhs of lhs.responsiblePerson) { for (const rhs of lhs.responsiblePerson) {
tempPerson.push(rhs.user); if (!userIds.has(rhs.user.id)) {
userIds.add(rhs.user.id);
tempPerson.push(rhs.user);
}
} }
}); });
tempStep.forEach((lhs) => { tempStep.forEach((lhs) => {
const newGroup = lhs.responsibleGroup as unknown as { const newGroup = lhs.responsibleGroup as unknown as {
group: string; group: string;
id: string; id: string;
workflowTemplateStepId: string; workflowTemplateStepId: string;
}[]; }[];
for (const rhs of newGroup) { for (const rhs of newGroup) {
tempGroup.push(rhs); const key = `${rhs.group}-${rhs.id}-${rhs.workflowTemplateStepId}`;
if (!groupKeys.has(key)) {
groupKeys.add(key);
tempGroup.push(rhs);
}
} }
}); });
return { user: tempPerson, group: tempGroup }; return { user: tempPerson, group: tempGroup };
} }
} }