Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-06-25 18:42:05 +07:00
commit d5373fb62b
10 changed files with 897 additions and 209 deletions

View file

@ -1056,7 +1056,7 @@ export class EmployeePositionController extends Controller {
}); });
const authRoleName = await this.authRoleRepo.findOne({ const authRoleName = await this.authRoleRepo.findOne({
where: { id: String(posMaster.authRoleId) } where: { id: String(posMaster.authRoleId) },
}); });
let profile: any; let profile: any;
@ -1149,7 +1149,8 @@ export class EmployeePositionController extends Controller {
profilePoslevel: profilePoslevel:
level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`, level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`,
authRoleId: posMaster.authRoleId, authRoleId: posMaster.authRoleId,
authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName, authRoleName:
authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
positions: positions.map((position) => ({ positions: positions.map((position) => ({
id: position.id, id: position.id,
positionName: position.positionName, positionName: position.positionName,
@ -2150,4 +2151,46 @@ export class EmployeePositionController extends Controller {
return new HttpSuccess(); return new HttpSuccess();
} }
/**
* API
*
* @summary
*
*/
@Post("report/current")
async reportApproveCurrent(
@Body()
body: {
posmasterId: string;
positionId: string;
profileId: string;
},
) {
const posMaster = await this.employeePosMasterRepository.findOne({
where: { id: body.posmasterId },
});
if (posMaster == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
const posMasterOld = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: body.profileId,
orgRevisionId: posMaster.orgRevisionId,
},
});
if (posMasterOld != null) posMasterOld.current_holderId = null;
if (posMasterOld != null) posMasterOld.next_holderId = null;
const profile = await this.profileRepository.findOne({
where: { id: body.profileId },
});
if (profile == null)
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
posMaster.current_holderId = body.profileId;
posMaster.next_holderId = body.profileId;
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
await this.employeePosMasterRepository.save(posMaster);
return new HttpSuccess();
}
} }

View file

@ -203,7 +203,7 @@ export class InsigniaController extends Controller {
id: item.id, id: item.id,
name: item.name, name: item.name,
shortName: item.shortName, shortName: item.shortName,
insigniaTypeId: item.insigniaTypeId??null, insigniaTypeId: item.insigniaTypeId ?? null,
insigniaTypeName: item.insigniaType == null ? null : item.insigniaType.name, //ลำดับชั้นเครื่องราช insigniaTypeName: item.insigniaType == null ? null : item.insigniaType.name, //ลำดับชั้นเครื่องราช
createdAt: item.createdAt, createdAt: item.createdAt,
lastUpdatedAt: item.lastUpdatedAt, lastUpdatedAt: item.lastUpdatedAt,

View file

@ -30,6 +30,9 @@ import { OrgChild4 } from "../entities/OrgChild4";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { log } from "console"; import { log } from "console";
import CallAPI from "../interfaces/call-api";
import { ProfileSalary } from "../entities/ProfileSalary";
import { Profile } from "../entities/Profile";
@Route("api/v1/org") @Route("api/v1/org")
@Tags("Organization") @Tags("Organization")
@ -48,6 +51,8 @@ export class OrganizationController extends Controller {
private child4Repository = AppDataSource.getRepository(OrgChild4); private child4Repository = AppDataSource.getRepository(OrgChild4);
private posMasterRepository = AppDataSource.getRepository(PosMaster); private posMasterRepository = AppDataSource.getRepository(PosMaster);
private positionRepository = AppDataSource.getRepository(Position); private positionRepository = AppDataSource.getRepository(Position);
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
private profileRepo = AppDataSource.getRepository(Profile);
/** /**
* API * API
@ -1601,7 +1606,7 @@ export class OrganizationController extends Controller {
* @param {string} id Id revison * @param {string} id Id revison
*/ */
@Get("get/publish") @Get("get/publish")
async runPublish() { async runPublish(@Request() request: { user: Record<string, any> }) {
const today = new Date(); const today = new Date();
today.setHours(0, 0, 0, 0); // Set time to the beginning of the day today.setHours(0, 0, 0, 0); // Set time to the beginning of the day
const orgRevisionPublish = await this.orgRevisionRepository const orgRevisionPublish = await this.orgRevisionRepository
@ -1631,14 +1636,73 @@ export class OrganizationController extends Controller {
const posMaster = await this.posMasterRepository.find({ const posMaster = await this.posMasterRepository.find({
where: { orgRevisionId: orgRevisionDraft.id }, where: { orgRevisionId: orgRevisionDraft.id },
relations: [
"orgRoot",
"orgChild4",
"orgChild3",
"orgChild2",
"orgChild1",
"positions",
"positions.posLevel",
"positions.posType",
"positions.posExecutive",
],
}); });
posMaster.forEach(async (item) => { await Promise.all(
// if(item.next_holderId != null){ posMaster.map(async (item) => {
item.current_holderId = item.next_holderId; // if(item.next_holderId != null){
item.next_holderId = null; if (item.next_holderId != null) {
await this.posMasterRepository.save(item); const profile = await this.profileRepo.findOne({
// } where: { id: item.next_holderId == null ? "" : item.next_holderId },
}); });
const position = await item.positions.find((x) => x.positionIsSelected == true);
const _null: any = null;
if (profile != null) {
profile.posLevelId = position?.posLevelId ?? _null;
profile.posTypeId = position?.posTypeId ?? _null;
profile.position = position?.positionName ?? _null;
await this.profileRepo.save(profile);
}
const profileSalary = await this.salaryRepository.findOne({
where: { profileId: item.next_holderId },
order: { createdAt: "DESC" },
});
const shortName =
item != null && item.orgChild4 != null
? `${item.orgChild4.orgChild4ShortName}${item.posMasterNo}`
: item != null && item?.orgChild3 != null
? `${item.orgChild3.orgChild3ShortName}${item.posMasterNo}`
: item != null && item?.orgChild2 != null
? `${item.orgChild2.orgChild2ShortName}${item.posMasterNo}`
: item != null && item?.orgChild1 != null
? `${item.orgChild1.orgChild1ShortName}${item.posMasterNo}`
: item != null && item?.orgRoot != null
? `${item.orgRoot.orgRootShortName}${item.posMasterNo}`
: null;
// await new CallAPI().PostData(request, "org/profile/salary", {
// profileId: item.next_holderId,
// date: new Date(),
// amount: profileSalary?.amount ?? null,
// positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
// mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
// posNo: shortName,
// position: position?.positionName ?? _null,
// positionLine: position?.positionField ?? _null,
// positionPathSide: position?.positionArea ?? _null,
// positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
// positionType: position?.posType?.posTypeName ?? _null,
// positionLevel: position?.posLevel?.posLevelName ?? _null,
// refCommandNo: null,
// templateDoc: "ปรับโครงสร้าง",
// });
}
item.current_holderId = item.next_holderId;
item.next_holderId = null;
await this.posMasterRepository.save(item);
// }
}),
);
return new HttpSuccess(); return new HttpSuccess();
} }
@ -3353,4 +3417,41 @@ export class OrganizationController extends Controller {
return new HttpSuccess(formattedData); return new HttpSuccess(formattedData);
} }
/**
* API
*
* @summary (ADMIN)
*
* @param {string} id
*/
@Get("approver/{id}")
async getUserRootOrg(@Path() id: string, @Request() request: { user: Record<string, any> }) {
if (id == "00000000-0000-0000-0000-000000000000") {
const maps = {
id: "00000000-0000-0000-0000-000000000000",
name: "",
positionName: "ปลัดกรุงเทพมหานคร",
};
return new HttpSuccess(maps);
}
const root = await this.orgRootRepository.findOne({
where: { id: id },
});
if (!root) throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Root");
const posMaster = await this.posMasterRepository.find({
where: { orgRootId: root.id, orgChild1Id: IsNull() },
relations: ["current_holder"],
});
if (!posMaster) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
const maps = posMaster.map((posMaster) => ({
id: posMaster.current_holder.id,
name: `${posMaster.current_holder.prefix}${posMaster.current_holder.firstName} ${posMaster.current_holder.lastName}`,
positionName: posMaster.current_holder.position,
}));
return new HttpSuccess(maps);
}
} }

