2023-11-02 16:44:02 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, ref, useAttrs } from "vue";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
|
|
|
|
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
|
|
|
|
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
2023-11-06 15:08:36 +07:00
|
|
|
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
|
2023-11-02 16:44:02 +07:00
|
|
|
|
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
|
const dataSpecialTime = useSpecialTimeStore();
|
|
|
|
|
const { fecthList } = dataSpecialTime;
|
|
|
|
|
const $q = useQuasar(); // show dialog
|
|
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const { hideLoader, monthYear2Thai } = mixin;
|
|
|
|
|
const modalUnapprove = ref(false);
|
2023-11-06 15:08:36 +07:00
|
|
|
const modalApprove = ref(false);
|
|
|
|
|
const detailData = ref<any>();
|
|
|
|
|
const editCheck = ref<string>("");
|
2023-11-02 16:44:02 +07:00
|
|
|
const pagination = ref({
|
|
|
|
|
// sortBy: "desc",
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: 10,
|
|
|
|
|
});
|
|
|
|
|
const dialogTitle = ref<string>("");
|
|
|
|
|
const dialogDesc = ref<string>("");
|
2023-11-06 15:08:36 +07:00
|
|
|
const name = ref<string>("");
|
|
|
|
|
const dateDialog = ref<string>("");
|
|
|
|
|
const dateFixDialog = ref<string>("");
|
2023-11-02 16:44:02 +07:00
|
|
|
const unapprove = async (fullname: string) => {
|
|
|
|
|
dialogTitle.value = " ไม่อนุมัติการลงเวลาพิเศษของ" + fullname;
|
|
|
|
|
name.value = fullname;
|
|
|
|
|
modalUnapprove.value = true;
|
|
|
|
|
};
|
2023-11-06 15:08:36 +07:00
|
|
|
function openModal(data: any, check: string, date: string, dateFix: string) {
|
|
|
|
|
modalApprove.value = true;
|
|
|
|
|
dateDialog.value = date;
|
|
|
|
|
dateFixDialog.value = dateFix;
|
|
|
|
|
editCheck.value = check;
|
|
|
|
|
if (check === "PENDING") {
|
|
|
|
|
detailData.value = data;
|
|
|
|
|
}
|
|
|
|
|
console.log(data);
|
|
|
|
|
}
|
|
|
|
|
const closeDialog = () => {
|
2023-11-02 16:44:02 +07:00
|
|
|
modalUnapprove.value = false;
|
2023-11-06 15:08:36 +07:00
|
|
|
modalApprove.value = false;
|
|
|
|
|
editCheck.value = "PENDING";
|
2023-11-02 16:44:02 +07:00
|
|
|
};
|
|
|
|
|
const clickSave = () => {
|
|
|
|
|
modalUnapprove.value = false;
|
|
|
|
|
};
|
|
|
|
|
// ค้นหาในตาราง
|
|
|
|
|
const filterKeyword = ref<string>("");
|
|
|
|
|
const filterRef = ref<HTMLInputElement | null>(null);
|
|
|
|
|
const resetFilter = () => {
|
|
|
|
|
filterKeyword.value = "";
|
|
|
|
|
if (filterRef.value) {
|
|
|
|
|
filterRef.value.focus();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
fecthList([
|
|
|
|
|
{
|
2023-11-03 15:29:11 +07:00
|
|
|
id: "00000000-0000-0000-0000-000000000000",
|
2023-11-02 16:44:02 +07:00
|
|
|
fullname: "นางสาวณัฐกา ชมสิน",
|
2023-11-03 15:08:53 +07:00
|
|
|
date: "2023-11-01 08:54",
|
2023-11-02 16:44:02 +07:00
|
|
|
dateFix: "2023-10-30",
|
2023-11-03 15:08:53 +07:00
|
|
|
startTimeMorning: "08:00",
|
|
|
|
|
endTimeMorning: "12:00",
|
|
|
|
|
startTimeAfternoon: "08:00",
|
|
|
|
|
endTimeAfternoon: "12:00",
|
|
|
|
|
status: "PENDING",
|
2023-11-06 17:49:30 +07:00
|
|
|
checkInStatus: "normal",
|
|
|
|
|
checkOutStatus: "late",
|
2023-11-07 12:03:20 +07:00
|
|
|
checkIn: "08:00",
|
|
|
|
|
checkOut: "12.00",
|
2023-11-02 16:44:02 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-11-03 15:29:11 +07:00
|
|
|
id: "00000000-0000-0000-0000-000000000000",
|
2023-11-02 16:44:02 +07:00
|
|
|
fullname: "นางสาวรัชภรณ์ ภักดี",
|
2023-11-03 15:08:53 +07:00
|
|
|
date: "2023-10-30 08:55",
|
|
|
|
|
dateFix: "2023-10-29",
|
|
|
|
|
startTimeMorning: "08:00",
|
|
|
|
|
endTimeMorning: "12:00",
|
|
|
|
|
startTimeAfternoon: null,
|
|
|
|
|
endTimeAfternoon: null,
|
|
|
|
|
status: "APPROVE",
|
2023-11-06 17:49:30 +07:00
|
|
|
checkInStatus: "normal",
|
|
|
|
|
checkOutStatus: "late",
|
2023-11-07 12:03:20 +07:00
|
|
|
checkIn: "08:00",
|
|
|
|
|
checkOut: "12.00",
|
2023-11-02 16:44:02 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-11-03 15:29:11 +07:00
|
|
|
id: "00000000-0000-0000-0000-000000000000",
|
2023-11-02 16:44:02 +07:00
|
|
|
fullname: "นางสาวภาพรรณ ลออ",
|
2023-11-03 15:08:53 +07:00
|
|
|
date: "2023-10-31 18:54",
|
2023-11-02 16:44:02 +07:00
|
|
|
dateFix: "2023-10-30",
|
2023-11-03 15:08:53 +07:00
|
|
|
startTimeMorning: null,
|
|
|
|
|
endTimeMorning: null,
|
|
|
|
|
startTimeAfternoon: "13:00",
|
|
|
|
|
endTimeAfternoon: "16:30",
|
|
|
|
|
status: "REJECT",
|
2023-11-06 17:49:30 +07:00
|
|
|
checkInStatus: "normal",
|
|
|
|
|
checkOutStatus: "late",
|
2023-11-07 12:03:20 +07:00
|
|
|
checkIn: "08:00",
|
|
|
|
|
checkOut: "12.00",
|
2023-11-02 16:44:02 +07:00
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
});
|
2023-11-03 15:08:53 +07:00
|
|
|
|
|
|
|
|
const selectedDate = ref<string>("");
|
|
|
|
|
const dateMonth = ref<any>({
|
|
|
|
|
month: new Date().getMonth(),
|
|
|
|
|
year: new Date().getFullYear(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const monthYearThai = (val: any) => {
|
|
|
|
|
if (val == null) return "";
|
|
|
|
|
else return monthYear2Thai(val.month, val.year);
|
|
|
|
|
};
|
2023-11-02 16:44:02 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="toptitle text-dark col-12 row items-center">
|
|
|
|
|
รายการลงเวลากรณีพิเศษ
|
|
|
|
|
</div>
|
|
|
|
|
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md">
|
2023-11-03 15:08:53 +07:00
|
|
|
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
|
|
|
|
<div class="q-gutter-sm">
|
|
|
|
|
<datepicker
|
|
|
|
|
v-model="selectedDate"
|
|
|
|
|
:locale="'th'"
|
|
|
|
|
autoApply
|
|
|
|
|
month-picker
|
|
|
|
|
:enableTimePicker="false"
|
|
|
|
|
>
|
|
|
|
|
<template #year="{ year }">{{ year + 543 }}</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">{{
|
|
|
|
|
parseInt(value + 543)
|
|
|
|
|
}}</template>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<q-input
|
|
|
|
|
:model-value="monthYearThai(dateMonth)"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
style="width: 130px"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="event"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
style="color: var(--q-primary)"
|
|
|
|
|
>
|
|
|
|
|
</q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-space />
|
|
|
|
|
|
|
|
|
|
<q-input
|
|
|
|
|
class="col-xs-12 col-sm-3 col-md-2"
|
|
|
|
|
standout
|
|
|
|
|
dense
|
|
|
|
|
v-model="filterKeyword"
|
|
|
|
|
ref="filterRef"
|
|
|
|
|
outlined
|
|
|
|
|
debounce="300"
|
|
|
|
|
placeholder="ค้นหา"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon v-if="filterKeyword == ''" name="search" />
|
|
|
|
|
<q-icon
|
|
|
|
|
v-if="filterKeyword !== ''"
|
|
|
|
|
name="clear"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="resetFilter"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
|
|
|
|
|
<q-select
|
|
|
|
|
v-model="dataSpecialTime.visibleColumns"
|
|
|
|
|
multiple
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
options-dense
|
|
|
|
|
:display-value="$q.lang.table.columns"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
:options="dataSpecialTime.columns"
|
|
|
|
|
option-value="name"
|
|
|
|
|
options-cover
|
|
|
|
|
style="min-width: 150px"
|
|
|
|
|
class="col-xs-12 col-sm-3 col-md-2"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<d-table
|
|
|
|
|
:columns="dataSpecialTime.columns"
|
|
|
|
|
:rows="dataSpecialTime.rows"
|
|
|
|
|
:filter="filterKeyword"
|
|
|
|
|
row-key="tb-list"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
:paging="true"
|
|
|
|
|
dense
|
|
|
|
|
v-model:pagination="pagination"
|
|
|
|
|
:visible-columns="dataSpecialTime.visibleColumns"
|
|
|
|
|
>
|
|
|
|
|
<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-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 v-if="col.name == 'no'">
|
|
|
|
|
{{ props.rowIndex + 1 }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
|
|
|
|
{{ col.value }}
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td auto-width>
|
|
|
|
|
<q-btn
|
|
|
|
|
v-if="props.row.status == 'PENDING'"
|
|
|
|
|
color="orange"
|
|
|
|
|
class="q-px-md"
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
@click="unapprove(props.row.fullname)"
|
|
|
|
|
>ไม่อนุมัติ</q-btn
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<q-btn
|
|
|
|
|
v-if="props.row.status == 'PENDING'"
|
|
|
|
|
color="primary"
|
|
|
|
|
class="q-px-md q-ml-sm"
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
2023-11-06 15:08:36 +07:00
|
|
|
@click="
|
|
|
|
|
openModal(
|
|
|
|
|
props.row,
|
|
|
|
|
'PENDING',
|
|
|
|
|
props.row.date,
|
|
|
|
|
props.row.dateFix
|
|
|
|
|
)
|
|
|
|
|
"
|
2023-11-03 15:08:53 +07:00
|
|
|
>อนุมัติ</q-btn
|
|
|
|
|
>
|
2023-11-06 15:08:36 +07:00
|
|
|
<q-badge
|
|
|
|
|
v-if="props.row.status == 'APPROVE'"
|
|
|
|
|
rounded
|
|
|
|
|
outline
|
|
|
|
|
color="green"
|
|
|
|
|
label="อนุมัติ"
|
|
|
|
|
/>
|
|
|
|
|
<q-badge
|
|
|
|
|
v-if="props.row.status == 'REJECT'"
|
|
|
|
|
rounded
|
|
|
|
|
outline
|
|
|
|
|
color="red"
|
|
|
|
|
label="ไม่อนุมัติ"
|
|
|
|
|
/>
|
2023-11-03 15:08:53 +07:00
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
</d-table>
|
2023-11-02 16:44:02 +07:00
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<DialogReason
|
|
|
|
|
:modal="modalUnapprove"
|
|
|
|
|
:title="dialogTitle"
|
|
|
|
|
:desc="dialogDesc"
|
2023-11-06 15:08:36 +07:00
|
|
|
:click-close="closeDialog"
|
2023-11-02 16:44:02 +07:00
|
|
|
label="เหตุผล"
|
|
|
|
|
:savaForm="clickSave"
|
|
|
|
|
/>
|
2023-11-06 15:08:36 +07:00
|
|
|
<DialogApprove
|
|
|
|
|
:modal="modalApprove"
|
|
|
|
|
:closeDialog="closeDialog"
|
|
|
|
|
:date="dateDialog"
|
|
|
|
|
:dateFix="dateFixDialog"
|
|
|
|
|
:editCheck="editCheck"
|
|
|
|
|
:detailData="detailData"
|
|
|
|
|
/>
|
2023-11-02 16:44:02 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style></style>
|