import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, Double } 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"; @Entity("development") export class Development extends EntityBase { @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; @Column({ nullable: true, comment: "ประเภทตัวชี้วัด", default: null, }) metricType: string; @Column({ nullable: true, comment: "ตัวชี้วัด", default: null, }) indicators: string; @Column({ nullable: true, comment: "เป้าหมาย", default: null, }) target: string; @Column({ nullable: true, comment: "วิธีการคำนวณ/เครื่องมือ", default: null, }) calculation: string; @Column({ nullable: true, comment: "ระยะเวลาวัดผล", default: null, }) measuRement: string; @Column({ nullable: true, comment: "ผลการดำเนิน", default: null, }) results: string; @Column({ nullable: true, comment: "ปัญหาอุปสรรค", default: null, }) obstacles: string; @Column({ nullable: true, comment: "ข้อเสนอเเนะ", default: null, }) suggestions: string; @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; @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; @Column({ nullable: true, comment: "ที่อยู่", default: null, }) address: string; @Column({ nullable: true, comment: "จังหวัด", default: null, }) provinceId: string; @ManyToOne(() => Province, (province: Province) => province.developments) @JoinColumn({ name: "provinceId" }) province: Province; @Column({ nullable: true, comment: "ประเภทงบประมาณ", default: null, }) budget: 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: string; @Column({ nullable: true, comment: "ผลกระทบจากการเกิด", default: null, }) effects: string; @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, type: "datetime", comment: "วันเริ่มต้นการศึกษาดูงาน", default: null, }) dateStudyStart: Date; @Column({ nullable: true, type: "datetime", comment: "วันสิ้นสุดการศึกษาดูงาน", default: null, }) dateStudyEnd: Date; @Column({ nullable: true, comment: "จังหวัด(ข้อมูลวิชาการ)", default: null, }) provinceActualId: string; @ManyToOne(() => Province, (province: Province) => province.developmentActuals) @JoinColumn({ name: "provinceActualId" }) provinceActual: Province; @OneToMany( () => ActualPeople, (actualPeople: ActualPeople) => actualPeople.developmentActualPeople, ) developmentActualPeoples: ActualPeople[]; @OneToMany( () => PlannedPeople, (plannedPeople: PlannedPeople) => plannedPeople.developmentPlannedPeople, ) developmentPlannedPeoples: PlannedPeople[]; @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.developmentActualGoal) developmentActualGoals: ActualGoal[]; @OneToMany(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.developmentPlannedGoal) developmentPlannedGoals: PlannedGoal[]; @OneToMany( () => DevelopmentHistory, (developmentHistory: DevelopmentHistory) => developmentHistory.development, ) developmentHistorys: DevelopmentHistory[]; } export class CreateDevelopment { @Column() year: number; @Column() projectName: string; @Column() reason: string | null; @Column() objective: string | null; @Column() metricType: string | null; @Column() indicators: string | null; @Column() target: string | null; @Column() calculation: string | null; @Column() measuRement: string | null; @Column() results: string | null; @Column() obstacles: string | null; @Column() suggestions: string | null; @Column() project: string | null; @Column() isPassAllocate: boolean; @Column() isPassNoAllocate: boolean; @Column() isNoPass: boolean; @Column() isBudget: boolean; @Column() isOutBudget: boolean; @Column() dateStart: Date | null; @Column() dateEnd: Date | null; @Column() totalDate: number | null; @Column() address: string | null; @Column() provinceId: string | null; @Column() budget: string | null; @Column() accept: Double | null; @Column() receive: Double | null; @Column() approved: Double | null; @Column() budgetPay: Double | null; @Column() issues: string | null; @Column() chance: string | null; @Column() effects: string | 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; @Column() actualPeoples: CreateActualPeople[]; @Column() plannedPeoples: CreatePlannedPeople[]; @Column() actualGoals: CreateActualGoal[]; @Column() plannedGoals: CreatePlannedGoal[]; } export class UpdateDevelopment { @Column() year: number; @Column() projectName: string; @Column() reason: string | null; @Column() objective: string | null; @Column() metricType: string | null; @Column() indicators: string | null; @Column() target: string | null; @Column() calculation: string | null; @Column() measuRement: string | null; @Column() results: string | null; @Column() obstacles: string | null; @Column() suggestions: string | null; @Column() project: string | null; @Column() isPassAllocate: boolean; @Column() isPassNoAllocate: boolean; @Column() isNoPass: boolean; @Column() isBudget: boolean; @Column() isOutBudget: boolean; @Column() dateStart: Date | null; @Column() dateEnd: Date | null; @Column() totalDate: number | null; @Column() address: string | null; @Column() provinceId: string | null; @Column() budget: string | null; @Column() accept: Double | null; @Column() receive: Double | null; @Column() approved: Double | null; @Column() budgetPay: Double | null; @Column() issues: string | null; @Column() chance: string | null; @Column() effects: string | 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; @Column() actualPeoples: CreateActualPeople[]; @Column() plannedPeoples: CreatePlannedPeople[]; @Column() actualGoals: CreateActualGoal[]; @Column() plannedGoals: CreatePlannedGoal[]; }