View file

@ -26,6 +26,9 @@ import { OrgRevision } from "../entities/OrgRevision";
import { OrgRoot } from "../entities/OrgRoot"; import { OrgRoot } from "../entities/OrgRoot";
import { ProfileEmployee } from "../entities/ProfileEmployee"; import { ProfileEmployee } from "../entities/ProfileEmployee";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { CreateInsignias, Insignia } from "../entities/Insignia";
import { InsigniaType } from "../entities/InsigniaType";
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
@Route("api/v1/org/dotnet") @Route("api/v1/org/dotnet")
@Tags("Dotnet") @Tags("Dotnet")
@ -39,7 +42,10 @@ export class OrganizationDotnetController extends Controller {
private orgRootRepo = AppDataSource.getRepository(OrgRoot); private orgRootRepo = AppDataSource.getRepository(OrgRoot);
private orgRevisionRepo = AppDataSource.getRepository(OrgRevision); private orgRevisionRepo = AppDataSource.getRepository(OrgRevision);
private profileRepo = AppDataSource.getRepository(Profile); private profileRepo = AppDataSource.getRepository(Profile);
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
private positionRepository = AppDataSource.getRepository(Position); private positionRepository = AppDataSource.getRepository(Position);
private insigniaMetaRepo = AppDataSource.getRepository(Insignia);
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
/** /**
* 1. API Search Profile * 1. API Search Profile
@ -117,8 +123,8 @@ export class OrganizationDotnetController extends Controller {
}), }),
); );
} }
const profileEmp = await queryBuilder.getMany(); const profileEmp = await queryBuilder.getMany();
return new HttpSuccess(profileEmp); return new HttpSuccess(profileEmp);
} }
/** /**
@ -168,14 +174,18 @@ export class OrganizationDotnetController extends Controller {
relations: { relations: {
posLevel: true, posLevel: true,
posType: true, posType: true,
profileSalary: true profileSalary: true,
profileInsignias: true,
}, },
where: { keycloak: keycloakId }, where: { keycloak: keycloakId },
order:{ order: {
profileSalary:{ profileSalary: {
date: "DESC" date: "DESC",
} },
} profileInsignias: {
receiveDate: "DESC",
},
},
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -221,12 +231,247 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel? profile.posLevel : null, posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType? profile.posType : null, posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary.length > 0 profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
? profile.profileSalary[0] profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
: null };
}
return new HttpSuccess(mapProfile);
}
/**
* 3. API Get Profile keycloak id
*
* @summary 3. API Get Profile keycloak id
*
* @param {string} citizenId Id keycloak
*/
@Get("citizenId/{citizenId}")
async GetProfileByCitizenIdAsync(@Path() citizenId: string) {
const profile = await this.profileRepo.findOne({
relations: {
posLevel: true,
posType: true,
profileSalary: true,
profileInsignias: true,
},
where: { citizenId: citizenId },
order: {
profileSalary: {
date: "DESC",
},
profileInsignias: {
receiveDate: "DESC",
},
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = {
id: profile.id,
avatar: profile.avatar,
avatarName: profile.avatarName,
rank: profile.rank,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
citizenId: profile.citizenId,
position: profile.position,
posLevelId: profile.posLevelId,
email: profile.email,
phone: profile.phone,
keycloak: profile.keycloak,
isProbation: profile.isProbation,
isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
govAgeAbsent: profile.govAgeAbsent,
govAgePlus: profile.govAgePlus,
birthDate: profile.birthDate,
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
};
return new HttpSuccess(mapProfile);
}
/**
* 3. API Get Profile keycloak id
*
* @summary 3. API Get Profile keycloak id
*
* @param {string} keycloakId Id keycloak
*/
@Get("root/officer/{rootId}")
async GetProfileByRootIdAsync(@Path() rootId: string) {
const profiles = await this.profileRepo.find({
relations: {
posLevel: true,
posType: true,
profileSalary: true,
profileInsignias: true,
},
where: { current_holders: { orgRootId: rootId } },
order: {
profileSalary: {
date: "DESC",
},
profileInsignias: {
receiveDate: "DESC",
},
},
});
// if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = profiles.map((profile) => ({
id: profile.id,
avatar: profile.avatar,
avatarName: profile.avatarName,
rank: profile.rank,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
citizenId: profile.citizenId,
position: profile.position,
posLevelId: profile.posLevelId,
email: profile.email,
phone: profile.phone,
keycloak: profile.keycloak,
isProbation: profile.isProbation,
isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
govAgeAbsent: profile.govAgeAbsent,
govAgePlus: profile.govAgePlus,
birthDate: profile.birthDate,
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary,
profileInsignia: profile.profileInsignias,
}));
return new HttpSuccess(mapProfile);
}
/**
* 3. API Get Profile keycloak id
*
* @summary 3. API Get Profile keycloak id
*
* @param {string} keycloakId Id keycloak
*/
@Get("root/employee/{rootId}")
async GetProfileByRootIdEmpAsync(@Path() rootId: string) {
const profiles = await this.profileEmpRepo.find({
relations: {
posLevel: true,
posType: true,
profileSalarys: true,
profileInsignias: true,
},
where: { current_holders: { orgRootId: rootId } },
order: {
profileSalarys: {
date: "DESC",
},
profileInsignias: {
receiveDate: "DESC",
},
},
});
// if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = profiles.map((profile) => ({
id: profile.id,
avatar: profile.avatar,
avatarName: profile.avatarName,
rank: profile.rank,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
citizenId: profile.citizenId,
position: profile.position,
posLevelId: profile.posLevelId,
email: profile.email,
phone: profile.phone,
keycloak: profile.keycloak,
isProbation: profile.isProbation,
isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
govAgeAbsent: profile.govAgeAbsent,
govAgePlus: profile.govAgePlus,
birthDate: profile.birthDate,
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
// dutyTimeId: profile.dutyTimeId,
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalarys,
profileInsignia: profile.profileInsignias,
}));
return new HttpSuccess(mapProfile); return new HttpSuccess(mapProfile);
} }
@ -242,10 +487,10 @@ export class OrganizationDotnetController extends Controller {
async GetUserFullName(@Path() keycloakId: string) { async GetUserFullName(@Path() keycloakId: string) {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { keycloak: keycloakId }, where: { keycloak: keycloakId },
select: ["prefix", "firstName", "lastName"] select: ["prefix", "firstName", "lastName"],
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const fullName = profile? `${profile.prefix}${profile.firstName} ${profile.lastName}` : "-"; const fullName = profile ? `${profile.prefix}${profile.firstName} ${profile.lastName}` : "-";
return new HttpSuccess(fullName); return new HttpSuccess(fullName);
} }
@ -296,7 +541,7 @@ export class OrganizationDotnetController extends Controller {
root: root == null ? null : root.orgRootName, root: root == null ? null : root.orgRootName,
rootShortName: root == null ? null : root.orgRootShortName, rootShortName: root == null ? null : root.orgRootShortName,
}; };
return new HttpSuccess(profile); return new HttpSuccess(_profile);
} }
/** /**
@ -462,7 +707,7 @@ export class OrganizationDotnetController extends Controller {
where: { id: ocId }, where: { id: ocId },
}); });
if (!orgRoot) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!orgRoot) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const root = orgRoot? orgRoot.id : ""; const root = orgRoot ? orgRoot.id : "";
return new HttpSuccess(root); return new HttpSuccess(root);
} }
@ -475,7 +720,7 @@ export class OrganizationDotnetController extends Controller {
@Get("keycloak") @Get("keycloak")
async GetProfileWithKeycloak() { async GetProfileWithKeycloak() {
const profile = await this.profileRepo.find({ const profile = await this.profileRepo.find({
where: { keycloak: Not(IsNull()) || Not(""), }, where: { keycloak: Not(IsNull()) || Not("") },
}); });
return new HttpSuccess(profile); return new HttpSuccess(profile);
} }
@ -489,11 +734,12 @@ export class OrganizationDotnetController extends Controller {
@Put("update-dutytime") @Put("update-dutytime")
async UpdateDutyTimeAsync( async UpdateDutyTimeAsync(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@Body() body: { @Body()
body: {
profileId: string; profileId: string;
roundId: string; roundId: string;
effectiveDate: Date; effectiveDate: Date;
} },
) { ) {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: body.profileId }, where: { id: body.profileId },
@ -507,5 +753,55 @@ export class OrganizationDotnetController extends Controller {
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
return new HttpSuccess(); return new HttpSuccess();
} }
/**
* API
*
* @summary ORG_ - (ADMIN) #
*
*/
@Post("insignia/Dumb")
public async newInsignia(@Request() req: RequestWithUser, @Body() body: CreateProfileInsignia) {
if (!body.profileId) {
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
}
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
// const insignia = await this.insigniaMetaRepo.findOne({
// where: { name: body.insigniaId },
// });
// const _null: any = null;
// if (body && body.insigniaId) {
// const findPosLevel = await this.insigniaMetaRepo.findOne({
// where: { name: body.insigniaId },
// select: ["id", "name"],
// });
// if (findPosLevel) {
// body.insigniaId = findPosLevel.id;
// } else {
// body.insigniaId = _null;
// }
// } else {
// body.insigniaId = _null;
// }
const data = new ProfileInsignia();
const meta = {
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
};
Object.assign(data, { ...body, ...meta });
await this.insigniaRepo.save(data);
return new HttpSuccess();
}
} }

