scheduler-node-models 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/general/emailer.d.ts +1 -0
- package/general/emailer.js +31 -0
- package/general/general.d.ts +12 -0
- package/general/general.js +2 -0
- package/general/index.d.ts +5 -0
- package/general/index.js +21 -0
- package/general/logger.d.ts +10 -0
- package/general/logger.js +90 -0
- package/general/report.d.ts +25 -0
- package/general/report.js +76 -0
- package/general/viewstate.d.ts +5 -0
- package/general/viewstate.js +9 -0
- package/index.d.ts +0 -0
- package/index.js +1 -0
- package/metrics/images.d.ts +22 -0
- package/metrics/images.js +33 -0
- package/metrics/index.d.ts +5 -0
- package/metrics/index.js +21 -0
- package/metrics/mission.d.ts +47 -0
- package/metrics/mission.js +81 -0
- package/metrics/missionSensorOutage.d.ts +11 -0
- package/metrics/missionSensorOutage.js +14 -0
- package/metrics/missionsensor.d.ts +67 -0
- package/metrics/missionsensor.js +128 -0
- package/metrics/outage.d.ts +43 -0
- package/metrics/outage.js +55 -0
- package/metrics/systemdata/classifications.d.ts +18 -0
- package/metrics/systemdata/classifications.js +23 -0
- package/metrics/systemdata/communications.d.ts +21 -0
- package/metrics/systemdata/communications.js +40 -0
- package/metrics/systemdata/dcgs.d.ts +19 -0
- package/metrics/systemdata/dcgs.js +29 -0
- package/metrics/systemdata/exploitations.d.ts +18 -0
- package/metrics/systemdata/exploitations.js +23 -0
- package/metrics/systemdata/groundSystems.d.ts +86 -0
- package/metrics/systemdata/groundSystems.js +143 -0
- package/metrics/systemdata/index.d.ts +7 -0
- package/metrics/systemdata/index.js +23 -0
- package/metrics/systemdata/platform.d.ts +124 -0
- package/metrics/systemdata/platform.js +176 -0
- package/metrics/systemdata/systeminfo.d.ts +28 -0
- package/metrics/systemdata/systeminfo.js +64 -0
- package/package.json +4 -4
- package/scheduler/employees/assignment.d.ts +139 -0
- package/scheduler/employees/assignment.js +304 -0
- package/scheduler/employees/balance.d.ts +35 -0
- package/scheduler/employees/balance.js +39 -0
- package/scheduler/employees/companyinfo.d.ts +16 -0
- package/scheduler/employees/companyinfo.js +6 -0
- package/scheduler/employees/contact.d.ts +36 -0
- package/scheduler/employees/contact.js +40 -0
- package/scheduler/employees/employee.d.ts +427 -0
- package/scheduler/employees/employee.js +1887 -0
- package/scheduler/employees/employeename.d.ts +48 -0
- package/scheduler/employees/employeename.js +97 -0
- package/scheduler/employees/index.d.ts +14 -0
- package/scheduler/employees/index.js +30 -0
- package/scheduler/employees/labor.d.ts +31 -0
- package/scheduler/employees/labor.js +39 -0
- package/scheduler/employees/leave.d.ts +58 -0
- package/scheduler/employees/leave.js +73 -0
- package/scheduler/employees/leaverequest.d.ts +105 -0
- package/scheduler/employees/leaverequest.js +226 -0
- package/scheduler/employees/specialty.d.ts +35 -0
- package/scheduler/employees/specialty.js +40 -0
- package/scheduler/employees/variation.d.ts +80 -0
- package/scheduler/employees/variation.js +132 -0
- package/scheduler/employees/web.d.ts +6 -0
- package/scheduler/employees/web.js +2 -0
- package/scheduler/employees/work.d.ts +96 -0
- package/scheduler/employees/work.js +133 -0
- package/scheduler/employees/workday.d.ts +91 -0
- package/scheduler/employees/workday.js +170 -0
- package/scheduler/labor/index.d.ts +2 -0
- package/scheduler/labor/index.js +18 -0
- package/scheduler/labor/laborcode.d.ts +33 -0
- package/scheduler/labor/laborcode.js +55 -0
- package/scheduler/labor/workcode.d.ts +28 -0
- package/scheduler/labor/workcode.js +35 -0
- package/scheduler/sites/index.d.ts +1 -0
- package/scheduler/sites/index.js +17 -0
- package/scheduler/sites/reports/cofsReport.d.ts +41 -0
- package/scheduler/sites/reports/cofsReport.js +104 -0
- package/scheduler/sites/reports/forecast.d.ts +57 -0
- package/scheduler/sites/reports/forecast.js +205 -0
- package/scheduler/sites/reports/index.d.ts +4 -0
- package/scheduler/sites/reports/index.js +20 -0
- package/scheduler/sites/reports/period.d.ts +11 -0
- package/scheduler/sites/reports/period.js +27 -0
- package/scheduler/sites/reports/section.d.ts +63 -0
- package/scheduler/sites/reports/section.js +186 -0
- package/scheduler/sites/site.d.ts +39 -0
- package/scheduler/sites/site.js +68 -0
- package/scheduler/sites/workcenters/index.d.ts +3 -0
- package/scheduler/sites/workcenters/index.js +19 -0
- package/scheduler/sites/workcenters/position.d.ts +27 -0
- package/scheduler/sites/workcenters/position.js +36 -0
- package/scheduler/sites/workcenters/shift.d.ts +32 -0
- package/scheduler/sites/workcenters/shift.js +47 -0
- package/scheduler/sites/workcenters/workcenter.d.ts +43 -0
- package/scheduler/sites/workcenters/workcenter.js +123 -0
- package/scheduler/teams/company/company.d.ts +99 -0
- package/scheduler/teams/company/company.js +256 -0
- package/scheduler/teams/company/holiday.d.ts +61 -0
- package/scheduler/teams/company/holiday.js +116 -0
- package/scheduler/teams/company/index.d.ts +3 -0
- package/scheduler/teams/company/index.js +19 -0
- package/scheduler/teams/company/modperiod.d.ts +21 -0
- package/scheduler/teams/company/modperiod.js +24 -0
- package/scheduler/teams/contact.d.ts +18 -0
- package/scheduler/teams/contact.js +23 -0
- package/scheduler/teams/index.d.ts +3 -0
- package/scheduler/teams/index.js +19 -0
- package/scheduler/teams/specialty.d.ts +18 -0
- package/scheduler/teams/specialty.js +23 -0
- package/scheduler/teams/team.d.ts +95 -0
- package/scheduler/teams/team.js +351 -0
- package/users/index.d.ts +2 -0
- package/users/index.js +18 -0
- package/users/question.d.ts +47 -0
- package/users/question.js +68 -0
- package/users/user.d.ts +150 -0
- package/users/user.js +304 -0
- package/users/web.d.ts +49 -0
- package/users/web.js +2 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkRecord = exports.Work = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This class description for a work object. The data members are:
|
|
6
|
+
* date worked (date object for the date the work record),
|
|
7
|
+
* charge number (string value for the labor code's charge number),
|
|
8
|
+
* extension (string value for the labor code's extension),
|
|
9
|
+
* paycode (numeric value for the pay code used by the company),
|
|
10
|
+
* modtime (boolean value to indicate if the recorded information is for modified time),
|
|
11
|
+
* hours (numeric value for the number of hours worked for the labor code)
|
|
12
|
+
*/
|
|
13
|
+
class Work {
|
|
14
|
+
dateworked;
|
|
15
|
+
chargenumber;
|
|
16
|
+
extension;
|
|
17
|
+
paycode;
|
|
18
|
+
modtime;
|
|
19
|
+
hours;
|
|
20
|
+
constructor(wk) {
|
|
21
|
+
this.dateworked = (wk) ? new Date(wk.dateworked) : new Date(0);
|
|
22
|
+
this.chargenumber = (wk) ? wk.chargenumber : '';
|
|
23
|
+
this.extension = (wk) ? wk.extension : '';
|
|
24
|
+
this.paycode = (wk) ? wk.paycode : 1;
|
|
25
|
+
this.modtime = (wk && wk.modtime) ? wk.modtime : false;
|
|
26
|
+
this.hours = (wk) ? wk.hours : 0.0;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This function is used in sorting work objects. Based on date worked and the labor
|
|
30
|
+
* code.
|
|
31
|
+
* @param other The work object to use in comparison
|
|
32
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
|
33
|
+
* object. -1 is before or 1 for after.
|
|
34
|
+
*/
|
|
35
|
+
compareTo(other) {
|
|
36
|
+
if (other) {
|
|
37
|
+
if (this.dateworked.getTime() === other.dateworked.getTime()) {
|
|
38
|
+
if (this.chargenumber === other.chargenumber) {
|
|
39
|
+
return this.extension < other.extension ? -1 : 1;
|
|
40
|
+
}
|
|
41
|
+
return this.chargenumber < other.chargenumber ? -1 : 1;
|
|
42
|
+
}
|
|
43
|
+
return this.dateworked.getTime() < other.dateworked.getTime() ? -1 : 1;
|
|
44
|
+
}
|
|
45
|
+
return -1;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* This function is used to compare this object's date worked with a date provided.
|
|
49
|
+
* @param date A date object used for comparison.
|
|
50
|
+
* @returns A boolean value to indicate whether the work object is on the date provided.
|
|
51
|
+
*/
|
|
52
|
+
useWork(date) {
|
|
53
|
+
return this.dateworked.getUTCFullYear() === date.getUTCFullYear()
|
|
54
|
+
&& this.dateworked.getUTCMonth() === date.getUTCMonth()
|
|
55
|
+
&& this.dateworked.getUTCDate() === date.getUTCDate();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Work = Work;
|
|
59
|
+
/**
|
|
60
|
+
* This class description for the employee's yearly work record. The data members are:
|
|
61
|
+
* id (string value representing the database's _id value - primary key)
|
|
62
|
+
* empID (string value for the associated employee's identifier)
|
|
63
|
+
* year (numeric value for the year associated with the work records)
|
|
64
|
+
* work (an array of work objects containing all the actual work performed)
|
|
65
|
+
*/
|
|
66
|
+
class WorkRecord {
|
|
67
|
+
id;
|
|
68
|
+
empID;
|
|
69
|
+
year;
|
|
70
|
+
work;
|
|
71
|
+
constructor(wr) {
|
|
72
|
+
this.id = (wr && wr.id) ? wr.id : '';
|
|
73
|
+
if (this.id === '') {
|
|
74
|
+
this.id = (wr && wr._id) ? wr._id.toString() : '';
|
|
75
|
+
}
|
|
76
|
+
this.empID = (wr && wr.empID) ? wr.empID : '';
|
|
77
|
+
if (this.empID === '') {
|
|
78
|
+
this.empID = (wr && wr.employeeID) ? wr.employeeID.toString() : '';
|
|
79
|
+
}
|
|
80
|
+
this.year = (wr) ? wr.year : (new Date()).getFullYear();
|
|
81
|
+
this.work = [];
|
|
82
|
+
if (wr && wr.work && wr.work.length > 0) {
|
|
83
|
+
wr.work.forEach(wk => {
|
|
84
|
+
this.work.push(new Work(wk));
|
|
85
|
+
});
|
|
86
|
+
this.work.sort((a, b) => a.compareTo(b));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* This function is used in sorting these annual work records. Based on employee
|
|
91
|
+
* identifier and year.
|
|
92
|
+
* @param other The annual work record used for comparison.
|
|
93
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
|
94
|
+
* object. -1 is before or 1 for after.
|
|
95
|
+
*/
|
|
96
|
+
compareTo(other) {
|
|
97
|
+
if (other) {
|
|
98
|
+
if (this.empID === other.empID) {
|
|
99
|
+
return (this.year < other.year) ? -1 : 1;
|
|
100
|
+
}
|
|
101
|
+
return (this.empID < other.empID) ? -1 : 1;
|
|
102
|
+
}
|
|
103
|
+
return -1;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* This function will remove work objects from this object's work array based on the
|
|
107
|
+
* period defined by the start and end dates.
|
|
108
|
+
* @param start The date object for the start of the removal period
|
|
109
|
+
* @param end The date object for the end of the removal period
|
|
110
|
+
*/
|
|
111
|
+
removeWork(start, end) {
|
|
112
|
+
for (let w = this.work.length - 1; w >= 0; w--) {
|
|
113
|
+
if (this.work[w].dateworked.getTime() >= start.getTime()
|
|
114
|
+
&& this.work[w].dateworked.getTime() <= end.getTime()) {
|
|
115
|
+
this.work.splice(w, 1);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This function will remove work objects from this object's work array
|
|
121
|
+
* @param purgeDate The date object to remove all data before it.
|
|
122
|
+
* @returns A boolean value to indicate whether or not the work array is empty.
|
|
123
|
+
*/
|
|
124
|
+
purge(purgeDate) {
|
|
125
|
+
for (let w = this.work.length - 1; w >= 0; w--) {
|
|
126
|
+
if (this.work[w].dateworked.getTime() < purgeDate.getTime()) {
|
|
127
|
+
this.work.splice(w, 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return this.work.length === 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.WorkRecord = WorkRecord;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workday interface and class descriptions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* This interface describes the data members to describe a workday object.
|
|
6
|
+
*/
|
|
7
|
+
export interface IWorkday {
|
|
8
|
+
id: number;
|
|
9
|
+
workcenter: string;
|
|
10
|
+
code: string;
|
|
11
|
+
hours: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This class provide the data members and the action a workday can complete. It will be
|
|
15
|
+
* used a children of a schedule class object in an assignment or variation.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Workday implements IWorkday {
|
|
18
|
+
id: number;
|
|
19
|
+
workcenter: string;
|
|
20
|
+
code: string;
|
|
21
|
+
hours: number;
|
|
22
|
+
constructor(wd?: IWorkday);
|
|
23
|
+
/**
|
|
24
|
+
* This function is used to sort two workday objects based on the workday's identifier.
|
|
25
|
+
* @param other The workday object used for the comparison
|
|
26
|
+
* @returns A number value to signify this object is before or after the other. -1
|
|
27
|
+
* represents before and 1 for after.
|
|
28
|
+
*/
|
|
29
|
+
compareTo(other?: Workday): number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The schedule class and interface is for holding workdays within an assignment
|
|
33
|
+
* and variation.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* This interface describes the data members to describe a schedule object.
|
|
37
|
+
*/
|
|
38
|
+
export interface ISchedule {
|
|
39
|
+
id: number;
|
|
40
|
+
workdays: IWorkday[];
|
|
41
|
+
showdates?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This class provide the data members and the action a schedule can complete. It will be
|
|
45
|
+
* used a children of an assignment or variation.
|
|
46
|
+
*/
|
|
47
|
+
export declare class Schedule implements ISchedule {
|
|
48
|
+
id: number;
|
|
49
|
+
workdays: Workday[];
|
|
50
|
+
showdates: boolean;
|
|
51
|
+
constructor(sch?: ISchedule);
|
|
52
|
+
/**
|
|
53
|
+
* This function will be used to sort multiple schedules based on the schedules' id.
|
|
54
|
+
* @param other A schedule object used for comparison
|
|
55
|
+
* @returns A numeric value to indicate whether the schedule is before or after the
|
|
56
|
+
* other schedule in a list. -1 for before and 1 for after.
|
|
57
|
+
*/
|
|
58
|
+
compareTo(other?: Schedule): number;
|
|
59
|
+
/**
|
|
60
|
+
* This function will retrieve a workday from the list based on the identifier provided.
|
|
61
|
+
* @param id A numeric value for the identifier
|
|
62
|
+
* @returns A workday object representing the requested workday.
|
|
63
|
+
*/
|
|
64
|
+
getWorkday(id: number): Workday;
|
|
65
|
+
/**
|
|
66
|
+
* This function allows the caller to update a schedule's workday with the values
|
|
67
|
+
* provided.
|
|
68
|
+
* @param id A numeric value to identify which workday to update.
|
|
69
|
+
* @param wkctr A string value representing the workcenter.
|
|
70
|
+
* @param code A string value representing the work code (shift) to assign.
|
|
71
|
+
* @param hours A numeric value (float) for the number of hours to work.
|
|
72
|
+
*/
|
|
73
|
+
changeWorkday(id: number, wkctr: string, code: string, hours: number): void;
|
|
74
|
+
/**
|
|
75
|
+
* This function will update a field on a particular workday, based on the field and
|
|
76
|
+
* value.
|
|
77
|
+
* @param id The numeric value to identify which workday object to change.
|
|
78
|
+
* @param field The string value used to identify which data member to update.
|
|
79
|
+
* @param value The string value representing the new value, either string or numeric
|
|
80
|
+
* value given as a string.
|
|
81
|
+
*/
|
|
82
|
+
updateWorkday(id: number, field: string, value: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* This function will either add or subtract workdays from the list to ensure
|
|
85
|
+
* that there was a certain number of days in the schedule. All schedules must
|
|
86
|
+
* contain a multiple of 7 workdays.
|
|
87
|
+
* @param days A numeric value, greater than zero (0) and a multiple of 7.
|
|
88
|
+
* @throws An error indicating the provided parameter is zero or not a multiple of 7.
|
|
89
|
+
*/
|
|
90
|
+
setScheduleDays(days: number): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Workday interface and class descriptions
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Schedule = exports.Workday = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This class provide the data members and the action a workday can complete. It will be
|
|
9
|
+
* used a children of a schedule class object in an assignment or variation.
|
|
10
|
+
*/
|
|
11
|
+
class Workday {
|
|
12
|
+
id;
|
|
13
|
+
workcenter;
|
|
14
|
+
code;
|
|
15
|
+
hours;
|
|
16
|
+
constructor(wd) {
|
|
17
|
+
this.id = (wd) ? wd.id : 0;
|
|
18
|
+
this.workcenter = (wd) ? wd.workcenter : '';
|
|
19
|
+
this.code = (wd) ? wd.code : '';
|
|
20
|
+
this.hours = (wd) ? wd.hours : 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This function is used to sort two workday objects based on the workday's identifier.
|
|
24
|
+
* @param other The workday object used for the comparison
|
|
25
|
+
* @returns A number value to signify this object is before or after the other. -1
|
|
26
|
+
* represents before and 1 for after.
|
|
27
|
+
*/
|
|
28
|
+
compareTo(other) {
|
|
29
|
+
if (other) {
|
|
30
|
+
return (this.id < other.id) ? -1 : 1;
|
|
31
|
+
}
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Workday = Workday;
|
|
36
|
+
/**
|
|
37
|
+
* This class provide the data members and the action a schedule can complete. It will be
|
|
38
|
+
* used a children of an assignment or variation.
|
|
39
|
+
*/
|
|
40
|
+
class Schedule {
|
|
41
|
+
id;
|
|
42
|
+
workdays;
|
|
43
|
+
showdates;
|
|
44
|
+
constructor(sch) {
|
|
45
|
+
this.id = (sch) ? sch.id : 0;
|
|
46
|
+
this.workdays = [];
|
|
47
|
+
if (sch && sch.workdays.length > 0) {
|
|
48
|
+
sch.workdays.forEach(wd => {
|
|
49
|
+
this.workdays.push(new Workday(wd));
|
|
50
|
+
});
|
|
51
|
+
this.workdays.sort((a, b) => a.compareTo(b));
|
|
52
|
+
}
|
|
53
|
+
this.showdates = (sch && sch.showdates) ? sch.showdates : false;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* This function will be used to sort multiple schedules based on the schedules' id.
|
|
57
|
+
* @param other A schedule object used for comparison
|
|
58
|
+
* @returns A numeric value to indicate whether the schedule is before or after the
|
|
59
|
+
* other schedule in a list. -1 for before and 1 for after.
|
|
60
|
+
*/
|
|
61
|
+
compareTo(other) {
|
|
62
|
+
if (other) {
|
|
63
|
+
return (this.id < other.id) ? -1 : 1;
|
|
64
|
+
}
|
|
65
|
+
return -1;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* This function will retrieve a workday from the list based on the identifier provided.
|
|
69
|
+
* @param id A numeric value for the identifier
|
|
70
|
+
* @returns A workday object representing the requested workday.
|
|
71
|
+
*/
|
|
72
|
+
getWorkday(id) {
|
|
73
|
+
let result = new Workday();
|
|
74
|
+
this.workdays.forEach(wd => {
|
|
75
|
+
if (wd.id === id) {
|
|
76
|
+
result = new Workday(wd);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This function allows the caller to update a schedule's workday with the values
|
|
83
|
+
* provided.
|
|
84
|
+
* @param id A numeric value to identify which workday to update.
|
|
85
|
+
* @param wkctr A string value representing the workcenter.
|
|
86
|
+
* @param code A string value representing the work code (shift) to assign.
|
|
87
|
+
* @param hours A numeric value (float) for the number of hours to work.
|
|
88
|
+
*/
|
|
89
|
+
changeWorkday(id, wkctr, code, hours) {
|
|
90
|
+
let found = false;
|
|
91
|
+
for (let w = 0; w < this.workdays.length && !found; w++) {
|
|
92
|
+
const wd = this.workdays[w];
|
|
93
|
+
if (wd.id === id) {
|
|
94
|
+
found = true;
|
|
95
|
+
wd.hours = hours;
|
|
96
|
+
wd.code = code;
|
|
97
|
+
wd.workcenter = wkctr;
|
|
98
|
+
this.workdays[w] = wd;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!found) {
|
|
102
|
+
const wd = new Workday({
|
|
103
|
+
id: id,
|
|
104
|
+
workcenter: wkctr,
|
|
105
|
+
code: code,
|
|
106
|
+
hours: hours
|
|
107
|
+
});
|
|
108
|
+
this.workdays.push(wd);
|
|
109
|
+
this.workdays.sort((a, b) => a.compareTo(b));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* This function will update a field on a particular workday, based on the field and
|
|
114
|
+
* value.
|
|
115
|
+
* @param id The numeric value to identify which workday object to change.
|
|
116
|
+
* @param field The string value used to identify which data member to update.
|
|
117
|
+
* @param value The string value representing the new value, either string or numeric
|
|
118
|
+
* value given as a string.
|
|
119
|
+
*/
|
|
120
|
+
updateWorkday(id, field, value) {
|
|
121
|
+
let found = false;
|
|
122
|
+
for (let w = 0; w < this.workdays.length && !found; w++) {
|
|
123
|
+
const wd = this.workdays[w];
|
|
124
|
+
if (wd.id === id) {
|
|
125
|
+
found = true;
|
|
126
|
+
switch (field.toLowerCase()) {
|
|
127
|
+
case "workcenter":
|
|
128
|
+
wd.workcenter = value;
|
|
129
|
+
break;
|
|
130
|
+
case "code":
|
|
131
|
+
wd.code = value;
|
|
132
|
+
break;
|
|
133
|
+
case 'hours':
|
|
134
|
+
wd.hours = Number(value);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
this.workdays[w] = wd;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* This function will either add or subtract workdays from the list to ensure
|
|
143
|
+
* that there was a certain number of days in the schedule. All schedules must
|
|
144
|
+
* contain a multiple of 7 workdays.
|
|
145
|
+
* @param days A numeric value, greater than zero (0) and a multiple of 7.
|
|
146
|
+
* @throws An error indicating the provided parameter is zero or not a multiple of 7.
|
|
147
|
+
*/
|
|
148
|
+
setScheduleDays(days) {
|
|
149
|
+
if (days <= 0 || days % 7 !== 0) {
|
|
150
|
+
throw new Error('New days value must be greater than zero and a multiple of seven');
|
|
151
|
+
}
|
|
152
|
+
this.workdays.sort((a, b) => a.compareTo(b));
|
|
153
|
+
if (days > this.workdays.length) {
|
|
154
|
+
for (let w = this.workdays.length; w < days; w++) {
|
|
155
|
+
const wd = new Workday();
|
|
156
|
+
wd.id = w;
|
|
157
|
+
this.workdays.push(wd);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (days < this.workdays.length) {
|
|
161
|
+
while (this.workdays.length > days) {
|
|
162
|
+
this.workdays.pop();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
for (let w = 0; w < this.workdays.length; w++) {
|
|
166
|
+
this.workdays[w].id = w;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.Schedule = Schedule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./workcode"), exports);
|
|
18
|
+
__exportStar(require("./laborcode"), exports);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ILaborCode {
|
|
2
|
+
chargeNumber: string;
|
|
3
|
+
extension: string;
|
|
4
|
+
clin?: string;
|
|
5
|
+
slin?: string;
|
|
6
|
+
location?: string;
|
|
7
|
+
wbs?: string;
|
|
8
|
+
minimumEmployees?: number;
|
|
9
|
+
notAssignedName?: string;
|
|
10
|
+
hoursPerEmployee?: number;
|
|
11
|
+
exercise?: boolean;
|
|
12
|
+
startDate?: Date;
|
|
13
|
+
endDate?: Date;
|
|
14
|
+
sort?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class LaborCode implements ILaborCode {
|
|
17
|
+
chargeNumber: string;
|
|
18
|
+
extension: string;
|
|
19
|
+
clin?: string;
|
|
20
|
+
slin?: string;
|
|
21
|
+
location?: string;
|
|
22
|
+
wbs?: string;
|
|
23
|
+
minimumEmployees?: number;
|
|
24
|
+
notAssignedName?: string;
|
|
25
|
+
hoursPerEmployee?: number;
|
|
26
|
+
exercise?: boolean;
|
|
27
|
+
startDate?: Date;
|
|
28
|
+
endDate?: Date;
|
|
29
|
+
sort: number;
|
|
30
|
+
constructor(lc?: ILaborCode);
|
|
31
|
+
compareTo(other?: LaborCode): 1 | -1;
|
|
32
|
+
inTimePeriod(start: Date, end: Date): boolean;
|
|
33
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LaborCode = void 0;
|
|
4
|
+
class LaborCode {
|
|
5
|
+
chargeNumber;
|
|
6
|
+
extension;
|
|
7
|
+
clin;
|
|
8
|
+
slin;
|
|
9
|
+
location;
|
|
10
|
+
wbs;
|
|
11
|
+
minimumEmployees;
|
|
12
|
+
notAssignedName;
|
|
13
|
+
hoursPerEmployee;
|
|
14
|
+
exercise;
|
|
15
|
+
startDate;
|
|
16
|
+
endDate;
|
|
17
|
+
sort;
|
|
18
|
+
constructor(lc) {
|
|
19
|
+
this.chargeNumber = (lc) ? lc.chargeNumber : '';
|
|
20
|
+
this.extension = (lc) ? lc.extension : '';
|
|
21
|
+
this.clin = (lc && lc.clin) ? lc.clin : undefined;
|
|
22
|
+
this.slin = (lc && lc.slin) ? lc.slin : undefined;
|
|
23
|
+
this.location = (lc && lc.location) ? lc.location : undefined;
|
|
24
|
+
this.wbs = (lc && lc.wbs) ? lc.wbs : undefined;
|
|
25
|
+
this.minimumEmployees = (lc && lc.minimumEmployees) ? lc.minimumEmployees : undefined;
|
|
26
|
+
this.notAssignedName = (lc && lc.notAssignedName) ? lc.notAssignedName : undefined;
|
|
27
|
+
this.hoursPerEmployee = (lc && lc.hoursPerEmployee) ? lc.hoursPerEmployee : undefined;
|
|
28
|
+
this.exercise = (lc && lc.exercise) ? lc.exercise : undefined;
|
|
29
|
+
this.startDate = (lc && lc.startDate) ? lc.startDate : undefined;
|
|
30
|
+
this.endDate = (lc && lc.endDate) ? lc.endDate : undefined;
|
|
31
|
+
this.sort = (lc && lc.sort) ? lc.sort : 0;
|
|
32
|
+
}
|
|
33
|
+
compareTo(other) {
|
|
34
|
+
if (other) {
|
|
35
|
+
if (this.sort === other.sort) {
|
|
36
|
+
if (this.chargeNumber.toLowerCase() === other.chargeNumber.toLowerCase()) {
|
|
37
|
+
return (this.extension.toLowerCase() < other.extension.toLowerCase()) ? -1 : 1;
|
|
38
|
+
}
|
|
39
|
+
return (this.chargeNumber.toLowerCase() < other.chargeNumber.toLowerCase()) ? -1 : 1;
|
|
40
|
+
}
|
|
41
|
+
return (this.sort < other.sort) ? -1 : 1;
|
|
42
|
+
}
|
|
43
|
+
return -1;
|
|
44
|
+
}
|
|
45
|
+
inTimePeriod(start, end) {
|
|
46
|
+
if (this.startDate && this.endDate) {
|
|
47
|
+
return ((start.getTime() >= this.startDate.getTime()
|
|
48
|
+
&& start.getTime() <= this.endDate.getTime())
|
|
49
|
+
|| (end.getTime() >= this.startDate.getTime()
|
|
50
|
+
&& end.getTime() <= this.endDate.getTime()));
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.LaborCode = LaborCode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface IWorkcode {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
start: number;
|
|
5
|
+
shiftCode: string;
|
|
6
|
+
altcode?: string;
|
|
7
|
+
search?: string;
|
|
8
|
+
isLeave: boolean;
|
|
9
|
+
textcolor: string;
|
|
10
|
+
backcolor: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class Workcode implements IWorkcode {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
start: number;
|
|
16
|
+
shiftCode: string;
|
|
17
|
+
altcode?: string;
|
|
18
|
+
search?: string;
|
|
19
|
+
isLeave: boolean;
|
|
20
|
+
textcolor: string;
|
|
21
|
+
backcolor: string;
|
|
22
|
+
constructor(wc?: IWorkcode);
|
|
23
|
+
compareTo(other?: Workcode): number;
|
|
24
|
+
}
|
|
25
|
+
export interface CompareWorkCode {
|
|
26
|
+
code: string;
|
|
27
|
+
isLeave: boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Workcode = void 0;
|
|
4
|
+
class Workcode {
|
|
5
|
+
id;
|
|
6
|
+
title;
|
|
7
|
+
start;
|
|
8
|
+
shiftCode;
|
|
9
|
+
altcode;
|
|
10
|
+
search;
|
|
11
|
+
isLeave;
|
|
12
|
+
textcolor;
|
|
13
|
+
backcolor;
|
|
14
|
+
constructor(wc) {
|
|
15
|
+
this.id = (wc) ? wc.id : '';
|
|
16
|
+
this.title = (wc) ? wc.title : '';
|
|
17
|
+
this.start = (wc) ? wc.start : 7;
|
|
18
|
+
this.shiftCode = (wc) ? wc.shiftCode : '';
|
|
19
|
+
this.altcode = (wc && wc.altcode) ? wc.altcode : undefined;
|
|
20
|
+
this.search = (wc && wc.search) ? wc.search : undefined;
|
|
21
|
+
this.isLeave = (wc) ? wc.isLeave : false;
|
|
22
|
+
this.textcolor = (wc) ? wc.textcolor : '000000';
|
|
23
|
+
this.backcolor = (wc) ? wc.backcolor : 'ffffff';
|
|
24
|
+
}
|
|
25
|
+
compareTo(other) {
|
|
26
|
+
if (other) {
|
|
27
|
+
if (this.isLeave === other.isLeave) {
|
|
28
|
+
return (this.id < other.id) ? -1 : 1;
|
|
29
|
+
}
|
|
30
|
+
return (this.isLeave && !other.isLeave) ? -1 : 1;
|
|
31
|
+
}
|
|
32
|
+
return -1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Workcode = Workcode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './site';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./site"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Employee } from "../../employees";
|
|
2
|
+
import { Workcode } from "../../labor";
|
|
3
|
+
import { ISection, Section } from "./section";
|
|
4
|
+
/**
|
|
5
|
+
* This interface will define the data members associated with a CofS Report.
|
|
6
|
+
*/
|
|
7
|
+
export interface ICofSReport {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
shortname: string;
|
|
11
|
+
unit: string;
|
|
12
|
+
startdate: Date;
|
|
13
|
+
enddate: Date;
|
|
14
|
+
sections?: ISection[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This class implements the interface data members plus actions.
|
|
18
|
+
*/
|
|
19
|
+
export declare class CofSReport implements ICofSReport {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
shortname: string;
|
|
23
|
+
unit: string;
|
|
24
|
+
startdate: Date;
|
|
25
|
+
enddate: Date;
|
|
26
|
+
sections: Section[];
|
|
27
|
+
constructor(rpt?: ICofSReport);
|
|
28
|
+
compareTo(other?: CofSReport): number;
|
|
29
|
+
use(start: Date, end: Date): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* This function will create an XML file from a CofS Report description.
|
|
32
|
+
* @param start The date object used for the start of the report period.
|
|
33
|
+
* @param end The date object used to signify the end of the period, but not included
|
|
34
|
+
* in the report (1st day of next month).
|
|
35
|
+
* @param workcodes The list of work codes used to signify shift or leave.
|
|
36
|
+
* @param employees The list of possible employees used in this report. Usually a list
|
|
37
|
+
* of the site's employees.
|
|
38
|
+
* @returns A File object for the XML data.
|
|
39
|
+
*/
|
|
40
|
+
create(start: Date, end: Date, workcodes: Map<string, Workcode>, employees: Employee[]): File;
|
|
41
|
+
}
|