refactor: add i18n

This commit is contained in:
Net 2024-09-25 10:55:06 +07:00
parent 9efe220548
commit 32975adeeb
4 changed files with 36 additions and 12 deletions

View file

@ -181,7 +181,7 @@ function deleteFileOfBranch(filename: string, index: number) {
:disable="readonly"
icon="mdi-upload"
color="info"
label="อัปโหลดเอกสาร"
:label="$t('general.uploadFile')"
@click="
() => {
currentIndex = obj.length;

View file

@ -21,11 +21,13 @@ const obj = defineModel<
default: [],
});
const modalDialog = ref(false);
const modalDialog = ref<boolean>(false);
const splitAttachment = ref(50);
const splitAttachment = ref<number>(50);
const currentIndex = ref(-1);
const currentIndex = ref<number>(-1);
const statusOcr = ref<boolean>(false);
const props = defineProps<{
ocr?: (
@ -112,16 +114,17 @@ async function change(e: Event) {
}
};
const statusOcr = await props.ocr?.(selectedMenu.value?.value, _file);
statusOcr.value = true;
const resOcr = await props.ocr?.(selectedMenu.value?.value, _file);
if (statusOcr?.status) {
if (resOcr?.status) {
modalDialog.value = true;
const map = statusOcr.meta.reduce<Record<string, string>>((a, c) => {
const map = resOcr.meta.reduce<Record<string, string>>((a, c) => {
a[c.name] = c.value;
return a;
}, {});
if (statusOcr.group === 'citizen') {
if (resOcr.group === 'citizen') {
obj.value[currentIndex.value]._meta = {
citizenId: map['citizen_id'],
firstName: map['firstname'],
@ -135,7 +138,7 @@ async function change(e: Event) {
};
}
if (statusOcr.group === 'passport') {
if (resOcr.group === 'passport') {
obj.value[currentIndex.value]._meta = {
type: map['type'],
number: map['passport_no'],
@ -144,7 +147,7 @@ async function change(e: Event) {
};
}
if (statusOcr.group === 'visa') {
if (resOcr.group === 'visa') {
obj.value[currentIndex.value]._meta = {
type: map['visa_type'],
number: map['visa_no'],
@ -153,6 +156,8 @@ async function change(e: Event) {
issuePlace: map['issue_place'],
};
}
statusOcr.value = false;
}
}
}
@ -180,7 +185,7 @@ defineEmits<{
:disable="readonly"
icon="mdi-upload"
color="info"
label="อัปโหลดเอกสาร"
:label="$t('general.uploadFile')"
>
<q-list v-for="(v, i) in menu" :key="v.value">
<q-item
@ -289,6 +294,12 @@ defineEmits<{
</template>
</slot>
</div>
<q-inner-loading
:showing="statusOcr"
label="Please wait..."
label-class="text-teal"
label-style="font-size: 1.1em"
/>
</div>
<DialogForm
edit

View file

@ -141,6 +141,13 @@ export default {
businessName: 'Name Used for Business',
romanCharacters: 'Roman Characters',
},
noticeJobEmployment: {
permitNumber: 'Work Permit Number',
jobDescription: 'Job Description',
workplace: 'Workplace',
dateOfHire: 'Date of Hire',
},
title: {
info: '{name}',
create: 'Create {name}',

View file

@ -54,7 +54,7 @@ export default {
age: 'อายุ',
nationality: 'สัญชาติ',
times: 'ครั้งที่ {number}',
uploadFile: 'อัปโหลดไฟล์',
uploadFile: 'อัปโหลดเอกสาร',
typeBranch: 'ประเภทสาขา',
branchStatus: 'สถานะสาขา',
success: 'สำเร็จ',
@ -141,6 +141,12 @@ export default {
businessName: 'ชื่อที่ใช้ในการประกอบพาณิชย์',
romanCharacters: 'อักษรโรมัน',
},
noticeJobEmployment: {
permitNumber: 'หมายเลขใบอนุญาตทำงาน ',
jobDescription: 'ลักษณะงาน',
workplace: 'สถานที่ทำงาน',
dateOfHire: 'วันที่จ้าง',
},
title: {
info: '{name}',
create: 'สร้าง {name}',