View file

@ -3267,4 +3267,44 @@ export class PositionController extends Controller {
); );
return new HttpSuccess(data); return new HttpSuccess(data);
} }
/**
* API
*
* @summary
*
*/
@Post("report/current")
async reportApproveCurrent(
@Body()
body: {
posmasterId: string;
positionId: string;
profileId: string;
},
) {
const posMaster = await this.posMasterRepository.findOne({
where: { id: body.posmasterId },
});
if (posMaster == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
const posMasterOld = await this.posMasterRepository.findOne({
where: {
current_holderId: body.profileId,
orgRevisionId: posMaster.orgRevisionId,
},
});
if (posMasterOld != null) posMasterOld.current_holderId = null;
const profile = await this.profileRepository.findOne({
where: { id: body.profileId },
});
if (profile == null)
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
posMaster.current_holderId = body.profileId;
if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld);
await this.posMasterRepository.save(posMaster);
return new HttpSuccess();
}
} }

View file

@ -901,6 +901,9 @@ export class ProfileController extends Controller {
} }
const profile: Profile = Object.assign(new Profile(), body); const profile: Profile = Object.assign(new Profile(), body);
const _null: any = null;
profile.dateRetire = body.birthDate == null ? _null : calculateRetireDate(body.birthDate);
profile.dateRetireLaw = body.birthDate == null ? _null : calculateRetireLaw(body.birthDate);
profile.createdUserId = request.user.sub; profile.createdUserId = request.user.sub;
profile.createdFullName = request.user.name; profile.createdFullName = request.user.name;
profile.lastUpdateUserId = request.user.sub; profile.lastUpdateUserId = request.user.sub;
@ -2516,7 +2519,7 @@ export class ProfileController extends Controller {
root: root == null ? null : root.orgRootName, root: root == null ? null : root.orgRootName,
orgRootShortName: root == null ? null : root.orgRootShortName, orgRootShortName: root == null ? null : root.orgRootShortName,
orgRevisionId: root == null ? null : root.orgRevisionId, orgRevisionId: root == null ? null : root.orgRevisionId,
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName}`, org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName ?? ""}`,
}; };
}), }),
); );
@ -2968,18 +2971,23 @@ export class ProfileController extends Controller {
if (_profile.child4Id != null) { if (_profile.child4Id != null) {
_profile.node = 4; _profile.node = 4;
_profile.nodeId = _profile.child4Id; _profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
} else if (_profile.child3Id != null) { } else if (_profile.child3Id != null) {
_profile.node = 3; _profile.node = 3;
_profile.nodeId = _profile.child3Id; _profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
} else if (_profile.child2Id != null) { } else if (_profile.child2Id != null) {
_profile.node = 2; _profile.node = 2;
_profile.nodeId = _profile.child2Id; _profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
} else if (_profile.child1Id != null) { } else if (_profile.child1Id != null) {
_profile.node = 1; _profile.node = 1;
_profile.nodeId = _profile.child1Id; _profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
} else if (_profile.rootId != null) { } else if (_profile.rootId != null) {
_profile.node = 0; _profile.node = 0;
_profile.nodeId = _profile.rootId; _profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
} }
return new HttpSuccess(_profile); return new HttpSuccess(_profile);
} }
@ -3695,6 +3703,7 @@ export class ProfileController extends Controller {
keyword?: string; keyword?: string;
}, },
) { ) {
const isProbation: boolean = true;
const [findProfile, total] = await AppDataSource.getRepository(Profile) const [findProfile, total] = await AppDataSource.getRepository(Profile)
.createQueryBuilder("profile") .createQueryBuilder("profile")
.leftJoinAndSelect("profile.posLevel", "posLevel") .leftJoinAndSelect("profile.posLevel", "posLevel")
@ -3708,12 +3717,24 @@ export class ProfileController extends Controller {
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4") .leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.leftJoinAndSelect("current_holders.positions", "positions") .leftJoinAndSelect("current_holders.positions", "positions")
.leftJoinAndSelect("positions.posExecutive", "posExecutive") .leftJoinAndSelect("positions.posExecutive", "posExecutive")
.where("profile.prefix LIKE :keyword", { keyword: `%${body.keyword}%` }) .where(`profile.prefix LIKE :keyword and profile.isProbation = ${isProbation}`, {
.orWhere("profile.firstName LIKE :keyword", { keyword: `%${body.keyword}%` }) keyword: `%${body.keyword}%`,
.orWhere("profile.lastName LIKE :keyword", { keyword: `%${body.keyword}%` }) })
.orWhere("profile.position LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere(`profile.firstName LIKE :keyword and profile.isProbation = ${isProbation}`, {
.orWhere("posLevel.posLevelName LIKE :keyword", { keyword: `%${body.keyword}%` }) keyword: `%${body.keyword}%`,
.orWhere("posType.posTypeName LIKE :keyword", { keyword: `%${body.keyword}%` }) })
.orWhere(`profile.lastName LIKE :keyword and profile.isProbation = ${isProbation}`, {
keyword: `%${body.keyword}%`,
})
.orWhere(`profile.position LIKE :keyword and profile.isProbation = ${isProbation}`, {
keyword: `%${body.keyword}%`,
})
.orWhere(`posLevel.posLevelName LIKE :keyword and profile.isProbation = ${isProbation}`, {
keyword: `%${body.keyword}%`,
})
.orWhere(`posType.posTypeName LIKE :keyword and profile.isProbation = ${isProbation}`, {
keyword: `%${body.keyword}%`,
})
.orderBy("profile.citizenId", "ASC") .orderBy("profile.citizenId", "ASC")
.skip((body.page - 1) * body.pageSize) .skip((body.page - 1) * body.pageSize)
.take(body.pageSize) .take(body.pageSize)
@ -4423,17 +4444,25 @@ export class ProfileController extends Controller {
async updateLeaveUser( async updateLeaveUser(
@Path() id: string, @Path() id: string,
@Body() @Body()
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date }, requestBody: { isLeave: boolean; leaveReason?: any; dateLeave?: any },
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
) { ) {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
where: { id: id }, where: { id: id },
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const _null: any = null;
profile.isLeave = requestBody.isLeave; profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason; if (requestBody.leaveReason != undefined && requestBody.leaveReason != null) {
profile.dateLeave = requestBody.dateLeave; profile.leaveReason = requestBody.leaveReason;
} else {
profile.leaveReason = _null;
}
if (requestBody.dateLeave != undefined && requestBody.dateLeave != null) {
profile.dateLeave = requestBody.dateLeave;
} else {
profile.dateLeave = _null;
}
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
const profileSalary = await this.salaryRepository.findOne({ const profileSalary = await this.salaryRepository.findOne({
@ -4645,7 +4674,7 @@ export class ProfileController extends Controller {
return new HttpSuccess(profile); return new HttpSuccess(profile);
} }
/** /**
* API * API
* *
* @summary ORG_065 - (ADMIN) #XXX * @summary ORG_065 - (ADMIN) #XXX
@ -4656,96 +4685,194 @@ export class ProfileController extends Controller {
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
@Body() body: CreateProfileAllFields, @Body() body: CreateProfileAllFields,
) { ) {
const citizen = await this.profileRepo.findOne({
where: { citizenId: body.citizenId },
select: ["id"],
});
if (citizen) return new HttpSuccess(citizen.id);
const _null: any = null;
const profile: Profile = Object.assign(new Profile(), body); const profile: Profile = Object.assign(new Profile(), body);
if (body && body.posLevelId) { if (body && body.posLevelId) {
const findPosLevel = await this.posLevelRepo.findOne({ const findPosLevel = await this.posLevelRepo.findOne({
where: { posLevelName: body.posLevelId }, where: { posLevelName: body.posLevelId },
select:['id','posLevelName'] select: ["id", "posLevelName"],
}); });
if (findPosLevel) { if (findPosLevel) {
profile.posLevelId = findPosLevel.id; profile.posLevelId = findPosLevel.id;
} else {
profile.posLevelId = _null;
} }
} else {
profile.posLevelId = _null;
} }
if (body && body.posTypeId) { if (body && body.posTypeId) {
const findPosType = await this.posTypeRepo.findOne({ const findPosType = await this.posTypeRepo.findOne({
where: { posTypeName: body.posTypeId }, where: { posTypeName: body.posTypeId },
select:['id','posTypeName'] select: ["id", "posTypeName"],
}); });
if (findPosType) { if (findPosType) {
profile.posTypeId = findPosType.id; profile.posTypeId = findPosType.id;
} else {
profile.posTypeId = _null;
} }
} else {
profile.posTypeId = _null;
} }
if (body && body.prefix) { // if (body && body.prefix) {
const findPrefix = await this.prefixRepo.findOne({ // const findPrefix = await this.prefixRepo.findOne({
where: { name: body.prefix }, // where: { name: body.prefix },
select:['id','name'] // select: ["id", "name"],
}); // });
if (findPrefix) { // if (findPrefix) {
profile.prefix = findPrefix.id; // profile.prefix = findPrefix.id;
} // } else {
} // profile.prefix = _null;
// }
// } else {
// profile.prefix = _null;
// }
//current //current
if (body && body.currentProvinceId) { if (body && body.currentProvinceId) {
const findProvince = await this.provinceRepo.findOne({ const findProvince = await this.provinceRepo.findOne({
where: { name: body.currentProvinceId }, where: { name: body.currentProvinceId },
select:['id','name'] select: ["id", "name"],
}); });
if (findProvince) { if (findProvince) {
profile.currentProvinceId = findProvince.id; profile.currentProvinceId = findProvince.id;
} } else {
profile.currentProvinceId = _null;
}
} else {
profile.currentProvinceId = _null;
} }
if (body && body.currentDistrictId) { if (body && body.currentDistrictId) {
const findDistrict = await this.districtRepo.findOne({ const findDistrict = await this.districtRepo.findOne({
where: { name: body.currentDistrictId }, where: { name: body.currentDistrictId },
select:['id','name'] select: ["id", "name"],
}); });
if (findDistrict) { if (findDistrict) {
profile.currentDistrictId = findDistrict.id; profile.currentDistrictId = findDistrict.id;
} } else {
profile.currentDistrictId = _null;
}
} else {
profile.currentDistrictId = _null;
} }
if (body && body.currentSubDistrictId) { if (body && body.currentSubDistrictId) {
const findSubDistrict = await this.subDistrictRepo.findOne({ const findSubDistrict = await this.subDistrictRepo.findOne({
where: { name: body.currentSubDistrictId }, where: { name: body.currentSubDistrictId },
select:['id','name'] select: ["id", "name"],
}); });
if (findSubDistrict) { if (findSubDistrict) {
profile.currentSubDistrictId = findSubDistrict.id; profile.currentSubDistrictId = findSubDistrict.id;
} else {
profile.currentSubDistrictId = _null;
} }
} else {
profile.currentSubDistrictId = _null;
} }
//register //register
if (body && body.registrationProvinceId) { if (body && body.registrationProvinceId) {
const findProvince_regis = await this.provinceRepo.findOne({ const findProvince_regis = await this.provinceRepo.findOne({
where: { name: body.registrationProvinceId }, where: { name: body.registrationProvinceId },
select:['id','name'] select: ["id", "name"],
}); });
if (findProvince_regis) { if (findProvince_regis) {
profile.registrationProvinceId = findProvince_regis.id; profile.registrationProvinceId = findProvince_regis.id;
} else {
profile.registrationProvinceId = _null;
} }
} else {
profile.registrationProvinceId = _null;
} }
if (body && body.registrationDistrictId) { if (body && body.registrationDistrictId) {
const findDistrict_regis = await this.districtRepo.findOne({ const findDistrict_regis = await this.districtRepo.findOne({
where: { name: body.registrationDistrictId }, where: { name: body.registrationDistrictId },
select:['id','name'] select: ["id", "name"],
}); });
if (findDistrict_regis) { if (findDistrict_regis) {
profile.registrationDistrictId = findDistrict_regis.id; profile.registrationDistrictId = findDistrict_regis.id;
} else {
profile.registrationDistrictId = _null;
} }
} else {
profile.registrationDistrictId = _null;
} }
if (body && body.registrationSubDistrictId) { if (body && body.registrationSubDistrictId) {
const findSubDistrict_regis = await this.subDistrictRepo.findOne({ const findSubDistrict_regis = await this.subDistrictRepo.findOne({
where: { name: body.registrationSubDistrictId }, where: { name: body.registrationSubDistrictId },
select:['id','name'] select: ["id", "name"],
}); });
if (findSubDistrict_regis) { if (findSubDistrict_regis) {
profile.registrationSubDistrictId = findSubDistrict_regis.id; profile.registrationSubDistrictId = findSubDistrict_regis.id;
} } else {
profile.registrationSubDistrictId = _null;
}
} else {
profile.registrationSubDistrictId = _null;
} }
profile.createdUserId = request.user.sub; profile.createdUserId = request.user.sub;
profile.createdFullName = request.user.name; profile.createdFullName = request.user.name;
profile.lastUpdateUserId = request.user.sub; profile.lastUpdateUserId = request.user.sub;
profile.lastUpdateFullName = request.user.name; profile.lastUpdateFullName = request.user.name;
// return new HttpSuccess(profile);
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
return new HttpSuccess(profile.id); return new HttpSuccess(profile.id);
} }
/**
*
* @summary (ADMIN)
*
*/
@Get("retireDate/mock")
async calRetireDate() {
const profile = await this.profileRepo.find({ relations: ["profileSalary"] });
const _null: any = null;
const profiles = profile.map((_data) => ({
..._data,
dateRetire: _data.birthDate == null ? _null : calculateRetireDate(_data.birthDate),
dateRetireLaw: _data.birthDate == null ? _null : calculateRetireLaw(_data.birthDate),
}));
await this.profileRepo.save(profiles);
return new HttpSuccess();
}
/**
*
* @summary (ADMIN)
*
*/
@Get("salarym/ock")
async calSalaryDate() {
const profile = await this.profileRepo.find();
const _null: any = null;
const profiles = await Promise.all(
profile.map(async (_data) => {
const salary = await this.salaryRepository.findOne({
where: {
profileId: _data.id,
},
order: { order: "DESC" },
});
const type = await this.posTypeRepo.findOne({
where: {
posTypeName: salary?.positionType ?? "",
},
});
const level = await this.posLevelRepo.findOne({
where: {
posLevelName: salary?.positionLevel ?? "",
},
});
return {
..._data,
position: salary?.position ?? _null,
posLevelId: level?.id ?? _null,
posTypeId: type?.id ?? _null,
};
}),
);
await this.profileRepo.save(profiles);
return new HttpSuccess("zxczx");
}
} }

View file

@ -60,6 +60,7 @@ import {
import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory"; import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory";
import CallAPI from "../interfaces/call-api"; import CallAPI from "../interfaces/call-api";
import e from "cors"; import e from "cors";
import { EmployeePosition } from "../entities/EmployeePosition";
@Route("api/v1/org/profile-employee") @Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee") @Tags("ProfileEmployee")
@ -76,6 +77,7 @@ export class ProfileEmployeeController extends Controller {
private profileHistoryRepo = AppDataSource.getRepository(ProfileEmployeeHistory); private profileHistoryRepo = AppDataSource.getRepository(ProfileEmployeeHistory);
private posLevelRepo = AppDataSource.getRepository(EmployeePosLevel); private posLevelRepo = AppDataSource.getRepository(EmployeePosLevel);
private posTypeRepo = AppDataSource.getRepository(EmployeePosType); private posTypeRepo = AppDataSource.getRepository(EmployeePosType);
private positionRepository = AppDataSource.getRepository(EmployeePosition);
private provinceRepository = AppDataSource.getRepository(Province); private provinceRepository = AppDataSource.getRepository(Province);
private districtRepository = AppDataSource.getRepository(District); private districtRepository = AppDataSource.getRepository(District);
private subDistrict = AppDataSource.getRepository(SubDistrict); private subDistrict = AppDataSource.getRepository(SubDistrict);
@ -2706,7 +2708,6 @@ export class ProfileEmployeeController extends Controller {
templateDoc: requestBody.leaveReason, templateDoc: requestBody.leaveReason,
}); });
return new HttpSuccess(); return new HttpSuccess();
} }
@ -3032,6 +3033,13 @@ export class ProfileEmployeeController extends Controller {
profile.employeeClass = "PERM"; profile.employeeClass = "PERM";
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
}); });
await new CallAPI()
.PostData(request, "org/employee/pos/report/current", {
posmasterId: profile.posmasterIdTemp,
positionId: profile.positionIdTemp,
profileId: profile.id,
})
.then(async (x) => {});
} }
}), }),
); );
@ -3204,4 +3212,129 @@ export class ProfileEmployeeController extends Controller {
return new HttpSuccess({ data: mapDataProfile, total }); return new HttpSuccess({ data: mapDataProfile, total });
} }
/**
* API profileid
*
* @summary ORG_065 - profileid (ADMIN) #70
*
*/
@Get("profileid/position/{id}")
async getProfileByProfileid(
@Request() request: { user: Record<string, any> },
@Path() id: string,
) {
const profile = await this.profileRepo.findOne({
where: { id: id },
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
});
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
}
const orgRevisionPublish = await this.orgRevisionRepo
.createQueryBuilder("orgRevision")
.where("orgRevision.orgRevisionIsDraft = false")
.andWhere("orgRevision.orgRevisionIsCurrent = true")
.getOne();
if (!orgRevisionPublish) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
}
const posMaster =
profile.current_holders == null ||
profile.current_holders.length == 0 ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
const root =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
const child1 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1;
const child2 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2;
const child3 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3;
const child4 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
const position = await this.positionRepository.findOne({
relations: ["posExecutive"],
where: {
posMasterId: posMaster?.id,
},
});
const _profile: any = {
profileId: profile.id,
prefix: profile.prefix,
rank: profile.rank,
isProbation: profile.isProbation,
firstName: profile.firstName,
lastName: profile.lastName,
citizenId: profile.citizenId,
birthDate: profile.birthDate,
position: profile.position,
leaveDate: profile.dateLeave,
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
posTypeId: profile.posType == null ? null : profile.posType.id,
posExecutiveName: "",
rootId: root == null ? null : root.id,
root: root == null ? null : root.orgRootName,
rootShortName: root == null ? null : root.orgRootShortName,
child1Id: child1 == null ? null : child1.id,
child1: child1 == null ? null : child1.orgChild1Name,
child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
child2Id: child2 == null ? null : child2.id,
child2: child2 == null ? null : child2.orgChild2Name,
child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
child3Id: child3 == null ? null : child3.id,
child3: child3 == null ? null : child3.orgChild3Name,
child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
child4Id: child4 == null ? null : child4.id,
child4: child4 == null ? null : child4.orgChild4Name,
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
};
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
}
return new HttpSuccess(_profile);
}
} }

