Merge branch 'develop' into develop-Bright
This commit is contained in:
commit
e2d5f7e13d
1 changed files with 50 additions and 49 deletions
|
|
@ -18,7 +18,7 @@ import { AppDataSource } from "../database/data-source";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { Brackets, In, IsNull, Like, Not } from "typeorm";
|
import { Brackets, Double, In, IsNull, Like, Not } from "typeorm";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
|
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
|
||||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||||
|
|
@ -619,12 +619,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Delete("{id}")
|
@Delete("{id}")
|
||||||
async deleteProfile(@Path() id: string) {
|
async deleteProfile(@Path() id: string) {
|
||||||
const result = await this.profileRepo.findOne({ where: { id: id } });
|
const result = await this.profileRepo.findOne({ where: { id: id } });
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
await this.informationHistoryRepository.delete({profileEmployeeId: id});
|
await this.informationHistoryRepository.delete({ profileEmployeeId: id });
|
||||||
await this.profileRepo.remove(result);
|
await this.profileRepo.remove(result);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -826,14 +826,14 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4"
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!profiles) {
|
if (!profiles) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true },
|
||||||
});
|
});
|
||||||
|
|
@ -841,39 +841,40 @@ export class ProfileEmployeeController extends Controller {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedData = profiles.map((profile) => {
|
const formattedData = profiles.map((profile) => {
|
||||||
const fullName = `${profile.prefix} ${profile.firstName} ${profile.lastName}`;
|
const fullName = `${profile.prefix} ${profile.firstName} ${profile.lastName}`;
|
||||||
const shortName =
|
const shortName =
|
||||||
profile.current_holders.length == 0
|
profile.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
||||||
null
|
null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 !=
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||||
null
|
?.orgChild3 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||||
?.orgChild2 != null
|
?.orgChild2 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||||
?.orgChild1 != null
|
?.orgChild1 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
null &&
|
||||||
?.orgRoot != null
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
?.orgRoot != null
|
||||||
: null;
|
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||||
|
: null;
|
||||||
|
|
||||||
const root =
|
const root =
|
||||||
profile.current_holders.length == 0 ||
|
profile.current_holders.length == 0 ||
|
||||||
(profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
(profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: profile.id,
|
id: profile.id,
|
||||||
|
|
@ -910,7 +911,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
positionLevel: profile.posLevel?.posLevelName,
|
positionLevel: profile.posLevel?.posLevelName,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2972,9 +2973,9 @@ export class ProfileEmployeeController extends Controller {
|
||||||
id: string;
|
id: string;
|
||||||
personId: string;
|
personId: string;
|
||||||
templateDoc: string;
|
templateDoc: string;
|
||||||
amount: string;
|
amount: Double | null;
|
||||||
positionSalaryAmount: string;
|
positionSalaryAmount: Double | null;
|
||||||
mouthSalaryAmount: string;
|
mouthSalaryAmount: Double | null;
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
}[];
|
}[];
|
||||||
},
|
},
|
||||||
|
|
@ -2990,8 +2991,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, "org/profile/salary", {
|
.PostData(request, "org/profile-employee/salary", {
|
||||||
profileId: profile.id,
|
profileEmployeeId: profile.id,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
amount: v.amount,
|
amount: v.amount,
|
||||||
positionSalaryAmount: v.positionSalaryAmount,
|
positionSalaryAmount: v.positionSalaryAmount,
|
||||||
|
|
@ -3005,7 +3006,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
})
|
})
|
||||||
.then(async (x) => {
|
.then(async (x) => {
|
||||||
profile.statusTemp = "DONE";
|
profile.statusTemp = "DONE";
|
||||||
profile.employeeClass = "TEMP";
|
profile.employeeClass = "PERM";
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue