1
|
import {Notification} from "./notifications";
|
2
|
import {HelperFunctions} from "../utils/HelperFunctions.class";
|
3
|
import {Composer} from "../utils/email/composer";
|
4
|
|
5
|
export class NotificationUtils {
|
6
|
public static CREATE_STAKEHOLDER: Notification = new Notification('CREATE', ['monitor'], 'User ((__user__)) has created a new profile', 'stakeholder')
|
7
|
public static EDIT_STAKEHOLDER: Notification = new Notification('EDIT', ['monitor'], 'User ((__user__)) has updated ((__stakeholder__)) profile', 'stakeholder')
|
8
|
public static CREATE_INDICATOR: Notification = new Notification('CREATE', ['monitor'], 'User ((__user__)) has created a new indicator in ((__stakeholder__)) profile', 'indicator');
|
9
|
public static EDIT_INDICATOR: Notification = new Notification('EDIT', ['monitor'], 'User ((__user__)) has updated an indicator in ((__stakeholder__)) profile', 'indicator');
|
10
|
public static DELETE_INDICATOR: Notification = new Notification('DELETE', ['monitor'], 'User ((__user__)) has deleted an indicator in ((__stakeholder__)) profile', 'indicator');
|
11
|
public static INVITE_MONITOR_MANAGER: Notification = new Notification('INVITE_MANAGER', ['monitor'], null, 'user');
|
12
|
public static INVITE_MONITOR_MEMBER: Notification = new Notification('INVITE_MEMBER', ['monitor'], null, 'user');
|
13
|
|
14
|
public static createStakeholder(user: string): Notification {
|
15
|
let notification: Notification = HelperFunctions.copy(this.CREATE_STAKEHOLDER);
|
16
|
notification.message = notification.message.replace('((__user__))', user);
|
17
|
return notification;
|
18
|
}
|
19
|
|
20
|
public static editStakeholder(user: string, stakeholder: string): Notification {
|
21
|
let notification: Notification = HelperFunctions.copy(this.EDIT_STAKEHOLDER);
|
22
|
notification.message = notification.message.replace('((__user__))', user);
|
23
|
notification.message = notification.message.replace('((__stakeholder__))', stakeholder);
|
24
|
return notification;
|
25
|
}
|
26
|
|
27
|
public static createIndicator(user: string, stakeholder: string): Notification {
|
28
|
let notification: Notification = HelperFunctions.copy(this.CREATE_INDICATOR);
|
29
|
notification.message = notification.message.replace('((__user__))', user);
|
30
|
notification.message = notification.message.replace('((__stakeholder__))', stakeholder);
|
31
|
return notification;
|
32
|
}
|
33
|
|
34
|
public static editIndicator(user: string, stakeholder: string): Notification {
|
35
|
let notification: Notification = HelperFunctions.copy(this.EDIT_INDICATOR);
|
36
|
notification.message = notification.message.replace('((__user__))', user);
|
37
|
notification.message = notification.message.replace('((__stakeholder__))', stakeholder);
|
38
|
return notification;
|
39
|
}
|
40
|
|
41
|
public static deleteIndicator(user: string, stakeholder: string): Notification {
|
42
|
let notification: Notification = HelperFunctions.copy(this.DELETE_INDICATOR);
|
43
|
notification.message = notification.message.replace('((__user__))', user);
|
44
|
notification.message = notification.message.replace('((__stakeholder__))', stakeholder);
|
45
|
return notification;
|
46
|
}
|
47
|
|
48
|
public static invite(name: string,role: "manager" | "member", user, invitation: string): Notification {
|
49
|
let notification: Notification = HelperFunctions.copy(this.INVITE_MONITOR_MANAGER);
|
50
|
if(role === "member") {
|
51
|
notification = HelperFunctions.copy(this.INVITE_MONITOR_MEMBER);
|
52
|
}
|
53
|
notification.message = Composer.composeMessageForMonitorDashboard(name, role, user, invitation);
|
54
|
return notification;
|
55
|
}
|
56
|
}
|