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++) {