import { Entity, Column, ManyToOne, JoinColumn, OneToMany, Double, ManyToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Province } from "./Province"; import { ActualPeople, CreateActualPeople } from "./ActualPeople"; import { CreatePlannedPeople, PlannedPeople } from "./PlannedPeople"; import { ActualGoal, CreateActualGoal } from "./ActualGoal"; import { CreatePlannedGoal, PlannedGoal } from "./PlannedGoal"; import { DevelopmentHistory } from "./DevelopmentHistory"; import { DevelopmentProjectType } from "./DevelopmentProjectType"; import { DevelopmentProjectTechnique } from "./DevelopmentProjectTechnique"; import { CreateDevelopmentEvaluation, DevelopmentEvaluation } from "./DevelopmentEvaluation"; import { CreateDevelopmentAddress, DevelopmentAddress } from "./DevelopmentAddress"; @Entity("development") export class Development extends EntityBase { @Column({ // กำลังดำเนินการ (ONGOING) // เสร็จสิ้น (FINISH) nullable: true, comment: "สถานะ", default: "ONGOING", }) status: string; ////////////////////////////////////////tab ข้อมูลเบื้องต้น @Column({ nullable: true, comment: "ปีงบประมาณ", }) year: number; @Column({ comment: "ชื่อโครงการ/กิจกรรม/หลักสูตร", length: 255, }) projectName: string; @Column({ nullable: true, comment: "หลักการและเหตุผล", default: null, }) reason: string; @Column({ nullable: true, comment: "วัตถุประสงค์", default: null, }) objective: string; ////////////////////////////////////////tab เป้าหมาย @OneToMany( () => ActualPeople, (actualPeople: ActualPeople) => actualPeople.developmentActualPeople, ) developmentActualPeoples: ActualPeople[]; @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.developmentActualGoal) developmentActualGoals: ActualGoal[]; @OneToMany( () => PlannedPeople, (plannedPeople: PlannedPeople) => plannedPeople.developmentPlannedPeople, ) developmentPlannedPeoples: PlannedPeople[]; @OneToMany(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.developmentPlannedGoal) developmentPlannedGoals: PlannedGoal[]; ////////////////////////////////////////tab ลักษณะโครงการ @OneToMany( () => DevelopmentProjectType, (developmentProjectType: DevelopmentProjectType) => developmentProjectType.development, ) developmentProjectTypes: DevelopmentProjectType[]; @Column({ comment: "ไป-กลับ", default: false, }) isBackPlanned: boolean; @Column({ comment: "พักค้าง", default: false, }) isHoldPlanned: boolean; @Column({ nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, }) projectDayBackPlanned: number; @Column({ nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, }) projectDayHoldPlanned: number; @Column({ nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, }) projectNigthHoldPlanned: number; @Column({ comment: "ไป-กลับ", default: false, }) isBackActual: boolean; @Column({ comment: "พักค้าง", default: false, }) isHoldActual: boolean; @Column({ nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, }) projectDayBackActual: number; @Column({ nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, }) projectDayHoldActual: number; @Column({ nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, }) projectNigthHoldActual: number; @OneToMany( () => DevelopmentProjectTechnique, (developmentProjectTechnique: DevelopmentProjectTechnique) => developmentProjectTechnique.development, ) developmentProjectTechniques: DevelopmentProjectTechnique[]; @Column({ nullable: true, comment: "จำนวน(รุ่น)", default: null, }) projectModal: number; ////////////////////////////////////////tab ผลประเมิน @OneToMany( () => DevelopmentEvaluation, (developmentEvaluation: DevelopmentEvaluation) => developmentEvaluation.development, ) developmentEvaluations: DevelopmentEvaluation[]; @Column({ nullable: true, comment: "ประเภทโครงการ", default: null, }) project: string; @Column({ comment: "ผ่านการพิจาณา ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ", default: false, }) isPassAllocate: boolean; @Column({ comment: "ผ่านการพิจารณา ไม่ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isPassNoAllocate: boolean; @Column({ comment: "ไม่ผ่านการพิจารณา แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isNoPass: boolean; @Column({ comment: "แต่ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ", default: false, }) isBudget: boolean; @Column({ comment: "แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isOutBudget: boolean; ////////////////////////////////////////tab อื่นๆ @Column({ nullable: true, type: "datetime", comment: "วันที่เริ่มต้น", default: null, }) dateStart: Date; @Column({ nullable: true, type: "datetime", comment: "วันที่สิ้นสุด", default: null, }) dateEnd: Date; @Column({ nullable: true, comment: "รวมระยะเวลา (วัน)", default: null, }) totalDate: number; @OneToMany( () => DevelopmentAddress, (developmentAddress: DevelopmentAddress) => developmentAddress.development, ) developmentAddresss: DevelopmentAddress[]; @Column({ nullable: true, comment: "ประเภทงบประมาณ", default: null, }) budget: string; @Column({ // เงินบำรุง = MAINTENANCE // เงินกองทุน = FUND // เงินอุดหนุน = SUBSIDY nullable: true, comment: "ประเภทย่อย", default: null, }) budgetSub: string; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ขอรับการจัดสรรฯ", default: 0, type: "double", }) accept: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ได้รับการจัดสรรฯ", default: 0, type: "double", }) receive: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ได้รับอนุมัติ", default: 0, type: "double", }) approved: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่จ่ายจริง", default: 0, type: "double", }) budgetPay: Double; @Column({ nullable: true, comment: "ประเด็นความเสี่ยง", default: null, }) issues: string; @Column({ nullable: true, comment: "โอกาสที่จะเกิด", default: null, }) chance: number; @Column({ nullable: true, comment: "ผลกระทบจากการเกิด", default: null, }) effects: number; @Column({ nullable: true, comment: "ระดับความเสี่ยง", default: null, }) riskLevel: string; @Column({ nullable: true, comment: "เเนวทางการบริหารความเสี่ยง", default: null, }) riskManagement: string; @Column({ nullable: true, comment: "ประโยชน์ที่คาดว่าจะได้รับ", default: null, }) expect: string; @Column({ nullable: true, comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน", default: null, }) topicAcademic: string; @Column({ nullable: true, comment: "สถานที่ฝึกอบรม ศึกษาดูงาน", default: null, }) addressAcademic: string; @Column({ nullable: true, comment: "จังหวัด(ข้อมูลวิชาการ)", default: null, }) provinceActualId: string; @ManyToOne(() => Province, (province: Province) => province.developmentActuals) @JoinColumn({ name: "provinceActualId" }) provinceActual: Province; @Column({ nullable: true, type: "datetime", comment: "วันเริ่มต้นการศึกษาดูงาน", default: null, }) dateStudyStart: Date; @Column({ nullable: true, type: "datetime", comment: "วันสิ้นสุดการศึกษาดูงาน", default: null, }) dateStudyEnd: Date; @OneToMany( () => DevelopmentHistory, (developmentHistory: DevelopmentHistory) => developmentHistory.development, ) developmentHistorys: DevelopmentHistory[]; } export class CreateDevelopment { @Column() year: number; @Column() projectName: string; } export class UpdateDevelopment1 { @Column() year: number; @Column() projectName: string; @Column() reason: string | null; @Column() objective: string | null; } export class UpdateDevelopment2_1 { @Column() actualGoals: CreateActualGoal[]; @Column() plannedGoals: CreatePlannedGoal[]; } export class UpdateDevelopment2_2 { @Column() actualPeoples: CreateActualPeople[]; @Column() plannedPeoples: CreatePlannedPeople[]; } export class UpdateDevelopment3 { @Column() developmentProjectTypes?: string[]; @Column() isBackPlanned?: boolean | null; @Column() isHoldPlanned?: boolean | null; @Column() projectDayBackPlanned?: number | null; @Column() projectDayHoldPlanned?: number | null; @Column() projectNigthHoldPlanned?: number | null; @Column() isBackActual?: boolean | null; @Column() isHoldActual?: boolean | null; @Column() projectDayBackActual?: number | null; @Column() projectDayHoldActual?: number | null; @Column() projectNigthHoldActual?: number | null; @Column() developmentProjectTechniques?: string[]; @Column() projectModal?: number | null; } export class UpdateDevelopment4 { @Column() developmentEvaluations: CreateDevelopmentEvaluation[]; @Column() project: string | null; @Column() isPassAllocate: boolean; @Column() isPassNoAllocate: boolean; @Column() isNoPass: boolean; @Column() isBudget: boolean; @Column() isOutBudget: boolean; } export class UpdateDevelopment5 { @Column() dateStart: Date | null; @Column() dateEnd: Date | null; @Column() totalDate: number | null; @Column() developmentAddresss: CreateDevelopmentAddress[]; @Column() budget: string | null; @Column() budgetSub: string | null; @Column() accept: Double | null; @Column() receive: Double | null; @Column() approved: Double | null; @Column() budgetPay: Double | null; @Column() issues: string | null; @Column() chance: number | null; @Column() effects: number | null; @Column() riskLevel: string | null; @Column() riskManagement: string | null; @Column() expect: string | null; @Column() topicAcademic: string | null; @Column() addressAcademic: string | null; @Column() provinceActualId: string | null; @Column() dateStudyStart: Date | null; @Column() dateStudyEnd: Date | null; }