เพิ่ม Extension.ToThaiNumber ใน profile
This commit is contained in:
parent
7c1bcebcb8
commit
3a258897fb
1 changed files with 35 additions and 25 deletions
|
|
@ -302,20 +302,25 @@ export class ProfileController extends Controller {
|
|||
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
||||
|
||||
const Profile = {
|
||||
CitizenId: profiles?.citizenId ?? null,
|
||||
CitizenId:
|
||||
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
||||
Prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||
FirstName: profiles?.firstName != null ? profiles.firstName : "",
|
||||
LastName: profiles?.lastName != null ? profiles.lastName : "",
|
||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null,
|
||||
BirthDay: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
||||
: null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate
|
||||
? new Date(profiles.birthDate).getMonth() + (1).toString()
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
||||
: null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null,
|
||||
BirthYear: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
|
||||
: null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
|
|
@ -326,24 +331,21 @@ export class ProfileController extends Controller {
|
|||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix:
|
||||
profileFamilyCouple?.couplePrefix != null ? profileFamilyCouple.couplePrefix : "",
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
FatherPrefix:
|
||||
profileFamilyFather?.fatherPrefix != null ? profileFamilyFather.fatherPrefix : "",
|
||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
MotherPrefix:
|
||||
profileFamilyMother?.motherPrefix != null ? profileFamilyMother.motherPrefix : "",
|
||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
|
||||
MotherFullName:
|
||||
profileFamilyMother?.motherPrefix ||
|
||||
profileFamilyMother?.motherFirstName ||
|
||||
|
|
@ -355,8 +357,13 @@ export class ProfileController extends Controller {
|
|||
Institute: "",
|
||||
StartDate: profiles?.dateStart,
|
||||
AppointDate: profiles?.dateAppoint,
|
||||
BirthDate: profiles?.birthDate ? Extension.ToThaiShortDate(profiles.birthDate) : null,
|
||||
RetireDate: profiles?.dateRetireLaw,
|
||||
BirthDate: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: null,
|
||||
RetireDate:
|
||||
profiles.dateRetireLaw != null
|
||||
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
||||
: "",
|
||||
// AvatarId: profiles?.avatar ?? null,
|
||||
};
|
||||
|
||||
|
|
@ -367,20 +374,20 @@ export class ProfileController extends Controller {
|
|||
const Cert = certs.map((item) => ({
|
||||
CertificateType: item.certificateType ?? null,
|
||||
Issuer: item.issuer ?? null,
|
||||
CertificateNo: item.certificateNo ?? null,
|
||||
IssueDate: Extension.ToThaiShortDate(item.issueDate) ?? null,
|
||||
CertificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null,
|
||||
IssueDate: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.issueDate)) ?? null,
|
||||
}));
|
||||
const trainings = await this.trainingRepository.find({
|
||||
select: ["startDate", "endDate", "place", "department"],
|
||||
where: { profileId: id },
|
||||
});
|
||||
const Training = trainings.map((item) => ({
|
||||
institute: item.department ?? null,
|
||||
start: Extension.ToThaiShortDate(item.startDate).toString() ?? null,
|
||||
end: Extension.ToThaiShortDate(item.endDate).toString() ?? null,
|
||||
level: "",
|
||||
degree: "",
|
||||
field: item.place ?? null,
|
||||
Institute: item.department ?? null,
|
||||
Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? null,
|
||||
End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? null,
|
||||
Level: "",
|
||||
Degree: "",
|
||||
Field: item.place ?? null,
|
||||
}));
|
||||
|
||||
const disciplines = await this.disciplineRepository.find({
|
||||
|
|
@ -388,7 +395,8 @@ export class ProfileController extends Controller {
|
|||
where: { profileId: id },
|
||||
});
|
||||
const Discipline = disciplines.map((item) => ({
|
||||
DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null,
|
||||
DisciplineYear:
|
||||
Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null,
|
||||
DisciplineDetail: item.detail ?? null,
|
||||
RefNo: item.refCommandNo ?? null,
|
||||
}));
|
||||
|
|
@ -399,8 +407,8 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute ?? null,
|
||||
Start: new Date(item.startDate).getFullYear().toString() ?? null,
|
||||
End: new Date(item.endDate).getFullYear().toString() ?? null,
|
||||
Start: Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()) ?? null,
|
||||
End: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()) ?? null,
|
||||
Level: item.educationLevel ?? null,
|
||||
Degree: item.degree ?? null,
|
||||
Field: item.field ?? null,
|
||||
|
|
@ -419,7 +427,7 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
|
||||
const Salary = salarys.map((item) => ({
|
||||
SalaryDate: Extension.ToThaiShortDate(item.date) ?? null,
|
||||
SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) ?? null,
|
||||
Position: item.position ?? null,
|
||||
PosNo: item.posNo ?? null,
|
||||
Salary: "",
|
||||
|
|
@ -428,7 +436,9 @@ export class ProfileController extends Controller {
|
|||
PositionType: item.positionType ?? null,
|
||||
PositionLevel: item.positionLevel ?? null,
|
||||
PositionAmount:
|
||||
item.positionSalaryAmount == null ? null : item.positionSalaryAmount.toString(),
|
||||
item.positionSalaryAmount == null
|
||||
? null
|
||||
: Extension.ToThaiNumber(item.positionSalaryAmount.toString()),
|
||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue