2023-11-14 17:47:43 +07:00
|
|
|
<script setup lang="ts">
|
2023-11-15 11:04:14 +07:00
|
|
|
import { ref, watch } from 'vue'
|
2023-11-14 17:47:43 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
import { useCounterMixin } from '@/stores/mixin'
|
2023-11-14 17:47:43 +07:00
|
|
|
import { useChekIn } from '@/stores/chekin'
|
|
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
import type { QTableProps } from 'quasar'
|
|
|
|
|
import type { Pagination, DataCheckIn } from '@/interface/index/Main'
|
|
|
|
|
|
|
|
|
|
import Popup from '@/components/PopUp.vue' // dialog เพิ่ม/ขอแก้ไขลงเวลากรณีพิเศษ
|
|
|
|
|
const { date2Thai } = useCounterMixin()
|
2024-07-09 11:43:20 +07:00
|
|
|
|
2023-11-14 17:47:43 +07:00
|
|
|
const stores = useChekIn()
|
2023-11-21 10:56:37 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
/**
|
|
|
|
|
* props ข้อมูลจาก Components Page HistoryView
|
|
|
|
|
*/
|
2023-11-15 11:04:14 +07:00
|
|
|
const props = defineProps({
|
|
|
|
|
paging: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
pageSize: {
|
|
|
|
|
type: Number,
|
2023-11-21 10:56:37 +07:00
|
|
|
defualt: 10,
|
2023-11-15 11:04:14 +07:00
|
|
|
},
|
|
|
|
|
page: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 1,
|
|
|
|
|
},
|
|
|
|
|
maxPage: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 1,
|
|
|
|
|
},
|
|
|
|
|
total: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 0,
|
|
|
|
|
},
|
2023-11-29 15:28:11 +07:00
|
|
|
tab: {
|
|
|
|
|
type: String,
|
|
|
|
|
defualt: '',
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
2023-11-15 11:04:14 +07:00
|
|
|
fetchData: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log('not function'),
|
|
|
|
|
},
|
|
|
|
|
changePage: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log('not function'),
|
|
|
|
|
},
|
|
|
|
|
})
|
2024-09-02 17:37:08 +07:00
|
|
|
const emit = defineEmits(['update:change-page'])
|
2023-11-15 11:04:14 +07:00
|
|
|
|
2023-11-29 15:28:11 +07:00
|
|
|
const keyword = ref<string>('')
|
|
|
|
|
const tab = ref<string>(props.tab?.toString())
|
2024-09-02 17:37:08 +07:00
|
|
|
const selected = ref<string[]>([])
|
2023-11-24 18:12:56 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
// column history table
|
2024-01-25 15:23:27 +07:00
|
|
|
const columns = ref<QTableProps['columns']>(
|
|
|
|
|
props.tab == 'history'
|
|
|
|
|
? [
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInDate',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'วัน/เดือน/ปี',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInDate',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInTime',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'เวลาเข้างาน',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInTime',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInLocation',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'พิกัด',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInLocation',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInStatus',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'สถานะช่วงเช้า',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInStatus',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkOutTime',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'เวลาออกงาน',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkOutTime',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
2025-07-07 13:26:21 +07:00
|
|
|
format: (val: string, row: DataCheckIn) => {
|
|
|
|
|
return row.checkOutStatus != '-' && val ? val : '-'
|
|
|
|
|
},
|
2024-01-25 15:23:27 +07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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: 'checkOutStatus',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
: [
|
|
|
|
|
{
|
2024-07-09 11:43:20 +07:00
|
|
|
name: 'checkInDateTime',
|
2024-01-25 15:23:27 +07:00
|
|
|
align: 'left',
|
|
|
|
|
label: 'วัน/เดือน/ปี',
|
|
|
|
|
sortable: true,
|
2024-07-09 11:43:20 +07:00
|
|
|
field: (v) => date2Thai(v.checkInDateTime),
|
2024-01-25 15:23:27 +07:00
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInTime',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'เวลาเข้างาน',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInTime',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkInLocation',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'พิกัด',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkInLocation',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkOutTime',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'เวลาออกงาน',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkOutTime',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px; width:15%;',
|
2025-07-07 13:26:21 +07:00
|
|
|
format: (val: string, row: DataCheckIn) => {
|
|
|
|
|
return row.checkOutStatus != '-' && val ? val : '-'
|
|
|
|
|
},
|
2024-01-25 15:23:27 +07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'checkOutLocation',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'พิกัด',
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: 'checkOutLocation',
|
|
|
|
|
headerStyle: 'font-size: 14px',
|
|
|
|
|
style: 'font-size: 14px',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
)
|
2023-11-24 18:12:56 +07:00
|
|
|
const visibleColumns = ref<string[]>([
|
2024-07-09 11:43:20 +07:00
|
|
|
'checkInDateTime',
|
2023-11-24 18:12:56 +07:00
|
|
|
'checkInDate',
|
|
|
|
|
'checkInTime',
|
|
|
|
|
'checkInLocation',
|
|
|
|
|
'checkInStatus',
|
|
|
|
|
'checkOutTime',
|
|
|
|
|
'checkOutLocation',
|
|
|
|
|
'checkOutStatus',
|
|
|
|
|
])
|
2024-07-09 11:43:20 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
const currentPage = ref<number>(1) //หน้าปัจจุบัน
|
2024-07-09 11:43:20 +07:00
|
|
|
// Pagination - initial pagination
|
2024-09-02 17:37:08 +07:00
|
|
|
const initialPagination = ref<Pagination>({
|
2024-07-09 11:43:20 +07:00
|
|
|
sortBy: null,
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: props.pageSize, // set ตาม page หลักส่งมา
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Pagination - update rowsPerPage
|
2024-09-02 17:37:08 +07:00
|
|
|
async function updatePagination(newPagination: Pagination) {
|
2024-07-09 11:43:20 +07:00
|
|
|
initialPagination.value = newPagination
|
|
|
|
|
currentPage.value = 1 // set current page เป็น 1 เสมอเมื่อเปลี่ยน per row
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function filterFn() {
|
2024-09-02 17:37:08 +07:00
|
|
|
// ส่งอีเวนต์ 'update:change-page' เมื่อหน้าเปลี่ยนแปลง
|
2024-07-09 11:43:20 +07:00
|
|
|
emit(
|
|
|
|
|
'update:change-page',
|
|
|
|
|
1,
|
|
|
|
|
initialPagination.value.rowsPerPage,
|
|
|
|
|
keyword.value
|
|
|
|
|
)
|
|
|
|
|
}
|
2024-09-02 17:37:08 +07:00
|
|
|
const modalPopup = ref<boolean>(false) // popup แก้ไขลงเวลา
|
|
|
|
|
const titlePopup = ref<string>('') // หัวขข้อ popup แก้ไขลงเวลา
|
|
|
|
|
const dataRow = ref<DataCheckIn>() // ข้อมูลการลงเวลา
|
2024-07-09 11:43:20 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
/**
|
|
|
|
|
* เปิด popup แก้ไขลงเวลา
|
|
|
|
|
* กำหนดค่า titlePopup เป็น แก้ไขลงเวลา
|
|
|
|
|
* @param data ข้อมูลการลงเวลา
|
|
|
|
|
*/
|
|
|
|
|
function openPopup(data: DataCheckIn) {
|
2023-11-14 17:47:43 +07:00
|
|
|
const title = 'แก้ไขลงเวลา'
|
|
|
|
|
modalPopup.value = true
|
|
|
|
|
titlePopup.value = title
|
|
|
|
|
dataRow.value = data
|
|
|
|
|
}
|
2023-11-21 10:56:37 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
/**
|
|
|
|
|
* ปิด popup แก้ไขลงเวลา
|
|
|
|
|
*/
|
2023-11-14 17:47:43 +07:00
|
|
|
function closePopup() {
|
|
|
|
|
modalPopup.value = false
|
|
|
|
|
}
|
2023-11-21 10:56:37 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
/**
|
|
|
|
|
* ฟังก์ชั่นสำหรับ convert ข้อความสถานะของการลงเวลา ปกติ, ขาดราชการ หรือสาย
|
|
|
|
|
* @param status ฟิลด์สถานะ
|
|
|
|
|
* @returns ข้อความสถานะ ปกติ, ขาดราชการ ,สาย หรือปฏิบัติงานไม่ครบตามกำหนดเวลา
|
|
|
|
|
*/
|
2023-11-14 17:47:43 +07:00
|
|
|
function classStatus(status: string) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 'ขาดราชการ':
|
|
|
|
|
return 'text-red'
|
|
|
|
|
case 'ปกติ':
|
|
|
|
|
return 'text-blue'
|
|
|
|
|
case 'สาย':
|
|
|
|
|
return 'text-yellow-8'
|
2024-01-16 14:26:00 +07:00
|
|
|
case 'ปฏิบัติงานไม่ครบตามกำหนดเวลา':
|
|
|
|
|
return 'text-orange-8'
|
2023-11-14 17:47:43 +07:00
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-08 17:09:15 +07:00
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
const modalReject = ref<boolean>(false) // modal popup หมายเหตุการไม่อนุมัติ
|
|
|
|
|
const reasonRejrct = ref<string>('') // หมายเหตุการไม่อนุมัติ
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* เปิด popup หมายเหตุการไม่อนุมัติ
|
|
|
|
|
* @param data ข้อมูลการลงเวลา
|
|
|
|
|
*/
|
|
|
|
|
function onClickOpenPopupRejrct(data: DataCheckIn) {
|
2023-12-08 17:09:15 +07:00
|
|
|
if (data.editStatus === 'ไม่อนุมัติ') {
|
|
|
|
|
reasonRejrct.value = data.editReason
|
|
|
|
|
modalReject.value = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-02 17:37:08 +07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* watch currentPage และ rowsPerPage
|
|
|
|
|
*/
|
|
|
|
|
watch(
|
|
|
|
|
[() => currentPage.value, () => initialPagination.value.rowsPerPage],
|
|
|
|
|
() => {
|
|
|
|
|
// ส่งอีเวนต์ 'update:change-page' เมื่อหน้าเปลี่ยนแปลง
|
|
|
|
|
emit(
|
|
|
|
|
'update:change-page',
|
|
|
|
|
currentPage.value,
|
|
|
|
|
initialPagination.value.rowsPerPage,
|
|
|
|
|
keyword.value
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-11-14 17:47:43 +07:00
|
|
|
</script>
|
2023-11-21 10:56:37 +07:00
|
|
|
|
2023-11-14 17:47:43 +07:00
|
|
|
<template>
|
2023-11-24 18:12:56 +07:00
|
|
|
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
|
|
|
|
<q-space />
|
|
|
|
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
|
|
|
|
<q-input
|
|
|
|
|
for="filterTable"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="keyword"
|
|
|
|
|
label="ค้นหา"
|
|
|
|
|
@keydown.enter.prevent="filterFn"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon name="search" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
|
|
|
|
<q-select
|
|
|
|
|
for="visibleColumns"
|
|
|
|
|
v-model="visibleColumns"
|
|
|
|
|
multiple
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
options-dense
|
|
|
|
|
:display-value="$q.lang.table.columns"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
:options="columns"
|
|
|
|
|
option-value="name"
|
2024-11-05 16:47:26 +07:00
|
|
|
style="min-width: 140px"
|
2023-11-24 18:12:56 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-09-02 17:37:08 +07:00
|
|
|
|
2023-11-14 17:47:43 +07:00
|
|
|
<q-table
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
class="custom-table2"
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:rows="stores.rows"
|
2023-11-24 18:12:56 +07:00
|
|
|
:visible-columns="visibleColumns"
|
2023-11-14 17:47:43 +07:00
|
|
|
virtual-scroll
|
2023-11-22 11:40:21 +07:00
|
|
|
v-model:selected="selected"
|
2023-11-14 17:47:43 +07:00
|
|
|
:virtual-scroll-sticky-size-start="48"
|
|
|
|
|
:style="$q.screen.gt.xs ? 'max-height: 64vh' : ''"
|
2023-11-27 12:16:25 +07:00
|
|
|
:rows-per-page-options="[10, 25, 50, 100]"
|
2023-11-14 17:47:43 +07:00
|
|
|
:grid="$q.screen.gt.xs ? false : true"
|
2023-11-22 11:40:21 +07:00
|
|
|
:pagination="initialPagination"
|
2023-11-15 11:04:14 +07:00
|
|
|
@update:pagination="updatePagination"
|
2023-11-14 17:47:43 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
|
|
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width> </q-th>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr :props="props" class="cursor-pointer">
|
|
|
|
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<div
|
2023-11-21 10:56:37 +07:00
|
|
|
v-if="col.name === 'checkInStatus'"
|
|
|
|
|
:class="classStatus(props.row.checkInStatus)"
|
2023-11-14 17:47:43 +07:00
|
|
|
>
|
2023-11-21 10:56:37 +07:00
|
|
|
{{ props.row.checkInStatus }}
|
2023-11-14 17:47:43 +07:00
|
|
|
</div>
|
|
|
|
|
<div
|
2023-11-21 10:56:37 +07:00
|
|
|
v-else-if="col.name === 'checkOutStatus'"
|
|
|
|
|
:class="classStatus(props.row.checkOutStatus)"
|
2023-11-14 17:47:43 +07:00
|
|
|
>
|
2023-11-21 10:56:37 +07:00
|
|
|
{{ props.row.checkOutStatus }}
|
2023-11-14 17:47:43 +07:00
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
2024-07-09 11:43:20 +07:00
|
|
|
{{ col.value ?? '-' }}
|
2023-11-14 17:47:43 +07:00
|
|
|
</div>
|
|
|
|
|
</q-td>
|
2023-11-29 15:28:11 +07:00
|
|
|
<q-td v-if="tab === 'history'">
|
2023-11-14 17:47:43 +07:00
|
|
|
<q-btn
|
2025-03-19 15:51:36 +07:00
|
|
|
v-if="
|
|
|
|
|
!props.row.isEdit &&
|
2025-05-26 17:17:04 +07:00
|
|
|
((props.row.checkInStatus != 'ปกติ' &&
|
|
|
|
|
props.row.checkInStatus != '-') ||
|
|
|
|
|
(props.row.checkOutStatus != 'ปกติ' &&
|
|
|
|
|
props.row.checkOutStatus != '-'))
|
2025-03-19 15:51:36 +07:00
|
|
|
"
|
2023-11-21 10:56:37 +07:00
|
|
|
style="min-width: 110px"
|
2023-11-14 17:47:43 +07:00
|
|
|
outline
|
|
|
|
|
icon="edit"
|
|
|
|
|
size="12px"
|
|
|
|
|
label="ขอแก้ไข"
|
|
|
|
|
color="cyan-6"
|
|
|
|
|
@click="openPopup(props.row)"
|
|
|
|
|
/>
|
2023-11-29 15:28:11 +07:00
|
|
|
</q-td>
|
2023-12-08 17:09:15 +07:00
|
|
|
<q-td
|
|
|
|
|
v-else-if="tab === 'time'"
|
|
|
|
|
@click="onClickOpenPopupRejrct(props.row)"
|
|
|
|
|
>
|
2023-11-27 14:39:45 +07:00
|
|
|
<q-chip
|
|
|
|
|
:color="`${stores.classColorStatus(props.row.editStatus)}-2`"
|
|
|
|
|
:text-color="`${stores.classColorStatus(props.row.editStatus)}-7`"
|
|
|
|
|
>{{ props.row.editStatus }}</q-chip
|
|
|
|
|
>
|
2023-11-14 17:47:43 +07:00
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
2023-11-21 10:56:37 +07:00
|
|
|
|
|
|
|
|
<!-- กรณีแสดงผลบน mobile -->
|
2023-11-14 17:47:43 +07:00
|
|
|
<template #item="props">
|
|
|
|
|
<div
|
|
|
|
|
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
|
|
|
|
|
>
|
|
|
|
|
<q-card bordered flat class="q-py-sm shadow-0">
|
|
|
|
|
<q-list dense>
|
|
|
|
|
<q-item v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label caption>{{ col.label }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section side>
|
|
|
|
|
<q-item-label>
|
|
|
|
|
<span
|
2023-11-21 10:56:37 +07:00
|
|
|
v-if="col.name == 'checkInStatus'"
|
|
|
|
|
:class="classStatus(props.row.checkInStatus)"
|
2023-11-14 17:47:43 +07:00
|
|
|
>{{ col.value }}</span
|
|
|
|
|
>
|
|
|
|
|
<span
|
2023-11-21 10:56:37 +07:00
|
|
|
v-else-if="col.name == 'checkOutStatus'"
|
|
|
|
|
:class="classStatus(props.row.checkOutStatus)"
|
2023-11-14 17:47:43 +07:00
|
|
|
>{{ col.value }}</span
|
|
|
|
|
>
|
|
|
|
|
<span v-else class="text-black">{{ col.value }} </span>
|
|
|
|
|
</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-separator />
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
<q-card-section>
|
2023-11-29 15:28:11 +07:00
|
|
|
<div class="row" v-if="tab === 'history'">
|
2025-03-21 18:07:28 +07:00
|
|
|
<div
|
|
|
|
|
class="col"
|
|
|
|
|
v-if="
|
|
|
|
|
!props.row.isEdit &&
|
2025-05-29 09:29:31 +07:00
|
|
|
((props.row.checkInStatus != 'ปกติ' &&
|
|
|
|
|
props.row.checkInStatus != '-') ||
|
|
|
|
|
(props.row.checkOutStatus != 'ปกติ' &&
|
|
|
|
|
props.row.checkOutStatus != '-'))
|
2025-03-21 18:07:28 +07:00
|
|
|
"
|
|
|
|
|
>
|
2023-11-14 17:47:43 +07:00
|
|
|
<q-btn
|
|
|
|
|
class="full-width text-cen"
|
|
|
|
|
outline
|
|
|
|
|
icon="edit"
|
|
|
|
|
label="ขอแก้ไข"
|
|
|
|
|
color="info"
|
2024-01-19 15:34:09 +07:00
|
|
|
size="12px"
|
2023-11-14 17:47:43 +07:00
|
|
|
@click="openPopup(props.row)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-11-29 15:28:11 +07:00
|
|
|
</div>
|
|
|
|
|
|
2023-12-08 17:09:15 +07:00
|
|
|
<div
|
|
|
|
|
class="row"
|
|
|
|
|
v-else-if="tab === 'time'"
|
|
|
|
|
@click="onClickOpenPopupRejrct(props.row)"
|
|
|
|
|
>
|
2023-11-29 15:28:11 +07:00
|
|
|
<div>
|
2023-11-14 17:47:43 +07:00
|
|
|
<q-chip
|
2023-11-27 14:39:45 +07:00
|
|
|
:color="`${stores.classColorStatus(props.row.editStatus)}-2`"
|
2023-11-14 17:47:43 +07:00
|
|
|
:text-color="`${stores.classColorStatus(
|
2023-11-27 14:39:45 +07:00
|
|
|
props.row.editStatus
|
2023-11-14 17:47:43 +07:00
|
|
|
)}-7`"
|
|
|
|
|
>
|
2023-11-27 14:39:45 +07:00
|
|
|
{{ props.row.editStatus }}
|
2023-11-14 17:47:43 +07:00
|
|
|
</q-chip>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card-section>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-11-27 14:39:45 +07:00
|
|
|
<template v-slot:pagination>
|
2023-11-22 11:40:21 +07:00
|
|
|
ทั้งหมด {{ props.total }} รายการ
|
|
|
|
|
<q-pagination
|
|
|
|
|
v-model="currentPage"
|
|
|
|
|
active-color="primary"
|
|
|
|
|
color="dark"
|
|
|
|
|
:max-pages="5"
|
|
|
|
|
size="sm"
|
|
|
|
|
boundary-links
|
|
|
|
|
direction-links
|
|
|
|
|
:max="Number(props.maxPage)"
|
|
|
|
|
></q-pagination>
|
2023-11-14 17:47:43 +07:00
|
|
|
</template>
|
|
|
|
|
</q-table>
|
|
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
<!-- หมายเหตุการไม่อนุมัติ -->
|
2023-12-08 17:09:15 +07:00
|
|
|
<q-dialog v-model="modalReject">
|
|
|
|
|
<q-card style="width: 35vw; max-width: 35vw">
|
|
|
|
|
<q-toolbar>
|
|
|
|
|
<q-toolbar-title class="text-subtitle2 text-bold"
|
|
|
|
|
>หมายเหตุการไม่อนุมัติ</q-toolbar-title
|
|
|
|
|
>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="close"
|
|
|
|
|
unelevated
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
style="color: #ff8080; background-color: #ffdede"
|
|
|
|
|
v-close-popup
|
|
|
|
|
/>
|
|
|
|
|
</q-toolbar>
|
|
|
|
|
<q-form ref="myForm">
|
|
|
|
|
<q-separator />
|
|
|
|
|
<q-card-section class="q-pa-md bg-grey-1">
|
|
|
|
|
<div class="row col-12">{{ reasonRejrct }}</div>
|
|
|
|
|
</q-card-section>
|
|
|
|
|
</q-form>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-dialog>
|
|
|
|
|
|
2024-09-02 17:37:08 +07:00
|
|
|
<!-- แก้ไขลงเวลา -->
|
2023-11-14 17:47:43 +07:00
|
|
|
<Popup
|
2024-09-02 17:37:08 +07:00
|
|
|
:fetch-data="props.fetchData"
|
2023-11-14 17:47:43 +07:00
|
|
|
:modal="modalPopup"
|
2024-09-02 17:37:08 +07:00
|
|
|
:click-close="closePopup"
|
2023-11-14 17:47:43 +07:00
|
|
|
:title="titlePopup"
|
2024-09-02 17:37:08 +07:00
|
|
|
:data-ById="dataRow"
|
2025-03-19 15:51:36 +07:00
|
|
|
action="edit"
|
2023-11-14 17:47:43 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.icon-color {
|
|
|
|
|
color: #4154b3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.items-center {
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-table2 {
|
|
|
|
|
.q-table tr:nth-child(odd) td {
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table tr:nth-child(even) td {
|
|
|
|
|
background: #f8f8f8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr {
|
|
|
|
|
background: #ecebeb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr th {
|
|
|
|
|
position: sticky;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table td:nth-of-type(2) {
|
|
|
|
|
z-index: 3 !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table th:nth-of-type(2),
|
|
|
|
|
.q-table td:nth-of-type(2) {
|
|
|
|
|
position: sticky;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* this will be the loading indicator */
|
|
|
|
|
.q-table thead tr:last-child th {
|
|
|
|
|
/* height of all previous header rows */
|
|
|
|
|
top: 48px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr:first-child th {
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
.text-caption {
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.q-card-section-last {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
</style>
|