From 2c91afe1628d6ca84dac51d6a7e3ca56042920a5 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Tue, 15 Oct 2024 15:00:25 +0700 Subject: [PATCH] refactor: set value full name at ocr --- src/pages/05_quotation/QuotationForm.vue | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 5e9f641e..e1270495 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -1144,6 +1144,20 @@ watch( newData: { filName: string; value: string }[]; } = { oldData: [], newData: [] }; + if ( + formDataEmployee.gender !== '' && + formDataEmployee.gender !== allMeta['sex'] + ) { + tempValue.oldData.push({ + filName: $t('form.gender'), + value: $t(`general.${formDataEmployee.gender}`), + }); + tempValue.newData.push({ + filName: $t('form.gender'), + value: $t(`general.${allMeta['sex']}`), + }); + } + if (formDataEmployee.firstName !== '') { tempValue.oldData.push({ filName: $t('personnel.form.firstName'), @@ -1177,16 +1191,35 @@ watch( }); } + if (formDataEmployee.nationality !== '') { + tempValue.oldData.push({ + filName: $t('general.nationality'), + value: formDataEmployee.nationality || '', + }); + tempValue.newData.push({ + filName: $t('general.nationality'), + value: allMeta['nationality'], + }); + } + dialogCheckData({ action: async () => { + formDataEmployee.gender = allMeta['sex']; formDataEmployee.firstName = fullName[0]; formDataEmployee.lastName = fullName[1]; formDataEmployee.passportNo = allMeta['doc_number']; + formDataEmployee.nationality = allMeta['nationality']; }, checkData: () => { return tempValue; }, cancel: () => { + if (!formDataEmployee.firstName) { + formDataEmployee.gender = allMeta['gender']; + } + if (!formDataEmployee.firstName) { + formDataEmployee.firstName = fullName[0]; + } if (!formDataEmployee.firstName) { formDataEmployee.firstName = fullName[0]; } @@ -1196,6 +1229,9 @@ watch( if (!formDataEmployee.passportNo) { formDataEmployee.passportNo = allMeta['doc_number']; } + if (!formDataEmployee.nationality) { + formDataEmployee.nationality = allMeta['nationality']; + } }, }); } @@ -1284,6 +1320,9 @@ watch( :readonly="!isEdit" v-model:passport-type="meta.type" v-model:passport-number="meta.number" + v-model:gender="meta.gender" + v-model:first-name="meta.firstName" + v-model:last-name="meta.lastName" v-model:passport-issue-date="meta.issueDate" v-model:passport-expiry-date="meta.expireDate" v-model:passport-issuing-place="meta.issuePlace"