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(
|
async Edit(
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body() requestBody: { orgPublishDate: Date },
|
@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({
|
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
|
|
|
||||||
|
|
@ -1584,7 +1584,8 @@ export class PositionController extends Controller {
|
||||||
* @param {string} id Id อัตรากำลัง
|
* @param {string} id Id อัตรากำลัง
|
||||||
*/
|
*/
|
||||||
@Get("history/{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({
|
const posMaster = await this.posMasterRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
});
|
});
|
||||||
|
|
@ -3313,12 +3314,25 @@ export class PositionController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Post("act/search")
|
@Post("act/search")
|
||||||
async searchAct(
|
async searchAct(
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
posmasterId: string;
|
posmasterId: string;
|
||||||
isAll: boolean;
|
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({
|
const posMasterMain = await this.posMasterRepository.findOne({
|
||||||
where: { id: body.posmasterId },
|
where: { id: body.posmasterId },
|
||||||
relations: ["posMasterActs"],
|
relations: ["posMasterActs"],
|
||||||
|
|
@ -3349,7 +3363,21 @@ export class PositionController extends Controller {
|
||||||
current_holderId: Not(IsNull()),
|
current_holderId: Not(IsNull()),
|
||||||
id: Not(In(posId)),
|
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({
|
const posMaster = await this.posMasterRepository.find({
|
||||||
where: typeCondition,
|
where: typeCondition,
|
||||||
relations: [
|
relations: [
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,11 @@ export class ProfileController extends Controller {
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
where: { id: id },
|
where: { id: id },
|
||||||
|
order: {
|
||||||
|
profileSalary: {
|
||||||
|
date: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
|
|
@ -194,47 +199,47 @@ export class ProfileController extends Controller {
|
||||||
order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
});
|
});
|
||||||
const Education = educations.map((item) => ({
|
const Education = educations.map((item) => ({
|
||||||
Institute: item.institute,
|
Institute: item.institute ? item.institute : "-",
|
||||||
Date:
|
Date:
|
||||||
item.startDate && item.endDate
|
item.startDate && item.endDate
|
||||||
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(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 = {
|
const mapData = {
|
||||||
Id: profile.id,
|
Id: profile.id,
|
||||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
|
||||||
Prefix: profile.prefix != null ? profile.prefix : "",
|
Prefix: profile.prefix != null ? profile.prefix : null,
|
||||||
FirstName: profile.firstName != null ? profile.firstName : "",
|
FirstName: profile.firstName != null ? profile.firstName : null,
|
||||||
LastName: profile.lastName != null ? profile.lastName : "",
|
LastName: profile.lastName != null ? profile.lastName : null,
|
||||||
DateOfBirth:
|
DateOfBirth:
|
||||||
profile.birthDate != null
|
profile.birthDate != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
|
||||||
: "",
|
: "-",
|
||||||
DateRetire:
|
DateRetire:
|
||||||
profile.dateRetire != null
|
profile.dateRetire != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
||||||
: "",
|
: "-",
|
||||||
RegistrationAddress: Extension.ToThaiNumber(
|
RegistrationAddress: Extension.ToThaiNumber(
|
||||||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
),
|
),
|
||||||
SalaryAmount:
|
SalaryAmount:
|
||||||
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||||
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||||
: "",
|
: "-",
|
||||||
Education: Education,
|
Education: Education,
|
||||||
AppointText:
|
AppointText:
|
||||||
profile.dateAppoint != null
|
profile.dateAppoint != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
||||||
: "",
|
: "-",
|
||||||
SalaryDate:
|
SalaryDate:
|
||||||
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
|
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}`,
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
where: { id: id },
|
where: { id: id },
|
||||||
|
order: {
|
||||||
|
profileSalarys: {
|
||||||
|
date: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
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 _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
||||||
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
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 = {
|
const mapData = {
|
||||||
Id: profile.id,
|
Id: profile.id,
|
||||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
|
||||||
Prefix: profile.prefix != null ? profile.prefix : "",
|
Prefix: profile.prefix != null ? profile.prefix : null,
|
||||||
FirstName: profile.firstName != null ? profile.firstName : "",
|
FirstName: profile.firstName != null ? profile.firstName : null,
|
||||||
LastName: profile.lastName != null ? profile.lastName : "",
|
LastName: profile.lastName != null ? profile.lastName : null,
|
||||||
DateOfBirth:
|
DateOfBirth:
|
||||||
profile.birthDate != null
|
profile.birthDate != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
|
||||||
: "",
|
: "-",
|
||||||
DateRetire:
|
DateRetire:
|
||||||
profile.dateRetire != null
|
profile.dateRetire != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
||||||
: "",
|
: "-",
|
||||||
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
SalaryAmount:
|
SalaryAmount:
|
||||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
||||||
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||||
: "",
|
: "-",
|
||||||
Education:
|
Education: Education,
|
||||||
profile.profileEducations.length > 0 &&
|
// profile.profileEducations.length > 0 &&
|
||||||
profile.profileEducations[profile.profileEducations.length - 1].institute != null
|
// profile.profileEducations[profile.profileEducations.length - 1].institute != null
|
||||||
? profile.profileEducations[profile.profileEducations.length - 1].institute
|
// ? profile.profileEducations[profile.profileEducations.length - 1].institute
|
||||||
: "",
|
// : "",
|
||||||
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
|
AppointText:
|
||||||
|
profile.dateAppoint != null
|
||||||
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
||||||
|
: "-",
|
||||||
SalaryDate:
|
SalaryDate:
|
||||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalarys[0].date))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date))
|
||||||
: "",
|
: "-",
|
||||||
PositionName: profile.position != null ? profile.position : "",
|
PositionName: profile.position != null ? profile.position : "-",
|
||||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue