refactor: return mode from slot

This commit is contained in:
Net 2024-08-28 13:42:28 +07:00 committed by Methapon Metanipat
parent 7400f9f611
commit 218a2f39d4
2 changed files with 9 additions and 5 deletions

View file

@ -17,6 +17,7 @@ const file = defineModel<
const currentFile = computed(() => file.value.at(currentIndex.value));
const statusOcr = defineModel<boolean>('statusOcr', { default: false });
const currentMode = ref<string>('citizenId');
const currentIndex = ref(0);
const scale = ref(1);
@ -86,6 +87,7 @@ watch(currentFileSelected, () => {
file.value.findIndex((v, i) => {
if (v.url?.includes(currentFileSelected.value)) {
currentIndex.value = i;
currentMode.value = currentFileSelected.value.split('-').at(0) || '';
}
});
});
@ -227,8 +229,7 @@ const { pdf, pages } = usePDF(computed(() => currentFile.value?.url));
class="bordered row items-center justify-between q-pa-sm"
style="height: 50px"
>
อมลหนงสอเดนทาง
{{ $t(`customer.typeFile.${currentMode}`) }}
<div class="row" v-if="!hideAction">
<UndoButton icon-only type="button" />
<SaveButton
@ -245,8 +246,10 @@ const { pdf, pages } = usePDF(computed(() => currentFile.value?.url));
</div>
</div>
<div class="bordered-r bordered-b full-height">
<slot name="form" />
<div class="q-pa-sm bordered-r bordered-b full-height">
<slot name="form" :mode="currentMode" />
{{ currentFileSelected }}
</div>
</div>
</div>

View file

@ -208,8 +208,9 @@ defineProps<{
"
@save="(group: any, file: any) => {}"
>
<template #form>
<template #form="{ mode }">
<FormCitizen
v-if="mode === 'citizenId'"
orc
v-model:citizen-id="item.citizenId"
v-model:birth-date="customer.birthDate"