Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
bee2b69f61
4 changed files with 89 additions and 33 deletions
|
|
@ -1392,8 +1392,9 @@ export class OrganizationController extends Controller {
|
|||
async Edit(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: { orgPublishDate: Date },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(request, "SYS_ORG");//ไม่แน่ใจOFFปิดไว้ก่อน
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: {
|
||||
id: id,
|
||||
|
|
|
|||
|
|
@ -1584,7 +1584,8 @@ export class PositionController extends Controller {
|
|||
* @param {string} id Id อัตรากำลัง
|
||||
*/
|
||||
@Get("history/{id}")
|
||||
async getHistoryPosMater(@Path() id: string) {
|
||||
async getHistoryPosMater(@Path() id: string , @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request , "SYS_ORG");
|
||||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: { id },
|
||||
});
|
||||
|
|
@ -3313,12 +3314,25 @@ export class PositionController extends Controller {
|
|||
*/
|
||||
@Post("act/search")
|
||||
async searchAct(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
posmasterId: string;
|
||||
isAll: boolean;
|
||||
},
|
||||
) {
|
||||
// let _data = {
|
||||
// root: null,
|
||||
// child1: null,
|
||||
// child2: null,
|
||||
// child3: null,
|
||||
// child4: null,
|
||||
// }
|
||||
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// _data = await new permission().PermissionOrgList(request, "SYS_ORG");
|
||||
// }
|
||||
|
||||
const posMasterMain = await this.posMasterRepository.findOne({
|
||||
where: { id: body.posmasterId },
|
||||
relations: ["posMasterActs"],
|
||||
|
|
@ -3349,7 +3363,21 @@ export class PositionController extends Controller {
|
|||
current_holderId: Not(IsNull()),
|
||||
id: Not(In(posId)),
|
||||
};
|
||||
// console.log("ddddd",_data);
|
||||
|
||||
// typeCondition = {
|
||||
// orgRoot: _data.root && _data.root[0] ? { id: In(_data.root) } : { id: IsNull() },
|
||||
// orgChild1: _data.child1 && _data.child1[0] ? { id: In(_data.child1) } : { id: IsNull() },
|
||||
// orgChild2: _data.child2 && _data.child2[0] ? { id: In(_data.child2) } : { id: IsNull() },
|
||||
// orgChild3: _data.child3 && _data.child3[0] ? { id: In(_data.child3) } : { id: IsNull() },
|
||||
// orgChild4: _data.child4 && _data.child4[0] ? { id: In(_data.child4) } : { id: IsNull() },
|
||||
// current_holderId: Not(IsNull()),
|
||||
// id: Not(In(posId)),
|
||||
// };
|
||||
}
|
||||
|
||||
// console.log("typeCondition>>>",typeCondition);
|
||||
|
||||
const posMaster = await this.posMasterRepository.find({
|
||||
where: typeCondition,
|
||||
relations: [
|
||||
|
|
|
|||
|
|
@ -126,6 +126,11 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild4",
|
||||
],
|
||||
where: { id: id },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC"
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -194,47 +199,47 @@ export class ProfileController extends Controller {
|
|||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute,
|
||||
Institute: item.institute ? item.institute : "-",
|
||||
Date:
|
||||
item.startDate && item.endDate
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
||||
: "",
|
||||
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "",
|
||||
: "-",
|
||||
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
|
||||
}));
|
||||
|
||||
const mapData = {
|
||||
Id: profile.id,
|
||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
||||
Prefix: profile.prefix != null ? profile.prefix : "",
|
||||
FirstName: profile.firstName != null ? profile.firstName : "",
|
||||
LastName: profile.lastName != null ? profile.lastName : "",
|
||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
|
||||
Prefix: profile.prefix != null ? profile.prefix : null,
|
||||
FirstName: profile.firstName != null ? profile.firstName : null,
|
||||
LastName: profile.lastName != null ? profile.lastName : null,
|
||||
DateOfBirth:
|
||||
profile.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
|
||||
: "",
|
||||
: "-",
|
||||
DateRetire:
|
||||
profile.dateRetire != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
||||
: "",
|
||||
: "-",
|
||||
RegistrationAddress: Extension.ToThaiNumber(
|
||||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
),
|
||||
SalaryAmount:
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||
: "",
|
||||
: "-",
|
||||
Education: Education,
|
||||
AppointText:
|
||||
profile.dateAppoint != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
||||
: "",
|
||||
: "-",
|
||||
SalaryDate:
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
|
||||
)
|
||||
: "",
|
||||
PositionName: profile.position != null ? profile.position : "",
|
||||
: "-",
|
||||
PositionName: profile.position != null ? profile.position : "-",
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
"current_holders.orgChild4",
|
||||
],
|
||||
where: { id: id },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
date: "DESC"
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
|
@ -194,36 +199,53 @@ export class ProfileEmployeeController extends Controller {
|
|||
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
||||
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
||||
|
||||
const educations = await this.educationRepository.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||
where: { profileEmployeeId: id },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute ? item.institute : "-",
|
||||
Date:
|
||||
item.startDate && item.endDate
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
||||
: "-",
|
||||
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
|
||||
}));
|
||||
|
||||
const mapData = {
|
||||
Id: profile.id,
|
||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
||||
Prefix: profile.prefix != null ? profile.prefix : "",
|
||||
FirstName: profile.firstName != null ? profile.firstName : "",
|
||||
LastName: profile.lastName != null ? profile.lastName : "",
|
||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
|
||||
Prefix: profile.prefix != null ? profile.prefix : null,
|
||||
FirstName: profile.firstName != null ? profile.firstName : null,
|
||||
LastName: profile.lastName != null ? profile.lastName : null,
|
||||
DateOfBirth:
|
||||
profile.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate))
|
||||
: "",
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
|
||||
: "-",
|
||||
DateRetire:
|
||||
profile.dateRetire != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire))
|
||||
: "",
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
||||
: "-",
|
||||
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
SalaryAmount:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||
: "",
|
||||
Education:
|
||||
profile.profileEducations.length > 0 &&
|
||||
profile.profileEducations[profile.profileEducations.length - 1].institute != null
|
||||
? profile.profileEducations[profile.profileEducations.length - 1].institute
|
||||
: "",
|
||||
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
|
||||
: "-",
|
||||
Education: Education,
|
||||
// profile.profileEducations.length > 0 &&
|
||||
// profile.profileEducations[profile.profileEducations.length - 1].institute != null
|
||||
// ? profile.profileEducations[profile.profileEducations.length - 1].institute
|
||||
// : "",
|
||||
AppointText:
|
||||
profile.dateAppoint != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
||||
: "-",
|
||||
SalaryDate:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalarys[0].date))
|
||||
: "",
|
||||
PositionName: profile.position != null ? profile.position : "",
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date))
|
||||
: "-",
|
||||
PositionName: profile.position != null ? profile.position : "-",
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue