เพิ่มตำแหน่ง

This commit is contained in:
kittapath 2025-01-17 10:27:16 +07:00
parent 61f8925c80
commit 09f0918482

View file

@ -291,14 +291,14 @@ export class EmployeePositionController extends Controller {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posType: {
posTypeRank: "ASC",
createdAt: "DESC"
createdAt: "DESC",
},
posLevel: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
}
createdAt: "DESC",
},
},
});
break;
@ -314,14 +314,14 @@ export class EmployeePositionController extends Controller {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posType: {
posTypeRank: "ASC",
createdAt: "DESC"
createdAt: "DESC",
},
posLevel: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
}
createdAt: "DESC",
},
},
});
break;
@ -329,10 +329,9 @@ export class EmployeePositionController extends Controller {
case "positionLevel":
if (!isNaN(Number(keyword))) {
let findEmpLevels;
if(Number(keyword) === 0) {
if (Number(keyword) === 0) {
findEmpLevels = await this.employeePosLevelRepository.find();
}
else {
} else {
findEmpLevels = await this.employeePosLevelRepository.find({
where: { posLevelName: Number(keyword) },
});
@ -343,14 +342,14 @@ export class EmployeePositionController extends Controller {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posType: {
posTypeRank: "ASC",
createdAt: "DESC"
createdAt: "DESC",
},
posLevel: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
}
createdAt: "DESC",
},
},
});
} else {
@ -360,14 +359,14 @@ export class EmployeePositionController extends Controller {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posType: {
posTypeRank: "ASC",
createdAt: "DESC"
createdAt: "DESC",
},
posLevel: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
}
createdAt: "DESC",
},
},
});
}
@ -379,14 +378,14 @@ export class EmployeePositionController extends Controller {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posType: {
posTypeRank: "ASC",
createdAt: "DESC"
createdAt: "DESC",
},
posLevel: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
}
createdAt: "DESC",
},
},
});
break;
@ -417,7 +416,7 @@ export class EmployeePositionController extends Controller {
posLevelName: `${posTypeShortName} ${posLevelName}`,
createdAt: item.createdAt,
lastUpdatedAt: item.lastUpdatedAt,
lastUpdateFullName: item.lastUpdateFullName
lastUpdateFullName: item.lastUpdateFullName,
};
}),
);
@ -2196,6 +2195,16 @@ export class EmployeePositionController extends Controller {
dataMaster.positions.forEach(async (position) => {
if (position.id === requestBody.position) {
position.positionIsSelected = true;
const profile = await this.profileRepository.findOne({
where: { id: requestBody.profileId },
});
if (profile != null) {
const _null: any = null;
profile.posLevelId = position?.posLevelId ?? _null;
profile.posTypeId = position?.posTypeId ?? _null;
profile.position = position?.positionName ?? _null;
await this.profileRepository.save(profile);
}
} else {
position.positionIsSelected = false;
}