diff --git a/src/components/upload-file/UploadFileGroup.vue b/src/components/upload-file/UploadFileGroup.vue index 27ea34ab..553ee8d4 100644 --- a/src/components/upload-file/UploadFileGroup.vue +++ b/src/components/upload-file/UploadFileGroup.vue @@ -8,6 +8,7 @@ import ShowAttachent from 'src/components/ShowAttachent.vue'; import DialogForm from 'components/DialogForm.vue'; const isEdit = ref(false); +const allMeta = ref>(); const { t } = useI18n(); const obj = defineModel< { @@ -125,6 +126,8 @@ async function change(e: Event) { return a; }, {}); + allMeta.value = map; + if (resOcr.group === 'citizen') { obj.value[currentIndex.value]._meta = { citizenId: map['citizen_id'], @@ -176,7 +179,7 @@ async function fileList() { } defineEmits<{ - (e: 'submit', obj: any): void; + (e: 'submit', obj: any, allMate: Record | undefined): void; }>(); @@ -362,6 +365,7 @@ defineEmits<{ fileList(); } } + $emit('submit', obj[currentIndex].group, allMeta); } " > diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index a1bf6355..3ac1e9c1 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n'; import { storeToRefs } from 'pinia'; import { useQuasar } from 'quasar'; import { nextTick, onBeforeMount, onMounted, reactive, ref, watch } from 'vue'; +import { dialog } from 'stores/utils'; // NOTE: Import stores import { setLocale, dateFormat, calculateAge } from 'src/utils/datetime'; @@ -77,7 +78,7 @@ const quotationForm = useQuotationForm(); const employeeStore = useEmployeeStore(); const optionStore = useOptionStore(); const ocrStore = useOcrStore(); -const { locale } = useI18n(); +const { t, locale } = useI18n(); const $q = useQuasar(); const { @@ -203,6 +204,30 @@ const productServiceTableData = ref< }[] >([{ title: '', product: [] }]); +async function dialogWarning( + callback: () => void, + check: () => void | boolean, +) { + const status = check(); + + if (status) { + dialog({ + color: 'warning', + icon: 'mdi-alert', + title: t('form.warning.title'), + actionText: t('general.ok'), + persistent: true, + message: t('form.warning.message'), + action: async () => { + callback(); + }, + cancel: () => {}, + }); + } else { + callback(); + } +} + function convertDataToFormSubmit() { quotationFormData.value.productServiceList = JSON.parse( JSON.stringify( @@ -1041,6 +1066,33 @@ watch( show-title v-model="formDataEmployee.attachment" hide-action + @submit=" + async (group, allMeta) => { + if (allMeta === undefined) return; + + console.log(allMeta); + + if (group === 'passport') { + const fullName = allMeta['full_name'].split(' '); + + await dialogWarning( + () => { + formDataEmployee.firstName = fullName[0]; + formDataEmployee.lastName = fullName[1]; + formDataEmployee.passportNo = allMeta['doc_number']; + }, + () => { + let status = false; + if (formDataEmployee.firstName !== '') status = true; + if (formDataEmployee.lastName !== '') status = true; + if (formDataEmployee.passportNo !== '') status = true; + + return status; + }, + ); + } + } + " :menu="uploadFileListEmployee" :columns="columnsAttachment" :ocr="