diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index 7a4e130e..c89d7a7f 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -267,8 +267,8 @@ export class ProfileSalaryController extends Controller { }, { profileId: profile.id, commandCode: IsNull() }, ], - // order: { order: "ASC" }, - order: { commandDateAffect: "ASC" }, + order: { order: "ASC" }, + // order: { commandDateAffect: "ASC" }, }); return new HttpSuccess(record); } @@ -313,8 +313,8 @@ export class ProfileSalaryController extends Controller { }, { profileId: profileId, commandCode: IsNull() }, ], - // order: { order: "ASC" }, - order: { commandDateAffect: "ASC" }, + order: { order: "ASC" }, + // order: { commandDateAffect: "ASC" }, }); return new HttpSuccess(record); } diff --git a/src/controllers/WorkflowController.ts b/src/controllers/WorkflowController.ts index a1a7207c..1e305874 100644 --- a/src/controllers/WorkflowController.ts +++ b/src/controllers/WorkflowController.ts @@ -800,27 +800,28 @@ export class WorkflowController extends Controller { keyword: string; page: number; pageSize: number; + profileId?: string | null; }, ) { - let userId = ""; - // if (xxx) { - // } else { - // const posMasterUser = await this.posMasterRepo.findOne({ - // where: { - // orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, - // current_holder: { keycloak: request.user.sub }, - // }, - // relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"], - // }); - // } + let posMasterUser: PosMaster = new PosMaster(); + if (body.profileId) { + posMasterUser = (await this.posMasterRepo.findOne({ + where: { + orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, + current_holderId: body.profileId, + }, + relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"], + })) as PosMaster; + } else { + posMasterUser = (await this.posMasterRepo.findOne({ + where: { + orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, + current_holder: { keycloak: request.user.sub }, + }, + relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"], + })) as PosMaster; + } - const posMasterUser = await this.posMasterRepo.findOne({ - where: { - orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, - current_holder: { keycloak: request.user.sub }, - }, - relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"], - }); if (!posMasterUser || !posMasterUser.orgRootId) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบตำแหน่งผู้ใช้งาน"); @@ -846,10 +847,15 @@ export class WorkflowController extends Controller { // orgChild3Id: IsNull(), // orgChild4Id: IsNull(), }; - condition.orgChild1Id = IsNull(); - condition.orgChild2Id = IsNull(); - condition.orgChild3Id = IsNull(); - condition.orgChild4Id = IsNull(); + if (posMasterUser.orgChild4Id == null) { + condition.orgChild4Id = IsNull(); + } else if (posMasterUser.orgChild3Id == null) { + condition.orgChild3Id = IsNull(); + } else if (posMasterUser.orgChild2Id == null) { + condition.orgChild2Id = IsNull(); + } else if (posMasterUser.orgChild1Id == null) { + condition.orgChild1Id = IsNull(); + } } else { if ( (posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" && diff --git a/src/entities/ProfileAbility.ts b/src/entities/ProfileAbility.ts index 6b5767f1..da0aee40 100644 --- a/src/entities/ProfileAbility.ts +++ b/src/entities/ProfileAbility.ts @@ -99,6 +99,7 @@ export class CreateProfileAbility { dateStart: Date | null; dateEnd: Date | null; field: string | null; + isUpload?: boolean | null; } export class CreateProfileAbilityEmployee { @@ -109,6 +110,7 @@ export class CreateProfileAbilityEmployee { dateStart: Date | null; dateEnd: Date | null; field: string | null; + isUpload?: boolean | null; } export type UpdateProfileAbility = { diff --git a/src/entities/ProfileAssistance.ts b/src/entities/ProfileAssistance.ts index c74af049..bf5cdd10 100644 --- a/src/entities/ProfileAssistance.ts +++ b/src/entities/ProfileAssistance.ts @@ -109,6 +109,7 @@ export class CreateProfileAssistance { document: string | null; refCommandDate?: string | null; commandId?: string | null; + isUpload?: boolean | null; } export class CreateProfileAssistanceEmployee { @@ -120,6 +121,7 @@ export class CreateProfileAssistanceEmployee { document: string | null; refCommandDate?: string | null; commandId?: string | null; + isUpload?: boolean | null; } export type UpdateProfileAssistance = { diff --git a/src/entities/ProfileCertificate.ts b/src/entities/ProfileCertificate.ts index 1c1cdd7e..74e217e4 100644 --- a/src/entities/ProfileCertificate.ts +++ b/src/entities/ProfileCertificate.ts @@ -62,6 +62,12 @@ export class ProfileCertificate extends EntityBase { }) issuer: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @OneToMany( () => ProfileCertificateHistory, (profileCertificateHistory) => profileCertificateHistory.histories, @@ -84,6 +90,7 @@ export class CreateProfileCertificate { certificateNo: string | null; certificateType: string | null; issuer: string | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeCertificate { @@ -93,6 +100,7 @@ export class CreateProfileEmployeeCertificate { certificateNo: string | null; certificateType: string | null; issuer: string | null; + isUpload?: boolean | null; } export type UpdateProfileCertificate = { @@ -101,4 +109,5 @@ export type UpdateProfileCertificate = { certificateNo?: string | null; certificateType?: string | null; issuer?: string | null; + isUpload?: boolean | null; }; diff --git a/src/entities/ProfileCertificateHistory.ts b/src/entities/ProfileCertificateHistory.ts index 8b2dad8d..022d1e17 100644 --- a/src/entities/ProfileCertificateHistory.ts +++ b/src/entities/ProfileCertificateHistory.ts @@ -44,6 +44,12 @@ export class ProfileCertificateHistory extends EntityBase { }) issuer: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @Column({ nullable: true, length: 40, diff --git a/src/entities/ProfileDiscipline.ts b/src/entities/ProfileDiscipline.ts index c9fb0f3c..c4647593 100644 --- a/src/entities/ProfileDiscipline.ts +++ b/src/entities/ProfileDiscipline.ts @@ -70,6 +70,12 @@ export class ProfileDiscipline extends EntityBase { }) unStigma: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @OneToMany( () => ProfileDisciplineHistory, (profileDisciplineHistory) => profileDisciplineHistory.histories, @@ -93,6 +99,7 @@ export class CreateProfileDiscipline { refCommandDate: Date | null; refCommandNo: string | null; unStigma: string | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeDiscipline { @@ -103,6 +110,7 @@ export class CreateProfileEmployeeDiscipline { refCommandDate: Date | null; refCommandNo: string | null; unStigma: string | null; + isUpload?: boolean | null; } export type UpdateProfileDiscipline = { @@ -113,4 +121,5 @@ export type UpdateProfileDiscipline = { refCommandDate?: Date | null; refCommandNo?: string | null; unStigma?: string | null; + isUpload?: boolean | null; }; diff --git a/src/entities/ProfileDisciplineHistory.ts b/src/entities/ProfileDisciplineHistory.ts index 33769257..f265a825 100644 --- a/src/entities/ProfileDisciplineHistory.ts +++ b/src/entities/ProfileDisciplineHistory.ts @@ -59,6 +59,12 @@ export class ProfileDisciplineHistory extends EntityBase { }) unStigma: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @ManyToOne( () => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profileDisciplineHistories, diff --git a/src/entities/ProfileDuty.ts b/src/entities/ProfileDuty.ts index 0454b6fb..9bd98ca5 100644 --- a/src/entities/ProfileDuty.ts +++ b/src/entities/ProfileDuty.ts @@ -96,6 +96,7 @@ export class CreateProfileDuty { reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeDuty { @@ -106,6 +107,7 @@ export class CreateProfileEmployeeDuty { reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; + isUpload?: boolean | null; } export type UpdateProfileDuty = { diff --git a/src/entities/ProfileHonor.ts b/src/entities/ProfileHonor.ts index 1e73f676..718d15ad 100644 --- a/src/entities/ProfileHonor.ts +++ b/src/entities/ProfileHonor.ts @@ -104,6 +104,7 @@ export class CreateProfileHonor { refCommandNo: string | null; type: string | null; isDate: boolean | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeHonor { @@ -115,6 +116,7 @@ export class CreateProfileEmployeeHonor { refCommandNo: string | null; type: string | null; isDate: boolean | null; + isUpload?: boolean | null; } export type UpdateProfileHonor = { diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts index d195b701..23b91bcb 100644 --- a/src/entities/ProfileInsignia.ts +++ b/src/entities/ProfileInsignia.ts @@ -162,6 +162,7 @@ export class CreateProfileInsignia { refCommandDate: Date | null; refCommandNo: string | null; note: string | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeInsignia { @@ -179,6 +180,7 @@ export class CreateProfileEmployeeInsignia { refCommandDate: Date | null; refCommandNo: string | null; note: string | null; + isUpload?: boolean | null; } export type UpdateProfileInsignia = { diff --git a/src/entities/ProfileNopaid.ts b/src/entities/ProfileNopaid.ts index 84246ba0..ddbe6565 100644 --- a/src/entities/ProfileNopaid.ts +++ b/src/entities/ProfileNopaid.ts @@ -62,6 +62,12 @@ export class ProfileNopaid extends EntityBase { }) refCommandNo: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @OneToMany(() => ProfileNopaidHistory, (profileNopaidHistory) => profileNopaidHistory.histories) profileNopaidHistories: ProfileNopaidHistory[]; @@ -81,6 +87,7 @@ export class CreateProfileNopaid { reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; + isUpload?: boolean | null; } export class CreateProfileEmployeeNopaid { @@ -90,6 +97,7 @@ export class CreateProfileEmployeeNopaid { reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; + isUpload?: boolean | null; } export type UpdateProfileNopaid = { @@ -98,4 +106,5 @@ export type UpdateProfileNopaid = { reference?: string | null; refCommandDate?: Date | null; refCommandNo?: string | null; + isUpload?: boolean | null; }; diff --git a/src/entities/ProfileNopaidHistory.ts b/src/entities/ProfileNopaidHistory.ts index 28fa9afa..905395ef 100644 --- a/src/entities/ProfileNopaidHistory.ts +++ b/src/entities/ProfileNopaidHistory.ts @@ -44,6 +44,12 @@ export class ProfileNopaidHistory extends EntityBase { }) refCommandNo: string; + @Column({ + comment: "แนบไฟล์เอกสาร", + default: false, + }) + isUpload: boolean; + @Column({ nullable: true, length: 40,