แก้ไข profile เพิ่มเติม
This commit is contained in:
parent
857b0624f4
commit
d96a6319b6
1 changed files with 71 additions and 73 deletions
|
|
@ -301,73 +301,71 @@ export class ProfileController extends Controller {
|
|||
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
||||
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
||||
|
||||
const Profile = [
|
||||
{
|
||||
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
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
||||
const Profile = {
|
||||
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
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
||||
: null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
||||
: null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
|
||||
: null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
Area: "",
|
||||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
||||
: null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
|
||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
Area: "",
|
||||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
|
||||
MotherFullName:
|
||||
profileFamilyMother?.motherPrefix ||
|
||||
profileFamilyMother?.motherFirstName ||
|
||||
profileFamilyMother?.motherLastName
|
||||
? `${profileFamilyMother?.motherPrefix ?? ""} ${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
Division: "",
|
||||
Institute: "",
|
||||
StartDate: profiles?.dateStart,
|
||||
AppointDate: profiles?.dateAppoint,
|
||||
BirthDate: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
|
||||
MotherFullName:
|
||||
profileFamilyMother?.motherPrefix ||
|
||||
profileFamilyMother?.motherFirstName ||
|
||||
profileFamilyMother?.motherLastName
|
||||
? `${profileFamilyMother?.motherPrefix ?? ""} ${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
RetireDate:
|
||||
profiles.dateRetireLaw != null
|
||||
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
||||
: "",
|
||||
// AvatarId: profiles?.avatar ?? null,
|
||||
},
|
||||
];
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
Division: "",
|
||||
Institute: "",
|
||||
StartDate: profiles?.dateStart,
|
||||
AppointDate: profiles?.dateAppoint ?? "",
|
||||
BirthDate: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: null,
|
||||
RetireDate:
|
||||
profiles.dateRetireLaw != null
|
||||
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
||||
: "",
|
||||
// AvatarId: profiles?.avatar ?? null,
|
||||
};
|
||||
|
||||
const certs = await this.certificateRepository.find({
|
||||
where: { profileId: id },
|
||||
|
|
@ -384,12 +382,12 @@ export class ProfileController extends Controller {
|
|||
where: { profileId: id },
|
||||
});
|
||||
const Training = trainings.map((item) => ({
|
||||
Institute: item.department ?? null,
|
||||
Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? null,
|
||||
End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? null,
|
||||
Institute: item.department ?? "",
|
||||
Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? "",
|
||||
End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? "",
|
||||
Level: "",
|
||||
Degree: "",
|
||||
Field: item.place ?? null,
|
||||
Field: item.place ?? "",
|
||||
}));
|
||||
|
||||
const disciplines = await this.disciplineRepository.find({
|
||||
|
|
@ -408,12 +406,12 @@ export class ProfileController extends Controller {
|
|||
where: { profileId: id },
|
||||
});
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute ?? null,
|
||||
Institute: item.institute ?? "",
|
||||
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,
|
||||
Level: item.educationLevel ?? "",
|
||||
Degree: item.degree ?? "",
|
||||
Field: item.field ?? "",
|
||||
}));
|
||||
const salarys = await this.salaryRepository.find({
|
||||
select: [
|
||||
|
|
@ -445,7 +443,7 @@ export class ProfileController extends Controller {
|
|||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
return new HttpSuccess({
|
||||
Profile,
|
||||
Profile: [Profile],
|
||||
Cert,
|
||||
Training,
|
||||
Discipline,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue