From 8a624efe6f2a0b808fda8dae3bc32407fd5a1546 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 6 Jun 2024 18:06:01 +0700 Subject: [PATCH] fix format --- src/controllers/ProfileController.ts | 16 +++++++++------- src/interfaces/extension.ts | 10 ++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 882942ce..d4e058a7 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -177,11 +177,11 @@ export class ProfileController extends Controller { LastName: profile.lastName != null ? profile.lastName : "", DateOfBirth: profile.birthDate != null - ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.birthDate)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate)) : "", DateRetire: profile.dateRetire != null - ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateRetire)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire)) : "", RegistrationAddress: Extension.ToThaiNumber( `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, @@ -197,12 +197,12 @@ export class ProfileController extends Controller { : "", AppointText: profile.dateAppoint != null - ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateAppoint)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint)) : "", SalaryDate: profile.profileSalary.length > 0 && profile.profileSalary[0].date != null ? Extension.ToThaiNumber( - Extension.ToThaiShortDate_perfixMonthYear(profile.profileSalary[0].date), + Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date), ) : "", PositionName: profile.position != null ? profile.position : "", @@ -414,7 +414,7 @@ export class ProfileController extends Controller { DisciplineYear: Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null, DisciplineDetail: item.detail ?? null, - RefNo: item.refCommandNo ?? null, + RefNo: Extension.ToThaiNumber(item.refCommandNo) ?? null, })); const educations = await this.educationRepository.find({ @@ -448,6 +448,8 @@ export class ProfileController extends Controller { "positionLevel", "positionSalaryAmount", "refCommandNo", + "amount", + "templateDoc", ], where: { profileId: id }, }); @@ -456,9 +458,9 @@ export class ProfileController extends Controller { SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.date)) ?? null, Position: item.position ?? null, PosNo: item.posNo ?? null, - Salary: "", + Salary: item.amount ?? null, Rank: item.positionLevel ?? null, - RefAll: item.refCommandNo ?? null, + RefAll: Extension.ToThaiNumber(item.templateDoc) ?? null, PositionType: item.positionType ?? null, PositionLevel: item.positionLevel ?? null, PositionAmount: diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index cedb9ba5..d3c57877 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -123,15 +123,9 @@ class Extension { ); } - public static ToThaiShortDate_perfixMonthYear(value: Date) { + public static ToThaiShortDate_monthYear(value: Date) { let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear(); - return ( - value.getDate() + - " เดือน " + - Extension.ToThaiShortMonth(value.getMonth() + 1) + - " พ.ศ. " + - yy - ); + return value.getDate() + " เดือน " + Extension.ToThaiMonth(value.getMonth() + 1) + " พ.ศ. " + yy; } public static sumObjectValues(array: any, propertyName: any) {