From a0fb2d81d05a89bccb4bfdd042a75cade7d4118e Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Wed, 15 May 2024 11:50:06 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20ui=20=E0=B9=80=E0=B8=9B=E0=B8=A5=E0=B8=B5=E0=B9=88=E0=B8=A2?= =?UTF-8?q?=E0=B8=99=E0=B8=A3=E0=B8=B9=E0=B8=9B=20=E0=B8=A3=E0=B8=AD=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../04_registryNew/views/detailView.vue | 191 +++++++++++++++++- 1 file changed, 189 insertions(+), 2 deletions(-) diff --git a/src/modules/04_registryNew/views/detailView.vue b/src/modules/04_registryNew/views/detailView.vue index 54f4ba160..fcd5b1172 100644 --- a/src/modules/04_registryNew/views/detailView.vue +++ b/src/modules/04_registryNew/views/detailView.vue @@ -34,8 +34,13 @@ const { success, date2Thai, dateToISO, + dialogMessageNotify, } = mixin; +const dialogImage = ref(false); +const images = ref([]); +const activeImage = ref(null); + const profileId = ref(route.params.id.toString()); const empType = ref( route.name === "registryNewByid" ? "" : "-employee" @@ -306,6 +311,66 @@ async function clickSaveDeceased() { }); } +function imageActive(n: any) { + activeImage.value = n; +} +function onImage() { + dialogImage.value = true; +} + +function closeImage() { + dialogImage.value = false; +} + +function getClass(n: any) { + const val = n == activeImage.value; + return { + "rounded-borders border-green shadow-1": val, + "rounded-borders shadow-1": !val, + }; +} + +function imageClass(n: any) { + const val = n == activeImage.value; + return { + "rounded-borders bg-grey-2 image-size-default": val, + "rounded-borders bg-grey-2 image-size-full": !val, + }; +} + +const selectAvatarHistory = async () => { + if (activeImage.value == null) { + dialogMessageNotify( + $q, + "ไม่สามารถเปลี่ยนรูปได้ กรุณาเลือกรูปที่ต้องการเปลี่ยน" + ); + return; + } + showLoader(); + await http + .put(config.API.profileAvatarId(route.params.id.toString()), { + avatar: activeImage.value.avatarId, + }) + .then((res) => { + dialogImage.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + fileName.value = `profile-${profileId.value}`; + await fetchProfile(profileId.value); + await fetchDataPersonal(); + }); + // *************************************************************************************************** + // ****************** fetch data เปลี่ยนรูปภาพ ส่ง ID กลับ****************** + // *************************************************************************************************** +}; + +const deletePhoto = async (id: string) => { + dialogRemove($q, () => {}, "ต้องการทำการลบข้อมูลนี้ใช่หรือไม่"); +}; + onMounted(async () => { fileName.value = `profile-${profileId.value}`; fetchProfile(profileId.value); @@ -406,9 +471,23 @@ onMounted(async () => {
- - + + +
+ + อัปเดตรูปภาพ + +
+
+ { + + + + +
เลือกรูปภาพ
+ + + ปิดหน้านี้ + +
+ + +
+
+
+ + อัปโหลดรูปภาพ +
+
+
+
+ +
+ {{ date2Thai(n.createdDate) }} + + +
+
+
+
+
+
+ + + + เลือกรูปภาพ + + +
+