Merge branch 'develop' into adiDev
This commit is contained in:
commit
f8c0d7a2e9
6 changed files with 1303 additions and 191 deletions
|
|
@ -301,92 +301,104 @@ export class ProfileController extends Controller {
|
|||
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
||||
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
||||
|
||||
const profile = {
|
||||
CitizenId: profiles?.citizenId ?? null,
|
||||
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() : null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
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,
|
||||
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))
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
Area: "",
|
||||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix:
|
||||
profileFamilyCouple?.couplePrefix != null ? profileFamilyCouple.couplePrefix : "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
FatherPrefix:
|
||||
profileFamilyFather?.fatherPrefix != null ? profileFamilyFather.fatherPrefix : "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
MotherPrefix:
|
||||
profileFamilyMother?.motherPrefix != null ? 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.ToThaiShortDate(profiles.birthDate) : null,
|
||||
RetireDate: profiles?.dateRetireLaw,
|
||||
AvatarId: profiles?.avatar ?? null,
|
||||
};
|
||||
RetireDate:
|
||||
profiles.dateRetireLaw != null
|
||||
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
||||
: "",
|
||||
// AvatarId: profiles?.avatar ?? null,
|
||||
},
|
||||
];
|
||||
|
||||
const certs = await this.certificateRepository.find({
|
||||
where: { profileId: id },
|
||||
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
|
||||
});
|
||||
const cert = certs.map((item) => ({
|
||||
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) ?? null,
|
||||
end: Extension.ToThaiShortDate(item.endDate) ?? null,
|
||||
level: "",
|
||||
degree: "",
|
||||
field: item.place ?? null,
|
||||
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,
|
||||
Level: "",
|
||||
Degree: "",
|
||||
Field: item.place ?? null,
|
||||
}));
|
||||
|
||||
const disciplines = await this.disciplineRepository.find({
|
||||
select: ["refCommandDate", "refCommandNo", "detail"],
|
||||
where: { profileId: id },
|
||||
});
|
||||
const discipline = disciplines.map((item) => ({
|
||||
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
|
||||
const Discipline = disciplines.map((item) => ({
|
||||
DisciplineYear:
|
||||
Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null,
|
||||
DisciplineDetail: item.detail ?? null,
|
||||
RefNo: item.refCommandNo ?? null,
|
||||
}));
|
||||
|
|
@ -395,10 +407,10 @@ export class ProfileController extends Controller {
|
|||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||
where: { profileId: id },
|
||||
});
|
||||
const education = educations.map((item) => ({
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute ?? null,
|
||||
Start: new Date(item.startDate).getFullYear() ?? null,
|
||||
End: new Date(item.endDate).getFullYear() ?? 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,
|
||||
|
|
@ -416,25 +428,29 @@ export class ProfileController extends Controller {
|
|||
where: { profileId: id },
|
||||
});
|
||||
|
||||
const salary = salarys.map((item) => ({
|
||||
SalaryDate: Extension.ToThaiShortDate(item.date) ?? null,
|
||||
const Salary = salarys.map((item) => ({
|
||||
SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) ?? null,
|
||||
Position: item.position ?? null,
|
||||
PosNo: item.posNo ?? null,
|
||||
Salary: "",
|
||||
Rank: item.positionLevel ?? null,
|
||||
RefAll: item.refCommandNo ?? null,
|
||||
PositionType: item.positionType ?? null,
|
||||
PositionLevel: item.positionLevel ?? null,
|
||||
PositionAmount: item.positionSalaryAmount ?? null,
|
||||
PositionAmount:
|
||||
item.positionSalaryAmount == null
|
||||
? null
|
||||
: Extension.ToThaiNumber(item.positionSalaryAmount.toString()),
|
||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
return new HttpSuccess({
|
||||
profile,
|
||||
cert,
|
||||
training,
|
||||
discipline,
|
||||
education,
|
||||
salary,
|
||||
Profile,
|
||||
Cert,
|
||||
Training,
|
||||
Discipline,
|
||||
Education,
|
||||
Salary,
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue