Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-05-29 15:39:47 +07:00
commit f8c0d7a2e9
6 changed files with 1303 additions and 191 deletions

View file

@ -314,22 +314,24 @@ export class ProfileEmployeeController extends Controller {
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
const profile = {
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,
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null,
BirthDayText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
: "",
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
BirthMonth: profiles?.birthDate
? new Date(profiles.birthDate).getMonth() + (1).toString()
: null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null,
BirthYearText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
: "",
Address: "",
District: "",
@ -368,14 +370,14 @@ export class ProfileEmployeeController extends Controller {
AppointDate: profiles?.dateAppoint,
BirthDate: profiles?.birthDate ? Extension.ToThaiShortDate(profiles.birthDate) : null,
RetireDate: profiles?.dateRetireLaw,
AvatarId: profiles?.avatar ?? null,
// AvatarId: profiles?.avatar ?? null,
};
const certs = await this.certificateRepository.find({
where: { profileEmployeeId: 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,
@ -385,10 +387,10 @@ export class ProfileEmployeeController extends Controller {
select: ["startDate", "endDate", "place", "department"],
where: { profileEmployeeId: id },
});
const training = trainings.map((item) => ({
const Training = trainings.map((item) => ({
institute: item.department ?? null,
start: Extension.ToThaiShortDate(item.startDate) ?? null,
end: Extension.ToThaiShortDate(item.endDate) ?? null,
start: Extension.ToThaiShortDate(item.startDate).toString() ?? null,
end: Extension.ToThaiShortDate(item.endDate).toString() ?? null,
level: "",
degree: "",
field: item.place ?? null,
@ -398,8 +400,8 @@ export class ProfileEmployeeController extends Controller {
select: ["refCommandDate", "refCommandNo", "detail"],
where: { profileEmployeeId: id },
});
const discipline = disciplines.map((item) => ({
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
const Discipline = disciplines.map((item) => ({
DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null,
DisciplineDetail: item.detail ?? null,
RefNo: item.refCommandNo ?? null,
}));
@ -408,10 +410,10 @@ export class ProfileEmployeeController extends Controller {
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: 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: new Date(item.startDate).getFullYear().toString() ?? null,
End: new Date(item.endDate).getFullYear().toString() ?? null,
Level: item.educationLevel ?? null,
Degree: item.degree ?? null,
Field: item.field ?? null,
@ -429,11 +431,12 @@ export class ProfileEmployeeController extends Controller {
where: { profileEmployeeId: id },
});
const salary = salarys.map((item) => ({
const Salary = salarys.map((item) => ({
SalaryDate: 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,
@ -441,7 +444,7 @@ export class ProfileEmployeeController extends Controller {
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
}));
return new HttpSuccess({ profile, cert, training, discipline, education, salary });
return new HttpSuccess({ Profile, Cert, Training, Discipline, Education, Salary });
}
/**