diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 1e909cc5..6f768dfb 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -7304,6 +7304,7 @@ export class ProfileController extends Controller { profile && profile.profileEducations.length > 0 ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` : "-", + statusCheckEdit: profile.statusCheckEdit, }; if (_profile.child4Id != null) { diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 94214956..6924ff7d 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -4830,6 +4830,7 @@ export class ProfileEmployeeController extends Controller { profile && profile.profileEducations.length > 0 ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` : "-", + statusCheckEdit: profile.statusCheckEdit, }; if (_profile.child4Id != null) { diff --git a/src/controllers/ProfileSalaryTempController.ts b/src/controllers/ProfileSalaryTempController.ts index 1f4900c2..b972ab1b 100644 --- a/src/controllers/ProfileSalaryTempController.ts +++ b/src/controllers/ProfileSalaryTempController.ts @@ -17,7 +17,7 @@ import HttpSuccess from "../interfaces/http-success"; import HttpStatus from "../interfaces/http-status"; import HttpError from "../interfaces/http-error"; import { RequestWithUser } from "../middlewares/user"; -import { Brackets, LessThan, MoreThan } from "typeorm"; +import { Brackets, IsNull, LessThan, MoreThan, Not } from "typeorm"; import { setLogDataDiff } from "../interfaces/utils"; import { CreateProfileSalaryTemp, @@ -309,7 +309,7 @@ export class ProfileSalaryTempController extends Controller { orgRevisionId: findRevision.id, }) .andWhere( - statusCheckEdit != undefined && statusCheckEdit != null + statusCheckEdit != undefined && statusCheckEdit != null && statusCheckEdit.toUpperCase() != "ALL" ? "profile.statusCheckEdit = :statusCheckEdit" : "1=1", { @@ -640,9 +640,12 @@ export class ProfileSalaryTempController extends Controller { ) { if (type.toLocaleUpperCase() == "OFFICER") { const salary = await this.salaryRepo.find({ - where: { profileId: profileId }, + where: { + profileId: profileId, + }, order: { order: "ASC" } }); + if (salary.length <= 0) { let salaryOld = await this.salaryOldRepo.find({ where: { profileId: profileId }, @@ -725,6 +728,7 @@ export class ProfileSalaryTempController extends Controller { if (type.toLocaleUpperCase() == "OFFICER") { const salary = await this.salaryRepo.find({ where: { profileId: profileId, isDelete: false }, + order: { order: "ASC" } }); if (!salary) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); @@ -738,6 +742,7 @@ export class ProfileSalaryTempController extends Controller { } else { const salary = await this.salaryRepo.find({ where: { profileEmployeeId: profileId, isDelete: false }, + order: { order: "ASC" } }); if (!salary) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");