Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-01-21 13:16:24 +07:00
commit 9646659f4c
8 changed files with 411 additions and 99 deletions

View file

@ -526,6 +526,7 @@ export class KpiUserEvaluationController extends Controller {
kpiUserEvaluation.posLevelName = x.posLevelName;
kpiUserEvaluation.posTypeName = x.posTypeName;
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
kpiUserEvaluation.isProbation = x.isProbation;
kpiUserEvaluation.org = x.root;
kpiUserEvaluation.orgId = x.rootId;
kpiUserEvaluation.child1 = x.child1;
@ -553,6 +554,7 @@ export class KpiUserEvaluationController extends Controller {
kpiUserEvaluation.posLevelName = x.posLevelName;
kpiUserEvaluation.posTypeName = x.posTypeName;
kpiUserEvaluation.posExecutiveName = x.posExecutiveName;
kpiUserEvaluation.isProbation = x.isProbation;
kpiUserEvaluation.org = x.root;
kpiUserEvaluation.orgId = x.rootId;
kpiUserEvaluation.child1 = x.child1;
@ -569,17 +571,39 @@ export class KpiUserEvaluationController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
});
}
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.evaluatorId)
.then((x) => {
kpiUserEvaluation.prefixEvaluator = x.prefix;
kpiUserEvaluation.firstNameEvaluator = x.firstName;
kpiUserEvaluation.lastNameEvaluator = x.lastName;
kpiUserEvaluation.positionEvaluator = x.position;
kpiUserEvaluation.posLevelNameEvaluator = x.posLevelName;
kpiUserEvaluation.posTypeNameEvaluator = x.posTypeName;
kpiUserEvaluation.orgEvaluator = x.root;
});
if (requestBody.evaluatorId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.evaluatorId)
.then((x) => {
kpiUserEvaluation.prefixEvaluator = x.prefix;
kpiUserEvaluation.firstNameEvaluator = x.firstName;
kpiUserEvaluation.lastNameEvaluator = x.lastName;
kpiUserEvaluation.positionEvaluator = x.position;
kpiUserEvaluation.posLevelNameEvaluator = x.posLevelName;
kpiUserEvaluation.posTypeNameEvaluator = x.posTypeName;
kpiUserEvaluation.orgEvaluator = x.root;
});
}
if (requestBody.commanderId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.commanderId)
.then((x) => {
kpiUserEvaluation.prefixCommander = x.prefix;
kpiUserEvaluation.firstNameCommander = x.firstName;
kpiUserEvaluation.lastNameCommander = x.lastName;
kpiUserEvaluation.positionCommander = x.position;
});
}
if (requestBody.commanderHighId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.commanderHighId)
.then((x) => {
kpiUserEvaluation.prefixCommanderHigh = x.prefix;
kpiUserEvaluation.firstNameCommanderHigh = x.firstName;
kpiUserEvaluation.lastNameCommanderHigh = x.lastName;
kpiUserEvaluation.positionCommanderHigh = x.position;
});
}
const before = null;
kpiUserEvaluation.evaluationStatus = "NEW";
kpiUserEvaluation.evaluationResults = "PENDING";
@ -747,6 +771,40 @@ export class KpiUserEvaluationController extends Controller {
}
const before = structuredClone(kpiUserEvaluation);
if (requestBody.evaluatorId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.evaluatorId)
.then((x) => {
kpiUserEvaluation.prefixEvaluator = x.prefix;
kpiUserEvaluation.firstNameEvaluator = x.firstName;
kpiUserEvaluation.lastNameEvaluator = x.lastName;
kpiUserEvaluation.positionEvaluator = x.position;
kpiUserEvaluation.posLevelNameEvaluator = x.posLevelName;
kpiUserEvaluation.posTypeNameEvaluator = x.posTypeName;
kpiUserEvaluation.orgEvaluator = x.root;
});
}
if (requestBody.commanderId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.commanderId)
.then((x) => {
kpiUserEvaluation.prefixCommander = x.prefix;
kpiUserEvaluation.firstNameCommander = x.firstName;
kpiUserEvaluation.lastNameCommander = x.lastName;
kpiUserEvaluation.positionCommander = x.position;
});
}
if (requestBody.commanderHighId) {
await new CallAPI()
.GetData(request, "/org/profile/profileid/position/" + requestBody.commanderHighId)
.then((x) => {
kpiUserEvaluation.prefixCommanderHigh = x.prefix;
kpiUserEvaluation.firstNameCommanderHigh = x.firstName;
kpiUserEvaluation.lastNameCommanderHigh = x.lastName;
kpiUserEvaluation.positionCommanderHigh = x.position;
});
}
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
kpiUserEvaluation.lastUpdateFullName = request.user.name;
kpiUserEvaluation.lastUpdatedAt = new Date();
@ -1002,6 +1060,7 @@ export class KpiUserEvaluationController extends Controller {
evaluationStatus: kpiUserEvaluation.evaluationStatus,
evaluationResults: kpiUserEvaluation.evaluationResults,
evaluationReqEdit: kpiUserEvaluation.evaluationReqEdit,
isProbation: kpiUserEvaluation.isProbation,
createdAt: kpiUserEvaluation.createdAt,
evaluatorId: kpiUserEvaluation.evaluatorId,
commanderId: kpiUserEvaluation.commanderId,
@ -1017,6 +1076,11 @@ export class KpiUserEvaluationController extends Controller {
summaryPoint: kpiUserEvaluation.summaryPoint,
isOpen: kpiUserEvaluation.isOpen,
openDate: kpiUserEvaluation.openDate,
root: kpiUserEvaluation.org,
child1: kpiUserEvaluation.child1,
child2: kpiUserEvaluation.child2,
child3: kpiUserEvaluation.child3,
child4: kpiUserEvaluation.child4,
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
durationKPI:
kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,
@ -1426,6 +1490,7 @@ export class KpiUserEvaluationController extends Controller {
evaluationStatus: kpiUserEvaluation.evaluationStatus,
evaluationResults: kpiUserEvaluation.evaluationResults,
evaluationReqEdit: kpiUserEvaluation.evaluationReqEdit,
isProbation: kpiUserEvaluation.isProbation,
createdAt: kpiUserEvaluation.createdAt,
evaluatorId: kpiUserEvaluation.evaluatorId,
commanderId: kpiUserEvaluation.commanderId,
@ -1437,6 +1502,11 @@ export class KpiUserEvaluationController extends Controller {
summaryPoint: kpiUserEvaluation.summaryPoint,
isOpen: kpiUserEvaluation.isOpen,
openDate: kpiUserEvaluation.openDate,
root: kpiUserEvaluation.org,
child1: kpiUserEvaluation.child1,
child2: kpiUserEvaluation.child2,
child3: kpiUserEvaluation.child3,
child4: kpiUserEvaluation.child4,
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
durationKPI:
kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,