เพิ่ม link noti
This commit is contained in:
parent
0bca27a633
commit
2bfb36fd8a
2 changed files with 108 additions and 103 deletions
|
|
@ -36,6 +36,8 @@ import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
|||
import {
|
||||
calculateRetireDate,
|
||||
calculateRetireLaw,
|
||||
commandTypePath,
|
||||
commandTypePathLink,
|
||||
removeProfileInOrganize,
|
||||
setLogDataDiff,
|
||||
} from "../interfaces/utils";
|
||||
|
|
@ -556,7 +558,7 @@ export class CommandController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ได้รับคำสั่ง");
|
||||
}
|
||||
|
||||
const path = this.commandTypePath(commandRecive.command.commandType.code);
|
||||
const path = commandTypePath(commandRecive.command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
await new CallAPI()
|
||||
.PostData(request, path + "/delete", {
|
||||
|
|
@ -863,7 +865,7 @@ export class CommandController extends Controller {
|
|||
where: { commandId: id },
|
||||
});
|
||||
|
||||
const path = this.commandTypePath(command.commandType.code);
|
||||
const path = commandTypePath(command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
await new CallAPI()
|
||||
.PostData(request, path + "/delete", {
|
||||
|
|
@ -1013,7 +1015,12 @@ export class CommandController extends Controller {
|
|||
|
||||
let profiles =
|
||||
command && command.commandRecives.length > 0
|
||||
? command.commandRecives.filter((x) => x.profileId != null).map((x) => x.profileId)
|
||||
? command.commandRecives
|
||||
.filter((x) => x.profileId != null)
|
||||
.map((x) => ({
|
||||
profileId: x.profileId,
|
||||
notiLink: `${process.env.API_URL}${commandTypePathLink(command.commandType.code)}/${x.refId}`,
|
||||
}))
|
||||
: [];
|
||||
|
||||
await new CallAPI()
|
||||
|
|
@ -1022,7 +1029,6 @@ export class CommandController extends Controller {
|
|||
body: `${command.issue}`,
|
||||
receiverUserIds: profiles,
|
||||
payload: "", //แนบไฟล์
|
||||
notiLink: "", //แนบไฟล์
|
||||
isSendMail: true,
|
||||
isSendInbox: true,
|
||||
isSendNotification: true,
|
||||
|
|
@ -1044,7 +1050,7 @@ export class CommandController extends Controller {
|
|||
command.lastUpdatedAt = new Date();
|
||||
await this.commandRepository.save(command);
|
||||
} else {
|
||||
const path = this.commandTypePath(command.commandType.code);
|
||||
const path = commandTypePath(command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
const msg = {
|
||||
data: {
|
||||
|
|
@ -1101,7 +1107,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
command.forEach(async (x) => {
|
||||
const path = this.commandTypePath(x.commandType.code);
|
||||
const path = commandTypePath(x.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
const msg = {
|
||||
data: {
|
||||
|
|
@ -1213,7 +1219,7 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
let _command: any = [];
|
||||
const path = this.commandTypePath(command.commandType.code);
|
||||
const path = commandTypePath(command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
await new CallAPI()
|
||||
.PostData(request, path + "/attachment", {
|
||||
|
|
@ -1366,7 +1372,7 @@ export class CommandController extends Controller {
|
|||
await this.commandRepository.save(command);
|
||||
}
|
||||
|
||||
const path = this.commandTypePath(commandCode);
|
||||
const path = commandTypePath(commandCode);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
await new CallAPI()
|
||||
.PostData(request, path, {
|
||||
|
|
@ -2845,93 +2851,4 @@ export class CommandController extends Controller {
|
|||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
commandTypePath(commandCode: string) {
|
||||
switch (commandCode) {
|
||||
case "C-PM-01":
|
||||
return "/placement/recruit/report"; //
|
||||
case "C-PM-02":
|
||||
return "/placement/candidate/report"; //
|
||||
case "C-PM-03":
|
||||
return "/placement/appoint/report";
|
||||
case "C-PM-04":
|
||||
return "/placement/move/report";
|
||||
case "C-PM-05":
|
||||
return "/placement/appointment/appoint/report";
|
||||
case "C-PM-06":
|
||||
return "/placement/slip/report";
|
||||
case "C-PM-07":
|
||||
return "/placement/appointment/move/report";
|
||||
case "C-PM-08":
|
||||
return "/retirement/other/appoint/report";
|
||||
case "C-PM-09":
|
||||
return "/retirement/other/out/report";
|
||||
case "C-PM-10":
|
||||
return "/probation/report/command10/officer/report";
|
||||
case "C-PM-11":
|
||||
return "/probation/report/command11/officer/report";
|
||||
case "C-PM-12":
|
||||
return "/probation/report/command12/officer/report";
|
||||
case "C-PM-13":
|
||||
return "/placement/transfer/command/report";
|
||||
case "C-PM-14":
|
||||
return "/placement/receive/command/report";
|
||||
case "C-PM-15":
|
||||
return "/placement/officer/command/report";
|
||||
case "C-PM-16":
|
||||
return "/placement/repatriation/command/report";
|
||||
case "C-PM-17":
|
||||
return "/retirement/resign/command/report";
|
||||
case "C-PM-18":
|
||||
return "/retirement/out/command/report";
|
||||
case "C-PM-19":
|
||||
return "/discipline/result/command19/report";
|
||||
case "C-PM-20":
|
||||
return "/discipline/result/command20/report";
|
||||
case "C-PM-21":
|
||||
return "/org/command/command21/employee/report";
|
||||
case "C-PM-22":
|
||||
return "/placement/appointment/employee-appoint/report";
|
||||
case "C-PM-23":
|
||||
return "/retirement/resign/employee/report";
|
||||
case "C-PM-24":
|
||||
return "/placement/appointment/employee-move/report";
|
||||
case "C-PM-25":
|
||||
return "/discipline/result/command25/report";
|
||||
case "C-PM-26":
|
||||
return "/discipline/result/command26/report";
|
||||
case "C-PM-27":
|
||||
return "/discipline/result/command27/report";
|
||||
case "C-PM-28":
|
||||
return "/discipline/result/command28/report";
|
||||
case "C-PM-29":
|
||||
return "/discipline/result/command29/report";
|
||||
case "C-PM-30":
|
||||
return "/discipline/result/command30/report";
|
||||
case "C-PM-31":
|
||||
return "/discipline/result/command31/report";
|
||||
case "C-PM-32":
|
||||
return "/discipline/result/command32/report";
|
||||
case "C-PM-33":
|
||||
return "/salary/report/command/officer/report";
|
||||
case "C-PM-34":
|
||||
return "/salary/report/command/officer/report";
|
||||
case "C-PM-35":
|
||||
return "/salary/report/command/officer/report";
|
||||
case "C-PM-36":
|
||||
return "/salary/report/command/employee/report";
|
||||
case "C-PM-37":
|
||||
return "/salary/report/command/employee/report";
|
||||
case "C-PM-38":
|
||||
return "/org/command/command38/officer/report";
|
||||
case "C-PM-39":
|
||||
return "/placement/appointment/slip/report";
|
||||
case "C-PM-40":
|
||||
return "/org/command/command40/officer/report";
|
||||
case "C-PM-41":
|
||||
return "/retirement/resign/leave-cancel/report";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,9 +213,9 @@ export function editLogSequence(req: RequestWithUser, index: number, data: LogSe
|
|||
export function commandTypePath(commandCode: string): string | null {
|
||||
switch (commandCode) {
|
||||
case "C-PM-01":
|
||||
return "/placement/recruit/report";
|
||||
return "/placement/recruit/report"; //
|
||||
case "C-PM-02":
|
||||
return "/placement/candidate/report";
|
||||
return "/placement/candidate/report"; //
|
||||
case "C-PM-03":
|
||||
return "/placement/appoint/report";
|
||||
case "C-PM-04":
|
||||
|
|
@ -223,7 +223,7 @@ export function commandTypePath(commandCode: string): string | null {
|
|||
case "C-PM-05":
|
||||
return "/placement/appointment/appoint/report";
|
||||
case "C-PM-06":
|
||||
return "/placement/appointment/slip/report";
|
||||
return "/placement/slip/report";
|
||||
case "C-PM-07":
|
||||
return "/placement/appointment/move/report";
|
||||
case "C-PM-08":
|
||||
|
|
@ -231,7 +231,7 @@ export function commandTypePath(commandCode: string): string | null {
|
|||
case "C-PM-09":
|
||||
return "/retirement/other/out/report";
|
||||
case "C-PM-10":
|
||||
return "/xxxxxx";
|
||||
return "/probation/report/command10/officer/report";
|
||||
case "C-PM-11":
|
||||
return "/probation/report/command11/officer/report";
|
||||
case "C-PM-12":
|
||||
|
|
@ -239,7 +239,7 @@ export function commandTypePath(commandCode: string): string | null {
|
|||
case "C-PM-13":
|
||||
return "/placement/transfer/command/report";
|
||||
case "C-PM-14":
|
||||
return "/placement/Receive/command/report";
|
||||
return "/placement/receive/command/report";
|
||||
case "C-PM-15":
|
||||
return "/placement/officer/command/report";
|
||||
case "C-PM-16":
|
||||
|
|
@ -289,7 +289,7 @@ export function commandTypePath(commandCode: string): string | null {
|
|||
case "C-PM-38":
|
||||
return "/org/command/command38/officer/report";
|
||||
case "C-PM-39":
|
||||
return "/placement/slip/report";
|
||||
return "/placement/appointment/slip/report";
|
||||
case "C-PM-40":
|
||||
return "/org/command/command40/officer/report";
|
||||
case "C-PM-41":
|
||||
|
|
@ -299,3 +299,91 @@ export function commandTypePath(commandCode: string): string | null {
|
|||
}
|
||||
}
|
||||
|
||||
export function commandTypePathLink(commandCode: string): string | null {
|
||||
switch (commandCode) {
|
||||
case "C-PM-01":
|
||||
return "/placement/personal-detail";
|
||||
case "C-PM-02":
|
||||
return "/placement/personal-detail";
|
||||
case "C-PM-03":
|
||||
return "/placement/personal-detail";
|
||||
case "C-PM-04":
|
||||
return "/placement/personal-detail";
|
||||
case "C-PM-05":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-06":
|
||||
return "/placement/personal-detail";
|
||||
case "C-PM-07":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-08":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-09":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-10":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-11":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-12":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-13":
|
||||
return "/placement/transfer";
|
||||
case "C-PM-14":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-15":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-16":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-17":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-18":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-19":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-20":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-21":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-22":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-23":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-24":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-25":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-26":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-27":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-28":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-29":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-30":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-31":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-32":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-33":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-34":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-35":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-36":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-37":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-38":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-39":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-40":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-41":
|
||||
return "/xxxxxx";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue