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