From 69826b394de0ff72e0f33783a576d51083626f3c Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Mon, 4 Nov 2024 17:20:07 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=B5=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=B1=E0=B8=9E=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=94?= =?UTF-8?q?=E0=B8=A3=E0=B8=B9=E0=B8=9B=20kk1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 7 +++++++ src/controllers/ProfileEmployeeController.ts | 7 +++++++ src/interfaces/extension.ts | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index da9b6c4c..b4f03053 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -736,12 +736,19 @@ export class ProfileController extends Controller { ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`, url1: _ImgUrl[0] ? _ImgUrl[0] : null, + yearUpload1: profiles.profileAvatars[0] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt)) : null, url2: _ImgUrl[1] ? _ImgUrl[1] : null, + yearUpload2: profiles.profileAvatars[1] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt)) : null, url3: _ImgUrl[2] ? _ImgUrl[2] : null, + yearUpload3: profiles.profileAvatars[2] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt)) : null, url4: _ImgUrl[3] ? _ImgUrl[3] : null, + yearUpload4: profiles.profileAvatars[3] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt)) : null, url5: _ImgUrl[4] ? _ImgUrl[4] : null, + yearUpload5: profiles.profileAvatars[4] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt)) : null, url6: _ImgUrl[5] ? _ImgUrl[5] : null, + yearUpload6: profiles.profileAvatars[5] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt)) : null, url7: _ImgUrl[6] ? _ImgUrl[6] : null, + yearUpload7: profiles.profileAvatars[6] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt)) : null, // BirthDay: profiles?.birthDate // ? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString()) diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 6224790f..02ea587e 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -734,12 +734,19 @@ export class ProfileEmployeeController extends Controller { ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`, url1: _ImgUrl[0] ? _ImgUrl[0] : null, + yearUpload1: profiles.profileAvatars[0] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt)) : null, url2: _ImgUrl[1] ? _ImgUrl[1] : null, + yearUpload2: profiles.profileAvatars[1] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt)) : null, url3: _ImgUrl[2] ? _ImgUrl[2] : null, + yearUpload3: profiles.profileAvatars[2] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt)) : null, url4: _ImgUrl[3] ? _ImgUrl[3] : null, + yearUpload4: profiles.profileAvatars[3] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt)) : null, url5: _ImgUrl[4] ? _ImgUrl[4] : null, + yearUpload5: profiles.profileAvatars[4] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt)) : null, url6: _ImgUrl[5] ? _ImgUrl[5] : null, + yearUpload6: profiles.profileAvatars[5] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt)) : null, url7: _ImgUrl[6] ? _ImgUrl[6] : null, + yearUpload7: profiles.profileAvatars[6] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt)) : null, insignias, leaves, certs, diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index 6d11543c..8a168442 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -228,6 +228,13 @@ class Extension { ); } + public static ToThaiShortYear(value: Date) { + let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear(); + return ( + yy.toString() + ); + } + public static sumObjectValues(array: any, propertyName: any) { let sum = 0; for (let i = 0; i < array.length; i++) {