Merge branch 'develop' into adiDev
This commit is contained in:
commit
d7eef65555
18 changed files with 507 additions and 374 deletions
|
|
@ -25,7 +25,7 @@ import { KpiCapacityDetail } from "../entities/kpiCapacityDetail";
|
|||
import { Like, In } from "typeorm";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/capacity")
|
||||
@Tags("kpiCapacity")
|
||||
|
|
@ -83,6 +83,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacity.createdFullName = request.user.name;
|
||||
kpiCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiCapacity.createdAt = new Date();
|
||||
kpiCapacity.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityRepository.save(kpiCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacity });
|
||||
|
||||
|
|
@ -100,6 +102,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacityDetail.createdFullName = request.user.name;
|
||||
kpiCapacityDetail.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacityDetail.lastUpdateFullName = request.user.name;
|
||||
kpiCapacityDetail.createdAt = new Date();
|
||||
kpiCapacityDetail.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityDetailRepository.save(kpiCapacityDetail, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacityDetail });
|
||||
}
|
||||
|
|
@ -155,6 +159,7 @@ export class kpiCapacityController extends Controller {
|
|||
const before = structuredClone(kpiCapacity);
|
||||
kpiCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiCapacity.lastUpdatedAt = new Date();
|
||||
this.kpiCapacityRepository.merge(kpiCapacity, _kpiCapacity);
|
||||
await this.kpiCapacityRepository.save(kpiCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiCapacity });
|
||||
|
|
@ -180,6 +185,8 @@ export class kpiCapacityController extends Controller {
|
|||
kpiCapacityDetail.createdFullName = request.user.name;
|
||||
kpiCapacityDetail.lastUpdateUserId = request.user.sub;
|
||||
kpiCapacityDetail.lastUpdateFullName = request.user.name;
|
||||
kpiCapacityDetail.createdAt = new Date();
|
||||
kpiCapacityDetail.lastUpdatedAt = new Date();
|
||||
await this.kpiCapacityDetailRepository.save(kpiCapacityDetail, { data: request });
|
||||
setLogDataDiff(request, { before: beforeDetail, after: kpiCapacityDetail });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiEvaluation, updateKpiEvaluation } from "../entities/kpiEvaluation";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/evaluation")
|
||||
@Tags("kpiEvaluation")
|
||||
|
|
@ -56,6 +56,7 @@ export class kpiEvaluationController extends Controller {
|
|||
this.kpiEvaluationRepository.merge(kpiEvaluation, item);
|
||||
kpiEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiEvaluationRepository.save(kpiEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiEvaluation });
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiGroup, createKpiGroup, updateKpiGroup } from "../entities/kpiGroup";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/group")
|
||||
@Tags("kpiGroup")
|
||||
|
|
@ -62,6 +62,8 @@ export class kpiGroupController extends Controller {
|
|||
kpiGroup.createdFullName = request.user.name;
|
||||
kpiGroup.lastUpdateUserId = request.user.sub;
|
||||
kpiGroup.lastUpdateFullName = request.user.name;
|
||||
kpiGroup.createdAt = new Date();
|
||||
kpiGroup.lastUpdatedAt = new Date();
|
||||
await this.kpiGroupRepository.save(kpiGroup, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiGroup });
|
||||
|
||||
|
|
@ -100,6 +102,7 @@ export class kpiGroupController extends Controller {
|
|||
this.kpiGroupRepository.merge(kpiGroup, requestBody);
|
||||
kpiGroup.lastUpdateUserId = request.user.sub;
|
||||
kpiGroup.lastUpdateFullName = request.user.name;
|
||||
kpiGroup.lastUpdatedAt = new Date();
|
||||
await this.kpiGroupRepository.save(kpiGroup, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiGroup });
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { KpiCapacity } from "../entities/kpiCapacity";
|
|||
import { Position } from "../entities/position";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/link")
|
||||
@Tags("kpiLink")
|
||||
|
|
@ -65,6 +65,8 @@ export class kpiLinkController extends Controller {
|
|||
createdFullName: request.user.name,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
kpiGroup: chkkpiGroup,
|
||||
});
|
||||
await this.kpiLinkRepository.save(kpiLink, { data: request });
|
||||
|
|
@ -80,6 +82,8 @@ export class kpiLinkController extends Controller {
|
|||
position.createdFullName = request.user.name;
|
||||
position.lastUpdateUserId = request.user.sub;
|
||||
position.lastUpdateFullName = request.user.name;
|
||||
position.createdAt = new Date();
|
||||
position.lastUpdatedAt = new Date();
|
||||
await this.positionRepository.save(position, { data: request });
|
||||
setLogDataDiff(request, { before, after: position });
|
||||
}),
|
||||
|
|
@ -132,9 +136,10 @@ export class kpiLinkController extends Controller {
|
|||
...requestBody,
|
||||
kpiCapacitys: [],
|
||||
});
|
||||
(chkKpiLink.kpiGroupId = requestBody.kpiGroupId),
|
||||
(chkKpiLink.lastUpdateUserId = request.user.sub);
|
||||
chkKpiLink.kpiGroupId = requestBody.kpiGroupId;
|
||||
chkKpiLink.lastUpdateUserId = request.user.sub;
|
||||
chkKpiLink.lastUpdateFullName = request.user.name;
|
||||
chkKpiLink.lastUpdatedAt = new Date();
|
||||
|
||||
if (requestBody.positions != null) {
|
||||
await Promise.all(
|
||||
|
|
@ -146,6 +151,8 @@ export class kpiLinkController extends Controller {
|
|||
position.createdFullName = request.user.name;
|
||||
position.lastUpdateUserId = request.user.sub;
|
||||
position.lastUpdateFullName = request.user.name;
|
||||
position.createdAt = new Date();
|
||||
position.lastUpdatedAt = new Date();
|
||||
await this.positionRepository.save(position, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: position });
|
||||
}),
|
||||
|
|
@ -323,6 +330,9 @@ export class kpiLinkController extends Controller {
|
|||
}
|
||||
|
||||
kpiLink.kpiCapacitys = [];
|
||||
kpiLink.lastUpdateUserId = request.user.sub;
|
||||
kpiLink.lastUpdateFullName = request.user.name;
|
||||
kpiLink.lastUpdatedAt = new Date();
|
||||
await this.kpiLinkRepository.save(kpiLink, { data: request });
|
||||
|
||||
await this.positionRepository.delete({ kpiLinkId: id });
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import { KpiUserCapacity } from "../entities/kpiUserCapacity";
|
|||
import { KpiUserSpecial } from "../entities/kpiUserSpecial";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/period")
|
||||
@Tags("kpiPeriod")
|
||||
|
|
@ -78,6 +78,8 @@ export class kpiPeriodController extends Controller {
|
|||
kpiPeriod.createdFullName = request.user.name;
|
||||
kpiPeriod.lastUpdateUserId = request.user.sub;
|
||||
kpiPeriod.lastUpdateFullName = request.user.name;
|
||||
kpiPeriod.createdAt = new Date();
|
||||
kpiPeriod.lastUpdatedAt = new Date();
|
||||
await this.kpiPeriodRepository.save(kpiPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPeriod });
|
||||
|
||||
|
|
@ -120,10 +122,9 @@ export class kpiPeriodController extends Controller {
|
|||
|
||||
requestBody.durationKPI = requestBody.durationKPI.trim().toUpperCase();
|
||||
this.kpiPeriodRepository.merge(kpiPeriod, requestBody);
|
||||
kpiPeriod.createdUserId = request.user.sub;
|
||||
kpiPeriod.createdFullName = request.user.name;
|
||||
kpiPeriod.lastUpdateUserId = request.user.sub;
|
||||
kpiPeriod.lastUpdateFullName = request.user.name;
|
||||
kpiPeriod.lastUpdatedAt = new Date();
|
||||
await this.kpiPeriodRepository.save(kpiPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPeriod });
|
||||
|
||||
|
|
@ -154,6 +155,9 @@ export class kpiPeriodController extends Controller {
|
|||
const before = structuredClone(kpiPeriod);
|
||||
|
||||
kpiPeriod.isActive = false;
|
||||
kpiPeriod.lastUpdateUserId = request.user.sub;
|
||||
kpiPeriod.lastUpdateFullName = request.user.name;
|
||||
kpiPeriod.lastUpdatedAt = new Date();
|
||||
await this.kpiPeriodRepository.save(kpiPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPeriod });
|
||||
|
||||
|
|
@ -184,6 +188,9 @@ export class kpiPeriodController extends Controller {
|
|||
const before = structuredClone(kpiPeriod);
|
||||
|
||||
kpiPeriod.isActive = true;
|
||||
kpiPeriod.lastUpdateUserId = request.user.sub;
|
||||
kpiPeriod.lastUpdateFullName = request.user.name;
|
||||
kpiPeriod.lastUpdatedAt = new Date();
|
||||
await this.kpiPeriodRepository.save(kpiPeriod, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPeriod });
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import { KpiSpecial } from "../entities/kpiSpecial";
|
|||
import { KpiRole } from "../entities/kpiRole";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/plan")
|
||||
@Tags("kpiPlan")
|
||||
|
|
@ -186,6 +186,8 @@ export class kpiPlanController extends Controller {
|
|||
kpiPlan.createdFullName = request.user.name;
|
||||
kpiPlan.lastUpdateUserId = request.user.sub;
|
||||
kpiPlan.lastUpdateFullName = request.user.name;
|
||||
kpiPlan.createdAt = new Date();
|
||||
kpiPlan.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(kpiPlan, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPlan });
|
||||
|
||||
|
|
@ -195,6 +197,8 @@ export class kpiPlanController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: history });
|
||||
|
||||
|
|
@ -280,6 +284,8 @@ export class kpiPlanController extends Controller {
|
|||
kpiPlan.createdFullName = request.user.name;
|
||||
kpiPlan.lastUpdateUserId = request.user.sub;
|
||||
kpiPlan.lastUpdateFullName = request.user.name;
|
||||
kpiPlan.createdAt = new Date();
|
||||
kpiPlan.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(kpiPlan, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiPlan });
|
||||
|
||||
|
|
@ -290,6 +296,8 @@ export class kpiPlanController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: history });
|
||||
|
||||
|
|
@ -803,6 +811,9 @@ export class kpiPlanController extends Controller {
|
|||
remainingKpiPlans.forEach((kpiPlan: any, index: any) => {
|
||||
kpiPlan.including = index + 1;
|
||||
});
|
||||
remainingKpiPlans.lastUpdateUserId = request.user.sub;
|
||||
remainingKpiPlans.lastUpdateFullName = request.user.name;
|
||||
remainingKpiPlans.lastUpdatedAt = new Date();
|
||||
await this.kpiPlanRepository.save(remainingKpiPlans, { data: request });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import { KpiUserCapacity } from "../entities/kpiUserCapacity";
|
|||
import { KpiUserDevelopment } from "../entities/kpiUserDevelopment";
|
||||
import { KpiUserPlanned } from "../entities/kpiUserPlanned";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/reason")
|
||||
@Tags("kpiReason")
|
||||
|
|
@ -121,6 +121,8 @@ export class kpiReasonController extends Controller {
|
|||
kpiUserEvaluationReason.createdFullName = request.user.name;
|
||||
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluationReason.createdAt = new Date();
|
||||
kpiUserEvaluationReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonPlan.save(kpiUserEvaluationReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluationReason });
|
||||
|
||||
|
|
@ -159,6 +161,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonPlan.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -199,6 +202,7 @@ export class kpiReasonController extends Controller {
|
|||
kpiReason.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonPlan.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -348,6 +352,8 @@ export class kpiReasonController extends Controller {
|
|||
kpiUserEvaluationReason.createdFullName = request.user.name;
|
||||
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluationReason.createdAt = new Date();
|
||||
kpiUserEvaluationReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonRole.save(kpiUserEvaluationReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluationReason });
|
||||
|
||||
|
|
@ -386,6 +392,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonRole.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -426,6 +433,7 @@ export class kpiReasonController extends Controller {
|
|||
kpiReason.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonRole.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -578,6 +586,8 @@ export class kpiReasonController extends Controller {
|
|||
kpiUserEvaluationReason.createdFullName = request.user.name;
|
||||
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluationReason.createdAt = new Date();
|
||||
kpiUserEvaluationReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonSpecial.save(kpiUserEvaluationReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluationReason });
|
||||
|
||||
|
|
@ -616,6 +626,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonSpecial.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -656,6 +667,7 @@ export class kpiReasonController extends Controller {
|
|||
kpiReason.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonSpecial.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -804,6 +816,8 @@ export class kpiReasonController extends Controller {
|
|||
kpiUserEvaluationReason.createdFullName = request.user.name;
|
||||
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluationReason.createdAt = new Date();
|
||||
kpiUserEvaluationReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonDevelopment.save(kpiUserEvaluationReason, {
|
||||
data: request,
|
||||
});
|
||||
|
|
@ -844,6 +858,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonDevelopment.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -884,6 +899,7 @@ export class kpiReasonController extends Controller {
|
|||
kpiReason.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonDevelopment.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -1036,6 +1052,8 @@ export class kpiReasonController extends Controller {
|
|||
kpiUserEvaluationReason.createdFullName = request.user.name;
|
||||
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluationReason.createdAt = new Date();
|
||||
kpiUserEvaluationReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonCapacity.save(kpiUserEvaluationReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluationReason });
|
||||
|
||||
|
|
@ -1074,6 +1092,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonCapacity.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
@ -1114,6 +1133,7 @@ export class kpiReasonController extends Controller {
|
|||
kpiReason.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||
kpiReason.lastUpdateUserId = request.user.sub;
|
||||
kpiReason.lastUpdateFullName = request.user.name;
|
||||
kpiReason.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvaluationReasonCapacity.save(kpiReason, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiReason });
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ import { Brackets, IsNull, Like } from "typeorm";
|
|||
import { KpiRoleHistory } from "../entities/kpiRoleHistory";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/role")
|
||||
@Tags("kpiRole")
|
||||
|
|
@ -181,6 +180,8 @@ export class kpiRoleController extends Controller {
|
|||
kpiRole.createdFullName = request.user.name;
|
||||
kpiRole.lastUpdateUserId = request.user.sub;
|
||||
kpiRole.lastUpdateFullName = request.user.name;
|
||||
kpiRole.createdAt = new Date();
|
||||
kpiRole.lastUpdatedAt = new Date();
|
||||
await this.kpiRoleRepository.save(kpiRole, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiRole });
|
||||
|
||||
|
|
@ -190,6 +191,8 @@ export class kpiRoleController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiRoleHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiRole });
|
||||
|
||||
|
|
@ -257,6 +260,8 @@ export class kpiRoleController extends Controller {
|
|||
kpiRole.createdFullName = request.user.name;
|
||||
kpiRole.lastUpdateUserId = request.user.sub;
|
||||
kpiRole.lastUpdateFullName = request.user.name;
|
||||
kpiRole.createdAt = new Date();
|
||||
kpiRole.lastUpdatedAt = new Date();
|
||||
await this.kpiRoleRepository.save(kpiRole, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiRole });
|
||||
|
||||
|
|
@ -267,6 +272,8 @@ export class kpiRoleController extends Controller {
|
|||
history.createdFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
await this.kpiRoleHistoryRepository.save(history, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiRole });
|
||||
|
||||
|
|
@ -761,6 +768,9 @@ export class kpiRoleController extends Controller {
|
|||
remainingKpiRoles.forEach((kpiRole: any, index: any) => {
|
||||
kpiRole.including = index + 1;
|
||||
});
|
||||
remainingKpiRoles.lastUpdateUserId = request.user.sub;
|
||||
remainingKpiRoles.lastUpdateFullName = request.user.name;
|
||||
remainingKpiRoles.lastUpdatedAt = new Date();
|
||||
await this.kpiRoleRepository.save(remainingKpiRoles, { data: request });
|
||||
}
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { KpiSpecial, CreateKpiSpecial, UpdateKpiSpecial } from "../entities/kpiS
|
|||
import { Brackets, Not } from "typeorm";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/special")
|
||||
@Tags("kpiSpecial")
|
||||
|
|
@ -67,6 +67,8 @@ export class kpiSpecialController extends Controller {
|
|||
kpiSpecial.createdFullName = request.user.name;
|
||||
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiSpecial.createdAt = new Date();
|
||||
kpiSpecial.lastUpdatedAt = new Date();
|
||||
await this.kpiSpecialRepository.save(kpiSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiSpecial });
|
||||
|
||||
|
|
@ -110,6 +112,7 @@ export class kpiSpecialController extends Controller {
|
|||
|
||||
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiSpecial.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiSpecial, requestBody);
|
||||
await this.kpiSpecialRepository.save(kpiSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiSpecial });
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
|||
import { KpiUserCapacity, KpiUserCapacityDataPoint } from "../entities/kpiUserCapacity";
|
||||
import { Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { request } from "axios";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/capacity")
|
||||
@Tags("kpiUserCapacity")
|
||||
|
|
@ -93,6 +91,8 @@ export class KpiUserCapacityController extends Controller {
|
|||
kpiUserCapacity.createdFullName = request.user.name;
|
||||
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiUserCapacity.createdAt = new Date();
|
||||
kpiUserCapacity.lastUpdatedAt = new Date();
|
||||
await this.kpiUserCapacityRepository.save(kpiUserCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserCapacity });
|
||||
|
||||
|
|
@ -160,6 +160,7 @@ export class KpiUserCapacityController extends Controller {
|
|||
const _kpiUserCapacity = Object.assign(new KpiUserCapacity(), requestBody);
|
||||
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiUserCapacity.lastUpdatedAt = new Date();
|
||||
this.kpiUserCapacityRepository.merge(kpiUserCapacity, _kpiUserCapacity);
|
||||
await this.kpiUserCapacityRepository.save(kpiUserCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserCapacity });
|
||||
|
|
@ -285,6 +286,7 @@ export class KpiUserCapacityController extends Controller {
|
|||
this.kpiUserCapacityRepository.merge(kpiUserCapacity, item);
|
||||
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
||||
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
||||
kpiUserCapacity.lastUpdatedAt = new Date();
|
||||
await this.kpiUserCapacityRepository.save(kpiUserCapacity, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserCapacity });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import { Not, Brackets } from "typeorm";
|
|||
import { DevelopmentProject } from "../entities/developmentProject";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/achievement/development")
|
||||
@Tags("KpiUserDevelopment")
|
||||
|
|
@ -95,6 +95,8 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
kpiUserDevelopment.createdFullName = request.user.name;
|
||||
kpiUserDevelopment.lastUpdateUserId = request.user.sub;
|
||||
kpiUserDevelopment.lastUpdateFullName = request.user.name;
|
||||
kpiUserDevelopment.createdAt = new Date();
|
||||
kpiUserDevelopment.lastUpdatedAt = new Date();
|
||||
await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserDevelopment });
|
||||
|
||||
|
|
@ -107,6 +109,8 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
data.createdFullName = request.user.name;
|
||||
data.lastUpdateUserId = request.user.sub;
|
||||
data.lastUpdateFullName = request.user.name;
|
||||
data.createdAt = new Date();
|
||||
data.lastUpdatedAt = new Date();
|
||||
data.kpiUserDevelopmentId = kpiUserDevelopment.id;
|
||||
await this.developmentProjectRepository.save(data, { data: request });
|
||||
setLogDataDiff(request, { before, after: data });
|
||||
|
|
@ -179,6 +183,7 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
const before = structuredClone(kpiUserDevelopment);
|
||||
kpiUserDevelopment.lastUpdateUserId = request.user.sub;
|
||||
kpiUserDevelopment.lastUpdateFullName = request.user.name;
|
||||
kpiUserDevelopment.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserDevelopment, requestBody);
|
||||
await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserDevelopment });
|
||||
|
|
@ -192,6 +197,8 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
data.createdFullName = request.user.name;
|
||||
data.lastUpdateUserId = request.user.sub;
|
||||
data.lastUpdateFullName = request.user.name;
|
||||
data.createdAt = new Date();
|
||||
data.lastUpdatedAt = new Date();
|
||||
data.kpiUserDevelopmentId = kpiUserDevelopment.id;
|
||||
await this.developmentProjectRepository.save(data, { data: request });
|
||||
setLogDataDiff(request, { before: null, after: data });
|
||||
|
|
@ -325,6 +332,7 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
this.kpiUserDevelopmentRepository.merge(kpiUserDevelopment, item);
|
||||
kpiUserDevelopment.lastUpdateUserId = request.user.sub;
|
||||
kpiUserDevelopment.lastUpdateFullName = request.user.name;
|
||||
kpiUserDevelopment.lastUpdatedAt = new Date();
|
||||
await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserDevelopment });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,9 @@ import CallAPI from "../interfaces/call-api";
|
|||
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||
import { Position } from "../entities/position";
|
||||
import { KpiLink } from "../entities/kpiLink";
|
||||
import { KpiGroup } from "../entities/kpiGroup";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/evaluation")
|
||||
@Tags("kpiUserEvaluation")
|
||||
|
|
@ -53,7 +52,6 @@ export class KpiUserEvaluationController extends Controller {
|
|||
private kpiCapacityRepository = AppDataSource.getRepository(KpiCapacity);
|
||||
private kpiPositionRepository = AppDataSource.getRepository(Position);
|
||||
private kpiLinkRepository = AppDataSource.getRepository(KpiLink);
|
||||
private kpiGroupRepository = AppDataSource.getRepository(KpiGroup);
|
||||
|
||||
/**
|
||||
* API
|
||||
|
|
@ -83,7 +81,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
|
||||
|
|
@ -476,7 +474,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.child4Id = x.child4Id;
|
||||
isProbation = x.isProbation;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
} else {
|
||||
|
|
@ -503,7 +501,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.child4Id = x.child4Id;
|
||||
isProbation = x.isProbation;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
}
|
||||
|
|
@ -525,6 +523,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.createdFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.createdAt = new Date();
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
level: levelForGourp,
|
||||
weight: 100,
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถสร้างข้อมูลสมรรถนะได้");
|
||||
});
|
||||
}
|
||||
|
|
@ -685,6 +685,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
|
@ -733,6 +734,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
|
@ -774,6 +776,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
|
@ -806,6 +809,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.evaluationReqEdit = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
|
|
@ -837,6 +841,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.evaluationResults = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
|
|
@ -875,8 +880,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
} else if (requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR") {
|
||||
await new CallAPI()
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
|
|
@ -888,13 +893,14 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
|
|
@ -975,7 +981,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
|
|
@ -1064,7 +1070,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
const list = await this.kpiUserEvalutionRepository.find({
|
||||
|
|
@ -1104,8 +1110,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
item.evaluationStatus = "NEW_COMMANDER";
|
||||
}
|
||||
}
|
||||
|
|
@ -1124,8 +1130,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
item.evaluationStatus = "NEW_COMMANDER_HIGH";
|
||||
}
|
||||
}
|
||||
|
|
@ -1138,6 +1144,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
item.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
}),
|
||||
|
|
@ -1167,7 +1174,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
|
||||
|
|
@ -1221,6 +1228,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
item.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
});
|
||||
|
|
@ -1250,7 +1258,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
|
||||
|
|
@ -1301,6 +1309,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
item.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
});
|
||||
|
|
@ -1308,7 +1317,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (ADMIN)
|
||||
*
|
||||
* @summary รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (ADMIN)
|
||||
|
|
@ -1380,6 +1389,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.openDate = new Date();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
|
|
@ -1425,8 +1435,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
|
|
@ -1439,8 +1449,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER";
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
|
@ -1455,6 +1465,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
requestBody.reasonEvaluator == null ? _null : requestBody.reasonEvaluator;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
|
|
@ -1498,8 +1509,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
|
|
@ -1512,8 +1523,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER_HIGH";
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
|
@ -1522,6 +1533,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
|
|
@ -1566,14 +1578,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
||||
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
|
|
@ -1615,7 +1628,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
pointSum: kpiUserEvaluation.summaryPoint,
|
||||
profileId: kpiUserEvaluation.profileId,
|
||||
})
|
||||
.then(async (x) => {});
|
||||
.then(async () => {});
|
||||
|
||||
kpiUserEvaluation.kpiUserDevelopments.map(async (kpiUserDevelopment) => {
|
||||
new CallAPI()
|
||||
|
|
@ -1636,7 +1649,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
summary: kpiUserDevelopment.summary,
|
||||
point: kpiUserDevelopment.point,
|
||||
})
|
||||
.then(async (x) => {});
|
||||
.then(async () => {});
|
||||
});
|
||||
new CallAPI()
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
|
|
@ -1648,11 +1661,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
const before = null;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
}),
|
||||
|
|
@ -1736,6 +1750,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.evaluationStatus = "SUMMARY";
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdatedAt = new Date();
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ import { Not } from "typeorm";
|
|||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { KpiPlan } from "../entities/kpiPlan";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/achievement/planned")
|
||||
@Tags("KpiUserPlanned")
|
||||
|
|
@ -96,6 +95,8 @@ export class KpiUserPlannedController extends Controller {
|
|||
kpiUserPlanned.createdFullName = request.user.name;
|
||||
kpiUserPlanned.lastUpdateUserId = request.user.sub;
|
||||
kpiUserPlanned.lastUpdateFullName = request.user.name;
|
||||
kpiUserPlanned.createdAt = new Date();
|
||||
kpiUserPlanned.lastUpdatedAt = new Date();
|
||||
// kpiUserPlanned.documentInfoEvidence = request.user.documentInfoEvidence;
|
||||
// kpiUserPlanned.startDate = request.user.startDate;
|
||||
// kpiUserPlanned.endDate = request.user.endDate;
|
||||
|
|
@ -144,6 +145,7 @@ export class KpiUserPlannedController extends Controller {
|
|||
const before = structuredClone(kpiUserPlanned);
|
||||
kpiUserPlanned.lastUpdateUserId = request.user.sub;
|
||||
kpiUserPlanned.lastUpdateFullName = request.user.name;
|
||||
kpiUserPlanned.lastUpdatedAt = new Date();
|
||||
// kpiUserPlanned.documentInfoEvidence = request.user.documentInfoEvidence;
|
||||
// kpiUserPlanned.startDate = request.user.startDate;
|
||||
// kpiUserPlanned.endDate = request.user.endDate;
|
||||
|
|
@ -300,6 +302,7 @@ export class KpiUserPlannedController extends Controller {
|
|||
this.kpiUserPlannedRepository.merge(kpiUserPlanned, item);
|
||||
kpiUserPlanned.lastUpdateUserId = request.user.sub;
|
||||
kpiUserPlanned.lastUpdateFullName = request.user.name;
|
||||
kpiUserPlanned.lastUpdatedAt = new Date();
|
||||
await this.kpiUserPlannedRepository.save(kpiUserPlanned, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserPlanned });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ import { Not } from "typeorm";
|
|||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { KpiRole } from "../entities/kpiRole";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/achievement/role")
|
||||
@Tags("KpiUserRole")
|
||||
|
|
@ -99,6 +98,8 @@ export class KpiUserRoleController extends Controller {
|
|||
kpiUserRole.createdFullName = request.user.name;
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||
kpiUserRole.createdAt = new Date();
|
||||
kpiUserRole.lastUpdatedAt = new Date();
|
||||
await this.kpiUserRoleRepository.save(kpiUserRole, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserRole });
|
||||
|
||||
|
|
@ -156,6 +157,7 @@ export class KpiUserRoleController extends Controller {
|
|||
const before = structuredClone(kpiUserRole);
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||
kpiUserRole.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserRole, requestBody);
|
||||
kpiUserRole.startDate = requestBody.startDate == undefined ? null : requestBody.startDate;
|
||||
kpiUserRole.endDate = requestBody.endDate == undefined ? null : requestBody.endDate;
|
||||
|
|
@ -305,6 +307,7 @@ export class KpiUserRoleController extends Controller {
|
|||
this.kpiUserRoleRepository.merge(kpiUserRole, item);
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||
kpiUserRole.lastUpdatedAt = new Date();
|
||||
await this.kpiUserRoleRepository.save(kpiUserRole, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserRole });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
|||
import { KpiSpecial } from "../entities/kpiSpecial";
|
||||
import { Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/achievement/special")
|
||||
@Tags("KpiUserSpecial")
|
||||
|
|
@ -104,6 +103,8 @@ export class KpiUserSpecialController extends Controller {
|
|||
kpiSpecial.createdFullName = request.user.name;
|
||||
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiSpecial.createdAt = new Date();
|
||||
kpiSpecial.lastUpdatedAt = new Date();
|
||||
await this.kpiSpecialRepository.save(kpiSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiSpecial });
|
||||
}
|
||||
|
|
@ -113,6 +114,8 @@ export class KpiUserSpecialController extends Controller {
|
|||
kpiUserSpecial.createdFullName = request.user.name;
|
||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiUserSpecial.createdAt = new Date();
|
||||
kpiUserSpecial.lastUpdatedAt = new Date();
|
||||
await this.kpiUserSpecialRepository.save(kpiUserSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserSpecial });
|
||||
|
||||
|
|
@ -181,12 +184,15 @@ export class KpiUserSpecialController extends Controller {
|
|||
kpiSpecial.createdFullName = request.user.name;
|
||||
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiSpecial.createdAt = new Date();
|
||||
kpiSpecial.lastUpdatedAt = new Date();
|
||||
await this.kpiSpecialRepository.save(kpiSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiSpecial });
|
||||
}
|
||||
before = structuredClone(kpiUserSpecial);
|
||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiUserSpecial.lastUpdatedAt = new Date();
|
||||
Object.assign(kpiUserSpecial, requestBody);
|
||||
kpiUserSpecial.startDate = requestBody.startDate == undefined ? null : requestBody.startDate;
|
||||
kpiUserSpecial.endDate = requestBody.endDate == undefined ? null : requestBody.endDate;
|
||||
|
|
@ -343,6 +349,7 @@ export class KpiUserSpecialController extends Controller {
|
|||
this.kpiUserSpecialRepository.merge(kpiUserSpecial, item);
|
||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiUserSpecial.lastUpdatedAt = new Date();
|
||||
await this.kpiUserSpecialRepository.save(kpiUserSpecial, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserSpecial });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Controller, Get, Post, Put, Delete, Patch, Route, Security, Tags } from "tsoa";
|
||||
import { Controller, Get, Route, Security, Tags } from "tsoa";
|
||||
|
||||
@Route("/hello")
|
||||
@Tags("Test")
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiPeriod } from "../entities/kpiPeriod";
|
||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { KpiRole } from "../entities/kpiRole";
|
||||
import { KpiPlan } from "../entities/kpiPlan";
|
||||
import { KpiUserDevelopment } from "../entities/kpiUserDevelopment";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
@Route("api/v1/kpi/report")
|
||||
|
|
@ -17,8 +15,6 @@ import CallAPI from "../interfaces/call-api";
|
|||
export class ReportController extends Controller {
|
||||
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
||||
private kpiUserEvaluationRepository = AppDataSource.getRepository(KpiUserEvaluation);
|
||||
private kpiRoleRepository = AppDataSource.getRepository(KpiRole);
|
||||
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
||||
private kpiUserDevelopmentRepository = AppDataSource.getRepository(KpiUserDevelopment);
|
||||
|
||||
@Post("announcement")
|
||||
|
|
@ -44,7 +40,7 @@ export class ReportController extends Controller {
|
|||
let dataKpiUserEvaluations: any;
|
||||
let period1: any;
|
||||
let period2: any;
|
||||
let rootName: any
|
||||
let rootName: any;
|
||||
if (requestBody.root && requestBody.periodId) {
|
||||
data = await this.kpiPeriodRepository.findOne({
|
||||
where: { id: requestBody.periodId },
|
||||
|
|
@ -56,11 +52,9 @@ export class ReportController extends Controller {
|
|||
evaluationStatus: "KP7",
|
||||
},
|
||||
});
|
||||
await new CallAPI()
|
||||
.GetData(request, `/org/root/${requestBody.root}`)
|
||||
.then((x) => {
|
||||
rootName = x.orgRootName;
|
||||
});
|
||||
await new CallAPI().GetData(request, `/org/root/${requestBody.root}`).then((x) => {
|
||||
rootName = x.orgRootName;
|
||||
});
|
||||
data = {
|
||||
id: data.id,
|
||||
year: data.year,
|
||||
|
|
@ -68,7 +62,7 @@ export class ReportController extends Controller {
|
|||
startDate: data.startDate,
|
||||
endDate: data.endDate,
|
||||
kpiUserEvaluations: dataKpiUserEvaluations,
|
||||
rootName: rootName
|
||||
rootName: rootName,
|
||||
};
|
||||
|
||||
if (data.durationKPI == "APR") {
|
||||
|
|
@ -170,10 +164,7 @@ export class ReportController extends Controller {
|
|||
period1: Extension.ToThaiNumber(period1),
|
||||
period2: Extension.ToThaiNumber(period2),
|
||||
durationKPI: data?.durationKPI,
|
||||
root:
|
||||
data && data.rootName != null
|
||||
? data.rootName
|
||||
: "-",
|
||||
root: data && data.rootName != null ? data.rootName : "-",
|
||||
userEvaluations: [
|
||||
{
|
||||
no: userEvaluationOrg.length > 0 ? "๑" : "-",
|
||||
|
|
@ -205,172 +196,210 @@ export class ReportController extends Controller {
|
|||
.filter((x: any) => x.evaluationResults == "EXCELLENT")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix!=null&&x.firstName!=null&&x.lastName!=null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
org: x.org ? x.org : "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
];
|
||||
const verygood =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter((x: any) => x.evaluationResults == "VERY_GOOD")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix!=null&&x.firstName!=null&&x.lastName!=null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
org: x.org ? x.org : "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
];
|
||||
const good =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter((x: any) => x.evaluationResults == "GOOD")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix!=null&&x.firstName!=null&&x.lastName!=null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
org: x.org ? x.org : "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
];
|
||||
const fair =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter((x: any) => x.evaluationResults == "FAIR")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix!=null&&x.firstName!=null&&x.lastName!=null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
org: x.org ? x.org : "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
];
|
||||
const improvment =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter((x: any) => x.evaluationResults == "IMPROVEMENT")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix!=null&&x.firstName!=null&&x.lastName!=null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
org: x.org ? x.org : "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
];
|
||||
formattedData = {
|
||||
year: data?.year ? Extension.ToThaiNumber((data.year + 543).toString()) : "-",
|
||||
period1: Extension.ToThaiNumber(period1),
|
||||
period2: Extension.ToThaiNumber(period2),
|
||||
durationKPI: data?.durationKPI,
|
||||
root: data && data.rootName != null
|
||||
? data.rootName
|
||||
: "-",
|
||||
root: data && data.rootName != null ? data.rootName : "-",
|
||||
excellents: {
|
||||
count:
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? Extension.ToThaiNumber(excellent.length.toString())
|
||||
: "๐",
|
||||
data: excellent.length > 0 ? excellent : [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}],
|
||||
data:
|
||||
excellent.length > 0
|
||||
? excellent
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
],
|
||||
},
|
||||
verygoods: {
|
||||
count:
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? Extension.ToThaiNumber(verygood.length.toString())
|
||||
: "๐",
|
||||
data: verygood.length > 0 ? verygood : [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}],
|
||||
data:
|
||||
verygood.length > 0
|
||||
? verygood
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
],
|
||||
},
|
||||
goods: {
|
||||
count:
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? Extension.ToThaiNumber(good.length.toString())
|
||||
: "๐",
|
||||
data: good.length > 0 ? good : [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}],
|
||||
data:
|
||||
good.length > 0
|
||||
? good
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
],
|
||||
},
|
||||
fairs: {
|
||||
count:
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? Extension.ToThaiNumber(fair.length.toString())
|
||||
: "๐",
|
||||
data: fair.length > 0 ? fair : [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}],
|
||||
data:
|
||||
fair.length > 0
|
||||
? fair
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
],
|
||||
},
|
||||
improvments: {
|
||||
count:
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? Extension.ToThaiNumber(improvment.length.toString())
|
||||
: "๐",
|
||||
data: improvment.length > 0 ? improvment : [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
}],
|
||||
data:
|
||||
improvment.length > 0
|
||||
? improvment
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
org: "-",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -380,15 +409,14 @@ export class ReportController extends Controller {
|
|||
const userEvaluations_ =
|
||||
data?.kpiUserEvaluations?.length > 0
|
||||
? data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
||||
no: idx != null ?Extension.ToThaiNumber((idx + 1).toString()) : "-",
|
||||
fullName: x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
no: idx != null ? Extension.ToThaiNumber((idx + 1).toString()) : "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
point1:
|
||||
x.summaryPoint >= 90.0
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: "-",
|
||||
x.summaryPoint >= 90.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
||||
point2:
|
||||
x.summaryPoint >= 80.0 && x.summaryPoint <= 89.99
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
|
|
@ -402,22 +430,22 @@ export class ReportController extends Controller {
|
|||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: "-",
|
||||
point5:
|
||||
x.summaryPoint < 60.0
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: "-",
|
||||
x.summaryPoint < 60.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
||||
remark: x.reasonEvaluator,
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
point1: "-",
|
||||
point2: "-",
|
||||
point3: "-",
|
||||
point4: "-",
|
||||
point5: "-",
|
||||
remark: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
point1: "-",
|
||||
point2: "-",
|
||||
point3: "-",
|
||||
point4: "-",
|
||||
point5: "-",
|
||||
remark: "-",
|
||||
},
|
||||
];
|
||||
const prefixEvaluator_ =
|
||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].prefixEvaluator : "";
|
||||
const firstNameEvaluator_ =
|
||||
|
|
@ -449,7 +477,7 @@ export class ReportController extends Controller {
|
|||
posTypeNameCommander = x.posTypeName;
|
||||
posLevelNameCommander = x.posLevelName;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
}
|
||||
|
|
@ -479,7 +507,7 @@ export class ReportController extends Controller {
|
|||
posTypeNameCommanderHigh = x.posTypeName;
|
||||
posLevelNameCommanderHigh = x.posLevelName;
|
||||
})
|
||||
.catch((x) => {
|
||||
.catch(() => {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
}
|
||||
|
|
@ -493,10 +521,7 @@ export class ReportController extends Controller {
|
|||
period1: Extension.ToThaiNumber(period1),
|
||||
period2: Extension.ToThaiNumber(period2),
|
||||
durationKPI: data?.durationKPI,
|
||||
root:
|
||||
data && data.rootName != null
|
||||
? data.rootName
|
||||
: "-",
|
||||
root: data && data.rootName != null ? data.rootName : "-",
|
||||
fullNameEvaluator: fullNameEvaluator,
|
||||
positionEvaluator:
|
||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].positionEvaluator : "-",
|
||||
|
|
@ -541,7 +566,6 @@ export class ReportController extends Controller {
|
|||
if (requestBody.type == "KPI4") {
|
||||
templateName = "KPI4";
|
||||
reportName = "KPI4";
|
||||
const yearNow = new Date().getFullYear();
|
||||
let combinedDatas: any;
|
||||
if (requestBody.profileId) {
|
||||
//ชั่วคราว
|
||||
|
|
@ -913,60 +937,61 @@ export class ReportController extends Controller {
|
|||
year5: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = profileEvaluation.length > 0
|
||||
? combinedData
|
||||
: {
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posType: "-",
|
||||
posLevel: "-",
|
||||
affiliation: "-",
|
||||
summaryPointAPR1: "-",
|
||||
textPointAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
yearAPR1: "-",
|
||||
summaryPointOCT1: "-",
|
||||
textPointOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
yearOCT1: "-",
|
||||
summaryPointAPR2: "-",
|
||||
textPointAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
yearAPR2: "-",
|
||||
summaryPointOCT2: "-",
|
||||
textPointOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
yearOCT2: "-",
|
||||
summaryPointAPR3: "-",
|
||||
textPointAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
yearAPR3: "-",
|
||||
summaryPointOCT3: "-",
|
||||
textPointOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
yearOCT3: "-",
|
||||
summaryPointAPR4: "-",
|
||||
textPointAPR4: "-",
|
||||
periodAPR4: "-",
|
||||
yearAPR4: "-",
|
||||
summaryPointOCT4: "-",
|
||||
textPointOCT4: "-",
|
||||
periodOCT4: "-",
|
||||
yearOCT4: "-",
|
||||
summaryPointAPR5: "-",
|
||||
textPointAPR5: "-",
|
||||
periodAPR5: "-",
|
||||
yearAPR5: "-",
|
||||
summaryPointOCT5: "-",
|
||||
textPointOCT5: "-",
|
||||
periodOCT5: "-",
|
||||
yearOCT5: "-",
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 4).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 3).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year4: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year5: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
};
|
||||
formattedData =
|
||||
profileEvaluation.length > 0
|
||||
? combinedData
|
||||
: {
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posType: "-",
|
||||
posLevel: "-",
|
||||
affiliation: "-",
|
||||
summaryPointAPR1: "-",
|
||||
textPointAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
yearAPR1: "-",
|
||||
summaryPointOCT1: "-",
|
||||
textPointOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
yearOCT1: "-",
|
||||
summaryPointAPR2: "-",
|
||||
textPointAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
yearAPR2: "-",
|
||||
summaryPointOCT2: "-",
|
||||
textPointOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
yearOCT2: "-",
|
||||
summaryPointAPR3: "-",
|
||||
textPointAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
yearAPR3: "-",
|
||||
summaryPointOCT3: "-",
|
||||
textPointOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
yearOCT3: "-",
|
||||
summaryPointAPR4: "-",
|
||||
textPointAPR4: "-",
|
||||
periodAPR4: "-",
|
||||
yearAPR4: "-",
|
||||
summaryPointOCT4: "-",
|
||||
textPointOCT4: "-",
|
||||
periodOCT4: "-",
|
||||
yearOCT4: "-",
|
||||
summaryPointAPR5: "-",
|
||||
textPointAPR5: "-",
|
||||
periodAPR5: "-",
|
||||
yearAPR5: "-",
|
||||
summaryPointOCT5: "-",
|
||||
textPointOCT5: "-",
|
||||
periodOCT5: "-",
|
||||
yearOCT5: "-",
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 4).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 3).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year4: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year5: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
};
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -1149,42 +1174,43 @@ export class ReportController extends Controller {
|
|||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = profileEvaluation.length > 0
|
||||
? combinedData
|
||||
: {
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posType: "-",
|
||||
posLevel: "-",
|
||||
affiliation: "-",
|
||||
summaryPointAPR1: "-",
|
||||
textPointAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
yearAPR1: "-",
|
||||
summaryPointOCT1: "-",
|
||||
textPointOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
yearOCT1: "-",
|
||||
summaryPointAPR2: "-",
|
||||
textPointAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
yearAPR2: "-",
|
||||
summaryPointOCT2: "-",
|
||||
textPointOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
yearOCT2: "-",
|
||||
summaryPointAPR3: "-",
|
||||
textPointAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
yearAPR3: "-",
|
||||
summaryPointOCT3: "-",
|
||||
textPointOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
yearOCT3: "-",
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
};
|
||||
formattedData =
|
||||
profileEvaluation.length > 0
|
||||
? combinedData
|
||||
: {
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posType: "-",
|
||||
posLevel: "-",
|
||||
affiliation: "-",
|
||||
summaryPointAPR1: "-",
|
||||
textPointAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
yearAPR1: "-",
|
||||
summaryPointOCT1: "-",
|
||||
textPointOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
yearOCT1: "-",
|
||||
summaryPointAPR2: "-",
|
||||
textPointAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
yearAPR2: "-",
|
||||
summaryPointOCT2: "-",
|
||||
textPointOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
yearOCT2: "-",
|
||||
summaryPointAPR3: "-",
|
||||
textPointAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
yearAPR3: "-",
|
||||
summaryPointOCT3: "-",
|
||||
textPointOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
yearOCT3: "-",
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
};
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -1210,9 +1236,10 @@ export class ReportController extends Controller {
|
|||
// : ""
|
||||
return {
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
developName: x.topicEvaluator ? x.topicEvaluator : "-",
|
||||
|
|
@ -1225,42 +1252,44 @@ export class ReportController extends Controller {
|
|||
: "-",
|
||||
};
|
||||
})
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
developName: "-",
|
||||
developEvaluator: "-",
|
||||
target: "-",
|
||||
timeEvaluator: "-",
|
||||
developResults: "-",
|
||||
evaluationResults: "-"
|
||||
}],
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
developName: "-",
|
||||
developEvaluator: "-",
|
||||
target: "-",
|
||||
timeEvaluator: "-",
|
||||
developResults: "-",
|
||||
evaluationResults: "-",
|
||||
},
|
||||
],
|
||||
);
|
||||
formattedData = {
|
||||
year: data.year ? Extension.ToThaiNumber((data.year + 543).toString()) : "-",
|
||||
period1: Extension.ToThaiNumber(period1),
|
||||
period2: Extension.ToThaiNumber(period2),
|
||||
durationKPI: data.durationKPI,
|
||||
root:
|
||||
data && data.rootName != null
|
||||
? data.rootName
|
||||
: "-",
|
||||
userEvaluations: userEvaluations_.length > 0
|
||||
? userEvaluations_
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
developName: "-",
|
||||
developEvaluator: "-",
|
||||
target: "-",
|
||||
timeEvaluator: "-",
|
||||
developResults: "-",
|
||||
evaluationResults: "-"
|
||||
}],
|
||||
root: data && data.rootName != null ? data.rootName : "-",
|
||||
userEvaluations:
|
||||
userEvaluations_.length > 0
|
||||
? userEvaluations_
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
developName: "-",
|
||||
developEvaluator: "-",
|
||||
target: "-",
|
||||
timeEvaluator: "-",
|
||||
developResults: "-",
|
||||
evaluationResults: "-",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (requestBody.type == "KPI8") {
|
||||
|
|
@ -1395,45 +1424,47 @@ export class ReportController extends Controller {
|
|||
posLevel: userInfo ? userInfo[0]?.posLevelName : "-",
|
||||
period1: period1 ? Extension.ToThaiNumber(period1) : "-",
|
||||
period2: period2 ? Extension.ToThaiNumber(period2) : "-",
|
||||
developments: formattedUserDevelopmentLists
|
||||
? formattedUserDevelopmentLists
|
||||
: [{
|
||||
no:"-",
|
||||
name:"-",
|
||||
target:"-",
|
||||
summary:"-"
|
||||
}],
|
||||
developments: formattedUserDevelopmentLists
|
||||
? formattedUserDevelopmentLists
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
name: "-",
|
||||
target: "-",
|
||||
summary: "-",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (requestBody.type == "KPI9") {
|
||||
templateName = "KPI9";
|
||||
reportName = "KPI9";
|
||||
if(data && data.kpiUserEvaluations.length == 0) {
|
||||
if (data && data.kpiUserEvaluations.length == 0) {
|
||||
//แก้ไขกรณีมีผู้ประเมินที่มีผลการประเมินดีเด่น แต่ RootId ไม่ตรงกับหน่วยงานที่ filter
|
||||
let userEvaInRoot: any
|
||||
let userEvaOutRoot: any []
|
||||
let userEvaInRoot: any;
|
||||
let userEvaOutRoot: any[];
|
||||
userEvaInRoot = await this.kpiUserEvaluationRepository.findOne({
|
||||
select: ["org"],
|
||||
where: {
|
||||
kpiPeriodId: String(requestBody.periodId),
|
||||
orgId: String(requestBody.root),
|
||||
},
|
||||
});
|
||||
if(userEvaInRoot) {
|
||||
kpiPeriodId: String(requestBody.periodId),
|
||||
orgId: String(requestBody.root),
|
||||
},
|
||||
});
|
||||
if (userEvaInRoot) {
|
||||
userEvaOutRoot = await this.kpiUserEvaluationRepository.find({
|
||||
where: {
|
||||
kpiPeriodId: String(requestBody.periodId),
|
||||
orgId: Not(String(requestBody.root)),
|
||||
org: userEvaInRoot.org,
|
||||
evaluationStatus: "KP7",
|
||||
},
|
||||
});
|
||||
if(userEvaOutRoot.length > 0) {
|
||||
data.kpiUserEvaluations = userEvaOutRoot
|
||||
kpiPeriodId: String(requestBody.periodId),
|
||||
orgId: Not(String(requestBody.root)),
|
||||
org: userEvaInRoot.org,
|
||||
evaluationStatus: "KP7",
|
||||
},
|
||||
});
|
||||
if (userEvaOutRoot.length > 0) {
|
||||
data.kpiUserEvaluations = userEvaOutRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const userEvaluations_ =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
|
|
@ -1443,39 +1474,42 @@ export class ReportController extends Controller {
|
|||
)
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
fullName:
|
||||
x.prefix != null && x.firstName != null && x.lastName != null
|
||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||
: "-",
|
||||
position: x.position ? x.position : "-",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "-",
|
||||
evaluationResults: x.evaluationResults
|
||||
? Extension.EvaluationResult(x.evaluationResults)
|
||||
: "-",
|
||||
}))
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
evaluationResults: "-",
|
||||
}];
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
evaluationResults: "-",
|
||||
},
|
||||
];
|
||||
|
||||
formattedData = {
|
||||
root:
|
||||
data && data.rootName != null
|
||||
? data.rootName
|
||||
: "-",
|
||||
root: data && data.rootName != null ? data.rootName : "-",
|
||||
period: data?.durationKPI == "APR" ? "๑" : data?.durationKPI == "OCT" ? "๒" : "-",
|
||||
year: data.year ? Extension.ToThaiNumber((data.year + 543).toString()) : "-",
|
||||
userEvaluations: userEvaluations_.length > 0
|
||||
? userEvaluations_
|
||||
: [{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
evaluationResults: "-",
|
||||
}],
|
||||
userEvaluations:
|
||||
userEvaluations_.length > 0
|
||||
? userEvaluations_
|
||||
: [
|
||||
{
|
||||
no: "-",
|
||||
fullName: "-",
|
||||
position: "-",
|
||||
posLevelName: "-",
|
||||
evaluationResults: "-",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,20 +45,9 @@ class CheckAuth {
|
|||
return null;
|
||||
}
|
||||
return await new CallAPI()
|
||||
.GetData(req, "/org/permission/org")
|
||||
.GetData(req, `/org/permission/org/${action}/${system}`)
|
||||
.then(async (x) => {
|
||||
let privilege = null;
|
||||
if (action.trim().toLocaleUpperCase() == "CREATE")
|
||||
privilege = await this.PermissionCreate(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "DELETE")
|
||||
privilege = await this.PermissionDelete(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "GET")
|
||||
privilege = await this.PermissionGet(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "LIST")
|
||||
privilege = await this.PermissionList(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "UPDATE")
|
||||
privilege = await this.PermissionUpdate(req, system);
|
||||
|
||||
let privilege = x.privilege;
|
||||
let data: any = {
|
||||
root: [null],
|
||||
child1: [null],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue