บันทึกการศึกษา

This commit is contained in:
Kittapath 2024-05-03 17:38:39 +07:00
parent d101cbca4a
commit 00df943de5

View file

@ -218,6 +218,7 @@ export class DevelopmentScholarshipController extends Controller {
.getManyAndCount(); .getManyAndCount();
const formattedData = development.map((item) => ({ const formattedData = development.map((item) => ({
id: item.id, id: item.id,
year: item.scholarshipYear,
citizenId: item.citizenId, citizenId: item.citizenId,
fullName: item.prefix + item.firstName + " " + item.lastName, fullName: item.prefix + item.firstName + " " + item.lastName,
position: item.position, position: item.position,
@ -461,51 +462,61 @@ export class DevelopmentScholarshipController extends Controller {
getDevelopment.status = _status; getDevelopment.status = _status;
getDevelopment.lastUpdateUserId = request.user.sub; getDevelopment.lastUpdateUserId = request.user.sub;
getDevelopment.lastUpdateFullName = request.user.name; getDevelopment.lastUpdateFullName = request.user.name;
let scholarshipType = "";
if (_status == "GRADUATE") { if (_status == "GRADUATE") {
if (getDevelopment.scholarshipType != null) { if (getDevelopment.scholarshipType != null) {
switch (getDevelopment.scholarshipType.trim().toUpperCase()) { switch (getDevelopment.scholarshipType.trim().toUpperCase()) {
case "DOMESTICE": case "DOMESTICE":
getDevelopment.scholarshipType = "การศึกษาในประเทศ"; scholarshipType = "การศึกษาในประเทศ";
break; break;
case "NOABROAD": case "NOABROAD":
getDevelopment.scholarshipType = scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)"; "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)";
break; break;
case "ABROAD": case "ABROAD":
getDevelopment.scholarshipType = scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)"; "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)";
break; break;
case "EXECUTIVE": case "EXECUTIVE":
getDevelopment.scholarshipType = scholarshipType =
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)"; "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)";
break; break;
default: default:
break; break;
} }
} }
let profileEdu = await new CallAPI().PostData(request, "org/profile/educations", { let profileEdu = await new CallAPI()
profileId: getDevelopment.profileId, .PostData(request, "org/profile/educations", {
institute: getDevelopment.educationalInstitution, profileId: getDevelopment.profileId,
startDate: getDevelopment.startDate, institute: getDevelopment.educationalInstitution,
endDate: getDevelopment.endDate, startDate: getDevelopment.startDate,
finishDate: null, endDate: getDevelopment.endDate,
isEducation: false, finishDate: null,
degree: null, isEducation: false,
field: getDevelopment.field, degree: null,
fundName: getDevelopment.scholarshipType, field: getDevelopment.field,
gpa: null, fundName: scholarshipType,
country: getDevelopment.studyCountry, gpa: null,
other: null, country: getDevelopment.studyCountry,
duration: getDevelopment.totalPeriod, other: null,
durationYear: 0, duration: getDevelopment.totalPeriod,
note: null, durationYear: 0,
educationLevel: getDevelopment.degreeLevel, note: null,
educationLevelId: null, educationLevel: getDevelopment.degreeLevel,
isDate: false, educationLevelId: null,
positionPath: null, isDate: false,
positionPathId: null, positionPath: null,
}); positionPathId: null,
})
.then(async (x) => {
await this.developmentScholarshipRepository.save(getDevelopment);
})
.catch((error) => {
console.error("ไม่สามารถบันทึกลงทะเบียนประวัติได้");
});
} else if (_status == "NOTGRADUATE") { } else if (_status == "NOTGRADUATE") {
getDevelopment.status = _status;
await this.developmentScholarshipRepository.save(getDevelopment);
} else { } else {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสถานะนี้ในระบบ"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสถานะนี้ในระบบ");
} }