diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index c9aea54b..6643ca7f 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -317,6 +317,7 @@ export class CommandController extends Controller { command.detailBody = commandType.detailBody; command.detailFooter = commandType.detailFooter; command.isAttachment = commandType.isAttachment; + command.isUploadAttachment = commandType.isUploadAttachment; command.status = "NEW"; command.issue = commandType.name; command.createdUserId = request.user.sub; @@ -358,6 +359,7 @@ export class CommandController extends Controller { detailFooter: command.detailFooter, isBangkok: command.isBangkok, isAttachment: command.isAttachment, + isUploadAttachment: command.isUploadAttachment, commandAffectDate: command.commandAffectDate, commandExcecuteDate: command.commandExcecuteDate, commandTypeName: command.commandType?.name || null, @@ -963,6 +965,7 @@ export class CommandController extends Controller { isDraft: command.isDraft, isSign: command.isSign, isAttachment: command.isAttachment, + isUploadAttachment: command.isUploadAttachment, isSalary: command.commandType ? command.commandType.isSalary : null, }; return new HttpSuccess(_command); @@ -1853,6 +1856,7 @@ export class CommandController extends Controller { command.detailBody = commandType.detailBody; command.detailFooter = commandType.detailFooter; command.isAttachment = commandType.isAttachment; + command.isUploadAttachment = commandType.isUploadAttachment; command.status = "NEW"; command.issue = commandType.name; (command.commandAffectDate = requestBody.commandAffectDate @@ -4501,6 +4505,7 @@ export class CommandController extends Controller { isDraft: command.isDraft, isSign: command.isSign, isAttachment: command.isAttachment, + isUploadAttachment: command.isUploadAttachment, }; return new HttpSuccess(_command); } diff --git a/src/controllers/CommandTypeController.ts b/src/controllers/CommandTypeController.ts index 2fdf3c67..4d12f478 100644 --- a/src/controllers/CommandTypeController.ts +++ b/src/controllers/CommandTypeController.ts @@ -54,6 +54,7 @@ export class CommandTypeController extends Controller { "detailFooter", "subtitle", "isAttachment", + "isUploadAttachment", "createdAt", "lastUpdatedAt", "createdFullName", @@ -74,7 +75,7 @@ export class CommandTypeController extends Controller { async GetAdmin( @Query("page") page: number = 1, @Query("pageSize") pageSize: number = 10, - @Query("keyword") keyword?: string | null , + @Query("keyword") keyword?: string | null, @Query() isActive?: boolean | null, ) { const [commandTypes, total] = await this.commandTypeRepository @@ -88,19 +89,15 @@ export class CommandTypeController extends Controller { ) .andWhere( new Brackets((qb) => { - qb.where( - keyword != null && keyword != "" ? "commandType.name LIKE :keyword" : "1=1", - { - keyword: `%${keyword}%`, - }, - ) - .orWhere( + qb.where(keyword != null && keyword != "" ? "commandType.name LIKE :keyword" : "1=1", { + keyword: `%${keyword}%`, + }).orWhere( keyword != null && keyword != "" ? "commandType.detailBody LIKE :keyword" : "1=1", { keyword: `%${keyword}%`, }, - ) - }) + ); + }), ) .orderBy("commandType.order", "ASC") .skip((page - 1) * pageSize) @@ -133,6 +130,7 @@ export class CommandTypeController extends Controller { "detailFooter", "subtitle", "isAttachment", + "isUploadAttachment", ], }); if (!_commandType) { @@ -153,14 +151,14 @@ export class CommandTypeController extends Controller { detailFooter: _commandType.detailFooter, subtitle: _commandType.subtitle, isAttachment: _commandType.isAttachment, + isUploadAttachment: _commandType.isUploadAttachment, name1: "๑. ..........................ประธาน", name2: "๒. ..........................กรรมการ", name3: "๓. ..........................กรรมการ", name4: "๔. ..........................กรรมการ", }; _commandType = _commandType10; - } - else if (["C-PM-21", "C-PM-23"].includes(_commandType.code)) { + } else if (["C-PM-21", "C-PM-23"].includes(_commandType.code)) { let _commandType21and23: any; _commandType21and23 = { id: _commandType.id, @@ -175,6 +173,7 @@ export class CommandTypeController extends Controller { detailFooter: _commandType.detailFooter, subtitle: _commandType.subtitle, isAttachment: _commandType.isAttachment, + isUploadAttachment: _commandType.isUploadAttachment, name1: "๑. ..........................ประธาน", name2: "๒. ..........................กรรมการ", name3: "๓. ..........................กรรมการ", @@ -191,9 +190,9 @@ export class CommandTypeController extends Controller { amount: "", dateRetire: "", dateExecute: "", - remark: "" - } - ] + remark: "", + }, + ], }; _commandType = _commandType21and23; } diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index c9d03d9f..ee607745 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -410,8 +410,8 @@ export class ImportDataController extends Controller { profileSalary.profileEmployeeId = _item.id; profileSalary.refCommandNo = item.MP_COMMAND_NUM; profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE; - profileSalary.position = item.FLAG_TO_NAME; - profileSalary.positionLine = item.WORK_LINE_NAME; + // profileSalary.position = item.FLAG_TO_NAME; + profileSalary.position = item.WORK_LINE_NAME; profileSalary.positionPathSide = item.SPECIALIST_NAME; profileSalary.positionExecutive = item.ADMIN_NAME; profileSalary.templateDoc = item.REMARK; diff --git a/src/entities/Command.ts b/src/entities/Command.ts index c3f55958..614aad0d 100644 --- a/src/entities/Command.ts +++ b/src/entities/Command.ts @@ -109,6 +109,12 @@ export class Command extends EntityBase { }) isAttachment: boolean; + @Column({ + comment: "อัปโหลดบัญชีแนบท้าย", + default: true, + }) + isUploadAttachment: boolean; + @Column({ comment: "ออกคำสั่งแบบ Digital Signature", default: null, diff --git a/src/entities/CommandType.ts b/src/entities/CommandType.ts index 2ec53177..57261f8e 100644 --- a/src/entities/CommandType.ts +++ b/src/entities/CommandType.ts @@ -80,6 +80,12 @@ export class CommandType extends EntityBase { }) isAttachment: boolean; + @Column({ + comment: "อัปโหลดบัญชีแนบท้าย", + default: false, + }) + isUploadAttachment: boolean; + @Column({ comment: "สถานะแก้ไขเงินเดือน", default: true, @@ -126,6 +132,9 @@ export class CreateCommandType { @Column() isAttachment: boolean; + @Column() + isUploadAttachment: boolean; + @Column() isSalary?: boolean | null; } diff --git a/src/migration/1736221443955-update_table_commandtype_add_isUploadAttachment.ts b/src/migration/1736221443955-update_table_commandtype_add_isUploadAttachment.ts new file mode 100644 index 00000000..b8e11ab4 --- /dev/null +++ b/src/migration/1736221443955-update_table_commandtype_add_isUploadAttachment.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableCommandtypeAddIsUploadAttachment1736221443955 implements MigrationInterface { + name = 'UpdateTableCommandtypeAddIsUploadAttachment1736221443955' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isUploadAttachment\` tinyint NOT NULL COMMENT 'อัปโหลดบัญชีแนบท้าย' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`command\` ADD \`isUploadAttachment\` tinyint NOT NULL COMMENT 'อัปโหลดบัญชีแนบท้าย' DEFAULT 1`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isUploadAttachment\``); + await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isUploadAttachment\``); + } + +}