hrms-api-development/src/entities/Development.ts

487 lines
12 KiB
TypeScript
Raw Normal View History

import { Entity, Column, ManyToOne, JoinColumn, OneToMany, Double, ManyToMany } from "typeorm";
2024-04-02 17:53:45 +07:00
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";
2024-04-11 11:39:56 +07:00
import { DevelopmentProjectType } from "./DevelopmentProjectType";
import { DevelopmentProjectTechnique } from "./DevelopmentProjectTechnique";
import { CreateDevelopmentEvaluation, DevelopmentEvaluation } from "./DevelopmentEvaluation";
import { CreateDevelopmentAddress, DevelopmentAddress } from "./DevelopmentAddress";
2024-04-02 17:53:45 +07:00
@Entity("development")
export class Development extends EntityBase {
2024-04-11 11:39:56 +07:00
@Column({
// กำลังดำเนินการ (ONGOING)
// เสร็จสิ้น (FINISH)
nullable: true,
comment: "สถานะ",
default: "ONGOING",
})
status: string;
////////////////////////////////////////tab ข้อมูลเบื้องต้น
@Column({
nullable: true,
comment: "ปีงบประมาณ",
})
year: number;
2024-04-02 17:53:45 +07:00
@Column({
comment: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
length: 255,
})
projectName: string;
2024-04-02 17:53:45 +07:00
@Column({
nullable: true,
comment: "หลักการและเหตุผล",
default: null,
2024-04-02 17:53:45 +07:00
})
reason: string;
2024-04-02 17:53:45 +07:00
@Column({
nullable: true,
comment: "วัตถุประสงค์",
default: null,
})
objective: string;
2024-04-02 17:53:45 +07:00
2024-04-11 11:39:56 +07:00
////////////////////////////////////////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({
2024-04-11 11:39:56 +07:00
comment: "ไป-กลับ",
default: false,
})
isBackPlanned: boolean;
@Column({
comment: "พักค้าง",
default: false,
})
2024-04-11 11:39:56 +07:00
isHoldPlanned: boolean;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectDayBackPlanned: number;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectDayHoldPlanned: number;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectNigthHoldPlanned: number;
@Column({
comment: "ไป-กลับ",
default: false,
})
isBackActual: boolean;
@Column({
comment: "พักค้าง",
default: false,
})
isHoldActual: boolean;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectDayBackActual: number;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectDayHoldActual: number;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
})
2024-04-11 11:39:56 +07:00
projectNigthHoldActual: number;
@OneToMany(
() => DevelopmentProjectTechnique,
(developmentProjectTechnique: DevelopmentProjectTechnique) =>
developmentProjectTechnique.development,
)
developmentProjectTechniques: DevelopmentProjectTechnique[];
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จำนวน(รุ่น)",
default: null,
})
2024-04-11 11:39:56 +07:00
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;
2024-04-11 11:39:56 +07:00
////////////////////////////////////////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;
2024-04-11 11:39:56 +07:00
@OneToMany(
() => DevelopmentAddress,
(developmentAddress: DevelopmentAddress) => developmentAddress.development,
)
developmentAddresss: DevelopmentAddress[];
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "ประเภทงบประมาณ",
default: null,
})
2024-04-11 11:39:56 +07:00
budget: string;
@Column({
2024-04-11 11:39:56 +07:00
// เงินบำรุง = MAINTENANCE
// เงินกองทุน = FUND
// เงินอุดหนุน = SUBSIDY
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "ประเภทย่อย",
default: null,
})
2024-04-11 11:39:56 +07:00
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,
})
2024-04-11 11:39:56 +07:00
chance: number;
@Column({
nullable: true,
comment: "ผลกระทบจากการเกิด",
default: null,
})
2024-04-11 11:39:56 +07:00
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;
2024-04-03 16:14:00 +07:00
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
comment: "จังหวัด(ข้อมูลวิชาการ)",
default: null,
})
2024-04-11 11:39:56 +07:00
provinceActualId: string;
2024-04-11 11:39:56 +07:00
@ManyToOne(() => Province, (province: Province) => province.developmentActuals)
@JoinColumn({ name: "provinceActualId" })
provinceActual: Province;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
type: "datetime",
comment: "วันเริ่มต้นการศึกษาดูงาน",
default: null,
})
2024-04-11 11:39:56 +07:00
dateStudyStart: Date;
@Column({
nullable: true,
2024-04-11 11:39:56 +07:00
type: "datetime",
comment: "วันสิ้นสุดการศึกษาดูงาน",
default: null,
})
2024-04-11 11:39:56 +07:00
dateStudyEnd: Date;
@OneToMany(
() => DevelopmentHistory,
(developmentHistory: DevelopmentHistory) => developmentHistory.development,
)
developmentHistorys: DevelopmentHistory[];
}
export class CreateDevelopment {
2024-04-02 17:53:45 +07:00
@Column()
year: number;
@Column()
projectName: string;
2024-04-11 11:39:56 +07:00
}
export class UpdateDevelopment1 {
@Column()
2024-04-11 11:39:56 +07:00
year: number;
@Column()
2024-04-11 11:39:56 +07:00
projectName: string;
@Column()
2024-04-11 11:39:56 +07:00
reason: string | null;
@Column()
2024-04-11 11:39:56 +07:00
objective: string | null;
}
export class UpdateDevelopment2_1 {
@Column()
2024-04-11 11:39:56 +07:00
actualGoals: CreateActualGoal[];
@Column()
2024-04-11 11:39:56 +07:00
plannedGoals: CreatePlannedGoal[];
}
export class UpdateDevelopment2_2 {
@Column()
actualPeoples: CreateActualPeople[];
@Column()
plannedPeoples: CreatePlannedPeople[];
2024-04-11 11:39:56 +07:00
}
export class UpdateDevelopment3 {
@Column()
2024-04-11 11:39:56 +07:00
developmentProjectTypes?: string[];
@Column()
2024-04-11 11:39:56 +07:00
isBackPlanned?: boolean | null;
2024-04-02 17:53:45 +07:00
@Column()
2024-04-11 11:39:56 +07:00
isHoldPlanned?: boolean | null;
@Column()
2024-04-11 11:39:56 +07:00
projectDayBackPlanned?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
projectDayHoldPlanned?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
projectNigthHoldPlanned?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
isBackActual?: boolean | null;
@Column()
2024-04-11 11:39:56 +07:00
isHoldActual?: boolean | null;
@Column()
2024-04-11 11:39:56 +07:00
projectDayBackActual?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
projectDayHoldActual?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
projectNigthHoldActual?: number | null;
@Column()
2024-04-11 11:39:56 +07:00
developmentProjectTechniques?: string[];
@Column()
2024-04-11 11:39:56 +07:00
projectModal?: number | null;
}
export class UpdateDevelopment4 {
@Column()
2024-04-11 11:39:56 +07:00
developmentEvaluations: CreateDevelopmentEvaluation[];
@Column()
project: string | null;
@Column()
isPassAllocate: boolean;
@Column()
isPassNoAllocate: boolean;
@Column()
isNoPass: boolean;
@Column()
isBudget: boolean;
@Column()
isOutBudget: boolean;
2024-04-11 11:39:56 +07:00
}
export class UpdateDevelopment5 {
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
totalDate: number | null;
@Column()
2024-04-11 11:39:56 +07:00
developmentAddresss: CreateDevelopmentAddress[];
@Column()
budget: string | null;
@Column()
2024-04-11 11:39:56 +07:00
budgetSub: string | null;
@Column()
accept: Double | null;
@Column()
receive: Double | null;
@Column()
approved: Double | null;
@Column()
budgetPay: Double | null;
@Column()
issues: string | null;
@Column()
2024-04-11 11:39:56 +07:00
chance: number | null;
@Column()
2024-04-11 11:39:56 +07:00
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()
2024-04-11 11:39:56 +07:00
dateStudyStart: Date | null;
@Column()
2024-04-11 11:39:56 +07:00
dateStudyEnd: Date | null;
2024-04-02 17:53:45 +07:00
}