This commit is contained in:
AdisakKanthawilang 2025-04-04 10:07:34 +07:00
parent 351621ee18
commit b1b9700e40
7 changed files with 90 additions and 47 deletions

View file

@ -221,10 +221,11 @@ export class PermissionProfileController extends Controller {
? null
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4;
let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`;
let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`;
let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`;
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
return {
id: _data.id,
@ -234,7 +235,11 @@ export class PermissionProfileController extends Controller {
rank: _data.rank,
firstName: _data.firstName,
lastName: _data.lastName,
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName ?? ""}`,
org: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
posNo: shortName,
position: _data.position,
posType: _data.posType == null ? null : _data.posType.posTypeName,
@ -430,10 +435,11 @@ export class PermissionProfileController extends Controller {
: _data.profileTree.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild4;
let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`;
let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`;
let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`;
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
return {
id: _data.id,
@ -448,7 +454,11 @@ export class PermissionProfileController extends Controller {
rank: _data.profileTree.rank,
firstName: _data.profileTree.firstName,
lastName: _data.profileTree.lastName,
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName ?? ""}`,
org: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
posNo: shortName,
position: _data.profileTree.position,
posType: _data.profileTree.posType == null ? null : _data.profileTree.posType.posTypeName,

View file

@ -553,11 +553,11 @@ export class ProfileController extends Controller {
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
// Construct org path
const _root = root ? `${root.orgRootName}` : "";
const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileId: id },
@ -712,7 +712,11 @@ export class ProfileController extends Controller {
? null
: Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
}))
: [
{
@ -801,7 +805,11 @@ export class ProfileController extends Controller {
prefix: profiles?.prefix != null ? profiles.prefix : "",
firstName: profiles?.firstName != null ? profiles.firstName : "",
lastName: profiles?.lastName != null ? profiles.lastName : "",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
birthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
: "",
@ -1033,11 +1041,11 @@ export class ProfileController extends Controller {
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
// Construct org path
const _root = root ? `${root.orgRootName}` : "";
const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileId: id },
@ -1208,7 +1216,11 @@ export class ProfileController extends Controller {
? null
: Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
}))
: [
{
@ -1643,7 +1655,11 @@ export class ProfileController extends Controller {
? Extension.ToThaiNumber(profiles.amountSpecial.toLocaleString())
: "",
salarySum: sum,
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
birthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
: "",

View file

@ -539,11 +539,11 @@ export class ProfileEmployeeController extends Controller {
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
// Construct org path
const _root = root ? `${root.orgRootName}` : "";
const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileEmployeeId: id },
@ -698,7 +698,11 @@ export class ProfileEmployeeController extends Controller {
? null
: Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
OcFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
}))
: [
{
@ -787,7 +791,11 @@ export class ProfileEmployeeController extends Controller {
prefix: profiles?.prefix != null ? profiles.prefix : "",
firstName: profiles?.firstName != null ? profiles.firstName : "",
lastName: profiles?.lastName != null ? profiles.lastName : "",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
birthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
: "",

View file

@ -533,11 +533,12 @@ export class ProfileEmployeeTempController extends Controller {
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
// Construct org path
const _root = root ? `${root.orgRootName}` : "";
const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
let _root = root?.orgRootName;
let _child1 =child1?.orgChild1Name;
let _child2 =child2?.orgChild2Name;
let _child3 =child3?.orgChild3Name;
let _child4 =child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileEmployeeId: id },
@ -692,7 +693,11 @@ export class ProfileEmployeeTempController extends Controller {
? null
: Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
OcFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
}))
: [
{
@ -781,7 +786,11 @@ export class ProfileEmployeeTempController extends Controller {
prefix: profiles?.prefix != null ? profiles.prefix : "",
firstName: profiles?.firstName != null ? profiles.firstName : "",
lastName: profiles?.lastName != null ? profiles.lastName : "",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ocFullPath: (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
birthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
: "",

View file

@ -94,7 +94,7 @@ export class ProfileGovernmentHistoryController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -205,7 +205,7 @@ export class ProfileGovernmentHistoryController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -299,7 +299,7 @@ export class ProfileGovernmentHistoryController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("/n");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {

View file

@ -90,7 +90,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -194,7 +194,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -281,7 +281,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {

View file

@ -85,7 +85,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -184,7 +184,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {
@ -271,7 +271,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
posMaster == null || posMaster.orgChild1 == null ? null : posMaster.orgChild1.orgChild1Name,
posMaster == null || posMaster.orgRoot == null ? null : posMaster.orgRoot.orgRootName,
];
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join(" ");
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("\n");
let orgShortName = "";
if (posMaster != null) {
if (posMaster.orgChild1Id === null) {