scheduler-node-models 1.0.81 → 1.0.85
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 +4 -0
- package/general/index.js +20 -0
- package/general/report.d.ts +12 -0
- package/general/report.js +70 -0
- package/general/reportStyle.d.ts +0 -0
- package/general/reportStyle.js +1 -0
- package/general/viewstate.d.ts +5 -0
- package/general/viewstate.js +9 -0
- package/index.d.ts +0 -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/reports/drawSummary.d.ts +24 -0
- package/metrics/reports/drawSummary.js +311 -0
- package/metrics/reports/index.d.ts +5 -0
- package/metrics/reports/index.js +21 -0
- package/metrics/reports/missionDay.d.ts +8 -0
- package/metrics/reports/missionDay.js +23 -0
- package/metrics/reports/missionSummary.d.ts +25 -0
- package/metrics/reports/missionSummary.js +421 -0
- package/metrics/reports/missionType.d.ts +20 -0
- package/metrics/reports/missionType.js +314 -0
- package/metrics/reports/outageDay.d.ts +8 -0
- package/metrics/reports/outageDay.js +23 -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 +3 -18
- 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 +420 -0
- package/scheduler/employees/employee.js +1862 -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/reports/chargeStatus.d.ts +66 -0
- package/scheduler/reports/chargeStatus.js +702 -0
- package/scheduler/reports/cofsReports.d.ts +11 -0
- package/scheduler/reports/cofsReports.js +36 -0
- package/scheduler/reports/enterpriseSchedule.d.ts +18 -0
- package/scheduler/reports/enterpriseSchedule.js +159 -0
- package/scheduler/reports/index.d.ts +4 -0
- package/scheduler/reports/index.js +20 -0
- package/scheduler/reports/scheduleReport.d.ts +17 -0
- package/scheduler/reports/scheduleReport.js +311 -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 +174 -0
- package/scheduler/sites/site.d.ts +39 -0
- package/scheduler/sites/site.js +61 -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 +55 -0
- package/scheduler/teams/company/holiday.js +108 -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/user.d.ts +130 -0
- package/users/user.js +254 -0
- package/users/web.d.ts +22 -0
- package/users/web.js +2 -0
@@ -0,0 +1,226 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.LeaveRequest = exports.LeaveRequestComment = void 0;
|
4
|
+
const leave_1 = require("./leave");
|
5
|
+
/**
|
6
|
+
* The class description for a comment to a leave request. The data members are:
|
7
|
+
* comment date (date object for the date the comment was written on.)
|
8
|
+
* comment (the string value for the actual comment to the request)
|
9
|
+
*/
|
10
|
+
class LeaveRequestComment {
|
11
|
+
commentdate;
|
12
|
+
comment;
|
13
|
+
constructor(cmt) {
|
14
|
+
this.commentdate = (cmt) ? new Date(cmt.commentdate) : new Date();
|
15
|
+
this.comment = (cmt) ? cmt.comment : '';
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* This function is used to sort the comments by date.
|
19
|
+
* @param other The comment object used in comparison.
|
20
|
+
* @returns
|
21
|
+
|
22
|
+
/**
|
23
|
+
* This function is used to sort this object from another variation object
|
24
|
+
* @param other The other variation object for comparison
|
25
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
26
|
+
* object. -1 is before or 1 for after.
|
27
|
+
*/
|
28
|
+
compareTo(other) {
|
29
|
+
if (other) {
|
30
|
+
return this.commentdate.getTime() < other.commentdate.getTime() ? -1 : 1;
|
31
|
+
}
|
32
|
+
return -1;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
exports.LeaveRequestComment = LeaveRequestComment;
|
36
|
+
/**
|
37
|
+
* This class describes a leave request object. The data members are:
|
38
|
+
* id (string value representing a mongo db object identifier)
|
39
|
+
* employeeid (string value representing a mongo db object identifier for the employee)
|
40
|
+
* requestdate (the date object for the date the request was created)
|
41
|
+
* primarycode (string value for the leave code used the most in the request)
|
42
|
+
* startdate (the date object used to define the begining of the leave period)
|
43
|
+
* enddate (the date object used to define the end of the leave period)
|
44
|
+
* status (the string value for the step the request is in the approval process. The
|
45
|
+
* available statuses are DRAFT, REQUESTED, APPROVED)
|
46
|
+
* approvedby (the string value representing the object id of the supervisor approving
|
47
|
+
* the request)
|
48
|
+
* approvaldate (the date object for the date the request was approved)
|
49
|
+
* requesteddays (the list of proposed leave days within the period)
|
50
|
+
* comments (the list of comments to this request)
|
51
|
+
*/
|
52
|
+
class LeaveRequest {
|
53
|
+
id;
|
54
|
+
employeeid;
|
55
|
+
requestdate;
|
56
|
+
primarycode;
|
57
|
+
startdate;
|
58
|
+
enddate;
|
59
|
+
status;
|
60
|
+
approvedby;
|
61
|
+
approvalDate;
|
62
|
+
requesteddays;
|
63
|
+
comments;
|
64
|
+
constructor(req) {
|
65
|
+
this.id = (req) ? req.id : '';
|
66
|
+
this.employeeid = (req) ? req.employeeid : '';
|
67
|
+
this.requestdate = (req) ? new Date(req.requestdate) : new Date();
|
68
|
+
this.primarycode = (req) ? req.primarycode : 'V';
|
69
|
+
this.startdate = (req) ? new Date(req.startdate) : new Date();
|
70
|
+
this.enddate = (req) ? new Date(req.enddate) : new Date();
|
71
|
+
this.status = (req) ? req.status : 'REQUESTED';
|
72
|
+
this.approvedby = (req) ? req.approvedby : '';
|
73
|
+
this.approvalDate = (req) ? new Date(req.approvalDate) : new Date(0);
|
74
|
+
this.requesteddays = [];
|
75
|
+
if (req && req.requesteddays && req.requesteddays.length > 0) {
|
76
|
+
req.requesteddays.forEach(day => {
|
77
|
+
this.requesteddays.push(new leave_1.Leave(day));
|
78
|
+
});
|
79
|
+
this.requesteddays.sort((a, b) => a.compareTo(b));
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
const first = new Date(Date.UTC(this.startdate.getFullYear(), this.startdate.getMonth(), this.startdate.getDate()));
|
83
|
+
const leave = new leave_1.Leave();
|
84
|
+
leave.leavedate = first;
|
85
|
+
leave.code = 'V';
|
86
|
+
leave.requestid = this.id;
|
87
|
+
this.requesteddays.push(leave);
|
88
|
+
}
|
89
|
+
this.comments = [];
|
90
|
+
if (req && req.comments && req.comments.length > 0) {
|
91
|
+
req.comments.forEach(cmt => {
|
92
|
+
this.comments?.push(new LeaveRequestComment(cmt));
|
93
|
+
});
|
94
|
+
this.comments.sort((a, b) => a.compareTo(b));
|
95
|
+
}
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* this function is used to sort this request from another. They are sorted based on
|
99
|
+
* start, end and request dates.
|
100
|
+
* @param other The request object used for comparison.
|
101
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
102
|
+
* object. -1 is before or 1 for after.
|
103
|
+
*/
|
104
|
+
compareTo(other) {
|
105
|
+
if (other) {
|
106
|
+
if (this.startdate.getTime() === other.startdate.getTime()) {
|
107
|
+
if (this.enddate.getTime() === other.enddate.getTime()) {
|
108
|
+
return (this.requestdate.getTime() < other.requestdate.getTime()) ? -1 : 1;
|
109
|
+
}
|
110
|
+
return (this.enddate.getTime() < other.enddate.getTime()) ? -1 : 1;
|
111
|
+
}
|
112
|
+
return (this.startdate.getTime() < other.startdate.getTime()) ? -1 : 1;
|
113
|
+
}
|
114
|
+
return -1;
|
115
|
+
}
|
116
|
+
useRequest(id) {
|
117
|
+
return this.id.toLowerCase() === id.toLowerCase();
|
118
|
+
}
|
119
|
+
/**
|
120
|
+
* This function is used to replace a value on a single proposed leave day.
|
121
|
+
* @param date The date object used to find which leave day to update
|
122
|
+
* @param field The string value for which field in the leave day to update.
|
123
|
+
* @param value The string value for the change. If can me a string value of a number
|
124
|
+
* or boolean value.
|
125
|
+
*/
|
126
|
+
updateLeaveDay(date, field, value) {
|
127
|
+
let lDate = new Date(date);
|
128
|
+
lDate = new Date(Date.UTC(lDate.getUTCFullYear(), lDate.getUTCMonth(), lDate.getUTCDate()));
|
129
|
+
for (let d = 0; d < this.requesteddays.length; d++) {
|
130
|
+
const lv = this.requesteddays[d];
|
131
|
+
if (lv.useLeave(lDate)) {
|
132
|
+
switch (field.toLowerCase()) {
|
133
|
+
case "code":
|
134
|
+
lv.code = value;
|
135
|
+
break;
|
136
|
+
case "hours":
|
137
|
+
lv.hours = Number(value);
|
138
|
+
break;
|
139
|
+
case "status":
|
140
|
+
lv.status = value;
|
141
|
+
break;
|
142
|
+
case "used":
|
143
|
+
lv.used = Boolean(value);
|
144
|
+
break;
|
145
|
+
case "tag":
|
146
|
+
case "tagday":
|
147
|
+
lv.tagday = value;
|
148
|
+
break;
|
149
|
+
}
|
150
|
+
this.requesteddays[d] = lv;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
/**
|
155
|
+
* This function is used to set up leave days in the request object based on the
|
156
|
+
* period and whether or not the employee normally works the day.
|
157
|
+
* @param emp This a reference to the employee object where this request resides and
|
158
|
+
* is used to determine if the employee normally works on that day.
|
159
|
+
*/
|
160
|
+
setLeaveDays(emp, reset = false) {
|
161
|
+
let start = new Date(Date.UTC(this.startdate.getFullYear(), this.startdate.getMonth(), this.startdate.getDate()));
|
162
|
+
const olddays = [];
|
163
|
+
this.requesteddays.forEach(lv => {
|
164
|
+
olddays.push(new leave_1.Leave(lv));
|
165
|
+
});
|
166
|
+
this.requesteddays = [];
|
167
|
+
let count = -1;
|
168
|
+
while (start.getTime() < this.enddate.getTime()) {
|
169
|
+
const wd = emp.getWorkday(start);
|
170
|
+
let leave = undefined;
|
171
|
+
if (wd && wd.code !== '') {
|
172
|
+
if (this.primarycode.toLowerCase() === 'mod') {
|
173
|
+
leave = new leave_1.Leave({
|
174
|
+
id: count++,
|
175
|
+
leavedate: new Date(start),
|
176
|
+
code: wd.code,
|
177
|
+
hours: wd.hours,
|
178
|
+
status: 'REQUESTED',
|
179
|
+
requestid: this.id,
|
180
|
+
used: false
|
181
|
+
});
|
182
|
+
}
|
183
|
+
else {
|
184
|
+
let stdHours = emp.getStandardWorkday(start);
|
185
|
+
if (this.primarycode.toLowerCase() === 'h') {
|
186
|
+
stdHours = 8.0;
|
187
|
+
}
|
188
|
+
leave = new leave_1.Leave({
|
189
|
+
id: count++,
|
190
|
+
leavedate: new Date(start),
|
191
|
+
code: this.primarycode,
|
192
|
+
hours: stdHours,
|
193
|
+
status: 'REQUESTED',
|
194
|
+
requestid: this.id,
|
195
|
+
used: false
|
196
|
+
});
|
197
|
+
}
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
leave = new leave_1.Leave({
|
201
|
+
id: count++,
|
202
|
+
leavedate: new Date(start),
|
203
|
+
code: '',
|
204
|
+
hours: 0.0,
|
205
|
+
status: 'REQUESTED',
|
206
|
+
requestid: this.id,
|
207
|
+
used: false
|
208
|
+
});
|
209
|
+
}
|
210
|
+
if (!reset) {
|
211
|
+
olddays.forEach(olv => {
|
212
|
+
if (olv.useLeave(start)) {
|
213
|
+
leave.code = olv.code;
|
214
|
+
leave.hours = olv.hours;
|
215
|
+
leave.status = this.status;
|
216
|
+
leave.tagday = olv.tagday;
|
217
|
+
}
|
218
|
+
});
|
219
|
+
}
|
220
|
+
this.requesteddays.push(leave);
|
221
|
+
start = new Date(start.getTime() + (24 * 3600000));
|
222
|
+
}
|
223
|
+
this.requesteddays.sort((a, b) => a.compareTo(b));
|
224
|
+
}
|
225
|
+
}
|
226
|
+
exports.LeaveRequest = LeaveRequest;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/**
|
2
|
+
* This interface and class is for recording the employee's work specialities or the
|
3
|
+
* skills they have from the team's specialty list.
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* This interface is used to describe a user's specialties.
|
7
|
+
*/
|
8
|
+
export interface ISpecialty {
|
9
|
+
id: number;
|
10
|
+
specialtyid: number;
|
11
|
+
sort: number;
|
12
|
+
qualified: boolean;
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* This class is used to describe the relationship of the employee's specialties to the
|
16
|
+
* team's specialties list. The data members are:
|
17
|
+
* id (numeric value for the key to the relationship list)
|
18
|
+
* specialtyid (numeric value in reference to the team's specialty list)
|
19
|
+
* sort (numeric value used to sort the display of the specialties)
|
20
|
+
* qualified (boolean value to show whether or not the employee is qualfied)
|
21
|
+
*/
|
22
|
+
export declare class Specialty implements ISpecialty {
|
23
|
+
id: number;
|
24
|
+
specialtyid: number;
|
25
|
+
sort: number;
|
26
|
+
qualified: boolean;
|
27
|
+
constructor(sp?: ISpecialty);
|
28
|
+
/**
|
29
|
+
* This function is used to sort this object from another specialty object
|
30
|
+
* @param other The other specialty object for comparison
|
31
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
32
|
+
* object. -1 is before or 1 for after.
|
33
|
+
*/
|
34
|
+
compareTo(other?: Specialty): number;
|
35
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
/**
|
3
|
+
* This interface and class is for recording the employee's work specialities or the
|
4
|
+
* skills they have from the team's specialty list.
|
5
|
+
*/
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
+
exports.Specialty = void 0;
|
8
|
+
/**
|
9
|
+
* This class is used to describe the relationship of the employee's specialties to the
|
10
|
+
* team's specialties list. The data members are:
|
11
|
+
* id (numeric value for the key to the relationship list)
|
12
|
+
* specialtyid (numeric value in reference to the team's specialty list)
|
13
|
+
* sort (numeric value used to sort the display of the specialties)
|
14
|
+
* qualified (boolean value to show whether or not the employee is qualfied)
|
15
|
+
*/
|
16
|
+
class Specialty {
|
17
|
+
id;
|
18
|
+
specialtyid;
|
19
|
+
sort;
|
20
|
+
qualified;
|
21
|
+
constructor(sp) {
|
22
|
+
this.id = (sp) ? sp.id : 0;
|
23
|
+
this.specialtyid = (sp) ? sp.specialtyid : 0;
|
24
|
+
this.sort = (sp) ? sp.sort : 0;
|
25
|
+
this.qualified = (sp) ? sp.qualified : false;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* This function is used to sort this object from another specialty object
|
29
|
+
* @param other The other specialty object for comparison
|
30
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
31
|
+
* object. -1 is before or 1 for after.
|
32
|
+
*/
|
33
|
+
compareTo(other) {
|
34
|
+
if (other) {
|
35
|
+
return this.sort < other.sort ? -1 : 1;
|
36
|
+
}
|
37
|
+
return -1;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.Specialty = Specialty;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { ISchedule, Schedule, Workday } from "./workday";
|
2
|
+
/**
|
3
|
+
* This interface provides the basis for a variation (a small change to an employee's
|
4
|
+
* assignment and schedule)
|
5
|
+
*/
|
6
|
+
export interface IVariation {
|
7
|
+
id: number;
|
8
|
+
site: string;
|
9
|
+
mids: boolean;
|
10
|
+
mod: boolean;
|
11
|
+
startdate: Date;
|
12
|
+
enddate: Date;
|
13
|
+
schedule: ISchedule;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* This class description is for a schedule variation. A schedule variation is used
|
17
|
+
* for a small change in an employee's schedule, one that will revert back to the primary
|
18
|
+
* schedule after the change period is complete. The data members are:
|
19
|
+
* id (numeric value for the primary key)
|
20
|
+
* site (the string value for the site the employee is assigned)
|
21
|
+
* mids (A boolean value for variations is associated with a temporary mid shift assignment)
|
22
|
+
* startdate (a date object for the start of the variation period)
|
23
|
+
* enddate (a date object for the end of the variation period)
|
24
|
+
* schedule (a schedule object containing a group of workday objects which is used to
|
25
|
+
* define the days of the variation).
|
26
|
+
*/
|
27
|
+
export declare class Variation implements IVariation {
|
28
|
+
id: number;
|
29
|
+
site: string;
|
30
|
+
mids: boolean;
|
31
|
+
mod: boolean;
|
32
|
+
startdate: Date;
|
33
|
+
enddate: Date;
|
34
|
+
schedule: Schedule;
|
35
|
+
constructor(vari: IVariation);
|
36
|
+
/**
|
37
|
+
* This function is used to sort this object from another variation object
|
38
|
+
* @param other The other variation object for comparison
|
39
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
40
|
+
* object. -1 is before or 1 for after.
|
41
|
+
*/
|
42
|
+
compareTo(other?: Variation): number;
|
43
|
+
/**
|
44
|
+
* This function is used to determine if the variation is usable on a particular
|
45
|
+
* date.
|
46
|
+
* @param date The date object used to compare for use.
|
47
|
+
* @returns a boolean value if the date fits within the variation's period.
|
48
|
+
*/
|
49
|
+
useVariation(date: Date): boolean;
|
50
|
+
/**
|
51
|
+
* This function will update the variation's schedule with the days from the sunday
|
52
|
+
* prior to start and the saturday after the end date.
|
53
|
+
*/
|
54
|
+
setScheduleDays(): void;
|
55
|
+
/**
|
56
|
+
* This function is used to find the workday object from the variation's schedule for
|
57
|
+
* the date requested. The workday is found by the number of days since the sunday
|
58
|
+
* prior to the start date.
|
59
|
+
* @param date The date object used to determine the workday.
|
60
|
+
* @returns The workday object representing the requested workday.
|
61
|
+
*/
|
62
|
+
getWorkday(date: Date): Workday;
|
63
|
+
/**
|
64
|
+
* This function will set the workday's values from the client app where they are set.
|
65
|
+
* @param wdID The numeric value for the identifier of the particular workday.
|
66
|
+
* @param wkctr The string value representing the workcenter.
|
67
|
+
* @param code The string value for the work code to use on the day.
|
68
|
+
* @param hours The numeric value (float) for the number of hours to work on that day.
|
69
|
+
*/
|
70
|
+
updateWorkday(wdID: number, wkctr: string, code: string, hours: number): void;
|
71
|
+
/**
|
72
|
+
* This function will set the workday's values from the client app the day of the
|
73
|
+
* schedule from a date.
|
74
|
+
* @param date The date object for the date of the workday.
|
75
|
+
* @param wkctr The string value representing the workcenter.
|
76
|
+
* @param code The string value for the work code to use on the day.
|
77
|
+
* @param hours The numeric value (float) for the number of hours to work on that day.
|
78
|
+
*/
|
79
|
+
updateWorkdayByDate(date: Date, wkctr: string, code: string, hours: number): void;
|
80
|
+
}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Variation = void 0;
|
4
|
+
const workday_1 = require("./workday");
|
5
|
+
/**
|
6
|
+
* This class description is for a schedule variation. A schedule variation is used
|
7
|
+
* for a small change in an employee's schedule, one that will revert back to the primary
|
8
|
+
* schedule after the change period is complete. The data members are:
|
9
|
+
* id (numeric value for the primary key)
|
10
|
+
* site (the string value for the site the employee is assigned)
|
11
|
+
* mids (A boolean value for variations is associated with a temporary mid shift assignment)
|
12
|
+
* startdate (a date object for the start of the variation period)
|
13
|
+
* enddate (a date object for the end of the variation period)
|
14
|
+
* schedule (a schedule object containing a group of workday objects which is used to
|
15
|
+
* define the days of the variation).
|
16
|
+
*/
|
17
|
+
class Variation {
|
18
|
+
id;
|
19
|
+
site;
|
20
|
+
mids;
|
21
|
+
mod;
|
22
|
+
startdate;
|
23
|
+
enddate;
|
24
|
+
schedule;
|
25
|
+
constructor(vari) {
|
26
|
+
this.id = (vari) ? vari.id : 0;
|
27
|
+
this.site = (vari) ? vari.site : '';
|
28
|
+
this.mids = (vari) ? vari.mids : false;
|
29
|
+
this.mod = (vari) ? vari.mod : false;
|
30
|
+
this.startdate = (vari) ? new Date(vari.startdate) : new Date();
|
31
|
+
this.enddate = (vari) ? new Date(vari.enddate) : new Date();
|
32
|
+
this.schedule = (vari) ? new workday_1.Schedule(vari.schedule)
|
33
|
+
: new workday_1.Schedule();
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* This function is used to sort this object from another variation object
|
37
|
+
* @param other The other variation object for comparison
|
38
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
39
|
+
* object. -1 is before or 1 for after.
|
40
|
+
*/
|
41
|
+
compareTo(other) {
|
42
|
+
if (other) {
|
43
|
+
if (this.startdate.getTime() === other.startdate.getTime()) {
|
44
|
+
if (this.enddate.getTime() === other.enddate.getTime()) {
|
45
|
+
return (this.id < other.id) ? -1 : 1;
|
46
|
+
}
|
47
|
+
return (this.enddate.getTime() < other.enddate.getTime()) ? -1 : 1;
|
48
|
+
}
|
49
|
+
return (this.startdate.getTime() < other.startdate.getTime()) ? -1 : 1;
|
50
|
+
}
|
51
|
+
return -1;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* This function is used to determine if the variation is usable on a particular
|
55
|
+
* date.
|
56
|
+
* @param date The date object used to compare for use.
|
57
|
+
* @returns a boolean value if the date fits within the variation's period.
|
58
|
+
*/
|
59
|
+
useVariation(date) {
|
60
|
+
return (this.startdate.getTime() <= date.getTime()
|
61
|
+
&& this.enddate.getTime() >= date.getTime());
|
62
|
+
}
|
63
|
+
/**
|
64
|
+
* This function will update the variation's schedule with the days from the sunday
|
65
|
+
* prior to start and the saturday after the end date.
|
66
|
+
*/
|
67
|
+
setScheduleDays() {
|
68
|
+
let start = new Date(this.startdate);
|
69
|
+
while (start.getUTCDay() !== 0) {
|
70
|
+
start = new Date(start.getTime() - (24 * 3600000));
|
71
|
+
}
|
72
|
+
let end = new Date(this.enddate);
|
73
|
+
while (end.getUTCDay() !== 6) {
|
74
|
+
end = new Date(end.getTime() + (24 * 3600000));
|
75
|
+
}
|
76
|
+
this.schedule.workdays = [];
|
77
|
+
let count = -1;
|
78
|
+
while (start.getTime() <= end.getTime()) {
|
79
|
+
count++;
|
80
|
+
const wd = new workday_1.Workday();
|
81
|
+
wd.id = count;
|
82
|
+
this.schedule.workdays.push(wd);
|
83
|
+
start = new Date(start.getTime() + (24 * 3600000));
|
84
|
+
}
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* This function is used to find the workday object from the variation's schedule for
|
88
|
+
* the date requested. The workday is found by the number of days since the sunday
|
89
|
+
* prior to the start date.
|
90
|
+
* @param date The date object used to determine the workday.
|
91
|
+
* @returns The workday object representing the requested workday.
|
92
|
+
*/
|
93
|
+
getWorkday(date) {
|
94
|
+
let start = new Date(this.startdate);
|
95
|
+
while (start.getUTCDay() !== 0) {
|
96
|
+
start = new Date(start.getTime() - (24 * 3600000));
|
97
|
+
}
|
98
|
+
const days = Math.floor((date.getTime() - start.getTime()) / (24 * 3600000));
|
99
|
+
const iDay = days % this.schedule.workdays.length;
|
100
|
+
return this.schedule.getWorkday(iDay);
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* This function will set the workday's values from the client app where they are set.
|
104
|
+
* @param wdID The numeric value for the identifier of the particular workday.
|
105
|
+
* @param wkctr The string value representing the workcenter.
|
106
|
+
* @param code The string value for the work code to use on the day.
|
107
|
+
* @param hours The numeric value (float) for the number of hours to work on that day.
|
108
|
+
*/
|
109
|
+
updateWorkday(wdID, wkctr, code, hours) {
|
110
|
+
this.schedule.changeWorkday(wdID, wkctr, code, hours);
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* This function will set the workday's values from the client app the day of the
|
114
|
+
* schedule from a date.
|
115
|
+
* @param date The date object for the date of the workday.
|
116
|
+
* @param wkctr The string value representing the workcenter.
|
117
|
+
* @param code The string value for the work code to use on the day.
|
118
|
+
* @param hours The numeric value (float) for the number of hours to work on that day.
|
119
|
+
*/
|
120
|
+
updateWorkdayByDate(date, wkctr, code, hours) {
|
121
|
+
if (date.getTime() >= this.startdate.getTime()
|
122
|
+
&& date.getTime() <= this.enddate.getTime()) {
|
123
|
+
let start = new Date(this.startdate);
|
124
|
+
while (start.getDay() !== 0) {
|
125
|
+
start = new Date(start.getTime() - (24 * 3600000));
|
126
|
+
}
|
127
|
+
const dos = Math.floor((date.getTime() - start.getTime()) / (24 * 3600000));
|
128
|
+
this.schedule.changeWorkday(dos, wkctr, code, hours);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
exports.Variation = Variation;
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { ObjectId } from "mongodb";
|
2
|
+
/**
|
3
|
+
* Work interface and class descriptions
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* The work interface describing the data members required.
|
7
|
+
*/
|
8
|
+
export interface IWork {
|
9
|
+
dateworked: Date;
|
10
|
+
chargenumber: string;
|
11
|
+
extension: string;
|
12
|
+
paycode: number;
|
13
|
+
modtime?: boolean;
|
14
|
+
hours: number;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* This class description for a work object. The data members are:
|
18
|
+
* date worked (date object for the date the work record),
|
19
|
+
* charge number (string value for the labor code's charge number),
|
20
|
+
* extension (string value for the labor code's extension),
|
21
|
+
* paycode (numeric value for the pay code used by the company),
|
22
|
+
* modtime (boolean value to indicate if the recorded information is for modified time),
|
23
|
+
* hours (numeric value for the number of hours worked for the labor code)
|
24
|
+
*/
|
25
|
+
export declare class Work implements IWork {
|
26
|
+
dateworked: Date;
|
27
|
+
chargenumber: string;
|
28
|
+
extension: string;
|
29
|
+
paycode: number;
|
30
|
+
modtime: boolean;
|
31
|
+
hours: number;
|
32
|
+
constructor(wk?: IWork);
|
33
|
+
/**
|
34
|
+
* This function is used in sorting work objects. Based on date worked and the labor
|
35
|
+
* code.
|
36
|
+
* @param other The work object to use in comparison
|
37
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
38
|
+
* object. -1 is before or 1 for after.
|
39
|
+
*/
|
40
|
+
compareTo(other?: Work): number;
|
41
|
+
/**
|
42
|
+
* This function is used to compare this object's date worked with a date provided.
|
43
|
+
* @param date A date object used for comparison.
|
44
|
+
* @returns A boolean value to indicate whether the work object is on the date provided.
|
45
|
+
*/
|
46
|
+
useWork(date: Date): boolean;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* The interface and class for holding work objects for an employee and year.
|
50
|
+
*/
|
51
|
+
/**
|
52
|
+
* This interface describes the data members of a Work Record.
|
53
|
+
*/
|
54
|
+
export interface IWorkRecord {
|
55
|
+
_id?: ObjectId;
|
56
|
+
id?: string;
|
57
|
+
employeeID?: ObjectId;
|
58
|
+
empID?: string;
|
59
|
+
year: number;
|
60
|
+
work?: IWork[];
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* This class description for the employee's yearly work record. The data members are:
|
64
|
+
* id (string value representing the database's _id value - primary key)
|
65
|
+
* empID (string value for the associated employee's identifier)
|
66
|
+
* year (numeric value for the year associated with the work records)
|
67
|
+
* work (an array of work objects containing all the actual work performed)
|
68
|
+
*/
|
69
|
+
export declare class WorkRecord implements IWorkRecord {
|
70
|
+
id: string;
|
71
|
+
empID: string;
|
72
|
+
year: number;
|
73
|
+
work: Work[];
|
74
|
+
constructor(wr?: IWorkRecord);
|
75
|
+
/**
|
76
|
+
* This function is used in sorting these annual work records. Based on employee
|
77
|
+
* identifier and year.
|
78
|
+
* @param other The annual work record used for comparison.
|
79
|
+
* @returns A numeric value to indicate whether this object is before or after the other
|
80
|
+
* object. -1 is before or 1 for after.
|
81
|
+
*/
|
82
|
+
compareTo(other?: WorkRecord): number;
|
83
|
+
/**
|
84
|
+
* This function will remove work objects from this object's work array based on the
|
85
|
+
* period defined by the start and end dates.
|
86
|
+
* @param start The date object for the start of the removal period
|
87
|
+
* @param end The date object for the end of the removal period
|
88
|
+
*/
|
89
|
+
removeWork(start: Date, end: Date): void;
|
90
|
+
/**
|
91
|
+
* This function will remove work objects from this object's work array
|
92
|
+
* @param purgeDate The date object to remove all data before it.
|
93
|
+
* @returns A boolean value to indicate whether or not the work array is empty.
|
94
|
+
*/
|
95
|
+
purge(purgeDate: Date): boolean;
|
96
|
+
}
|