From 71771b4b5122984092d4648885160150a612d8be Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Thu, 20 Mar 2025 13:11:03 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.checkin.ts | 4 +++- src/views/HomeView.vue | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/api/api.checkin.ts b/src/api/api.checkin.ts index b14ccaf..a0078fa 100644 --- a/src/api/api.checkin.ts +++ b/src/api/api.checkin.ts @@ -14,5 +14,7 @@ export default { `${urlFile}/file/${name}/${group}/${id}/${fileName}`, changePassword:`${orgKeycloak}/user/change-password`, - resetPassword:`${orgKeycloak}/user/reset-password` + resetPassword:`${orgKeycloak}/user/reset-password`, + + checkoutCheck:`${leave}/user/checkout-check` } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index da900af..b558009 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -13,11 +13,12 @@ import type { FormRef } from '@/interface/response/checkin' import MapCheck from '@/components/AscGISMap.vue' const mixin = useCounterMixin() -const { date2Thai, showLoader, hideLoader, messageError } = mixin +const { date2Thai, showLoader, hideLoader, messageError, dialogConfirm } = mixin const $q = useQuasar() const modalTime = ref(false) // Dailog ลงเวลาเข้างานของคุณ const stetusCheckin = ref(true) // สถานะเวลา เข้า,ออก +const checkStatus = ref('') const msgCheckTime = ref('') // ข้อความแจ้งเตือน const isDisabledCheckTime = ref(false) // ข้อความแจ้งเตือน @@ -188,7 +189,11 @@ function validateForm() { } } if (hasError.every((result) => result === true)) { - confirm() + if (stetusCheckin.value == false) { + getCheck() + } else if (stetusCheckin.value) { + confirm() + } } } @@ -233,6 +238,33 @@ async function confirm() { }) } +async function getCheck() { + showLoader() + await http + .get(config.API.checkoutCheck) + .then(async (res) => { + const data = await res.data.result.status + checkStatus.value = data.toLocaleUpperCase() + if (checkStatus.value == 'ABSENT') { + dialogConfirm( + $q, + () => { + confirm() + }, + 'หากลงเวลาออกเวลานี้สถานะการเข้างานของคุณจะเป็นขาดราชการ', + 'ยืนยันการลงเวลาออก?' + ) + } else if (checkStatus.value == 'NORMAL') { + confirm() + } + }) + .catch((e) => { + messageError($q, e) + }) + .finally(() => { + hideLoader() + }) +} /** ปิด popup แสดงการลงเวลา*/ async function onClickConfirm() { showLoader()