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" :disable="readonly"
icon="mdi-upload" icon="mdi-upload"
color="info" color="info"
label="อัปโหลดเอกสาร" :label="$t('general.uploadFile')"
@click=" @click="
() => { () => {
currentIndex = obj.length; currentIndex = obj.length;

View file

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

View file

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

View file

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