View file

@ -1181,7 +1181,7 @@ export class ReportController extends Controller {
: Extension.ToThaiNumber(node.profilePosLevel.toString()), : Extension.ToThaiNumber(node.profilePosLevel.toString()),
education: education:
node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()), node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(_head); data.push(_head);
} else { } else {
@ -1255,7 +1255,7 @@ export class ReportController extends Controller {
: Extension.ToThaiNumber(node.profilePosLevel.toString()), : Extension.ToThaiNumber(node.profilePosLevel.toString()),
education: education:
node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()), node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(head); data.push(head);
} }
@ -1552,7 +1552,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(_head); data.push(_head);
} else { } else {
@ -1630,7 +1630,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(head); data.push(head);
} }
@ -1933,7 +1933,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(_head); data.push(_head);
} else { } else {
@ -2015,7 +2015,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(head); data.push(head);
} }
@ -2322,7 +2322,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(_head); data.push(_head);
} else { } else {
@ -2407,7 +2407,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(head); data.push(head);
} }
@ -2713,7 +2713,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(_head); data.push(_head);
} else { } else {
@ -2798,7 +2798,7 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
}; };
data.push(head); data.push(head);
} }
@ -3139,13 +3139,13 @@ export class ReportController extends Controller {
node.posLevel == null ? "" : Extension.ToThaiNumber(node.posLevel.toString()), node.posLevel == null ? "" : Extension.ToThaiNumber(node.posLevel.toString()),
education: education:
node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()), node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), reason: node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
data.push(_head); data.push(_head);
@ -3192,13 +3192,13 @@ export class ReportController extends Controller {
node.posLevel == null ? "" : Extension.ToThaiNumber(node.posLevel.toString()), node.posLevel == null ? "" : Extension.ToThaiNumber(node.posLevel.toString()),
education: education:
node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()), node.education == null ? "" : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), reason: node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
data.push(head); data.push(head);
@ -3333,13 +3333,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3391,13 +3391,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3534,13 +3534,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3595,13 +3595,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3740,13 +3740,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3804,13 +3804,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()), node.reason == null ? "" : Extension.ToThaiNumber(node.reason.toString()),
}; };
@ -3951,13 +3951,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null node.reason == null
? "" ? ""
@ -4017,13 +4017,13 @@ export class ReportController extends Controller {
node.education == null node.education == null
? "" ? ""
: Extension.ToThaiNumber(node.education.toString()), : Extension.ToThaiNumber(node.education.toString()),
salary: Extension.ToThaiNumber(node.salary.toLocaleString()), salary: node.salary ? Extension.ToThaiNumber(node.salary.toLocaleString()) : "",
positionSalaryAmount: Extension.ToThaiNumber( positionSalaryAmount: node.positionSalaryAmount ? Extension.ToThaiNumber(
node.positionSalaryAmount.toLocaleString(), node.positionSalaryAmount.toLocaleString(),
), ) : "",
mouthSalaryAmount: Extension.ToThaiNumber( mouthSalaryAmount: node.mouthSalaryAmount ? Extension.ToThaiNumber(
node.mouthSalaryAmount.toLocaleString(), node.mouthSalaryAmount.toLocaleString(),
), ) : "",
reason: reason:
node.reason == null node.reason == null
? "" ? ""

View file

@ -649,6 +649,7 @@ export class CreateProfile {
} }
export class CreateProfileAllFields { export class CreateProfileAllFields {
id?: string | null;
rank: string | null; rank: string | null;
prefix: string; prefix: string;
firstName: string; firstName: string;
@ -688,7 +689,6 @@ export class CreateProfileAllFields {
currentZipCode: string | null; currentZipCode: string | null;
} }
export type UpdateProfile = { export type UpdateProfile = {
rank?: string | null; rank?: string | null;
prefix?: string | null; prefix?: string | null;

File diff suppressed because one or more lines are too long