noti employee
This commit is contained in:
parent
5e4f119730
commit
c72e1bf3c9
2 changed files with 341 additions and 365 deletions
|
|
@ -1742,17 +1742,18 @@ export class CommandController extends Controller {
|
|||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
org: commandCode != "C-PM-21"
|
||||
? (_child4 == null ? "" : _child4 + "\n") +
|
||||
(_child3 == null ? "" : _child3 + "\n") +
|
||||
(_child2 == null ? "" : _child2 + "\n") +
|
||||
(_child1 == null ? "" : _child1 + "\n") +
|
||||
(_root == null ? "" : _root)
|
||||
: (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") +
|
||||
(profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") +
|
||||
(profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") +
|
||||
(profile?.child1Temp == null ? "" : profile?.child1Temp + "\n") +
|
||||
(profile?.rootTemp == null ? "" : profile?.rootTemp),
|
||||
org:
|
||||
commandCode != "C-PM-21"
|
||||
? (_child4 == null ? "" : _child4 + "\n") +
|
||||
(_child3 == null ? "" : _child3 + "\n") +
|
||||
(_child2 == null ? "" : _child2 + "\n") +
|
||||
(_child1 == null ? "" : _child1 + "\n") +
|
||||
(_root == null ? "" : _root)
|
||||
: (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") +
|
||||
(profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") +
|
||||
(profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") +
|
||||
(profile?.child1Temp == null ? "" : profile?.child1Temp + "\n") +
|
||||
(profile?.rootTemp == null ? "" : profile?.rootTemp),
|
||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||
citizenId: Extension.ToThaiNumber(x.citizenId),
|
||||
position: profile?.position ? profile?.position : "-",
|
||||
|
|
@ -1762,24 +1763,27 @@ export class CommandController extends Controller {
|
|||
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
|
||||
)
|
||||
: "-",
|
||||
posNo: commandCode != "C-PM-21"
|
||||
? shortName
|
||||
? Extension.ToThaiNumber(shortName)
|
||||
: "-"
|
||||
: Extension.ToThaiNumber(`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`) ,
|
||||
posNo:
|
||||
commandCode != "C-PM-21"
|
||||
? shortName
|
||||
? Extension.ToThaiNumber(shortName)
|
||||
: "-"
|
||||
: Extension.ToThaiNumber(
|
||||
`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`,
|
||||
),
|
||||
amount: x.amount ? Extension.ToThaiNumber(x.amount.toLocaleString()) : "-",
|
||||
dateRetire: profile?.dateRetire
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_monthYear(profile?.dateRetire)
|
||||
)
|
||||
dateRetire: profile?.dateRetire
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire))
|
||||
: profile?.birthDate && commandCode == "C-PM-21"
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_monthYear(
|
||||
new Date(
|
||||
profile.birthDate.getFullYear() + 60, profile.birthDate.getMonth(), profile.birthDate.getDate()
|
||||
)
|
||||
Extension.ToThaiShortDate_monthYear(
|
||||
new Date(
|
||||
profile.birthDate.getFullYear() + 60,
|
||||
profile.birthDate.getMonth(),
|
||||
profile.birthDate.getDate(),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
: "-",
|
||||
dateExecute: command.commandExcecuteDate
|
||||
? Extension.ToThaiNumber(
|
||||
|
|
@ -2421,12 +2425,10 @@ export class CommandController extends Controller {
|
|||
"C-PM-22",
|
||||
"C-PM-23",
|
||||
"C-PM-24",
|
||||
"C-PM-34",
|
||||
"C-PM-36",
|
||||
"C-PM-37",
|
||||
"C-PM-37",
|
||||
"C-PM-37",
|
||||
"C-PM-37",
|
||||
"C-PM-42",
|
||||
"C-PM-43",
|
||||
].includes(commandCode)
|
||||
) {
|
||||
let posMaster = await this.employeePosMasterRepository.find({
|
||||
|
|
@ -2953,10 +2955,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -2965,35 +2967,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -3129,10 +3131,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -3141,35 +3143,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -3324,10 +3326,10 @@ export class CommandController extends Controller {
|
|||
const roleKeycloak = await this.roleKeycloakRepo.findOne({
|
||||
where: { name: Like("USER") },
|
||||
});
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -3336,35 +3338,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -3541,10 +3543,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -3553,35 +3555,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -3702,10 +3704,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -3714,35 +3716,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -4011,10 +4013,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -4023,35 +4025,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -4492,10 +4494,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -4504,35 +4506,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -4764,10 +4766,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -4776,35 +4778,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -4968,10 +4970,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -4980,35 +4982,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -5137,7 +5139,7 @@ export class CommandController extends Controller {
|
|||
commandName: item.commandName,
|
||||
remark: item.remark,
|
||||
posNumCodeSit: _posNumCodeSit,
|
||||
posNumCodeSitAbb: _posNumCodeSitAbb
|
||||
posNumCodeSitAbb: _posNumCodeSitAbb,
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
@ -5219,10 +5221,10 @@ export class CommandController extends Controller {
|
|||
const list = await getRoles();
|
||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||
const _null: any = null;
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.bodySalarys?.commandId)?.bodySalarys?.commandId ?? "" }
|
||||
where: { id: body.data.find((x) => x.bodySalarys?.commandId)?.bodySalarys?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -5231,35 +5233,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -5724,10 +5726,10 @@ export class CommandController extends Controller {
|
|||
const roleKeycloak = await this.roleKeycloakRepo.findOne({
|
||||
where: { name: Like("USER") },
|
||||
});
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.refIds.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -5736,35 +5738,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
@ -6274,10 +6276,10 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
let _posNumCodeSitAbb: string = ""
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
|
||||
where: { id: body.refIds.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -6286,35 +6288,35 @@ export class CommandController extends Controller {
|
|||
isDeputy: true,
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
relations: ["orgRevision"]
|
||||
})
|
||||
relations: ["orgRevision"],
|
||||
});
|
||||
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
|
||||
}
|
||||
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร"
|
||||
_posNumCodeSitAbb = "กทม."
|
||||
}
|
||||
else {
|
||||
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
|
||||
_posNumCodeSit = "กรุงเทพมหานคร";
|
||||
_posNumCodeSitAbb = "กทม.";
|
||||
} else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: {
|
||||
where: {
|
||||
keycloak: _command?.createdUserId.toString(),
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
}
|
||||
}
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
|
||||
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
_posNumCodeSitAbb = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
|
||||
_posNumCodeSit =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
|
||||
"";
|
||||
_posNumCodeSitAbb =
|
||||
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
|
||||
.orgRootShortName ?? "";
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue