Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-11-12 17:11:31 +07:00
commit da9e89147c
4 changed files with 72 additions and 28 deletions

View file

@ -3451,6 +3451,7 @@ export class CommandController extends Controller {
posMasterId: posMaster.id,
positionIsSelected: true,
},
relations: ["posType", "posLevel"]
});
const dest_item = await this.salaryRepo.findOne({
where: { profileId: profile?.id },
@ -3468,8 +3469,8 @@ export class CommandController extends Controller {
mouthSalaryAmount: item.mouthSalaryAmount,
posNo: shortName ?? null,
position: position?.positionName ?? null,
positionType: position?.posTypeId ?? null,
positionLevel: position?.posLevelId ?? null,
positionType: position?.posType.posTypeName ?? null,
positionLevel: position?.posLevel.posLevelName ?? null,
refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`,
templateDoc: item.templateDoc,
order: dest_item == null ? 1 : dest_item.order + 1,
@ -3521,13 +3522,13 @@ export class CommandController extends Controller {
body: {
refIds: {
refId: string;
commandAffectDate: Date | null;
commandNo: string | null;
commandYear: number;
templateDoc: string | null;
amount: Double | null;
positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null;
// commandAffectDate: Date | null;
// commandNo: string | null;
// commandYear: number;
// templateDoc: string | null;
// amount: Double | null;
// positionSalaryAmount: Double | null;
// mouthSalaryAmount: Double | null;
}[];
},
) {

View file

@ -69,6 +69,7 @@ import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHisto
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
import { viewDirector } from "../entities/view/viewDirector";
import { viewDirectorActing } from "../entities/view/viewDirectorActing";
import CallAPI from "../interfaces/call-api";
@Route("api/v1/org/profile")
@Tags("Profile")
@Security("bearerAuth")
@ -228,20 +229,23 @@ export class ProfileController extends Controller {
where: { profileId: id },
order: { lastUpdatedAt: "DESC" },
});
const Education = educations && educations.length > 0
? educations.map((item) => ({
institute: item.institute ? item.institute : "-",
date:
item.startDate && item.endDate
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
: "-",
degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
}))
: [{
institute: "-",
date: "-",
degree: "-",
}]
const Education =
educations && educations.length > 0
? educations.map((item) => ({
institute: item.institute ? item.institute : "-",
date:
item.startDate && item.endDate
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
: "-",
degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
}))
: [
{
institute: "-",
date: "-",
degree: "-",
},
];
const mapData = {
// Id: profile.id,
@ -7874,4 +7878,43 @@ export class ProfileController extends Controller {
]);
return new HttpSuccess();
}
@Post("noti-admin")
public async notiAllAdmin(
@Request() req: RequestWithUser,
@Body()
body: {
subject: string;
body: string;
},
) {
if (!req.user.role.includes("SUPER_ADMIN"))
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ส่งข้อความ");
const profileNoti = await this.profileRepo.find({
where: {
roleKeycloaks: {
name: "ADMIN",
},
},
});
profileNoti.map((x) => ({
receiverUserId: x.id,
notiLink: "",
}));
await new CallAPI()
.PostData(req, "/placement/noti/profiles", {
subject: body.subject,
body: body.body,
receiverUserIds: profileNoti,
payload: "", //แนบไฟล์
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.catch((error) => {
console.error("Error calling API:", error);
});
return new HttpSuccess();
}
}

View file

@ -120,9 +120,9 @@ export class CreateProfileLeave {
dateLeaveStart: Date | null;
dateLeaveEnd: Date | null;
leaveDays: number | null;
leaveCount: number | null;
totalLeave: number | null;
status: string | null;
leaveCount?: number | null;
totalLeave?: number | null;
status?: string | null;
reason: string | null;
}

View file

@ -194,7 +194,7 @@ export class CreateProfileSalary {
positionType: string | null;
positionLevel: string | null;
refCommandNo: string | null;
commandId: string | null;
commandId?: string | null;
// commandType?: string | null;
templateDoc: string | null;
isGovernment?: boolean | null;
@ -204,7 +204,7 @@ export class CreateProfileSalaryEmployee {
profileEmployeeId: string | null;
date?: Date | null;
amount?: Double | null;
commandId: string | null;
commandId?: string | null;
positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null;
posNo: string | null;