diff --git a/src/components/TableHistory.vue b/src/components/TableHistory.vue index 87c989b..95d0c05 100644 --- a/src/components/TableHistory.vue +++ b/src/components/TableHistory.vue @@ -9,6 +9,8 @@ import { useChekIn } from '@/stores/chekin' import Popup from '@/components/PopUp.vue' const stores = useChekIn() + +/** props from page */ const props = defineProps({ paging: { type: Boolean, @@ -16,7 +18,7 @@ const props = defineProps({ }, pageSize: { type: Number, - defualt: 25, + defualt: 10, }, page: { type: Number, @@ -90,79 +92,72 @@ async function updatePagination(newPagination: any) { props.changePage(1, newPagination.rowsPerPage, true) initialPagination.value = newPagination } + +/** column history table */ const columns = ref([ { - name: 'date', + name: 'checkInDate', align: 'left', label: 'วัน/เดือน/ปี', sortable: true, - field: 'date', + field: 'checkInDate', headerStyle: 'font-size: 14px', style: 'font-size: 14px; width:15%;', }, { - name: 'in', + name: 'checkInTime', align: 'left', label: 'เวลาเข้างาน', sortable: true, - field: 'in', + field: 'checkInTime', headerStyle: 'font-size: 14px', style: 'font-size: 14px; width:15%;', }, { - name: 'loIn', + name: 'checkInLocation', align: 'left', label: 'พิกัด', sortable: true, - field: 'loIn', + field: 'checkInLocation', headerStyle: 'font-size: 14px', style: 'font-size: 14px', }, { - name: 'out', - align: 'left', - label: 'เวลาออกงาน', - sortable: true, - field: 'out', - headerStyle: 'font-size: 14px', - style: 'font-size: 14px; width:15%;', - }, - { - name: 'loOut', - align: 'left', - label: 'พิกัด', - sortable: true, - field: 'loOut', - headerStyle: 'font-size: 14px', - style: 'font-size: 14px', - }, - { - name: 'Morningstatus', + name: 'checkInStatus', align: 'left', label: 'สถานะช่วงเช้า', sortable: true, - field: 'Morningstatus', + field: 'checkInStatus', headerStyle: 'font-size: 14px', style: 'font-size: 14px; width:15%;', }, { - name: 'AfternoonStatus', + name: 'checkOutTime', + align: 'left', + label: 'เวลาออกงาน', + sortable: true, + field: 'checkOutTime', + headerStyle: 'font-size: 14px', + style: 'font-size: 14px; width:15%;', + }, + { + name: 'checkOutLocation', + align: 'left', + label: 'พิกัด', + sortable: true, + field: 'checkOutLocation', + headerStyle: 'font-size: 14px', + style: 'font-size: 14px', + }, + { + name: 'checkOutStatus', align: 'left', label: 'สถานะช่วงบ่าย', sortable: true, - field: 'AfternoonStatus', + field: 'checkOutStatus', headerStyle: 'font-size: 14px', style: 'font-size: 14px; width:15%;', - }, - { - name: 'status', - align: 'left', - label: 'สถานะ', - sortable: true, - field: 'status', - headerStyle: 'font-size: 14px', - style: 'font-size: 14px; width:10%;', - }, + } ]) // popup const modalPopup = ref(false) @@ -174,9 +169,11 @@ function openPopup(data: any) { titlePopup.value = title dataRow.value = data } + function closePopup() { modalPopup.value = false } + function classStatus(status: string) { switch (status) { case 'ขาดราชการ': @@ -189,11 +186,24 @@ function classStatus(status: string) { break } } + const pagination = ref({ page: 1, - rowsPerPage: 10, + rowsPerPage: 2, }) + +const checkRequestEdit = (checkInStatus: string, checkOutStatus: string) => { + if ( + checkInStatus === 'ขาด' || + checkInStatus === 'สาย' || + checkOutStatus === 'ขาด' || + checkOutStatus === 'สาย' + ) + return true + else false +} + + +