refactor: Change the data retrieval method

This commit is contained in:
Net 2024-08-20 18:01:05 +07:00
parent bac245ce8c
commit a990363a38

View file

@ -184,71 +184,34 @@ watch(
() => $q.screen.lt.md && (gridView.value = true), () => $q.screen.lt.md && (gridView.value = true),
); );
const fieldDisplayEmployer = ref<{ label: string; value: string }[]>([ const fieldDisplayCustomer = ref<
{ label: 'corporation', value: 'customerName' },
{ label: 'type', value: 'type' },
{ label: 'name', value: 'personName' },
{ {
label: 'telephone', label: string;
value: 'telephoneNo', value: string;
}, }[]
{ label: 'formDialogInputEmail', value: 'branchEmail' }, >(
]); columnsCustomer
.filter((v) => v.name !== 'action')
.map((v) => ({ label: v.label, value: v.name })),
);
const fieldDisplayEmployee = ref< const fieldDisplayEmployee = ref<
{ {
label: string; label: string;
value: string; value: string;
}[] }[]
>([ >(
{ label: 'nameEmployee', value: 'firstName' }, columnsEmployee
{ label: 'formDialogInputNationality', value: 'formDialogInputNationality' }, .filter((v) => v.name !== 'action')
{ label: 'formDialogInputPassportNo', value: 'formDialogInputPassportNo' }, .map((v) => ({ label: v.label, value: v.name })),
{ label: 'formDialogInputAge', value: 'formDialogInputAge' }, );
{ label: 'passportExpire', value: 'passportExpiryDate' },
{
label: 'formDialogEmployeeNRCNo',
value: 'formDialogEmployeeNRCNo',
},
{ label: 'branchLabel', value: 'branchLabel' },
{ label: 'type', value: 'type' },
]);
const fieldSelected = ref< const fieldSelected = ref<string[]>(
( [
| 'orderNumber' ...columnsEmployee.map((v) => v.name),
| 'customerName' ...columnsCustomer.map((v) => v.name),
| 'businessTypePure' ].filter((v, index, self) => self.indexOf(v) === index),
| 'type' );
| 'personName'
| 'telephoneNo'
| 'branchEmail'
| 'firstName'
| 'formDialogInputNationality'
| 'formDialogInputPassportNo'
| 'passportExpiryDate'
| 'formDialogEmployeeNRCNo'
| 'formDialogInputAge'
| 'branchLabel'
| 'action'
)[]
>([
'orderNumber',
'customerName',
'businessTypePure',
'personName',
'telephoneNo',
'branchEmail',
'firstName',
'formDialogInputNationality',
'formDialogInputPassportNo',
'passportExpiryDate',
'type',
'formDialogEmployeeNRCNo',
'formDialogInputAge',
'branchLabel',
'action',
]);
const registerAbleBranchOption = ref<{ id: string; name: string }[]>(); const registerAbleBranchOption = ref<{ id: string; name: string }[]>();