scheduler-models 1.4.13 → 1.4.15
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.
|
@@ -19,6 +19,7 @@ class Employee {
|
|
|
19
19
|
team;
|
|
20
20
|
site;
|
|
21
21
|
email;
|
|
22
|
+
user;
|
|
22
23
|
name;
|
|
23
24
|
companyinfo;
|
|
24
25
|
assignments;
|
|
@@ -28,7 +29,6 @@ class Employee {
|
|
|
28
29
|
requests;
|
|
29
30
|
laborCodes;
|
|
30
31
|
work;
|
|
31
|
-
user;
|
|
32
32
|
contactinfo;
|
|
33
33
|
specialties;
|
|
34
34
|
emails;
|
|
@@ -40,8 +40,8 @@ class Employee {
|
|
|
40
40
|
}
|
|
41
41
|
this.team = (emp) ? emp.team : '';
|
|
42
42
|
this.site = (emp) ? emp.site : '';
|
|
43
|
-
this.email = (emp
|
|
44
|
-
this.name = (emp
|
|
43
|
+
this.email = (emp) ? emp.email : '';
|
|
44
|
+
this.name = (emp) ? new employeename_1.EmployeeName(emp.name) : new employeename_1.EmployeeName();
|
|
45
45
|
this.companyinfo = (emp) ? emp.companyinfo : { company: '', employeeid: '' };
|
|
46
46
|
this.assignments = [];
|
|
47
47
|
if (emp && emp.assignments && emp.assignments.length > 0) {
|
|
@@ -64,21 +64,17 @@ class Employee {
|
|
|
64
64
|
});
|
|
65
65
|
this.balances.sort((a, b) => a.compareTo(b));
|
|
66
66
|
}
|
|
67
|
+
this.leaves = [];
|
|
67
68
|
if (emp && emp.leaves && emp.leaves.length > 0) {
|
|
68
|
-
this.leaves = [];
|
|
69
69
|
emp.leaves.forEach(l => {
|
|
70
|
-
|
|
71
|
-
this.leaves.push(new leave_1.Leave(l));
|
|
72
|
-
}
|
|
70
|
+
this.leaves.push(new leave_1.Leave(l));
|
|
73
71
|
});
|
|
74
72
|
this.leaves.sort((a, b) => a.compareTo(b));
|
|
75
73
|
}
|
|
74
|
+
this.requests = [];
|
|
76
75
|
if (emp && emp.requests && emp.requests.length > 0) {
|
|
77
|
-
this.requests = [];
|
|
78
76
|
emp.requests.forEach(r => {
|
|
79
|
-
|
|
80
|
-
this.requests.push(new leaverequest_1.LeaveRequest(r));
|
|
81
|
-
}
|
|
77
|
+
this.requests.push(new leaverequest_1.LeaveRequest(r));
|
|
82
78
|
});
|
|
83
79
|
this.requests.sort((a, b) => a.compareTo(b));
|
|
84
80
|
}
|
|
@@ -103,12 +99,10 @@ class Employee {
|
|
|
103
99
|
});
|
|
104
100
|
this.specialties.sort((a, b) => a.compareTo(b));
|
|
105
101
|
}
|
|
102
|
+
this.emails = [];
|
|
106
103
|
if (emp && emp.emails && emp.emails.length > 0) {
|
|
107
|
-
this.emails = [];
|
|
108
104
|
emp.emails.forEach(e => {
|
|
109
|
-
|
|
110
|
-
this.emails.push(e);
|
|
111
|
-
}
|
|
105
|
+
this.emails.push(e);
|
|
112
106
|
});
|
|
113
107
|
this.emails.sort((a, b) => (a < b) ? -1 : 1);
|
|
114
108
|
}
|
|
@@ -131,29 +125,21 @@ class Employee {
|
|
|
131
125
|
}
|
|
132
126
|
compareTo(other) {
|
|
133
127
|
if (other) {
|
|
134
|
-
if (this.
|
|
135
|
-
if (this.
|
|
136
|
-
if (this.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return 1;
|
|
145
|
-
}
|
|
128
|
+
if (this.name.lastname === other.name.lastname) {
|
|
129
|
+
if (this.name.firstname === other.name.firstname) {
|
|
130
|
+
if (this.name.middlename && other.name.middlename) {
|
|
131
|
+
return (this.name.middlename < other.name.middlename) ? -1 : 1;
|
|
132
|
+
}
|
|
133
|
+
else if (this.name.middlename) {
|
|
134
|
+
return -1;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return 1;
|
|
146
138
|
}
|
|
147
|
-
return (this.user.firstName < other.user.firstName) ? -1 : 1;
|
|
148
139
|
}
|
|
149
|
-
return (this.
|
|
150
|
-
}
|
|
151
|
-
if (!this.user) {
|
|
152
|
-
return 1;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
return -1;
|
|
140
|
+
return (this.name.firstname < other.name.firstname) ? -1 : 1;
|
|
156
141
|
}
|
|
142
|
+
return (this.name.lastname < other.name.lastname) ? -1 : 1;
|
|
157
143
|
}
|
|
158
144
|
return -1;
|
|
159
145
|
}
|
|
@@ -161,8 +147,6 @@ class Employee {
|
|
|
161
147
|
const result = new Employee(this);
|
|
162
148
|
result.work = undefined;
|
|
163
149
|
result.user = undefined;
|
|
164
|
-
result.leaves = undefined;
|
|
165
|
-
result.requests = undefined;
|
|
166
150
|
return result;
|
|
167
151
|
}
|
|
168
152
|
purge(date) {
|
|
@@ -172,19 +156,15 @@ class Employee {
|
|
|
172
156
|
this.variations.splice(v, 1);
|
|
173
157
|
}
|
|
174
158
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this.leaves.splice(l, 1);
|
|
180
|
-
}
|
|
159
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
160
|
+
for (let l = this.leaves.length - 1; l >= 0; l--) {
|
|
161
|
+
if (this.leaves[l].leavedate.getTime() < date.getTime()) {
|
|
162
|
+
this.leaves.splice(l, 1);
|
|
181
163
|
}
|
|
182
164
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.requests.splice(l, 1);
|
|
187
|
-
}
|
|
165
|
+
for (let l = this.requests.length - 1; l >= 0; l--) {
|
|
166
|
+
if (this.requests[l].enddate.getTime() < date.getTime()) {
|
|
167
|
+
this.requests.splice(l, 1);
|
|
188
168
|
}
|
|
189
169
|
}
|
|
190
170
|
this.balances.sort((a, b) => a.compareTo(b));
|
|
@@ -198,36 +178,34 @@ class Employee {
|
|
|
198
178
|
return (last.endDate.getTime() < date.getTime());
|
|
199
179
|
}
|
|
200
180
|
removeLeaves(start, end, reqID = '', includeActuals = true) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
this.leaves.splice(l, 1);
|
|
208
|
-
}
|
|
181
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
182
|
+
for (let l = this.leaves.length - 1; l >= 0; l--) {
|
|
183
|
+
if (reqID === '' && includeActuals) {
|
|
184
|
+
if (this.leaves[l].leavedate.getTime() >= start.getTime()
|
|
185
|
+
&& this.leaves[l].leavedate.getTime() <= end.getTime()) {
|
|
186
|
+
this.leaves.splice(l, 1);
|
|
209
187
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
188
|
+
}
|
|
189
|
+
else if (reqID !== '' && includeActuals) {
|
|
190
|
+
if (this.leaves[l].leavedate.getTime() >= start.getTime()
|
|
191
|
+
&& this.leaves[l].leavedate.getTime() <= end.getTime()
|
|
192
|
+
&& this.leaves[l].requestid === reqID) {
|
|
193
|
+
this.leaves.splice(l, 1);
|
|
216
194
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
195
|
+
}
|
|
196
|
+
else if (reqID === '' && !includeActuals) {
|
|
197
|
+
if (this.leaves[l].leavedate.getTime() >= start.getTime()
|
|
198
|
+
&& this.leaves[l].leavedate.getTime() <= end.getTime()
|
|
199
|
+
&& this.leaves[l].status.toLowerCase() !== 'actual') {
|
|
200
|
+
this.leaves.splice(l, 1);
|
|
223
201
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
202
|
+
}
|
|
203
|
+
else if (reqID !== '' && !includeActuals) {
|
|
204
|
+
if (this.leaves[l].leavedate.getTime() >= start.getTime()
|
|
205
|
+
&& this.leaves[l].leavedate.getTime() <= end.getTime()
|
|
206
|
+
&& this.leaves[l].status.toLowerCase() !== 'actual'
|
|
207
|
+
&& this.leaves[l].requestid === reqID) {
|
|
208
|
+
this.leaves.splice(l, 1);
|
|
231
209
|
}
|
|
232
210
|
}
|
|
233
211
|
}
|
|
@@ -301,7 +279,7 @@ class Employee {
|
|
|
301
279
|
});
|
|
302
280
|
if (this.work) {
|
|
303
281
|
this.work.forEach(wk => {
|
|
304
|
-
if (wk.useWork(date) &&
|
|
282
|
+
if (wk.useWork(date) && wk.modtime) {
|
|
305
283
|
work += wk.hours;
|
|
306
284
|
}
|
|
307
285
|
if (wk.dateworked.getTime() > lastWorked.getTime()) {
|
|
@@ -332,19 +310,17 @@ class Employee {
|
|
|
332
310
|
wday.hours = work;
|
|
333
311
|
return wday;
|
|
334
312
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
});
|
|
347
|
-
}
|
|
313
|
+
this.leaves.forEach(lv => {
|
|
314
|
+
if (lv.useLeave(date)
|
|
315
|
+
&& (lv.hours > stdWorkday / 2 || lv.status.toLowerCase() === 'actual')) {
|
|
316
|
+
wday = new workday_1.Workday({
|
|
317
|
+
id: 0,
|
|
318
|
+
workcenter: '',
|
|
319
|
+
code: lv.code,
|
|
320
|
+
hours: lv.hours
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
348
324
|
return wday;
|
|
349
325
|
}
|
|
350
326
|
getWorkdayActual(date, labor) {
|
|
@@ -371,7 +347,7 @@ class Employee {
|
|
|
371
347
|
}
|
|
372
348
|
});
|
|
373
349
|
let bLeave = false;
|
|
374
|
-
if (
|
|
350
|
+
if (bPrimary || labor?.length === 0) {
|
|
375
351
|
this.leaves.forEach(lv => {
|
|
376
352
|
if (lv.useLeave(date) && lv.status.toLowerCase() === 'actual') {
|
|
377
353
|
if (!bLeave) {
|
|
@@ -403,7 +379,7 @@ class Employee {
|
|
|
403
379
|
let work = 0.0;
|
|
404
380
|
if (this.work) {
|
|
405
381
|
this.work.forEach(wk => {
|
|
406
|
-
if (wk.useWork(date) &&
|
|
382
|
+
if (wk.useWork(date) && wk.modtime) {
|
|
407
383
|
work += wk.hours;
|
|
408
384
|
}
|
|
409
385
|
});
|
|
@@ -433,21 +409,19 @@ class Employee {
|
|
|
433
409
|
}
|
|
434
410
|
return wday;
|
|
435
411
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if (lv.
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
});
|
|
447
|
-
}
|
|
412
|
+
this.leaves.forEach(lv => {
|
|
413
|
+
if (lv.useLeave(date)) {
|
|
414
|
+
if (!wday || wday.hours < lv.hours) {
|
|
415
|
+
wday = new workday_1.Workday({
|
|
416
|
+
id: date.getDate(),
|
|
417
|
+
workcenter: '',
|
|
418
|
+
date: new Date(date),
|
|
419
|
+
code: lv.code,
|
|
420
|
+
hours: lv.hours
|
|
421
|
+
});
|
|
448
422
|
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
423
|
+
}
|
|
424
|
+
});
|
|
451
425
|
return wday;
|
|
452
426
|
}
|
|
453
427
|
getWorkdayWOLeaves(date, useWork) {
|
|
@@ -835,14 +809,12 @@ class Employee {
|
|
|
835
809
|
this.work.sort((a, b) => a.compareTo(b));
|
|
836
810
|
lastWorked = new Date(this.work[this.work.length - 1].dateworked);
|
|
837
811
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
});
|
|
845
|
-
}
|
|
812
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
813
|
+
this.leaves.forEach(lv => {
|
|
814
|
+
if (lv.status.toLowerCase() === 'actual' && lv.leavedate.getTime() > lastWorked.getTime()) {
|
|
815
|
+
lastWorked = new Date(lv.leavedate);
|
|
816
|
+
}
|
|
817
|
+
});
|
|
846
818
|
let current = new Date(start);
|
|
847
819
|
while (current.getTime() <= end.getTime()) {
|
|
848
820
|
if (current.getTime() > lastWorked.getTime()) {
|
|
@@ -948,14 +920,12 @@ class Employee {
|
|
|
948
920
|
}
|
|
949
921
|
else {
|
|
950
922
|
let carry = lastAnnual + lastCarry;
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
});
|
|
958
|
-
}
|
|
923
|
+
this.leaves.forEach(lv => {
|
|
924
|
+
if (lv.leavedate.getFullYear() === year && lv.code.toLowerCase() === 'v'
|
|
925
|
+
&& lv.status.toLowerCase() === 'actual') {
|
|
926
|
+
carry -= lv.hours;
|
|
927
|
+
}
|
|
928
|
+
});
|
|
959
929
|
bal.carryover = carry;
|
|
960
930
|
}
|
|
961
931
|
this.balances.push(bal);
|
|
@@ -1004,181 +974,170 @@ class Employee {
|
|
|
1004
974
|
let found = false;
|
|
1005
975
|
let max = 0;
|
|
1006
976
|
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
lv.requestid = requestid;
|
|
1016
|
-
}
|
|
1017
|
-
if (holCode && holCode !== '') {
|
|
1018
|
-
lv.tagday = holCode;
|
|
1019
|
-
}
|
|
1020
|
-
if (this.leaves) {
|
|
1021
|
-
this.leaves[l] = lv;
|
|
1022
|
-
}
|
|
977
|
+
this.leaves.forEach((lv, l) => {
|
|
978
|
+
if ((lv.useLeave(date) && lv.code.toLowerCase() === code.toLowerCase())
|
|
979
|
+
|| lv.id === id) {
|
|
980
|
+
found = true;
|
|
981
|
+
lv.status = status;
|
|
982
|
+
lv.hours = hours;
|
|
983
|
+
if (lv.requestid === '') {
|
|
984
|
+
lv.requestid = requestid;
|
|
1023
985
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
986
|
+
if (holCode && holCode !== '') {
|
|
987
|
+
lv.tagday = holCode;
|
|
1026
988
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
leavedate: new Date(date),
|
|
1032
|
-
code: code,
|
|
1033
|
-
hours: hours,
|
|
1034
|
-
status: status,
|
|
1035
|
-
requestid: requestid,
|
|
1036
|
-
used: false,
|
|
1037
|
-
tagday: holCode
|
|
1038
|
-
});
|
|
1039
|
-
this.leaves.push(lv);
|
|
1040
|
-
this.leaves.sort((a, b) => a.compareTo(b));
|
|
989
|
+
this.leaves[l] = lv;
|
|
990
|
+
}
|
|
991
|
+
else if (lv.id > max) {
|
|
992
|
+
max = lv.id;
|
|
1041
993
|
}
|
|
994
|
+
});
|
|
995
|
+
if (!found) {
|
|
996
|
+
const lv = new leave_1.Leave({
|
|
997
|
+
id: max + 1,
|
|
998
|
+
leavedate: new Date(date),
|
|
999
|
+
code: code,
|
|
1000
|
+
hours: hours,
|
|
1001
|
+
status: status,
|
|
1002
|
+
requestid: requestid,
|
|
1003
|
+
used: false,
|
|
1004
|
+
tagday: holCode
|
|
1005
|
+
});
|
|
1006
|
+
this.leaves.push(lv);
|
|
1007
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1042
1008
|
}
|
|
1043
1009
|
}
|
|
1044
1010
|
updateLeave(id, field, value) {
|
|
1045
1011
|
let answer = undefined;
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
break;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
if (this.leaves) {
|
|
1072
|
-
this.leaves[l] = lv;
|
|
1073
|
-
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1012
|
+
this.leaves.forEach((lv, l) => {
|
|
1013
|
+
if (lv.id === id) {
|
|
1014
|
+
switch (field.toLowerCase()) {
|
|
1015
|
+
case "date":
|
|
1016
|
+
const newdate = new Date(Date.parse(value));
|
|
1017
|
+
lv.leavedate = newdate;
|
|
1018
|
+
break;
|
|
1019
|
+
case "code":
|
|
1020
|
+
lv.code = value;
|
|
1021
|
+
break;
|
|
1022
|
+
case "hours":
|
|
1023
|
+
lv.hours = Number(value);
|
|
1024
|
+
break;
|
|
1025
|
+
case 'status':
|
|
1026
|
+
lv.status = value;
|
|
1027
|
+
break;
|
|
1028
|
+
case 'requestid':
|
|
1029
|
+
lv.requestid = value;
|
|
1030
|
+
break;
|
|
1031
|
+
case 'tagday':
|
|
1032
|
+
lv.tagday = value;
|
|
1033
|
+
break;
|
|
1074
1034
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1035
|
+
}
|
|
1036
|
+
this.leaves[l] = lv;
|
|
1037
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1038
|
+
answer = lv;
|
|
1039
|
+
});
|
|
1078
1040
|
return answer;
|
|
1079
1041
|
}
|
|
1080
1042
|
deleteLeave(id) {
|
|
1081
1043
|
let found = -1;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
found = l;
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
if (found >= 0) {
|
|
1089
|
-
this.leaves.splice(found, 1);
|
|
1044
|
+
this.leaves.forEach((lv, l) => {
|
|
1045
|
+
if (lv.id === id) {
|
|
1046
|
+
found = l;
|
|
1090
1047
|
}
|
|
1048
|
+
});
|
|
1049
|
+
if (found >= 0) {
|
|
1050
|
+
this.leaves.splice(found, 1);
|
|
1091
1051
|
}
|
|
1092
1052
|
}
|
|
1093
1053
|
getLeaveHours(start, end) {
|
|
1094
1054
|
let answer = 0.0;
|
|
1095
|
-
|
|
1096
|
-
|
|
1055
|
+
this.leaves.forEach(lv => {
|
|
1056
|
+
if (lv.leavedate.getTime() >= start.getTime()
|
|
1057
|
+
&& end.getTime() >= lv.leavedate.getTime()
|
|
1058
|
+
&& lv.status.toLowerCase() === 'actual') {
|
|
1059
|
+
answer += lv.hours;
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1097
1062
|
return answer;
|
|
1098
1063
|
}
|
|
1099
1064
|
getLeave(start) {
|
|
1100
1065
|
const workday = new workday_1.Workday();
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1066
|
+
this.leaves.forEach(lv => {
|
|
1067
|
+
if (lv.leavedate.getUTCFullYear() === start.getUTCFullYear()
|
|
1068
|
+
&& lv.leavedate.getUTCMonth() === start.getUTCMonth()
|
|
1069
|
+
&& lv.leavedate.getUTCDate() === start.getUTCDate()) {
|
|
1070
|
+
if (workday.code === '') {
|
|
1071
|
+
workday.code = lv.code;
|
|
1072
|
+
workday.hours = lv.hours;
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
if (workday.hours < lv.hours) {
|
|
1107
1076
|
workday.code = lv.code;
|
|
1108
|
-
workday.hours
|
|
1109
|
-
}
|
|
1110
|
-
else {
|
|
1111
|
-
if (workday.hours < lv.hours) {
|
|
1112
|
-
workday.code = lv.code;
|
|
1113
|
-
workday.hours += lv.hours;
|
|
1114
|
-
}
|
|
1077
|
+
workday.hours += lv.hours;
|
|
1115
1078
|
}
|
|
1116
1079
|
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1119
1082
|
return workday;
|
|
1120
1083
|
}
|
|
1121
1084
|
getPTOHours(start, end) {
|
|
1122
1085
|
let answer = 0.0;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1086
|
+
this.leaves.forEach(lv => {
|
|
1087
|
+
if (lv.leavedate.getTime() >= start.getTime()
|
|
1088
|
+
&& end.getTime() >= lv.leavedate.getTime()
|
|
1089
|
+
&& lv.status.toLowerCase() === 'actual'
|
|
1090
|
+
&& lv.code.toLowerCase() === 'v') {
|
|
1091
|
+
answer += lv.hours;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1133
1094
|
return answer;
|
|
1134
1095
|
}
|
|
1135
1096
|
createLeaveRequest(start, end, code, comment) {
|
|
1136
1097
|
start = new Date(Date.UTC(start.getFullYear(), start.getMonth(), start.getDate()));
|
|
1137
1098
|
end = new Date(Date.UTC(end.getFullYear(), end.getMonth(), end.getDate()));
|
|
1138
1099
|
let answer = undefined;
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
req.comments.sort((a, b) => a.compareTo(b));
|
|
1150
|
-
}
|
|
1151
|
-
answer = new leaverequest_1.LeaveRequest(req);
|
|
1100
|
+
this.requests.forEach((req, r) => {
|
|
1101
|
+
if (req.startdate.getTime() === start.getTime()
|
|
1102
|
+
&& req.enddate.getTime() === end.getTime()) {
|
|
1103
|
+
if (comment) {
|
|
1104
|
+
const cmt = new leaverequest_1.LeaveRequestComment({
|
|
1105
|
+
commentdate: new Date(),
|
|
1106
|
+
comment: comment
|
|
1107
|
+
});
|
|
1108
|
+
req.comments.push(cmt);
|
|
1109
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1152
1110
|
}
|
|
1111
|
+
answer = new leaverequest_1.LeaveRequest(req);
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
if (!answer) {
|
|
1115
|
+
const id = (new Date()).getTime().toString();
|
|
1116
|
+
answer = new leaverequest_1.LeaveRequest({
|
|
1117
|
+
id: id,
|
|
1118
|
+
employeeid: this.id,
|
|
1119
|
+
requestDate: new Date(),
|
|
1120
|
+
primarycode: code,
|
|
1121
|
+
startdate: start,
|
|
1122
|
+
enddate: end,
|
|
1123
|
+
status: 'DRAFT',
|
|
1124
|
+
approvalDate: new Date(0),
|
|
1125
|
+
approvedby: '',
|
|
1126
|
+
requesteddays: [],
|
|
1127
|
+
comments: []
|
|
1153
1128
|
});
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
requestDate: new Date(),
|
|
1160
|
-
primarycode: code,
|
|
1161
|
-
startdate: start,
|
|
1162
|
-
enddate: end,
|
|
1163
|
-
status: 'DRAFT',
|
|
1164
|
-
approvalDate: new Date(0),
|
|
1165
|
-
approvedby: '',
|
|
1166
|
-
requesteddays: [],
|
|
1167
|
-
comments: []
|
|
1168
|
-
});
|
|
1129
|
+
answer.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1130
|
+
commentdate: new Date(),
|
|
1131
|
+
comment: 'Request Created'
|
|
1132
|
+
}));
|
|
1133
|
+
if (comment) {
|
|
1169
1134
|
answer.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1170
1135
|
commentdate: new Date(),
|
|
1171
|
-
comment:
|
|
1136
|
+
comment: comment
|
|
1172
1137
|
}));
|
|
1173
|
-
if (comment) {
|
|
1174
|
-
answer.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1175
|
-
commentdate: new Date(),
|
|
1176
|
-
comment: comment
|
|
1177
|
-
}));
|
|
1178
|
-
}
|
|
1179
|
-
answer.setLeaveDays(this, true);
|
|
1180
|
-
this.requests.push(new leaverequest_1.LeaveRequest(answer));
|
|
1181
1138
|
}
|
|
1139
|
+
answer.setLeaveDays(this, true);
|
|
1140
|
+
this.requests.push(new leaverequest_1.LeaveRequest(answer));
|
|
1182
1141
|
}
|
|
1183
1142
|
return answer;
|
|
1184
1143
|
}
|
|
@@ -1188,395 +1147,377 @@ class Employee {
|
|
|
1188
1147
|
leaverequest: undefined,
|
|
1189
1148
|
error: undefined
|
|
1190
1149
|
};
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
else {
|
|
1216
|
-
count++;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
});
|
|
1220
|
-
if (startpos >= 0) {
|
|
1221
|
-
this.leaves.splice(startpos, count);
|
|
1150
|
+
this.requests.forEach((req, r) => {
|
|
1151
|
+
if (req.useRequest(id)) {
|
|
1152
|
+
switch (field.toLowerCase()) {
|
|
1153
|
+
case "approve":
|
|
1154
|
+
this.approveLeaveRequest(id, value);
|
|
1155
|
+
break;
|
|
1156
|
+
case "startdate":
|
|
1157
|
+
case "start":
|
|
1158
|
+
let sdate = new Date(Date.parse(value));
|
|
1159
|
+
sdate = new Date(Date.UTC(sdate.getFullYear(), sdate.getMonth(), sdate.getDate()));
|
|
1160
|
+
if (sdate.getTime() < req.startdate.getTime()
|
|
1161
|
+
|| sdate.getTime() > req.enddate.getTime()) {
|
|
1162
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1163
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1164
|
+
let count = 0;
|
|
1165
|
+
let startpos = -1;
|
|
1166
|
+
this.leaves.forEach((lv, l) => {
|
|
1167
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual') {
|
|
1168
|
+
if (startpos < 0) {
|
|
1169
|
+
startpos = l;
|
|
1170
|
+
count++;
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
count++;
|
|
1222
1174
|
}
|
|
1223
1175
|
}
|
|
1176
|
+
});
|
|
1177
|
+
if (startpos >= 0) {
|
|
1178
|
+
this.leaves.splice(startpos, count);
|
|
1224
1179
|
}
|
|
1225
|
-
req.status = 'DRAFT';
|
|
1226
|
-
req.approvalDate = new Date(0);
|
|
1227
|
-
req.approvedby = '';
|
|
1228
|
-
answer.message = `Leave Request: ${this.user?.getFirstLast()} leave request `
|
|
1229
|
-
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1230
|
-
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed to `
|
|
1231
|
-
+ `before original date. This converted the leave request back to draft `
|
|
1232
|
-
+ `for resubmittal.`;
|
|
1233
1180
|
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1181
|
+
req.status = 'DRAFT';
|
|
1182
|
+
req.approvalDate = new Date(0);
|
|
1183
|
+
req.approvedby = '';
|
|
1184
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1185
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1186
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed to `
|
|
1187
|
+
+ `before original date. This converted the leave request back to draft `
|
|
1188
|
+
+ `for resubmittal.`;
|
|
1189
|
+
}
|
|
1190
|
+
else {
|
|
1191
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1192
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1193
|
+
let count = 0;
|
|
1194
|
+
let startpos = -1;
|
|
1195
|
+
this.leaves.forEach((lv, l) => {
|
|
1196
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual'
|
|
1197
|
+
&& lv.leavedate.getTime() < sdate.getTime()) {
|
|
1198
|
+
if (startpos < 0) {
|
|
1199
|
+
startpos = l;
|
|
1200
|
+
count++;
|
|
1201
|
+
}
|
|
1202
|
+
else {
|
|
1203
|
+
count++;
|
|
1254
1204
|
}
|
|
1255
1205
|
}
|
|
1206
|
+
});
|
|
1207
|
+
if (startpos >= 0 && count > 0) {
|
|
1208
|
+
this.leaves.splice(startpos, count);
|
|
1256
1209
|
}
|
|
1257
|
-
answer.message = `Leave Request: ${this.user?.getFirstLast()} leave request `
|
|
1258
|
-
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1259
|
-
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed `
|
|
1260
|
-
+ `within the original dates. Approved Leave days were updated in the database `
|
|
1261
|
-
+ 'as approved.';
|
|
1262
1210
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1211
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1212
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1213
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed `
|
|
1214
|
+
+ `within the original dates. Approved Leave days were updated in the database `
|
|
1215
|
+
+ 'as approved.';
|
|
1216
|
+
}
|
|
1217
|
+
req.startdate = new Date(sdate);
|
|
1218
|
+
req.setLeaveDays(this);
|
|
1219
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1220
|
+
commentdate: new Date(),
|
|
1221
|
+
comment: `Start date for request was changed to ${sdate.toDateString()}`
|
|
1222
|
+
}));
|
|
1223
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1224
|
+
break;
|
|
1225
|
+
case "enddate":
|
|
1226
|
+
case "end":
|
|
1227
|
+
let edate = new Date(Date.parse(value));
|
|
1228
|
+
edate = new Date(Date.UTC(edate.getFullYear(), edate.getMonth(), edate.getDate()));
|
|
1229
|
+
if (edate.getTime() < req.startdate.getTime()
|
|
1230
|
+
|| edate.getTime() > req.enddate.getTime()) {
|
|
1231
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1232
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1233
|
+
let count = 0;
|
|
1234
|
+
let startpos = -1;
|
|
1235
|
+
this.leaves.forEach((lv, l) => {
|
|
1236
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual') {
|
|
1237
|
+
if (startpos < 0) {
|
|
1238
|
+
startpos = l;
|
|
1239
|
+
count++;
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
count++;
|
|
1295
1243
|
}
|
|
1296
1244
|
}
|
|
1245
|
+
});
|
|
1246
|
+
if (startpos >= 0) {
|
|
1247
|
+
this.leaves.splice(startpos, count);
|
|
1297
1248
|
}
|
|
1298
|
-
req.status = 'DRAFT';
|
|
1299
|
-
req.approvalDate = new Date(0);
|
|
1300
|
-
req.approvedby = '';
|
|
1301
|
-
answer.message = `Leave Request: ${this.user?.getFirstLast()} leave request `
|
|
1302
|
-
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1303
|
-
+ `${req.enddate.toLocaleDateString('en-US')}) ending date was changed to `
|
|
1304
|
-
+ `after original date. This converted the leave request back to draft `
|
|
1305
|
-
+ `for resubmittal.`;
|
|
1306
1249
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1250
|
+
req.status = 'DRAFT';
|
|
1251
|
+
req.approvalDate = new Date(0);
|
|
1252
|
+
req.approvedby = '';
|
|
1253
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1254
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1255
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) ending date was changed to `
|
|
1256
|
+
+ `after original date. This converted the leave request back to draft `
|
|
1257
|
+
+ `for resubmittal.`;
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1261
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1262
|
+
let count = 0;
|
|
1263
|
+
let startpos = -1;
|
|
1264
|
+
this.leaves.forEach((lv, l) => {
|
|
1265
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual'
|
|
1266
|
+
&& lv.leavedate.getTime() > edate.getTime()) {
|
|
1267
|
+
if (startpos < 0) {
|
|
1268
|
+
startpos = l;
|
|
1269
|
+
count++;
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
count++;
|
|
1327
1273
|
}
|
|
1328
1274
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
+ `within the original dates. Approved leave dates were updated in the`
|
|
1333
|
-
+ 'database as approved';
|
|
1275
|
+
});
|
|
1276
|
+
if (startpos >= 0 && count > 0) {
|
|
1277
|
+
this.leaves.splice(startpos, count);
|
|
1334
1278
|
}
|
|
1279
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1280
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1281
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed `
|
|
1282
|
+
+ `within the original dates. Approved leave dates were updated in the`
|
|
1283
|
+
+ 'database as approved';
|
|
1335
1284
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
});
|
|
1370
|
-
if (startpos >= 0) {
|
|
1371
|
-
this.leaves.splice(startpos, count);
|
|
1285
|
+
}
|
|
1286
|
+
req.enddate = new Date(edate);
|
|
1287
|
+
req.setLeaveDays(this);
|
|
1288
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1289
|
+
commentdate: new Date(),
|
|
1290
|
+
comment: `End date for request was changed to ${edate.toDateString()}`
|
|
1291
|
+
}));
|
|
1292
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1293
|
+
break;
|
|
1294
|
+
case 'dates':
|
|
1295
|
+
const values = value.split('|');
|
|
1296
|
+
let newstart = new Date(Date.parse(values[0]));
|
|
1297
|
+
newstart = new Date(Date.UTC(newstart.getFullYear(), newstart.getMonth(), newstart.getDate()));
|
|
1298
|
+
let newend = new Date(Date.parse(values[1]));
|
|
1299
|
+
newend = new Date(Date.UTC(newend.getFullYear(), newend.getMonth(), newend.getDate()));
|
|
1300
|
+
if (newstart.getTime() < req.startdate.getTime()
|
|
1301
|
+
|| newstart.getTime() > req.enddate.getTime()
|
|
1302
|
+
|| newend.getTime() < req.startdate.getTime()
|
|
1303
|
+
|| newend.getTime() > req.enddate.getTime()) {
|
|
1304
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1305
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1306
|
+
let count = 0;
|
|
1307
|
+
let startpos = -1;
|
|
1308
|
+
this.leaves.forEach((lv, l) => {
|
|
1309
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual') {
|
|
1310
|
+
if (startpos < 0) {
|
|
1311
|
+
startpos = l;
|
|
1312
|
+
count++;
|
|
1313
|
+
}
|
|
1314
|
+
else {
|
|
1315
|
+
count++;
|
|
1372
1316
|
}
|
|
1373
1317
|
}
|
|
1318
|
+
});
|
|
1319
|
+
if (startpos >= 0) {
|
|
1320
|
+
this.leaves.splice(startpos, count);
|
|
1374
1321
|
}
|
|
1375
|
-
req.status = 'DRAFT';
|
|
1376
|
-
req.approvalDate = new Date(0);
|
|
1377
|
-
req.approvedby = '';
|
|
1378
|
-
answer.message = `Leave Request: ${this.user?.getFirstLast()} leave request `
|
|
1379
|
-
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1380
|
-
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed to `
|
|
1381
|
-
+ `outside the original dates. This converted the leave request back to draft `
|
|
1382
|
-
+ `for resubmittal.`;
|
|
1383
1322
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
else {
|
|
1410
|
-
endcount++;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
});
|
|
1414
|
-
if (startpos >= 0 && endcount > 0) {
|
|
1415
|
-
this.leaves.splice(startpos, startcount);
|
|
1323
|
+
req.status = 'DRAFT';
|
|
1324
|
+
req.approvalDate = new Date(0);
|
|
1325
|
+
req.approvedby = '';
|
|
1326
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1327
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1328
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) start date was changed to `
|
|
1329
|
+
+ `outside the original dates. This converted the leave request back to draft `
|
|
1330
|
+
+ `for resubmittal.`;
|
|
1331
|
+
}
|
|
1332
|
+
else {
|
|
1333
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1334
|
+
this.leaves.sort((a, b) => a.compareTo(b));
|
|
1335
|
+
let startcount = 0;
|
|
1336
|
+
let startpos = -1;
|
|
1337
|
+
let endcount = 0;
|
|
1338
|
+
let endpos = -1;
|
|
1339
|
+
this.leaves.forEach((lv, l) => {
|
|
1340
|
+
if (lv.requestid === id && lv.status.toLowerCase() !== 'actual'
|
|
1341
|
+
&& lv.leavedate.getTime() < newstart.getTime()) {
|
|
1342
|
+
if (startpos < 0) {
|
|
1343
|
+
startpos = l;
|
|
1344
|
+
startcount++;
|
|
1345
|
+
}
|
|
1346
|
+
else {
|
|
1347
|
+
startcount++;
|
|
1416
1348
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1349
|
+
}
|
|
1350
|
+
else if (lv.requestid === id && lv.status.toLowerCase() !== 'actual'
|
|
1351
|
+
&& lv.leavedate.getTime() > newend.getTime()) {
|
|
1352
|
+
if (endpos < 0) {
|
|
1353
|
+
endpos = l;
|
|
1354
|
+
endcount++;
|
|
1355
|
+
}
|
|
1356
|
+
else {
|
|
1357
|
+
endcount++;
|
|
1419
1358
|
}
|
|
1420
1359
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
+ `within the original dates. All approved leave dates were updated in `
|
|
1425
|
-
+ 'the database.';
|
|
1360
|
+
});
|
|
1361
|
+
if (startpos >= 0 && endcount > 0) {
|
|
1362
|
+
this.leaves.splice(startpos, startcount);
|
|
1426
1363
|
}
|
|
1364
|
+
if (endpos >= 0 && endcount > 0) {
|
|
1365
|
+
this.leaves.splice(endpos, endcount);
|
|
1366
|
+
}
|
|
1367
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1368
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1369
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) both dates were changed to `
|
|
1370
|
+
+ `within the original dates. All approved leave dates were updated in `
|
|
1371
|
+
+ 'the database.';
|
|
1427
1372
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1373
|
+
}
|
|
1374
|
+
req.startdate = new Date(newstart);
|
|
1375
|
+
req.enddate = new Date(newend);
|
|
1376
|
+
req.setLeaveDays(this);
|
|
1377
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1378
|
+
commentdate: new Date(),
|
|
1379
|
+
comment: `Request dates for request were changed to `
|
|
1380
|
+
+ `${newstart.toDateString()} - ${newend.toDateString()}`
|
|
1381
|
+
}));
|
|
1382
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1383
|
+
break;
|
|
1384
|
+
case "code":
|
|
1385
|
+
case "primarycode":
|
|
1386
|
+
req.primarycode = value;
|
|
1387
|
+
req.setLeaveDays(this, true);
|
|
1388
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1389
|
+
commentdate: new Date(),
|
|
1390
|
+
comment: `Primary Code for request was changed to ${value}`
|
|
1391
|
+
}));
|
|
1392
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1393
|
+
break;
|
|
1394
|
+
case "requested":
|
|
1395
|
+
req.status = 'REQUESTED';
|
|
1396
|
+
req.requesteddays.forEach((lv, l) => {
|
|
1397
|
+
if (lv.code !== '') {
|
|
1398
|
+
lv.status = 'REQUESTED';
|
|
1399
|
+
req.requesteddays[l] = lv;
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1403
|
+
commentdate: new Date(),
|
|
1404
|
+
comment: 'Leave request was submitted for approval.'
|
|
1405
|
+
}));
|
|
1406
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1407
|
+
answer.message = `Leave Request from ${this.name.getLastFirst()} `
|
|
1408
|
+
+ `submitted for approval. Requested leave dates: `
|
|
1409
|
+
+ `${req.startdate.toDateString()} - ${req.enddate.toDateString()}.`;
|
|
1410
|
+
break;
|
|
1411
|
+
case "unapprove":
|
|
1412
|
+
req.approvedby = '';
|
|
1413
|
+
req.approvalDate = new Date(0);
|
|
1414
|
+
req.status = 'DRAFT';
|
|
1415
|
+
req.requesteddays.forEach((lv, l) => {
|
|
1416
|
+
if (lv.code !== '') {
|
|
1417
|
+
lv.status = 'REQUESTED';
|
|
1418
|
+
req.requesteddays[l] = lv;
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1422
|
+
commentdate: new Date(),
|
|
1423
|
+
comment: `Request was declined by approver: ${value}`
|
|
1424
|
+
}));
|
|
1425
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1426
|
+
answer.message = `Leave Request: ${this.name.getFirstLast()} leave request `
|
|
1427
|
+
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1428
|
+
+ `${req.enddate.toLocaleDateString('en-US')}) was declined by approver.`;
|
|
1429
|
+
break;
|
|
1430
|
+
case 'day':
|
|
1431
|
+
case 'requestday':
|
|
1432
|
+
const bApproved = req.status.toLowerCase() === 'approved';
|
|
1433
|
+
let found = false;
|
|
1434
|
+
let max = 0;
|
|
1435
|
+
const svalues = value.split('|');
|
|
1436
|
+
let lvDate = new Date(Number(svalues[0]));
|
|
1437
|
+
let code = svalues[1];
|
|
1438
|
+
let hours = Number(svalues[2]);
|
|
1439
|
+
let tagday = svalues[3];
|
|
1440
|
+
let status = '';
|
|
1441
|
+
let workcenter = '';
|
|
1442
|
+
if (svalues.length > 3) {
|
|
1443
|
+
workcenter = svalues[3];
|
|
1444
|
+
}
|
|
1445
|
+
req.requesteddays.forEach((lv, l) => {
|
|
1446
|
+
if (lv.useLeave(lvDate)) {
|
|
1447
|
+
found = true;
|
|
1448
|
+
lv.code = code;
|
|
1449
|
+
if (status == '') {
|
|
1450
|
+
status = lv.status;
|
|
1454
1451
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
comment: 'Leave request was submitted for approval.'
|
|
1459
|
-
}));
|
|
1460
|
-
req.comments.sort((a, b) => a.compareTo(b));
|
|
1461
|
-
answer.message = `Leave Request from ${this.user?.getLastFirst()} `
|
|
1462
|
-
+ `submitted for approval. Requested leave dates: `
|
|
1463
|
-
+ `${req.startdate.toDateString()} - ${req.enddate.toDateString()}.`;
|
|
1464
|
-
break;
|
|
1465
|
-
case "unapprove":
|
|
1466
|
-
req.approvedby = '';
|
|
1467
|
-
req.approvalDate = new Date(0);
|
|
1468
|
-
req.status = 'DRAFT';
|
|
1469
|
-
req.requesteddays.forEach((lv, l) => {
|
|
1470
|
-
if (lv.code !== '') {
|
|
1471
|
-
lv.status = 'REQUESTED';
|
|
1472
|
-
req.requesteddays[l] = lv;
|
|
1452
|
+
lv.status = workcenter;
|
|
1453
|
+
if (code == '') {
|
|
1454
|
+
lv.hours = 0.0;
|
|
1473
1455
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
req.comments.sort((a, b) => a.compareTo(b));
|
|
1480
|
-
answer.message = `Leave Request: ${this.user?.getFirstLast()} leave request `
|
|
1481
|
-
+ `(${req.startdate.toLocaleDateString('en-US')}-`
|
|
1482
|
-
+ `${req.enddate.toLocaleDateString('en-US')}) was declined by approver.`;
|
|
1483
|
-
break;
|
|
1484
|
-
case 'day':
|
|
1485
|
-
case 'requestday':
|
|
1486
|
-
const bApproved = req.status.toLowerCase() === 'approved';
|
|
1487
|
-
let found = false;
|
|
1488
|
-
let max = 0;
|
|
1489
|
-
const svalues = value.split('|');
|
|
1490
|
-
let lvDate = new Date(Number(svalues[0]));
|
|
1491
|
-
let code = svalues[1];
|
|
1492
|
-
let hours = Number(svalues[2]);
|
|
1493
|
-
let tagday = svalues[3];
|
|
1494
|
-
let status = '';
|
|
1495
|
-
let workcenter = '';
|
|
1496
|
-
if (svalues.length > 3) {
|
|
1497
|
-
workcenter = svalues[3];
|
|
1456
|
+
else {
|
|
1457
|
+
lv.hours = hours;
|
|
1458
|
+
}
|
|
1459
|
+
lv.tagday = tagday;
|
|
1460
|
+
req.requesteddays[l] = lv;
|
|
1498
1461
|
}
|
|
1499
|
-
|
|
1462
|
+
if (max < lv.id) {
|
|
1463
|
+
max = lv.id;
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
if (!found) {
|
|
1467
|
+
const lv = new leave_1.Leave({
|
|
1468
|
+
id: max + 1,
|
|
1469
|
+
leavedate: new Date(lvDate),
|
|
1470
|
+
code: code,
|
|
1471
|
+
hours: hours,
|
|
1472
|
+
tagday: tagday,
|
|
1473
|
+
status: status,
|
|
1474
|
+
requestid: req.id,
|
|
1475
|
+
used: false
|
|
1476
|
+
});
|
|
1477
|
+
req.requesteddays.push(lv);
|
|
1478
|
+
req.requesteddays.sort((a, b) => a.compareTo(b));
|
|
1479
|
+
}
|
|
1480
|
+
if (bApproved) {
|
|
1481
|
+
found = false;
|
|
1482
|
+
this.leaves.forEach((lv, l) => {
|
|
1500
1483
|
if (lv.useLeave(lvDate)) {
|
|
1501
1484
|
found = true;
|
|
1502
1485
|
lv.code = code;
|
|
1503
|
-
if (
|
|
1504
|
-
status = lv.status;
|
|
1505
|
-
}
|
|
1506
|
-
lv.status = workcenter;
|
|
1507
|
-
if (code == '') {
|
|
1486
|
+
if (code === '') {
|
|
1508
1487
|
lv.hours = 0.0;
|
|
1509
1488
|
}
|
|
1510
1489
|
else {
|
|
1511
1490
|
lv.hours = hours;
|
|
1512
1491
|
}
|
|
1513
|
-
|
|
1514
|
-
req.requesteddays[l] = lv;
|
|
1515
|
-
}
|
|
1516
|
-
if (max < lv.id) {
|
|
1517
|
-
max = lv.id;
|
|
1492
|
+
this.leaves[l] = lv;
|
|
1518
1493
|
}
|
|
1519
1494
|
});
|
|
1520
|
-
if (!found) {
|
|
1521
|
-
|
|
1495
|
+
if (!found && code !== '') {
|
|
1496
|
+
this.leaves.push(new leave_1.Leave({
|
|
1522
1497
|
id: max + 1,
|
|
1523
1498
|
leavedate: new Date(lvDate),
|
|
1524
1499
|
code: code,
|
|
1525
1500
|
hours: hours,
|
|
1526
1501
|
tagday: tagday,
|
|
1527
|
-
status: status,
|
|
1502
|
+
status: req.status,
|
|
1528
1503
|
requestid: req.id,
|
|
1529
1504
|
used: false
|
|
1530
|
-
});
|
|
1531
|
-
req.requesteddays.push(lv);
|
|
1532
|
-
req.requesteddays.sort((a, b) => a.compareTo(b));
|
|
1533
|
-
}
|
|
1534
|
-
if (bApproved) {
|
|
1535
|
-
found = false;
|
|
1536
|
-
if (this.leaves) {
|
|
1537
|
-
this.leaves.forEach((lv, l) => {
|
|
1538
|
-
if (lv.useLeave(lvDate)) {
|
|
1539
|
-
found = true;
|
|
1540
|
-
lv.code = code;
|
|
1541
|
-
if (code === '') {
|
|
1542
|
-
lv.hours = 0.0;
|
|
1543
|
-
}
|
|
1544
|
-
else {
|
|
1545
|
-
lv.hours = hours;
|
|
1546
|
-
}
|
|
1547
|
-
if (this.leaves) {
|
|
1548
|
-
this.leaves[l] = lv;
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
});
|
|
1552
|
-
if (!found && code !== '') {
|
|
1553
|
-
this.leaves.push(new leave_1.Leave({
|
|
1554
|
-
id: max + 1,
|
|
1555
|
-
leavedate: new Date(lvDate),
|
|
1556
|
-
code: code,
|
|
1557
|
-
hours: hours,
|
|
1558
|
-
tagday: tagday,
|
|
1559
|
-
status: req.status,
|
|
1560
|
-
requestid: req.id,
|
|
1561
|
-
used: false
|
|
1562
|
-
}));
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1505
|
+
}));
|
|
1565
1506
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
answer.leaverequest = req;
|
|
1507
|
+
}
|
|
1508
|
+
break;
|
|
1509
|
+
case "comment":
|
|
1510
|
+
case "addcomment":
|
|
1511
|
+
req.comments.push(new leaverequest_1.LeaveRequestComment({
|
|
1512
|
+
commentdate: new Date(),
|
|
1513
|
+
comment: value
|
|
1514
|
+
}));
|
|
1515
|
+
req.comments.sort((a, b) => a.compareTo(b));
|
|
1516
|
+
break;
|
|
1577
1517
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1518
|
+
answer.leaverequest = req;
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1580
1521
|
return answer;
|
|
1581
1522
|
}
|
|
1582
1523
|
approveLeaveRequest(id, approver) {
|
|
@@ -1585,126 +1526,116 @@ class Employee {
|
|
|
1585
1526
|
leaverequest: undefined,
|
|
1586
1527
|
error: undefined
|
|
1587
1528
|
};
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1529
|
+
this.requests.forEach((req, r) => {
|
|
1530
|
+
if (req.id === id) {
|
|
1531
|
+
req.approvalDate = new Date();
|
|
1532
|
+
req.approvedby = approver;
|
|
1533
|
+
req.status = 'Approved';
|
|
1534
|
+
let max = 0;
|
|
1535
|
+
if (req.primarycode.toLowerCase() !== 'mod') {
|
|
1536
|
+
this.removeLeaves(req.startdate, req.enddate, req.id, false);
|
|
1537
|
+
this.leaves.forEach(lv => {
|
|
1538
|
+
if (max < lv.id) {
|
|
1539
|
+
max = lv.id;
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
req.requesteddays.forEach((day, d) => {
|
|
1543
|
+
if (day.code !== '') {
|
|
1544
|
+
max++;
|
|
1545
|
+
day.status = 'Approved';
|
|
1546
|
+
req.requesteddays[d] = day;
|
|
1547
|
+
this.leaves.push(new leave_1.Leave({
|
|
1548
|
+
id: max,
|
|
1549
|
+
leavedate: new Date(day.leavedate),
|
|
1550
|
+
code: day.code,
|
|
1551
|
+
hours: day.hours,
|
|
1552
|
+
status: day.status,
|
|
1553
|
+
requestid: req.id,
|
|
1554
|
+
used: false
|
|
1555
|
+
}));
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
answer.message = `Leave Request was approved for period of `
|
|
1559
|
+
+ `${req.startdate.toDateString()} - ${req.enddate.toDateString()}.`;
|
|
1560
|
+
answer.leaverequest = req;
|
|
1561
|
+
}
|
|
1562
|
+
else {
|
|
1563
|
+
let found = false;
|
|
1564
|
+
this.variations.forEach((vari, v) => {
|
|
1565
|
+
if (vari.startdate.getTime() === req.startdate.getTime()
|
|
1566
|
+
&& vari.enddate.getTime() === req.enddate.getTime()
|
|
1567
|
+
&& vari.mod) {
|
|
1568
|
+
found = true;
|
|
1569
|
+
let start = new Date(req.startdate);
|
|
1570
|
+
while (start.getDay() !== 0) {
|
|
1571
|
+
start = new Date(start.getTime() - (24 * 3600000));
|
|
1572
|
+
}
|
|
1573
|
+
vari.setScheduleDays();
|
|
1574
|
+
let lastcode = '';
|
|
1575
|
+
let workcenter = '';
|
|
1576
|
+
req.requesteddays.forEach(day => {
|
|
1604
1577
|
if (day.code !== '') {
|
|
1605
|
-
|
|
1606
|
-
day.
|
|
1607
|
-
|
|
1608
|
-
if (this.leaves) {
|
|
1609
|
-
this.leaves.push(new leave_1.Leave({
|
|
1610
|
-
id: max,
|
|
1611
|
-
leavedate: new Date(day.leavedate),
|
|
1612
|
-
code: day.code,
|
|
1613
|
-
hours: day.hours,
|
|
1614
|
-
status: day.status,
|
|
1615
|
-
requestid: req.id,
|
|
1616
|
-
used: false
|
|
1617
|
-
}));
|
|
1578
|
+
lastcode = day.code;
|
|
1579
|
+
if (day.tagday) {
|
|
1580
|
+
workcenter = day.tagday;
|
|
1618
1581
|
}
|
|
1619
1582
|
}
|
|
1583
|
+
const dos = Math.floor((day.leavedate.getTime() - start.getTime())
|
|
1584
|
+
/ (24 * 3600000));
|
|
1585
|
+
vari.schedule.workdays[dos].code = lastcode;
|
|
1586
|
+
vari.schedule.workdays[dos].hours = day.hours;
|
|
1587
|
+
vari.schedule.workdays[dos].workcenter = workcenter;
|
|
1620
1588
|
});
|
|
1621
1589
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
this.variations.forEach((vari, v) => {
|
|
1629
|
-
if (vari.startdate.getTime() === req.startdate.getTime()
|
|
1630
|
-
&& vari.enddate.getTime() === req.enddate.getTime()
|
|
1631
|
-
&& vari.mod) {
|
|
1632
|
-
found = true;
|
|
1633
|
-
let start = new Date(req.startdate);
|
|
1634
|
-
while (start.getDay() !== 0) {
|
|
1635
|
-
start = new Date(start.getTime() - (24 * 3600000));
|
|
1636
|
-
}
|
|
1637
|
-
vari.setScheduleDays();
|
|
1638
|
-
let lastcode = '';
|
|
1639
|
-
let workcenter = '';
|
|
1640
|
-
req.requesteddays.forEach(day => {
|
|
1641
|
-
if (day.code !== '') {
|
|
1642
|
-
lastcode = day.code;
|
|
1643
|
-
if (day.tagday) {
|
|
1644
|
-
workcenter = day.tagday;
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
const dos = Math.floor((day.leavedate.getTime() - start.getTime())
|
|
1648
|
-
/ (24 * 3600000));
|
|
1649
|
-
vari.schedule.workdays[dos].code = lastcode;
|
|
1650
|
-
vari.schedule.workdays[dos].hours = day.hours;
|
|
1651
|
-
vari.schedule.workdays[dos].workcenter = workcenter;
|
|
1652
|
-
});
|
|
1590
|
+
});
|
|
1591
|
+
if (!found) {
|
|
1592
|
+
let max = 0;
|
|
1593
|
+
this.variations.forEach(vari => {
|
|
1594
|
+
if (max < vari.id) {
|
|
1595
|
+
max = vari.id;
|
|
1653
1596
|
}
|
|
1654
1597
|
});
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
schedule: new workday_1.Schedule()
|
|
1670
|
-
});
|
|
1671
|
-
vari.setScheduleDays();
|
|
1672
|
-
vari.schedule.showdates = true;
|
|
1673
|
-
req.requesteddays.forEach(day => {
|
|
1674
|
-
vari.updateWorkdayByDate;
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1598
|
+
const vari = new variation_1.Variation({
|
|
1599
|
+
id: max + 1,
|
|
1600
|
+
mids: false,
|
|
1601
|
+
mod: true,
|
|
1602
|
+
startdate: new Date(req.startdate),
|
|
1603
|
+
enddate: new Date(req.enddate),
|
|
1604
|
+
site: this.site,
|
|
1605
|
+
schedule: new workday_1.Schedule()
|
|
1606
|
+
});
|
|
1607
|
+
vari.setScheduleDays();
|
|
1608
|
+
vari.schedule.showdates = true;
|
|
1609
|
+
req.requesteddays.forEach(day => {
|
|
1610
|
+
vari.updateWorkdayByDate;
|
|
1611
|
+
});
|
|
1677
1612
|
}
|
|
1678
1613
|
}
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1681
1616
|
return answer;
|
|
1682
1617
|
}
|
|
1683
1618
|
deleteLeaveRequest(id) {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
if (req) {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
this.leaves.splice(pos, 1);
|
|
1692
|
-
pos = this.leaves.findIndex(l => l.requestid === id);
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
if (req.primarycode.toLowerCase() === 'mod') {
|
|
1696
|
-
let pos = this.variations.findIndex(v => (v.mod && v.startdate.getTime() === req.startdate.getTime()
|
|
1697
|
-
&& v.enddate.getTime() === req.enddate.getTime()));
|
|
1698
|
-
if (pos >= 0) {
|
|
1699
|
-
this.variations.splice(pos, 1);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1619
|
+
let req = this.requests.find(r => r.id === id);
|
|
1620
|
+
if (req) {
|
|
1621
|
+
if (req.status.toLowerCase() === 'approved') {
|
|
1622
|
+
let pos = this.leaves.findIndex(l => l.requestid === id);
|
|
1623
|
+
while (pos >= 0) {
|
|
1624
|
+
this.leaves.splice(pos, 1);
|
|
1625
|
+
pos = this.leaves.findIndex(l => l.requestid === id);
|
|
1702
1626
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1627
|
+
if (req.primarycode.toLowerCase() === 'mod') {
|
|
1628
|
+
pos = this.variations.findIndex(v => (v.mod && v.startdate.getTime() === req.startdate.getTime()
|
|
1629
|
+
&& v.enddate.getTime() === req.enddate.getTime()));
|
|
1630
|
+
if (pos >= 0) {
|
|
1631
|
+
this.variations.splice(pos, 1);
|
|
1632
|
+
}
|
|
1706
1633
|
}
|
|
1707
1634
|
}
|
|
1635
|
+
let pos = this.requests.findIndex(r => r.id === id);
|
|
1636
|
+
if (pos >= 0) {
|
|
1637
|
+
this.requests.splice(pos, 1);
|
|
1638
|
+
}
|
|
1708
1639
|
}
|
|
1709
1640
|
}
|
|
1710
1641
|
addContactInfo(typeid, value, sortid) {
|