add mock location

This commit is contained in:
Warunee Tamkoo 2026-03-06 23:19:31 +07:00
parent 386ab6480f
commit 9c68349983
4 changed files with 325 additions and 95 deletions

View file

@ -32,6 +32,8 @@ const endTimeAfternoon = ref<string>('12:00:00') //เวลาเช็คเ
const isLoadingCheckTime = ref<boolean>(false) //
const disabledBtn = ref<boolean>(false)
const locationGranted = ref<boolean>(false)
const isMockLocationDetected = ref<boolean>(false)
/**
* fetch เชคเวลาตองลงเวลาเขาหรอออกงาน
@ -113,6 +115,21 @@ async function updateLocation(
formLocation.POI = namePOI
}
/**
* บคาสถานะ location จาก AscGISMap
*/
function onLocationStatus(status: boolean) {
locationGranted.value = status
}
/**
* บค mock location detection จาก AscGISMap
*/
function onMockDetected(result: any) {
isMockLocationDetected.value = true
disabledBtn.value = true
}
const location = ref<string>('') //
const model = ref<string>('') //
//
@ -595,6 +612,16 @@ watch(
}
}
)
watch(
() => locationGranted.value,
(newVal) => {
// Removed auto-reset of isMockLocationDetected to prevent
// clearing mock detection state when permission is granted.
// Mock detection state should only be reset after explicit user action
// or after a successful validation without mock indicators.
}
)
</script>
<template>
@ -667,6 +694,8 @@ watch(
v-if="$q.screen.gt.xs"
ref="mapRef"
@update:location="updateLocation"
@location-status="onLocationStatus"
@mock-detected="onMockDetected"
/>
</div>
</div>
@ -833,7 +862,12 @@ watch(
</div>
<div class="col-12" v-if="$q.screen.xs">
<MapCheck ref="mapRef" @update:location="updateLocation" />
<MapCheck
ref="mapRef"
@update:location="updateLocation"
@location-status="onLocationStatus"
@mock-detected="onMockDetected"
/>
</div>
</div>
<!-- กรอกขอม หนามอถ -->
@ -982,7 +1016,7 @@ watch(
push
size="18px"
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
:disable="disabledBtn ? true : camera && img ? false : true"
:disable="disabledBtn || !locationGranted || isMockLocationDetected ? true : camera && img ? false : true"
@click="validateForm"
:loading="inQueue"
/>
@ -1097,7 +1131,7 @@ watch(
push
size="18px"
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
:disable="disabledBtn ? true : camera && img ? false : true"
:disable="disabledBtn || !locationGranted || isMockLocationDetected ? true : camera && img ? false : true"
@click="validateForm"
:loading="inQueue"
/>