From e094c0ad07ed16365054cc6db47d523250703f8b Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 19 Dec 2024 17:00:41 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=97=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=20Individual=20De?= =?UTF-8?q?velopment=20Plan=20#875?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/DevelopmentController.ts | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index a5d6fdf..2e9bd9c 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -2606,6 +2606,58 @@ export class DevelopmentController extends Controller { return new HttpSuccess(getOrg); } + @Get("registry/{type}/{developmentId}") + async developmentDetail( + @Path() developmentId: string, + @Path() type: string, + @Request() request: RequestWithUser + ) { + const getDevelopment = await this.developmentRepository.findOne({ + where: { id: developmentId }, + relations: [ + "developmentProjectTypes", + "developmentProjectTechniquePlanneds", + "developmentProjectTechniqueActuals", + "developmentAddresss", + ], + }); + if (!getDevelopment) + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้"); + + if (type.trim().toLocaleUpperCase() == "OFFICER") { + let _workflow = await new permission().Workflow(request, developmentId, "SYS_REGISTRY_OFFICER"); + if (_workflow == false) await new permission().PermissionGet(request, "SYS_REGISTRY_OFFICER"); + } else if (type.trim().toLocaleUpperCase() == "USER") { + } else { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถเข้าถึงข้อมูลนี้ได้"); + } + + let _getDevelopment: any = { + id: getDevelopment.id, + evaluationId: null, + target: null, + summary: null, + point: null, + name: getDevelopment.projectName, + achievement10: "มีผลการพัฒนาและมีการดำเนินการตามเป้าหมายการนำไปพัฒนางาน1", + achievement5: "มีผลการพัฒนาแต่ยังไม่ได้ดำเนินการตามเป้าหมายการนำไปพัฒนางาน", + achievement0: "ไม่ได้ดำเนินการพัฒนา", + isDevelopment70: getDevelopment.isReasonActual70, + isDevelopment20: getDevelopment.isReasonActual20, + isDevelopment10: getDevelopment.isReasonActual10, + reasonDevelopment70: getDevelopment.reasonActual70, + reasonDevelopment20: getDevelopment.reasonActual20, + reasonDevelopment10: getDevelopment.reasonActual10, + selectType: "PROJECT", + selectTypeYear: getDevelopment.year, + selectTypeId: null, + developmentProjects : getDevelopment.developmentProjectTechniqueActuals + .map((x) => x.name) + .sort(), + }; + return new HttpSuccess(_getDevelopment); + } + /** * API upload User *