diff --git a/src/components/DialogHeader.vue b/src/components/DialogHeader.vue new file mode 100644 index 0000000..77d936c --- /dev/null +++ b/src/components/DialogHeader.vue @@ -0,0 +1,29 @@ + + diff --git a/src/views/MainView.vue b/src/views/MainView.vue index 3e534a8..a7a799d 100644 --- a/src/views/MainView.vue +++ b/src/views/MainView.vue @@ -12,6 +12,8 @@ import { useCounterMixin } from '@/stores/mixin' import type { notiType } from '@/interface/index/Main' import type { Noti } from '@/interface/response/Main' +import DialogHeader from '@/components/DialogHeader.vue' + const mixin = useCounterMixin() const { date2Thai, hideLoader, messageError, dialogRemove, success } = mixin const router = useRouter() @@ -22,6 +24,7 @@ const configParam = { landingPageUrl: import.meta.env.VITE_URL_LANDING, } +const modalReset = ref(false) //ตัวแปร popup reset password const fullName = ref('') //ชื่อผู้ใช้งาน const notiTrigger = ref(false) // เปิด,ปิดรายการ const notiList = ref([]) // รายการแจ้งเตือน @@ -34,6 +37,15 @@ const thaiOptions: Intl.DateTimeFormatOptions = { minute: '2-digit', } +const oldPassWord = ref('') + +const newPassword = ref('') + +const reNewPassWord = ref('') + +const isPwdOld = ref(true) +const isPwdNewOld = ref(true) +const isPwdReNewOld = ref(true) /** * ฟังก์ชั่นดึงข้อมูลจำนวนการแจ้งเตือน */ @@ -184,6 +196,66 @@ watch( } ) +function onreset() { + modalReset.value = true +} + +function closeDialog() { + modalReset.value = false + oldPassWord.value = '' +} + +function onSubmit() {} + +function ruleNewPassWord(val: string) { + return new Promise((resolve) => { + if (!val) { + return resolve('กรุณากรอกรหัสผ่านใหม่') + } + if (val === oldPassWord.value) { + return resolve('รหัสผ่านใหม่ต้องไม่ซ้ำกับรหัสผ่านเดิม') + } + if (val.length < 8) { + return resolve('รหัสผ่านต้องมีอย่างน้อย 8 ตัวอักษร') + } + if (!/[A-Z]/.test(val)) { + return resolve('ต้องมีตัวอักษรพิมพ์ใหญ่ (A-Z)') + } + if (!/[0-9]/.test(val)) { + return resolve('ต้องมีตัวเลข (0-9)') + } + // if (!/[@$!%*?&]/.test(val)) { + // return resolve('ต้องมีอักขระพิเศษ (@$!%*?&)') + // } + + resolve(true) + }) +} + +function ruleReNewPassWord(val: string) { + return new Promise((resolve) => { + if (!val) { + return resolve('กรุณายืนยันรหัสผ่านใหม่') + } + if (val.length < 8) { + return resolve('รหัสผ่านต้องมีอย่างน้อย 8 ตัวอักษร') + } + if (!/[A-Z]/.test(val)) { + return resolve('ต้องมีตัวอักษรพิมพ์ใหญ่ (A-Z)') + } + if (!/[0-9]/.test(val)) { + return resolve('ต้องมีตัวเลข (0-9)') + } + // else if (!/[@$!%*?&]/.test(val)) { + // return resolve('ต้องมีอักขระพิเศษ (@$!%*?&)'); + // } + if (val !== newPassword.value) { + return resolve('รหัสผ่านใหม่ไม่ตรงกัน') + } + resolve(true) + }) +} + onMounted(async () => { fetchTotolNotificate() fetchKeycloakPosition() @@ -376,7 +448,7 @@ onMounted(async () => { Landing Page --> - + { + + + + + + + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+ + + + บันทึกข้อมูล + +
+
+