refactor: แก้ field ลูกจ้าง

This commit is contained in:
Net 2024-07-16 11:27:47 +07:00
parent 6e1e10d11a
commit 889a78e52b

View file

@ -80,24 +80,19 @@ const columnsEmployee = [
field: 'firstName', field: 'firstName',
sortable: true, sortable: true,
}, },
{
name: 'type',
align: 'left',
label: 'type',
field: 'type',
sortable: true,
},
{ {
name: 'formDialogInputNationality', name: 'formDialogInputNationality',
align: 'left', align: 'left',
label: 'formDialogInputNationality', label: 'formDialogInputNationality',
field: 'nationality', field: 'nationality',
}, },
{ {
name: 'formDialogEmployeeNRCNo', name: 'formDialogInputPassportNo',
align: 'left', align: 'left',
label: 'formDialogEmployeeNRCNo', label: 'formDialogInputPassportNo',
field: 'nrcNo', field: 'passportNumber',
}, },
{ {
name: 'formDialogInputAge', name: 'formDialogInputAge',
@ -106,12 +101,34 @@ const columnsEmployee = [
field: 'dateOfBirth', field: 'dateOfBirth',
}, },
{
name: 'passportExpiryDate',
align: 'left',
label: 'passportExpire',
field: 'passportExpiryDate',
},
{
name: 'formDialogEmployeeNRCNo',
align: 'left',
label: 'formDialogEmployeeNRCNo',
field: 'nrcNo',
},
{ {
name: 'branchLabel', name: 'branchLabel',
align: 'left', align: 'left',
label: 'branchLabel', label: 'branchLabel',
field: 'customerBranch', field: 'customerBranch',
}, },
{
name: 'type',
align: 'left',
label: 'type',
field: 'type',
sortable: true,
},
] satisfies QTableProps['columns']; ] satisfies QTableProps['columns'];
const columnsCustomer = [ const columnsCustomer = [
@ -256,30 +273,36 @@ const fieldDisplayEmployee = ref<
label: t('nameEmployee'), label: t('nameEmployee'),
value: 'firstName', value: 'firstName',
}, },
{
label: t('type'),
value: 'type',
},
{ {
label: t('formDialogInputNationality'), label: t('formDialogInputNationality'),
value: 'formDialogInputNationality', value: 'formDialogInputNationality',
}, },
{ {
label: t('formDialogEmployeeNRCNo'), label: t('formDialogInputPassportNo'),
value: 'formDialogEmployeeNRCNo', value: 'formDialogInputPassportNo',
}, },
{ {
label: t('formDialogInputAge'), label: t('formDialogInputAge'),
value: 'formDialogInputAge', value: 'formDialogInputAge',
}, },
{
label: t('passportExpire'),
value: 'passportExpiryDate',
},
{
label: t('formDialogEmployeeNRCNo'),
value: 'formDialogEmployeeNRCNo',
},
{ {
label: t('branchLabel'), label: t('branchLabel'),
value: 'branchLabel', value: 'branchLabel',
}, },
{
label: t('type'),
value: 'type',
},
]); ]);
const fieldSelected = ref< const fieldSelected = ref<
@ -291,19 +314,22 @@ const fieldSelected = ref<
| 'branchEmail' | 'branchEmail'
| 'firstName' | 'firstName'
| 'formDialogInputNationality' | 'formDialogInputNationality'
| 'formDialogInputPassportNo'
| 'passportExpiryDate'
| 'formDialogEmployeeNRCNo' | 'formDialogEmployeeNRCNo'
| 'formDialogInputAge' | 'formDialogInputAge'
| 'branchLabel' | 'branchLabel'
)[] )[]
>([ >([
'customerName', 'customerName',
'type',
'personName', 'personName',
'telephoneNo', 'telephoneNo',
'branchEmail', 'branchEmail',
'firstName', 'firstName',
'formDialogInputNationality', 'formDialogInputNationality',
'formDialogInputNationality', 'formDialogInputPassportNo',
'passportExpiryDate',
'type',
'formDialogEmployeeNRCNo', 'formDialogEmployeeNRCNo',
'formDialogInputAge', 'formDialogInputAge',
'branchLabel', 'branchLabel',
@ -2287,7 +2313,7 @@ watch([inputSearch, currentStatus], async () => {
<div <div
v-if="listEmployee.length === 0" v-if="listEmployee.length === 0"
class="row full-width items-center justify-center col" class="row full-width items-center justify-center col"
style="min-height: 250px" style="min-height: 250px; flex-wrap: nowrap"
> >
<NoData :not-found="!!inputSearch" /> <NoData :not-found="!!inputSearch" />
</div> </div>
@ -2314,10 +2340,10 @@ watch([inputSearch, currentStatus], async () => {
v-for="col in props.cols" v-for="col in props.cols"
:key="col.name" :key="col.name"
:props="props" :props="props"
st
> >
{{ $t(col.label) }} {{ $t(col.label) }}
</q-th> </q-th>
<q-th auto-width />
</q-tr> </q-tr>
</template> </template>
@ -2343,7 +2369,10 @@ watch([inputSearch, currentStatus], async () => {
" "
> >
<q-td v-if="fieldSelected.includes('firstName')"> <q-td v-if="fieldSelected.includes('firstName')">
<div class="row items-center"> <div
class="row items-center"
style="flex-wrap: nowrap"
>
<div <div
style=" style="
width: 50px; width: 50px;
@ -2395,11 +2424,7 @@ watch([inputSearch, currentStatus], async () => {
</div> </div>
</div> </div>
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('type')">
<span class="tags tags__pink">
{{ $t('EMPLOYEE') }}
</span>
</q-td>
<q-td <q-td
v-if=" v-if="
fieldSelected.includes('formDialogInputNationality') fieldSelected.includes('formDialogInputNationality')
@ -2407,6 +2432,27 @@ watch([inputSearch, currentStatus], async () => {
> >
{{ props.row.nationality || '-' }} {{ props.row.nationality || '-' }}
</q-td> </q-td>
<q-td
v-if="
fieldSelected.includes('formDialogInputPassportNo')
"
>
{{ props.row.passportNumber || '-' }}
</q-td>
<q-td
v-if="fieldSelected.includes('formDialogInputAge')"
>
{{ calculateAge(props.row.dateOfBirth) }}
</q-td>
<q-td
v-if="fieldSelected.includes('passportExpiryDate')"
>
{{ calculateAge(props.row.passportExpiryDate) }}
</q-td>
<q-td <q-td
v-if=" v-if="
fieldSelected.includes('formDialogEmployeeNRCNo') fieldSelected.includes('formDialogEmployeeNRCNo')
@ -2414,11 +2460,6 @@ watch([inputSearch, currentStatus], async () => {
> >
{{ props.row.nrcNo || '-' }} {{ props.row.nrcNo || '-' }}
</q-td> </q-td>
<q-td
v-if="fieldSelected.includes('formDialogInputAge')"
>
{{ calculateAge(props.row.dateOfBirth) }}
</q-td>
<q-td <q-td
v-if="fieldSelected.includes('formDialogInputAge')" v-if="fieldSelected.includes('formDialogInputAge')"
@ -2438,6 +2479,12 @@ watch([inputSearch, currentStatus], async () => {
</div> </div>
</div> </div>
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('type')">
<span class="tags tags__pink">
{{ $t('EMPLOYEE') }}
</span>
</q-td>
<q-td> <q-td>
<q-btn <q-btn
icon="mdi-eye-outline" icon="mdi-eye-outline"