refactor: handle filter file customer or employee

This commit is contained in:
Thanaphon Frappet 2024-11-25 10:50:52 +07:00
parent 1df27aeed0
commit 29c7186f9a

View file

@ -182,7 +182,8 @@ async function fetchRequestAttachment(type: 'customer' | 'employee') {
} }
const currentListDocument = computed(() => { const currentListDocument = computed(() => {
return props.listDocument.map((v, i) => { return props.listDocument
.map((v, i) => {
const fileIds = attachmentList.value[v] const fileIds = attachmentList.value[v]
? Object.values(attachmentList.value[v]) ? Object.values(attachmentList.value[v])
: []; : [];
@ -197,6 +198,16 @@ const currentListDocument = computed(() => {
? (attributes.value[state.tab]?.[v] ?? docStatus[0]) ? (attributes.value[state.tab]?.[v] ?? docStatus[0])
: docStatus[0], : docStatus[0],
}; };
})
.filter((v) => {
const filterFileCustomer = ['passport', 'visa', 'tm6'];
const filterFileEmployee = ['citizen'];
if (state.tab === 'customer') {
return !filterFileCustomer.includes(v.documentType);
} else {
return !filterFileEmployee.includes(v.documentType);
}
}); });
}); });