hrms-checkin/src/views/HomeView.vue

852 lines
31 KiB
Vue
Raw Normal View History

2023-11-07 11:17:13 +07:00
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
2023-11-14 17:47:43 +07:00
import { useQuasar } from 'quasar'
import moment from 'moment'
import Camera from 'simple-vue-camera'
2024-09-02 17:37:08 +07:00
import config from '@/app.config'
2024-09-02 17:37:08 +07:00
import http from '@/plugins/http'
import { useCounterMixin } from '@/stores/mixin'
2023-11-14 17:47:43 +07:00
import type { FormRef } from '@/interface/response/checkin'
2024-09-02 17:37:08 +07:00
2023-12-21 14:59:29 +07:00
import MapCheck from '@/components/AscGISMap.vue'
2023-11-07 11:17:13 +07:00
2023-11-14 17:47:43 +07:00
const mixin = useCounterMixin()
2024-01-24 11:18:58 +07:00
const { date2Thai, showLoader, hideLoader, messageError } = mixin
2023-11-14 17:47:43 +07:00
const $q = useQuasar()
2023-11-07 11:17:13 +07:00
2024-09-02 17:37:08 +07:00
const modalTime = ref<boolean>(false) // Dailog ลงเวลาเข้างานของคุณ
const stetusCheckin = ref<boolean>(true) // สถานะเวลา เข้า,ออก
2024-12-15 21:08:50 +07:00
const msgCheckTime = ref<string>('') // ข้อความแจ้งเตือน
const isDisabledCheckTime = ref<boolean>(false) // ข้อความแจ้งเตือน
2024-09-02 17:37:08 +07:00
/**
* fetch เชคเวลาตองลงเวลาเขาหรอออกงาน
*/
async function fetchCheckTime() {
showLoader()
await http
.get(config.API.checkTime())
2024-09-02 17:37:08 +07:00
.then(async (res) => {
const data = await res.data.result
stetusCheckin.value = data.checkInId ? false : true
checkInId.value = data.checkInId ? data.checkInId : ''
})
.catch((err) => {
2024-12-15 21:08:50 +07:00
if (err.response.status === 500) {
isDisabledCheckTime.value = true
msgCheckTime.value = err.response.data.message
} else messageError($q, err)
})
.finally(() => {
hideLoader()
})
}
/** ref อัพเดทเวลา*/
2023-11-14 17:47:43 +07:00
const dateNow = ref<Date>(new Date())
const Thai = ref<Date>(dateNow.value)
const formattedS = ref()
const formattedM = ref()
const formattedH = ref()
const formattedHH = ref()
const formattedA = ref()
2024-09-02 17:37:08 +07:00
2025-01-29 16:25:47 +07:00
/** function อัพเดทเวลา*/
2023-11-07 11:17:13 +07:00
function updateClock() {
2023-11-14 17:47:43 +07:00
const date = Date.now()
const hh = moment(date).format('HH')
const mm = moment(date).format('mm')
const ss = moment(date).format('ss')
const HH = moment(date).format('hh');
const A = moment(date).format('a');
2023-11-14 17:47:43 +07:00
formattedS.value = ss
formattedM.value = mm
formattedH.value = hh
formattedHH.value = HH
formattedA.value = A
2023-11-07 11:17:13 +07:00
}
2023-11-14 17:47:43 +07:00
setInterval(updateClock, 1000)
2023-11-07 11:17:13 +07:00
/** form-data */
const formLocation = reactive({
lat: 0, //พิกัดละติจูด
lng: 0, //พิกัดลองจิจูด
POI: '', //ชื่อสถานที่
})
const workplace = ref<string>('in-place') //ณ สถานที่ตั้ง, นอกสถานที่ตั้ง
const useLocation = ref<string>('') //กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่
const fileImg = ref<any>() //รูปถ่ายสถานที่
const remark = ref<string>('') //ข้อความหมายเหตุที่ต้องการระบุเพิ่ม
const checkInId = ref<string>('') //Id ลงเวลา check-in ล่าสุดที่ยังไม่ลงเวลาออก
/**
* funciton เรยกพดละต ดลองต
* @param location ดละต ดลองต
* @param namePOI อสถานท ไดมาจากระบบ ArcGis ของกองสารสนเทศภศาสตร
*/
2024-09-02 17:37:08 +07:00
async function updateLocation(
latitude: number,
longitude: number,
namePOI: string
) {
2023-12-21 14:59:29 +07:00
formLocation.lat = latitude
formLocation.lng = longitude
formLocation.POI = namePOI
}
2024-09-02 17:37:08 +07:00
const location = ref<string>('') // พื้นที่ใกล้เคียง
const model = ref<string>('') // สถานที่ทำงาน
// ตัวเลือกสถานที่ทำงาน
2023-11-07 11:17:13 +07:00
const options = ref<string[]>([
2023-11-14 17:47:43 +07:00
'ปฏิบัติงานที่บ้าน',
'ลืมลงเวลาปฏิบัติงาน',
'ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่',
'ขออนุญาตออกนอกสถานที่',
'อื่นๆ',
])
2025-01-29 16:25:47 +07:00
/** function เลือกสถานที่*/
2023-11-07 11:17:13 +07:00
function selectLocation() {
2023-11-14 17:47:43 +07:00
if (model.value === 'อื่นๆ') {
useLocation.value = ''
2023-11-07 11:17:13 +07:00
} else {
2023-11-14 17:47:43 +07:00
useLocation.value = model.value
2023-11-07 11:17:13 +07:00
}
}
/** Camera */
2023-11-14 17:47:43 +07:00
const camera = ref<InstanceType<typeof Camera>>()
const cameraIsOn = ref<boolean>(false)
const img = ref<any>(undefined)
const photoWidth = ref<number>(350)
const photoHeight = ref<number>(350)
2023-11-07 11:17:13 +07:00
2025-01-29 16:25:47 +07:00
/** function เปิดกล้อง*/
async function openCamera() {
// change camera device
if (cameraIsOn.value) {
2025-01-29 16:25:47 +07:00
await camera.value?.stop()
} else {
await camera.value?.start()
2025-01-29 16:25:47 +07:00
await changeCamera() // ต้องรอให้ start() เสร็จก่อน
}
2023-11-14 17:47:43 +07:00
cameraIsOn.value = !cameraIsOn.value
}
2023-11-07 11:17:13 +07:00
2025-01-29 16:25:47 +07:00
/** change camera device*/
async function changeCamera() {
const devices: any = await camera.value?.devices(['videoinput'])
const device = await devices[0]
camera.value?.changeCamera(device.deviceId)
}
2025-01-29 16:25:47 +07:00
/** function ถ่ายรูป*/
2023-11-14 17:47:43 +07:00
async function capturePhoto() {
const imageBlob: any = await camera.value?.snapshot(
{ width: photoWidth.value, height: photoHeight.value },
'image/png',
0.5
)
2025-01-29 16:25:47 +07:00
if (!imageBlob) return
const fileName = 'photo.png'
2023-11-07 11:17:13 +07:00
//ไฟล์รูป
const file = new File([imageBlob], fileName, { type: 'image/png' })
fileImg.value = file
//แสดงรูป
2025-01-29 16:25:47 +07:00
await camera.value?.stop()
2023-11-14 17:47:43 +07:00
const url = URL.createObjectURL(imageBlob)
img.value = url
2023-11-07 11:17:13 +07:00
}
2023-11-14 17:47:43 +07:00
2025-01-29 16:25:47 +07:00
/** function เปลี่ยนรูปภาพ*/
2023-11-07 11:17:13 +07:00
function refreshPhoto() {
2023-11-14 17:47:43 +07:00
img.value = undefined
camera.value?.start()
2023-11-07 11:17:13 +07:00
}
2023-11-14 17:47:43 +07:00
/** ref validate*/
2023-11-14 17:47:43 +07:00
const useLocationRef = ref<object | null>(null)
const modelRef = ref<object | null>(null)
2023-11-07 11:17:13 +07:00
const objectRef: FormRef = {
model: modelRef,
useLocation: useLocationRef,
2023-11-14 17:47:43 +07:00
}
2025-01-29 16:25:47 +07:00
/** function ตรวจสอบค่าว่างของ input*/
2023-11-07 11:17:13 +07:00
function validateForm() {
2023-11-14 17:47:43 +07:00
const hasError = []
2023-11-07 11:17:13 +07:00
for (const key in objectRef) {
if (Object.prototype.hasOwnProperty.call(objectRef, key)) {
2023-11-14 17:47:43 +07:00
const property = objectRef[key]
if (property.value && typeof property.value.validate === 'function') {
const isValid = property.value.validate()
hasError.push(isValid)
2023-11-07 11:17:13 +07:00
}
}
}
if (hasError.every((result) => result === true)) {
2023-11-14 17:47:43 +07:00
confirm()
2024-01-18 10:47:24 +07:00
}
2023-11-07 11:17:13 +07:00
}
2024-09-02 17:37:08 +07:00
const timeChickin = ref<string>('') //เวลาเข้างาน,เวลาออกงาน
2025-01-29 16:25:47 +07:00
/** function ยืนยันการลงเวลาเข้า - ออก*/
async function confirm() {
2023-12-21 14:59:29 +07:00
showLoader()
const isLocation = workplace.value === 'in-place' //*true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง
2024-01-24 11:18:58 +07:00
const locationName = workplace.value === 'in-place' ? '' : useLocation.value
const formdata = new FormData()
formdata.append('lat', formLocation.lat.toString())
formdata.append('lon', formLocation.lng.toString())
formdata.append('POI', formLocation.POI)
formdata.append('isLocation', isLocation.toString())
2024-01-24 11:18:58 +07:00
formdata.append('locationName', locationName)
2023-11-27 09:38:41 +07:00
formdata.append('img', fileImg.value)
formdata.append('remark', remark.value)
2023-11-27 09:38:41 +07:00
formdata.append('checkInId', checkInId.value)
await http
.post(config.API.checkin(), formdata)
.then(async (res) => {
2024-09-02 17:37:08 +07:00
const data = await res.data.result
2023-11-16 17:30:24 +07:00
const dateObject = new Date(data.date)
const options: Intl.DateTimeFormatOptions = {
hour12: false,
hour: '2-digit',
minute: '2-digit',
}
const timeString = new Intl.DateTimeFormat('en-US', options).format(
dateObject
)
timeChickin.value = timeString
2025-01-29 16:25:47 +07:00
modalTime.value = true
remark.value = ''
})
.catch((err) => {
2024-12-15 21:08:50 +07:00
messageError($q, err)
2023-12-21 14:59:29 +07:00
})
2025-01-29 16:25:47 +07:00
.finally(() => {
hideLoader()
})
2023-11-16 17:30:24 +07:00
}
2025-01-29 16:25:47 +07:00
/** ปิด popup แสดงการลงเวลา*/
2023-11-16 17:30:24 +07:00
async function onClickConfirm() {
2024-12-15 21:08:50 +07:00
showLoader()
2025-01-29 16:25:47 +07:00
if (!stetusCheckin.value) {
stetusCheckin.value = true
}
2025-01-29 18:11:14 +07:00
// await fetchCheckTime()
// fetchCheckStatus()
2025-01-29 16:25:47 +07:00
startChecking()
2023-11-16 17:30:24 +07:00
cameraIsOn.value = false
img.value = undefined
2024-09-02 17:37:08 +07:00
modalTime.value = false
}
2023-11-07 11:17:13 +07:00
2025-01-29 16:25:47 +07:00
/** เลือกสถานที่ทำงาน*/
2024-01-24 11:18:58 +07:00
function updateWorkplace() {
useLocation.value = ''
model.value = ''
}
2024-01-18 11:25:41 +07:00
2024-09-02 17:37:08 +07:00
/**
* เทนร class นหล
* @param val stetusCheckin
*/
2023-11-07 11:17:13 +07:00
const getClass = (val: boolean) => {
return {
'bg-primary text-white col-12 row items-center q-px-md q-py-sm ': val,
'bg-red-9 text-white col-12 row items-center q-px-md q-py-sm ': !val,
2023-11-14 17:47:43 +07:00
}
}
2023-12-21 14:59:29 +07:00
const getClassXS = (val: boolean) => {
return {
'bg-topIn text-white q-pa-lg col-12 row': val,
'bg-topOut text-white q-pa-lg col-12 row': !val,
}
}
2025-01-29 16:25:47 +07:00
const inQueue = ref<boolean>(false)
async function fetchCheckStatus() {
try {
const res = await http.get(config.API.checkStatus())
inQueue.value = res.data.result.inQueue
if (res.data.result.inQueue) {
isDisabledCheckTime.value = true
2025-01-29 18:11:14 +07:00
msgCheckTime.value = 'ระบบกำลังประมวลผล'
hideLoader()
2025-01-29 16:25:47 +07:00
} else {
isDisabledCheckTime.value = false
msgCheckTime.value = ''
stopChecking() // หยุดการทำงาน
console.log('Response เป็น false, หยุด interval')
}
} catch (error) {
console.log('เกิดข้อผิดพลาด', error)
stopChecking() // หยุดการทำงาน
}
}
const intervalId = ref<number | undefined>(undefined) // ต้องใช้ตัวแปรเก็บค่า interval
2025-01-29 18:11:14 +07:00
async function startChecking() {
showLoader()
fetchCheckStatus()
2025-01-29 16:25:47 +07:00
if (intervalId.value === undefined) {
// ป้องกันการสร้าง interval ซ้ำ
2025-01-29 18:11:14 +07:00
intervalId.value = setInterval(async () => {
await fetchCheckStatus() // รอให้ fetchCheckStatus ทำงานเสร็จก่อน
}, 3000)
2025-01-29 16:25:47 +07:00
}
}
2025-01-29 18:11:14 +07:00
async function stopChecking() {
2025-01-29 16:25:47 +07:00
if (intervalId.value !== undefined) {
clearInterval(intervalId.value) // หยุด interval
2025-01-29 18:11:14 +07:00
setTimeout(() => {
fetchCheckTime()
}, 1000)
2025-01-29 16:25:47 +07:00
intervalId.value = undefined // รีเซ็ตค่า
}
}
/** Hook*/
onMounted(async () => {
2025-01-29 16:25:47 +07:00
// await fetchCheckTime()
updateClock()
2025-01-29 16:25:47 +07:00
startChecking()
})
2023-11-07 11:17:13 +07:00
</script>
<template>
<q-page :style="$q.screen.xs ? 'padding-top: 90px':''">
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-12">
<q-card flat :class="$q.screen.gt.xs ? 'row col-12 cardNone': 'row col-12 bg-grey-2'">
<!-- <q-header elevated class="bg-purple"> -->
<div :class="getClass(stetusCheckin)" class="gt-xs">
<div class="col">
<div class="row col-12 justify-center q-py-sm text-subtitle1">
<!-- <strong v-if="stetusCheckin" style="font-size: 1rem">
ลงเวลาเขางาน
</strong> -->
<!-- <strong v-else style="font-size: 1rem">ลงเวลาออกงาน</strong> -->
<strong v-if="!stetusCheckin && inQueue" >
ลงเวลาออกงาน (ระบบกำลงประมวลผล)
</strong>
<strong
v-else-if="stetusCheckin && inQueue"
>
ลงเวลาเขางาน (ระบบกำลงประมวลผล)
</strong>
2025-01-29 16:25:47 +07:00
<strong
v-else-if="stetusCheckin && !inQueue"
>
ลงเวลาเขางาน
</strong>
<strong v-else > ลงเวลาออกงาน </strong>
</div>
</div>
</div>
<div class="col-12 text-grey-9">
<div class="col-12 row justify-center">
<div class="col-12 row q-pt-md justify-center gt-xs">
2023-11-14 17:47:43 +07:00
<div
class="col-xs-12 col-sm-10 text-h6 text-center text-weight-bold"
2023-11-14 17:47:43 +07:00
>
{{ date2Thai(Thai) }}
</div>
<div class="row col-12 justify-center q-py-sm">
<div class="colunm">
<div class="text-h3 text-weight-bold">
{{ formattedH }}<span class="q-ma-md">:</span>
</div>
2023-11-07 11:17:13 +07:00
</div>
<div class="colunm">
<div class="text-h3 text-weight-bold">
{{ formattedM }}<span class="q-ma-md">:</span>
</div>
</div>
<div class="colunm">
<div class="text-h3 text-weight-bold">{{ formattedS }}</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-11 q-pa-md q-col-gutter-md row q-pt-lg">
<div class="col-12" v-if="$q.screen.xs">
<MapCheck @update:location="updateLocation" />
2023-11-07 11:17:13 +07:00
</div>
<div class="col-xs-12 col-sm-8 gt-xs">
<div class="col-12">
<MapCheck @update:location="updateLocation" />
2023-11-07 11:17:13 +07:00
</div>
<!-- <AscMaps /> -->
</div>
<div class="col-xs-12 col-sm-4">
<q-card :class="$q.screen.xs? 'card-container-xs':'card-container'">
<div
v-if="!cameraIsOn && img == null"
class="preview-placeholder"
@click="() => !isDisabledCheckTime && openCamera()"
>
<div class="text-center">
<q-icon
name="mdi-camera"
color="blue-grey-3"
size="100px"
class="center-icon"
/>
</div>
</div>
<div class="col-12 row items-center">
<!-- แสดงกลองตอนกดถายภาพ -->
<Camera
:resolution="{ width: photoWidth, height: photoHeight }"
ref="camera"
:autoplay="false"
:style="!img ? 'display: block' : 'display: none'"
/>
<!-- แสดงรปเมอกด capture -->
<div v-if="img" class="image-container">
<q-img :src="img" class="image-element"></q-img>
</div>
<div
v-if="cameraIsOn"
>
<div v-if="$q.screen.gt.xs" class="absolute-bottom-right q-ma-md">
<q-btn
v-if="img == null"
round
push
icon="photo_camera"
size="md"
color="positive"
@click="capturePhoto"
/>
<q-btn
v-else
round
push
icon="refresh"
size="md"
color="negative"
@click="refreshPhoto"
/>
</div>
<div v-else>
<div class="absolute-bottom text-subtitle2 text-center q-py-sm" style="background:#00000021">
<q-btn
round
v-if="img == null"
icon="photo_camera"
size="18px"
style="background: #263238; color: white;"
@click="capturePhoto"
unelevated
/>
<q-btn
v-else
round
icon="refresh"
size="18px"
style="background: #263238; color: white;"
@click="refreshPhoto"
/>
</div>
</div>
</div>
</div>
</q-card>
</div>
2023-11-14 17:47:43 +07:00
<!-- กรอกขอม หนามอถ -->
<div class="col-12 row q-col-gutter-y-md" v-if="$q.screen.xs">
<div class="col-12" v-if="!isDisabledCheckTime">
<q-card flat bordered class="row col-12" style="border-radius: 10px">
<q-input
v-model="remark"
filled
type="textarea"
label="กรอกหมายเหตุ"
input-style="border-radius: 10px 10px 0 0;"
class="col-12"
bg-color="white"
/>
<div class="col-12"><q-separator /></div>
<q-btn-toggle
v-model="workplace"
@update:model-value="updateWorkplace"
spread
no-caps
toggle-color="blue-grey-10"
color="white"
text-color="black"
class="col-12"
style="min-height:3em"
size="15px"
:options="[
{label: 'ในสถานที่', value: 'in-place'},
{label: 'นอกสถานที่', value: 'off-site'}
]"
/>
</q-card>
</div>
<div class="col-12" v-if="workplace == 'off-site'">
<q-card class="col-12">
<q-select
ref="modelRef"
filled
v-model="model"
:options="options"
label="เลือกสถานที่"
bg-color="white"
:rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
lazy-rules
@update:model-value="selectLocation()"
hide-bottom-space
/>
</q-card>
</div>
2023-11-14 17:47:43 +07:00
<div
class="col-12"
v-if="model == 'อื่นๆ' && workplace === 'off-site'"
2023-11-14 17:47:43 +07:00
>
<q-card class="col-12">
<q-input
ref="useLocationRef"
filled
v-model="useLocation"
label="ระบุสถานที่"
bg-color="white"
:rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
hide-bottom-space
lazy-rules
/>
</q-card>
2023-11-07 11:17:13 +07:00
</div>
</div>
<!-- กรอกขอม หนามอถ -->
2023-11-14 17:47:43 +07:00
2023-11-07 11:17:13 +07:00
<div
v-if="!isDisabledCheckTime"
class="col-xs-12 col-sm-12 items-center gt-xs"
2023-11-07 11:17:13 +07:00
>
<q-card
bordered
flat
:class="
$q.screen.gt.xs
? 'q-px-md q-py-sm row items-center shadow-0'
: 'q-pa-md row items-center shadow-0'
"
>
<div class="text-weight-bold">สถานททำงาน</div>
<div
:class="
$q.screen.gt.xs
? 'row q-gutter-md q-pl-md col-sm-6 col-md-3'
: 'column col-12'
"
>
<q-radio
v-model="workplace"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="in-place"
label="ในสถานที่"
@update:model-value="updateWorkplace"
/>
<q-radio
v-model="workplace"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="off-site"
label="นอกสถานที่"
@update:model-value="updateWorkplace"
/>
</div>
<div
class="col-xs-12 col-sm-6 col-md-4"
v-if="workplace == 'off-site'"
>
<q-select
ref="modelRef"
dense
class="q-ml-md"
outlined
v-model="model"
:options="options"
prefix="ระบุสถานที่ :"
:rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
lazy-rules
@update:model-value="selectLocation()"
hide-bottom-space
/>
</div>
<div
class="col-xs-12 col-sm-6 col-md-4"
v-if="model == 'อื่นๆ' && workplace === 'off-site'"
>
<q-input
ref="useLocationRef"
dense
class="q-ml-md"
outlined
v-model="useLocation"
label="ระบุสถานที่"
:rules="[(val:string) => !!val || 'กรุณาระบุสถานที่']"
lazy-rules
/>
</div>
</q-card>
2023-11-07 11:17:13 +07:00
</div>
<div v-if="!isDisabledCheckTime" class="col-xs-12 col-sm-12 gt-xs">
<q-card
bordered
flat
:class="
$q.screen.gt.xs
? 'q-px-md q-py-sm row items-center shadow-0'
: 'q-pa-md row items-center shadow-0'
"
>
<div class="text-weight-bold">หมายเหต</div>
<div class="col-12 q-pt-sm">
<q-input outlined v-model="remark" lazy-rules dense />
</div>
</q-card>
2023-11-07 11:17:13 +07:00
</div>
</div>
</div>
<div v-if="!isDisabledCheckTime && $q.screen.gt.xs" class="col-12 text-right">
<q-separator />
<div class="col-12 q-pa-md">
<p
:class="
$q.screen.gt.xs
? 'text-red text-caption '
: 'text-red text-caption text-center'
"
2023-11-07 11:17:13 +07:00
>
*หมายเหต คลกลงเวลาเขางานแลวระบบจะลงเวลาทนท
</p>
<q-btn
:label="stetusCheckin ? 'ลงเวลาเข้างาน' : 'ลงเวลาออกงาน'"
:color="img == null ? 'grey-6' : 'primary'"
push
size="18px"
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
:disable="camera && img ? false : true"
@click="validateForm"
:loading="inQueue"
/>
</div>
2024-01-19 15:34:09 +07:00
</div>
2024-01-24 11:18:58 +07:00
<div v-if="isDisabledCheckTime && $q.screen.gt.xs" class="col-12">
<q-separator />
<div class="text-red q-pa-md">*{{ msgCheckTime }}</div>
2023-11-07 11:17:13 +07:00
</div>
2024-01-19 15:34:09 +07:00
</div>
</q-card>
</div>
</div>
</q-page>
<!-- top page sticky หนามอถ-->
<q-page-sticky expand position="top" v-if="$q.screen.xs">
<div :class="getClassXS(stetusCheckin)" >
<div class="col">
<div class="row col-12 justify-right items-center text-body1">
<strong v-if="!stetusCheckin && inQueue" >
ลงเวลาออกงาน (ระบบกำลงประมวลผล)
</strong>
2024-09-02 17:37:08 +07:00
<strong
v-else-if="stetusCheckin && inQueue"
>
ลงเวลาเขางาน (ระบบกำลงประมวลผล)
</strong>
<strong
v-else-if="stetusCheckin && !inQueue"
>
ลงเวลาเขางาน
</strong>
2024-12-15 21:08:50 +07:00
<strong v-else > ลงเวลาออกงาน </strong>
</div>
<div class="text-white text-body2 row col-12" style="line-height:1.5rem">
{{ date2Thai(Thai) }}
2024-12-15 21:08:50 +07:00
</div>
</div>
<div class="col-6 row items-center" >
<div class="row col-12 justify-end">
<div class="colunm">
<div class="text-h4 text-weight-bold">
{{ formattedHH }}<span class="q-ma-xs">:</span>
</div>
</div>
<div class="colunm">
<div class="text-h4 text-weight-bold">
{{ formattedM }}
</div>
</div>
<div class="colunm">
<div class="text-caption q-pl-sm">{{ formattedA }}</div>
</div>
</div>
</div>
</div>
</q-page-sticky>
<!-- footer หนามอถ-->
<q-footer reveal v-if="!isDisabledCheckTime && $q.screen.xs" class="bg-grey-2">
<q-separator />
<div class="col-12 q-pa-md">
<p
:class="
$q.screen.gt.xs
? 'text-red text-caption '
: 'text-red text-caption text-center'
"
>
*หมายเหต คลกลงเวลาเขางานแลวระบบจะลงเวลาทนท
</p>
<q-btn
:label="stetusCheckin ? 'ลงเวลาเข้างาน' : 'ลงเวลาออกงาน'"
:color="img == null ? 'grey-6' : 'primary'"
push
size="18px"
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
:disable="camera && img ? false : true"
@click="validateForm"
:loading="inQueue"
/>
2023-11-07 11:17:13 +07:00
</div>
</q-footer>
2023-11-07 11:17:13 +07:00
2024-09-02 17:37:08 +07:00
<!-- แสดงการลงเวลา -->
<q-dialog v-model="modalTime" persistent>
2023-11-07 11:17:13 +07:00
<q-card class="full-width cardNone">
<div :class="getClass(stetusCheckin)">
<div class="text-body1 text-center col-12 text-weight-bold">
<span v-if="stetusCheckin">ลงเวลาเข้างานของคุณ</span>
<span v-else>ลงเวลาออกงานของคุณ</span>
</div>
</div>
<q-card-section class="row col-12 justify-center">
<div class="bg-grey-2 rounded-borders q-pa-md col-11">
<div class="col-12 text-subtitle1 text-center text-weight-medium">
2023-11-07 16:35:39 +07:00
{{ date2Thai(Thai) }}
2023-11-07 11:17:13 +07:00
</div>
<div class="row col-12 justify-center q-pt-sm">
2024-09-02 13:40:15 +07:00
<div class="text-h3 text-weight-bold"></div>
2023-11-16 17:30:24 +07:00
<div class="text-h3 text-weight-bold">{{ timeChickin }}</div>
2023-11-07 11:17:13 +07:00
</div>
</div>
<div class="col-12 text-center row q-pt-md">
2023-12-21 14:59:29 +07:00
<div class="col-12 text-subtitle1 text-weight-medium text-secondary">
นทใกลเคยง {{ formLocation.POI ?? formLocation.POI }}
</div>
2023-11-07 11:17:13 +07:00
<div class="col-12 text-subtitle1 text-weight-medium text-secondary">
{{ location }}
</div>
2023-11-16 17:30:24 +07:00
<div class="col-12 text-grey-7">
{{ formLocation.lat }} , {{ formLocation.lng }}
</div>
2023-11-07 11:17:13 +07:00
</div>
</q-card-section>
<q-card-actions align="center" class="q-mb-md row">
<q-btn
class="col-xs-11 col-sm-6"
push
label="ตกลง"
color="secondary"
v-close-popup
2023-11-16 17:30:24 +07:00
@click="onClickConfirm"
2023-11-07 11:17:13 +07:00
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style scoped>
2023-11-07 11:17:13 +07:00
.q-card.cardImg:hover {
border: 1px solid #02a998 !important;
}
.center-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.card-container {
position: relative;
overflow: hidden;
2024-01-19 15:34:09 +07:00
height: autu; /* Adjust as needed */
background: #f5f5f5;
height: 35vh !important;
box-shadow: none !important;;
border: 1px solid #EDEDED;
}
.card-container-xs {
position: relative;
overflow: hidden;
height: autu; /* Adjust as needed */
background: #ffffff;
2024-01-19 15:34:09 +07:00
height: 35vh !important;
border-radius: 10px;
2023-11-07 11:17:13 +07:00
}
.image-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.image-element {
width: 100%;
height: 100%;
object-fit: cover;
2024-01-19 15:34:09 +07:00
border-radius: 8px; /* Adjust as needed */
2023-11-07 11:17:13 +07:00
}
2023-11-14 17:47:43 +07:00
.preview-placeholder {
width: 100%;
height: 100%;
2023-11-07 11:17:13 +07:00
}
.bg-topOut{
background: rgb(39,50,56);
background: linear-gradient(175deg, rgba(39,50,56,1) 76%, rgba(198,40,40,1) 100%);
}
.bg-topIn{
background: rgb(39,50,56);
background: linear-gradient(175deg, rgba(39,50,56,1) 76%, rgba(2,169,152,1) 100%);
}
2023-12-22 15:56:31 +07:00
</style>