parent
c6fabbcf16
commit
d3534a3085
4 changed files with 85 additions and 63 deletions
|
|
@ -2952,8 +2952,8 @@ export class DevelopmentController extends Controller {
|
||||||
const oldProfile: any = getDevelopment.developmentHistorys.find(
|
const oldProfile: any = getDevelopment.developmentHistorys.find(
|
||||||
(x) => x.citizenId == item["รหัสประจำตัวประชาชน"],
|
(x) => x.citizenId == item["รหัสประจำตัวประชาชน"],
|
||||||
);
|
);
|
||||||
if (oldProfile != null) {
|
if (oldProfile.length > 0) {
|
||||||
if (oldProfile.isDone == true) return;
|
return;
|
||||||
}
|
}
|
||||||
if (item["ประเภท"] == undefined) return;
|
if (item["ประเภท"] == undefined) return;
|
||||||
let development = Object.assign(new DevelopmentHistory(), oldProfile);
|
let development = Object.assign(new DevelopmentHistory(), oldProfile);
|
||||||
|
|
@ -3202,30 +3202,28 @@ export class DevelopmentController extends Controller {
|
||||||
let status = null;
|
let status = null;
|
||||||
let _null: any = null;
|
let _null: any = null;
|
||||||
if (oldProfile != null) {
|
if (oldProfile != null) {
|
||||||
if (oldProfile.isDone == true)
|
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ข้อมูลนี้ได้ถูกบันทึกแล้ว");
|
||||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ข้อมูลนี้ได้ถูกบันทึกแล้ว");
|
|
||||||
oldProfile.dateStart = requestBody.dateStart == undefined ? _null : requestBody.dateStart;
|
|
||||||
oldProfile.dateEnd = requestBody.dateEnd == undefined ? _null : requestBody.dateEnd;
|
|
||||||
oldProfile.order = requestBody.commandNumber == undefined ? _null : requestBody.commandNumber;
|
|
||||||
oldProfile.dateOrder =
|
|
||||||
requestBody.commandDate == undefined ? _null : new Date(requestBody.commandDate);
|
|
||||||
oldProfile.trainingDays =
|
|
||||||
requestBody.trainingDays == undefined ? _null : requestBody.trainingDays;
|
|
||||||
oldProfile.createdUserId = request.user.sub;
|
|
||||||
oldProfile.createdFullName = request.user.name;
|
|
||||||
oldProfile.lastUpdateUserId = request.user.sub;
|
|
||||||
oldProfile.lastUpdateFullName = request.user.name;
|
|
||||||
oldProfile.createdAt = new Date();
|
|
||||||
oldProfile.lastUpdatedAt = new Date();
|
|
||||||
// addLogSequence(request, {
|
|
||||||
// action: "database",
|
|
||||||
// status: "success",
|
|
||||||
// description: "Store DevelopmentHistory.",
|
|
||||||
// });
|
|
||||||
await this.developmentHistoryRepository.save(oldProfile, { data: request });
|
|
||||||
setLogDataDiff(request, { before, after: oldProfile });
|
|
||||||
status = oldProfile.isProfile;
|
|
||||||
}
|
}
|
||||||
|
oldProfile.dateStart = requestBody.dateStart == undefined ? _null : requestBody.dateStart;
|
||||||
|
oldProfile.dateEnd = requestBody.dateEnd == undefined ? _null : requestBody.dateEnd;
|
||||||
|
oldProfile.order = requestBody.commandNumber == undefined ? _null : requestBody.commandNumber;
|
||||||
|
oldProfile.dateOrder = requestBody.commandDate == undefined ? _null : new Date(requestBody.commandDate);
|
||||||
|
oldProfile.trainingDays = requestBody.trainingDays == undefined ? _null : requestBody.trainingDays;
|
||||||
|
oldProfile.createdUserId = request.user.sub;
|
||||||
|
oldProfile.createdFullName = request.user.name;
|
||||||
|
oldProfile.lastUpdateUserId = request.user.sub;
|
||||||
|
oldProfile.lastUpdateFullName = request.user.name;
|
||||||
|
oldProfile.createdAt = new Date();
|
||||||
|
oldProfile.lastUpdatedAt = new Date();
|
||||||
|
// addLogSequence(request, {
|
||||||
|
// action: "database",
|
||||||
|
// status: "success",
|
||||||
|
// description: "Store DevelopmentHistory.",
|
||||||
|
// });
|
||||||
|
await this.developmentHistoryRepository.save(oldProfile, { data: request });
|
||||||
|
setLogDataDiff(request, { before, after: oldProfile });
|
||||||
|
status = oldProfile.isProfile;
|
||||||
|
|
||||||
|
|
||||||
if (requestBody.type == "OFFICER") {
|
if (requestBody.type == "OFFICER") {
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
|
||||||
.leftJoinAndSelect("developmentHistory.development", "development")
|
.leftJoinAndSelect("developmentHistory.development", "development")
|
||||||
.leftJoinAndSelect("developmentHistory.employeePosLevel", "employeePosLevel")
|
.leftJoinAndSelect("developmentHistory.employeePosLevel", "employeePosLevel")
|
||||||
.leftJoinAndSelect("developmentHistory.employeePosType", "employeePosType")
|
.leftJoinAndSelect("developmentHistory.employeePosType", "employeePosType")
|
||||||
|
.where("developmentHistory.isProfile IS TRUE")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
body.year != 0 && body.year != null && body.year != undefined
|
body.year != 0 && body.year != null && body.year != undefined
|
||||||
? "development.year = :year"
|
? "development.year = :year"
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,16 @@ export class DevelopmentScholarshipController extends Controller {
|
||||||
_data = x;
|
_data = x;
|
||||||
})
|
})
|
||||||
.catch((x) => {});
|
.catch((x) => {});
|
||||||
|
|
||||||
|
if (keyword && ["กำลังศึกษา", "เรียนไม่จบ", "เรียนจบ"].includes(keyword.trim())) {
|
||||||
|
const mapStatus: Record<string, string> = {
|
||||||
|
"กำลังศึกษา": "PENDING",
|
||||||
|
"เรียนไม่จบ": "NOTGRADUATE",
|
||||||
|
"เรียนจบ": "GRADUATE",
|
||||||
|
};
|
||||||
|
keyword = mapStatus[keyword.trim()];
|
||||||
|
}
|
||||||
|
|
||||||
let query = await AppDataSource.getRepository(DevelopmentScholarship)
|
let query = await AppDataSource.getRepository(DevelopmentScholarship)
|
||||||
.createQueryBuilder("developmentScholarship")
|
.createQueryBuilder("developmentScholarship")
|
||||||
.leftJoinAndSelect("developmentScholarship.posLevel", "posLevel")
|
.leftJoinAndSelect("developmentScholarship.posLevel", "posLevel")
|
||||||
|
|
@ -196,42 +206,50 @@ export class DevelopmentScholarshipController extends Controller {
|
||||||
keyword: `%${keyword}%`,
|
keyword: `%${keyword}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
keyword != null && keyword != ""
|
keyword != null && keyword != ""
|
||||||
? "developmentScholarship.citizenId LIKE :keyword"
|
? "developmentScholarship.citizenId LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${keyword}%`,
|
keyword: `%${keyword}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
keyword != null && keyword != ""
|
keyword != null && keyword != ""
|
||||||
? "developmentScholarship.position LIKE :keyword"
|
? "developmentScholarship.position LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${keyword}%`,
|
keyword: `%${keyword}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
keyword != null && keyword != ""
|
keyword != null && keyword != ""
|
||||||
? "developmentScholarship.posExecutive LIKE :keyword"
|
? "developmentScholarship.posExecutive LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${keyword}%`,
|
keyword: `%${keyword}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
keyword != null && keyword != "" ? "posType.posTypeName LIKE :keyword" : "1=1",
|
keyword != null && keyword != ""
|
||||||
{
|
? "developmentScholarship.status LIKE :keyword"
|
||||||
keyword: `%${keyword}%`,
|
: "1=1",
|
||||||
},
|
{
|
||||||
)
|
keyword: `${keyword}`,
|
||||||
.orWhere(
|
},
|
||||||
keyword != null && keyword != "" ? "posLevel.posLevelName LIKE :keyword" : "1=1",
|
)
|
||||||
{
|
.orWhere(
|
||||||
keyword: `%${keyword}%`,
|
keyword != null && keyword != "" ? "posType.posTypeName LIKE :keyword" : "1=1",
|
||||||
},
|
{
|
||||||
);
|
keyword: `%${keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
keyword != null && keyword != "" ? "posLevel.posLevelName LIKE :keyword" : "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${keyword}%`,
|
||||||
|
},
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
|
||||||
|
|
@ -658,13 +658,18 @@ export class ReportController extends Controller {
|
||||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate3(getDevelopment.graduatedDate)),
|
: Extension.ToThaiNumber(Extension.ToThaiFullDate3(getDevelopment.graduatedDate)),
|
||||||
graduatedReason: getDevelopment.graduatedReason == null ? "" : getDevelopment.graduatedReason,
|
graduatedReason: getDevelopment.graduatedReason == null ? "" : getDevelopment.graduatedReason,
|
||||||
useOfficialTime: getDevelopment.useOfficialTime,
|
useOfficialTime: getDevelopment.useOfficialTime,
|
||||||
useOffTime: getDevelopment.useOfficialTime == "NOUSETIME" ? "🗹 ใช้ ☐ ไม่ใช้" : "☐ ใช้ 🗹 ไม่ใช้",
|
useOffTime:
|
||||||
|
getDevelopment.useOfficialTime == "NOUSETIME"
|
||||||
|
? "☐ ใช้ 🗹 ไม่ใช้ เวลาราชการ"
|
||||||
|
: getDevelopment.useOfficialTime == "USETIME"
|
||||||
|
? "🗹 ใช้ ☐ ไม่ใช้ เวลาราชการ"
|
||||||
|
: "🗹 ใช้ ☐ ไม่ใช้ เวลาราชการบางส่วน",
|
||||||
isGraduated: getDevelopment.isGraduated,
|
isGraduated: getDevelopment.isGraduated,
|
||||||
isG1: getDevelopment.isGraduated == true ? "🗹" : "☐",
|
isG1: getDevelopment.isGraduated == true ? "🗹" : "☐",
|
||||||
isG2: getDevelopment.isGraduated == true ? "☐" : "🗹",
|
isG2: getDevelopment.isGraduated == true ? "☐" : "🗹",
|
||||||
totalPeriod:
|
totalPeriod:
|
||||||
getDevelopment.totalPeriod == null || getDevelopment.totalPeriod == ""
|
getDevelopment.totalPeriod == null || getDevelopment.totalPeriod == ""
|
||||||
? ""
|
? "-"
|
||||||
: Extension.ToThaiNumber(getDevelopment.totalPeriod),
|
: Extension.ToThaiNumber(getDevelopment.totalPeriod),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue