เพิ่มปุ่มไปหน้าการลา และแก้ไข disbled ปุ่มลงเวลาหลังจากคลิกลงเวลา
This commit is contained in:
parent
e7e5ded4d9
commit
50b9ed9d35
5 changed files with 37 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
VITE_API_URI_CONFIG=VITE_API_URI_CONFIG
|
VITE_API_URI_CONFIG=VITE_API_URI_CONFIG
|
||||||
VITE_URL_SSO=VITE_URL_SSO
|
VITE_URL_SSO=VITE_URL_SSO
|
||||||
VITE_URL_LANDING=VITE_URL_LANDING
|
VITE_URL_LANDING=VITE_URL_LANDING
|
||||||
|
VITE_URL_USER=VITE_URL_USER
|
||||||
|
|
@ -11,6 +11,7 @@ do
|
||||||
sed -i 's|VITE_API_URI_CONFIG|'${VITE_API_URI_CONFIG}'|g' $file
|
sed -i 's|VITE_API_URI_CONFIG|'${VITE_API_URI_CONFIG}'|g' $file
|
||||||
sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file
|
sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file
|
||||||
sed -i 's|VITE_URL_LANDING|'${VITE_URL_LANDING}'|g' $file
|
sed -i 's|VITE_URL_LANDING|'${VITE_URL_LANDING}'|g' $file
|
||||||
|
sed -i 's|VITE_URL_USER|'${VITE_URL_USER}'|g' $file
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ import router from '@/router'
|
||||||
|
|
||||||
const ACCESS_TOKEN = 'BMAHRISCKI_KEYCLOAK_IDENTITY'
|
const ACCESS_TOKEN = 'BMAHRISCKI_KEYCLOAK_IDENTITY'
|
||||||
const key_C_Config = {
|
const key_C_Config = {
|
||||||
url_Logout: import.meta.env.VITE_URL_SSO,
|
urlLogout: import.meta.env.VITE_URL_SSO,
|
||||||
|
urlUser: import.meta.env.VITE_URL_USER,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AuthResponse {
|
interface AuthResponse {
|
||||||
|
|
@ -31,7 +32,7 @@ async function setCookieSso(val: string, r: AuthResponse) {
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await deleteCookie(ACCESS_TOKEN)
|
await deleteCookie(ACCESS_TOKEN)
|
||||||
// window.location.href = key_C_Config.url_Logout
|
// window.location.href = key_C_Config.urlLogout
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,6 +98,14 @@ async function tokenParsed() {
|
||||||
return JSON.parse(jsonPayload)
|
return JSON.parse(jsonPayload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function gotoLeavePage() {
|
||||||
|
const token = await getToken()
|
||||||
|
if (!token) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.location.href = `${key_C_Config.urlUser}/auth?token=${token}&accessToken=${token}&redirectUrl=${key_C_Config.urlUser}/leave`
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getCookie,
|
getCookie,
|
||||||
getToken,
|
getToken,
|
||||||
|
|
@ -105,4 +114,5 @@ export {
|
||||||
setAuthen,
|
setAuthen,
|
||||||
tokenParsed,
|
tokenParsed,
|
||||||
setAuthenCheckin,
|
setAuthenCheckin,
|
||||||
|
gotoLeavePage,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ const isErr = ref<boolean | null>(null) // ข้อความแจ้งเ
|
||||||
const endTimeAfternoon = ref<string>('12:00:00') //เวลาเช็คเอาท์ตามรอบ
|
const endTimeAfternoon = ref<string>('12:00:00') //เวลาเช็คเอาท์ตามรอบ
|
||||||
|
|
||||||
const isLoadingCheckTime = ref<boolean>(false) // ตัวแปรสำหรับการโหลด
|
const isLoadingCheckTime = ref<boolean>(false) // ตัวแปรสำหรับการโหลด
|
||||||
|
const disabledBtn = ref<boolean>(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch เช็คเวลาต้องลงเวลาเข้าหรือออกงาน
|
* fetch เช็คเวลาต้องลงเวลาเข้าหรือออกงาน
|
||||||
|
|
@ -354,6 +355,7 @@ async function confirm() {
|
||||||
mapRef.value?.requestLocationPermission()
|
mapRef.value?.requestLocationPermission()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
disabledBtn.value = true
|
||||||
showLoader()
|
showLoader()
|
||||||
const isLocation = workplace.value === 'in-place' //*true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง
|
const isLocation = workplace.value === 'in-place' //*true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง
|
||||||
const locationName = workplace.value === 'in-place' ? '' : useLocation.value
|
const locationName = workplace.value === 'in-place' ? '' : useLocation.value
|
||||||
|
|
@ -383,9 +385,11 @@ async function confirm() {
|
||||||
timeChickin.value = timeString
|
timeChickin.value = timeString
|
||||||
modalTime.value = true
|
modalTime.value = true
|
||||||
remark.value = ''
|
remark.value = ''
|
||||||
|
disabledBtn.value = false
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err)
|
messageError($q, err)
|
||||||
|
disabledBtn.value = false
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader()
|
hideLoader()
|
||||||
|
|
@ -889,7 +893,7 @@ watch(
|
||||||
push
|
push
|
||||||
size="18px"
|
size="18px"
|
||||||
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
||||||
:disable="camera && img ? false : true"
|
:disable="disabledBtn ? true : camera && img ? false : true"
|
||||||
@click="validateForm"
|
@click="validateForm"
|
||||||
:loading="inQueue"
|
:loading="inQueue"
|
||||||
/>
|
/>
|
||||||
|
|
@ -1004,7 +1008,7 @@ watch(
|
||||||
push
|
push
|
||||||
size="18px"
|
size="18px"
|
||||||
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
:class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'"
|
||||||
:disable="camera && img ? false : true"
|
:disable="disabledBtn ? true : camera && img ? false : true"
|
||||||
@click="validateForm"
|
@click="validateForm"
|
||||||
:loading="inQueue"
|
:loading="inQueue"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { useRouter } from 'vue-router'
|
||||||
import http from '@/plugins/http'
|
import http from '@/plugins/http'
|
||||||
import config from '@/app.config'
|
import config from '@/app.config'
|
||||||
import avatar from '@/assets/avatar_user.jpg'
|
import avatar from '@/assets/avatar_user.jpg'
|
||||||
import { logout, tokenParsed, getCookie } from '@/plugins/auth'
|
import { logout, tokenParsed, getCookie, gotoLeavePage } from '@/plugins/auth'
|
||||||
import { useCounterMixin } from '@/stores/mixin'
|
import { useCounterMixin } from '@/stores/mixin'
|
||||||
import { usePrivacyStore } from '@/stores/privacy'
|
import { usePrivacyStore } from '@/stores/privacy'
|
||||||
|
|
||||||
|
|
@ -324,6 +324,18 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
<q-btn
|
||||||
|
icon="mdi-calendar-account-outline"
|
||||||
|
unelevated
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
color="white"
|
||||||
|
class="q-mx-md"
|
||||||
|
@click="gotoLeavePage"
|
||||||
|
>
|
||||||
|
<q-tooltip>ไปหน้าการลา</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
icon="history"
|
icon="history"
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -332,7 +344,9 @@ onMounted(async () => {
|
||||||
flat
|
flat
|
||||||
color="white"
|
color="white"
|
||||||
@click="router.push('/history')"
|
@click="router.push('/history')"
|
||||||
/>
|
>
|
||||||
|
<q-tooltip>ไปหน้าประวัติการลงเวลาฯ</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
<q-btn round dense flat size="13px" class="q-mx-md">
|
<q-btn round dense flat size="13px" class="q-mx-md">
|
||||||
<q-icon name="notifications" size="24px" color="white" />
|
<q-icon name="notifications" size="24px" color="white" />
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue