no message

This commit is contained in:
Kittapath 2024-02-07 18:53:15 +07:00
parent d33569005a
commit 8fd2131b4c
3 changed files with 87 additions and 41 deletions

View file

@ -89,6 +89,7 @@ export class ReportController extends Controller {
"posMasters.positions",
"posMasters.positions.posLevel",
"posMasters.positions.posType",
"posMasters.positions.posExecutive",
],
});
@ -181,6 +182,7 @@ export class ReportController extends Controller {
"posMasters.positions",
"posMasters.positions.posLevel",
"posMasters.positions.posType",
"posMasters.positions.posExecutive",
],
});
if (orgRevisionActive == null) {
@ -192,6 +194,7 @@ export class ReportController extends Controller {
"posMasters.positions",
"posMasters.positions.posLevel",
"posMasters.positions.posType",
"posMasters.positions.posExecutive",
],
});
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
@ -225,6 +228,9 @@ export class ReportController extends Controller {
const posLevel = [
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
];
const posExecutive = [
...new Set(posMaster.positions.map((x) => x.posExecutive.posExecutiveName)),
];
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
let positionMasterProfileOld: any = null;
if (posMaster.next_holder != null) {
@ -237,6 +243,7 @@ export class ReportController extends Controller {
let profilePositionName: any = [];
let profilePosType: any = [];
let profilePosLevel: any = [];
let profilePosExecutive: any = [];
let profilePositionField: any = [];
if (posMaster.ancestorDNA != null) {
positionMasterOld = orgRevisionActive.posMasters.find(
@ -255,6 +262,11 @@ export class ReportController extends Controller {
positionMasterOld.positions.map((x: any) => x.posLevel.posLevelName),
),
];
profilePosExecutive = [
...new Set(
positionMasterOld.positions.map((x: any) => x.posExecutive.posExecutiveName),
),
];
profilePositionField = [
...new Set(positionMasterOld.positions.map((x: any) => x.positionField)),
];
@ -265,74 +277,88 @@ export class ReportController extends Controller {
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
// positionName:
// posMaster.next_holder == null
// ? positionName.join(" หรือ ")
// : posMaster.positionIsSelected == false
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
// ?.positionName
// : posMaster.next_holder.position,
// posType:
// posMaster.next_holder == null
// ? posType.join(" หรือ ")
// : posMaster.positionIsSelected == false
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
// ?.posType?.posTypeName
// : posMaster.next_holder.posType == null
// ? "-"
// : posMaster.next_holder.posType.posTypeName,
// posLevel:
// posMaster.next_holder == null
// ? posLevel.join(" หรือ ")
// : posMaster.positionIsSelected == false
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
// ?.posLevel?.posLevelName
// : posMaster.next_holder.posLevel == null
// ? "-"
// : posMaster.next_holder.posLevel.posLevelName,
// posExecutive:
// posMaster.next_holder == null
// ? posExecutive.join(" หรือ ")
// : posMaster.positionIsSelected == false
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
// ?.posExecutive?.posExecutiveName
// : positionMasterProfileOld == null
// ? "-"
// : positionMasterProfileOld.positions.find(
// (x: any) => (x.positionIsSelected = true),
// )?.posExecutive?.posExecutiveName,
profileFullname:
posMaster.next_holder == null
? "- ว่าง -"
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
profilePosMasterNo:
positionMasterProfileOld == null
posMaster.next_holder == null
? positionMasterOld == null
? "-"
: positionMasterOld.posMasterNo
: positionMasterProfileOld.posMasterNo,
: positionMasterProfileOld == null
? "-"
: positionMasterProfileOld.posMasterNo,
profilePositionName:
posMaster.next_holder == null
? profilePositionName.length > 0
? profilePositionName.join(" หรือ ")
: positionName.join(" หรือ ")
? positionMasterOld == null
? positionName.join(" หรือ ")
: profilePositionName.join(" หรือ ")
: posMaster.next_holder.position,
profilePosType:
posMaster.next_holder == null
? profilePosType.length > 0
? profilePosType.join(" หรือ ")
: posType.join(" หรือ ")
? positionMasterOld == null
? posType.join(" หรือ ")
: profilePosType.join(" หรือ ")
: posMaster.next_holder.posType == null
? "-"
: posMaster.next_holder.posType.posTypeName,
profilePosLevel:
posMaster.next_holder == null
? profilePosLevel.length > 0
? profilePosLevel.join(" หรือ ")
: posLevel.join(" หรือ ")
? positionMasterOld == null
? posLevel.join(" หรือ ")
: profilePosLevel.join(" หรือ ")
: posMaster.next_holder.posLevel == null
? "-"
: posMaster.next_holder.posLevel.posLevelName,
profilePositionField:
profilePosExecutive:
posMaster.next_holder == null
? profilePositionField.length > 0
? profilePositionField.join(" หรือ ")
: positionField.join(" หรือ ")
? positionMasterOld == null
? posExecutive.join(" หรือ ")
: profilePosExecutive.join(" หรือ ")
: positionMasterProfileOld == null
? "-"
: positionMasterProfileOld.positions.find(
(x: any) => (x.positionIsSelected = true),
)?.positionField,
)?.posExecutive?.posExecutiveName,
positionName:
posMaster.next_holder == null
? positionName.join(" หรือ ")
: posMaster.next_holder.position,
posType:
posMaster.next_holder == null
? posType.join(" หรือ ")
: posMaster.next_holder.posType == null
? "-"
: posMaster.next_holder.posType.posTypeName,
posLevel:
posMaster.next_holder == null
? posLevel.join(" หรือ ")
: posMaster.next_holder.posLevel == null
? "-"
: posMaster.next_holder.posLevel.posLevelName,
positionField:
posMaster.next_holder == null
? positionField.join(" หรือ ")
: positionMasterProfileOld == null
? "-"
: positionMasterProfileOld.positions.find(
(x: any) => (x.positionIsSelected = true),
)?.positionField,
// positions: await Promise.all(
// positions
// .filter((position) => position.posMasterId === posMaster.id)

View file

@ -80,6 +80,12 @@ export class PosMaster extends EntityBase {
})
posMasterLine: PosMasterLine;
@Column({
comment: "นั่งทับตำแหน่งไหม",
default: false,
})
isSit: boolean;
@Column({
nullable: true,
length: 40,

View file

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTablePosMasterIsSit1707306721668 implements MigrationInterface {
name = 'UpdateTablePosMasterIsSit1707306721668'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isSit\` tinyint NOT NULL COMMENT 'นั่งทับตำแหน่งไหม' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isSit\``);
}
}