From 4dcaa92f63405926f4e1e5046d45035c7368a305 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 17 Jan 2025 10:40:19 +0700 Subject: [PATCH] posttion --- .../ProfileGovernmentEmployeeController.ts | 25 +++++++++++++------ ...ProfileGovernmentEmployeeTempController.ts | 5 +++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/controllers/ProfileGovernmentEmployeeController.ts b/src/controllers/ProfileGovernmentEmployeeController.ts index 2d5cc270..48959a68 100644 --- a/src/controllers/ProfileGovernmentEmployeeController.ts +++ b/src/controllers/ProfileGovernmentEmployeeController.ts @@ -8,7 +8,12 @@ import { ProfileEmployee } from "../entities/ProfileEmployee"; import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment"; import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosMaster } from "../entities/EmployeePosMaster"; -import { calculateAge, calculateGovAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils"; +import { + calculateAge, + calculateGovAge, + calculateRetireDate, + setLogDataDiff, +} from "../interfaces/utils"; import permission from "../interfaces/permission"; import { OrgRevision } from "../entities/OrgRevision"; @Route("api/v1/org/profile-employee/government") @@ -103,15 +108,16 @@ export class ProfileGovernmentEmployeeController extends Controller { const data = { org: org, //สังกัด position: record.position, //ตำแหน่ง - posLevel: record.posType == null && record.posLevel == null - ? null - : `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ + posLevel: + record.posType == null && record.posLevel == null + ? null + : `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), dateRetireLaw: record.dateRetireLaw ?? null, // govAge: record.dateStart == null ? null : calculateAge(record.dateStart), - govAge: await calculateGovAge(profile.id,"EMPLOYEE"), + govAge: await calculateGovAge(profile.id, "EMPLOYEE"), dateAppoint: record.dateAppoint, dateStart: record.dateStart, govAgeAbsent: record.govAgeAbsent, @@ -206,7 +212,10 @@ export class ProfileGovernmentEmployeeController extends Controller { const data = { org: org, //สังกัด position: record.position, //ตำแหน่ง - posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ + posLevel: + record.posLevel == null + ? null + : `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ @@ -215,7 +224,7 @@ export class ProfileGovernmentEmployeeController extends Controller { reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ // govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ - govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"), + govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"), govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย @@ -299,7 +308,7 @@ export class ProfileGovernmentEmployeeController extends Controller { reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ // govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ - govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"), + govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"), govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย diff --git a/src/controllers/ProfileGovernmentEmployeeTempController.ts b/src/controllers/ProfileGovernmentEmployeeTempController.ts index da8f3014..4657137c 100644 --- a/src/controllers/ProfileGovernmentEmployeeTempController.ts +++ b/src/controllers/ProfileGovernmentEmployeeTempController.ts @@ -202,7 +202,10 @@ export class ProfileGovernmentEmployeeTempController extends Controller { const data = { org: org, //สังกัด position: record.position, //ตำแหน่ง - posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ + posLevel: + record.posLevel == null + ? null + : `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