@syncfusion/ej2-gantt 20.1.58 → 20.2.36
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/CHANGELOG.md +37 -0
- package/dist/ej2-gantt.umd.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +1100 -74
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +1099 -71
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +2 -2
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +18 -18
- package/src/gantt/actions/actions.d.ts +1 -0
- package/src/gantt/actions/actions.js +1 -0
- package/src/gantt/actions/cell-edit.js +5 -3
- package/src/gantt/actions/connector-line-edit.js +20 -6
- package/src/gantt/actions/context-menu.js +3 -4
- package/src/gantt/actions/critical-path.d.ts +26 -0
- package/src/gantt/actions/critical-path.js +735 -0
- package/src/gantt/actions/dependency.js +3 -0
- package/src/gantt/actions/dialog-edit.js +1 -1
- package/src/gantt/actions/edit.js +29 -3
- package/src/gantt/actions/filter.js +1 -1
- package/src/gantt/actions/keyboard.js +2 -2
- package/src/gantt/actions/selection.js +3 -0
- package/src/gantt/actions/taskbar-edit.js +6 -4
- package/src/gantt/actions/toolbar.js +22 -4
- package/src/gantt/base/css-constants.d.ts +12 -0
- package/src/gantt/base/css-constants.js +12 -0
- package/src/gantt/base/date-processor.d.ts +1 -1
- package/src/gantt/base/date-processor.js +8 -2
- package/src/gantt/base/enum.d.ts +3 -1
- package/src/gantt/base/gantt-chart.js +6 -2
- package/src/gantt/base/gantt-model.d.ts +8 -1
- package/src/gantt/base/gantt.d.ts +32 -1
- package/src/gantt/base/gantt.js +133 -5
- package/src/gantt/base/interface.d.ts +16 -0
- package/src/gantt/base/splitter.js +4 -0
- package/src/gantt/base/task-processor.js +19 -6
- package/src/gantt/base/tree-grid.js +1 -1
- package/src/gantt/export/export-helper.js +19 -6
- package/src/gantt/export/pdf-base/pdf-style/gantt-theme.js +16 -0
- package/src/gantt/renderer/chart-rows.js +16 -5
- package/src/gantt/renderer/nonworking-day.js +5 -2
- package/src/gantt/renderer/timeline.js +35 -14
- package/src/global.js +1 -1
- package/styles/bootstrap-dark.css +272 -14
- package/styles/bootstrap.css +271 -14
- package/styles/bootstrap4.css +273 -12
- package/styles/bootstrap5-dark.css +272 -15
- package/styles/bootstrap5.css +272 -15
- package/styles/fabric-dark.css +270 -12
- package/styles/fabric.css +276 -18
- package/styles/fluent-dark.css +272 -14
- package/styles/fluent.css +272 -14
- package/styles/gantt/_bootstrap-dark-definition.scss +59 -16
- package/styles/gantt/_bootstrap-definition.scss +57 -14
- package/styles/gantt/_bootstrap4-definition.scss +65 -21
- package/styles/gantt/_bootstrap5-definition.scss +55 -12
- package/styles/gantt/_fabric-dark-definition.scss +58 -15
- package/styles/gantt/_fabric-definition.scss +58 -15
- package/styles/gantt/_fluent-definition.scss +53 -10
- package/styles/gantt/_fusionnew-definition.scss +212 -0
- package/styles/gantt/_highcontrast-definition.scss +57 -14
- package/styles/gantt/_highcontrast-light-definition.scss +55 -12
- package/styles/gantt/_layout.scss +293 -7
- package/styles/gantt/_material-dark-definition.scss +60 -16
- package/styles/gantt/_material-definition.scss +65 -21
- package/styles/gantt/_material3-definition.scss +213 -0
- package/styles/gantt/_tailwind-definition.scss +52 -8
- package/styles/gantt/_theme.scss +56 -1
- package/styles/gantt/bootstrap-dark.css +272 -14
- package/styles/gantt/bootstrap.css +271 -14
- package/styles/gantt/bootstrap4.css +273 -12
- package/styles/gantt/bootstrap5-dark.css +272 -15
- package/styles/gantt/bootstrap5.css +272 -15
- package/styles/gantt/fabric-dark.css +270 -12
- package/styles/gantt/fabric.css +276 -18
- package/styles/gantt/fluent-dark.css +272 -14
- package/styles/gantt/fluent.css +272 -14
- package/styles/gantt/highcontrast-light.css +260 -13
- package/styles/gantt/highcontrast.css +271 -13
- package/styles/gantt/icons/_bootstrap-dark.scss +12 -1
- package/styles/gantt/icons/_bootstrap.scss +12 -1
- package/styles/gantt/icons/_bootstrap4.scss +12 -1
- package/styles/gantt/icons/_bootstrap5.scss +12 -0
- package/styles/gantt/icons/_fabric-dark.scss +12 -0
- package/styles/gantt/icons/_fabric.scss +12 -0
- package/styles/gantt/icons/_fluent.scss +12 -0
- package/styles/gantt/icons/_fusionnew.scss +120 -0
- package/styles/gantt/icons/_highcontrast.scss +12 -0
- package/styles/gantt/icons/_material-dark.scss +12 -0
- package/styles/gantt/icons/_material.scss +12 -0
- package/styles/gantt/icons/_material3.scss +124 -0
- package/styles/gantt/icons/_tailwind-dark.scss +12 -0
- package/styles/gantt/icons/_tailwind.scss +12 -0
- package/styles/gantt/material-dark.css +277 -12
- package/styles/gantt/material.css +279 -14
- package/styles/gantt/tailwind-dark.css +279 -15
- package/styles/gantt/tailwind.css +276 -12
- package/styles/highcontrast-light.css +260 -13
- package/styles/highcontrast.css +271 -13
- package/styles/material-dark.css +277 -12
- package/styles/material.css +279 -14
- package/styles/tailwind-dark.css +279 -15
- package/styles/tailwind.css +276 -12
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import { isNullOrUndefined } from "@syncfusion/ej2-base";
|
|
2
|
+
import { addClass, removeClass } from '@syncfusion/ej2-base';
|
|
3
|
+
import * as cls from '../base/css-constants';
|
|
4
|
+
var CriticalPath = /** @class */ (function () {
|
|
5
|
+
function CriticalPath(parent) {
|
|
6
|
+
this.resourceCollectionIds = [];
|
|
7
|
+
this.criticalTasks = [];
|
|
8
|
+
this.parent = parent;
|
|
9
|
+
}
|
|
10
|
+
CriticalPath.prototype.getCriticalTasks = function () {
|
|
11
|
+
return this.criticalTasks;
|
|
12
|
+
};
|
|
13
|
+
CriticalPath.prototype.showCriticalPath = function (isCritical) {
|
|
14
|
+
var modelIds = this.parent.ids;
|
|
15
|
+
var totalRecords = this.parent.flatData;
|
|
16
|
+
if (isCritical && this.parent.flatData.length > 0 && !this.parent.enableMultiTaskbar) {
|
|
17
|
+
this.parent.enableCriticalPath = true;
|
|
18
|
+
var parentRecords = this.parent.treeGrid.parentData;
|
|
19
|
+
var checkEndDateTaskid = void 0;
|
|
20
|
+
var checkEndDate = parentRecords[0].ganttProperties.endDate;
|
|
21
|
+
var dateDifference = 0;
|
|
22
|
+
var checkBeyondEnddate = [];
|
|
23
|
+
var totalPredecessorsCollection = [];
|
|
24
|
+
var totalPredecessorsCollectionId = [];
|
|
25
|
+
var predecessorIndex = 0;
|
|
26
|
+
var taskBeyondEnddate = [];
|
|
27
|
+
var predecessorTaskBeyondEnddate = [];
|
|
28
|
+
var collection = [];
|
|
29
|
+
var collectionTaskId = [];
|
|
30
|
+
var fromDataObject = [];
|
|
31
|
+
var criticalPathIds = [];
|
|
32
|
+
/* eslint-disable-next-line */
|
|
33
|
+
if (parentRecords[0].ganttProperties.autoEndDate > parentRecords[0].ganttProperties.endDate && !parentRecords[0].ganttProperties.isAutoSchedule) {
|
|
34
|
+
checkEndDate = parentRecords[0].ganttProperties.autoEndDate;
|
|
35
|
+
}
|
|
36
|
+
checkEndDateTaskid = parentRecords[0].ganttProperties.taskId;
|
|
37
|
+
// Find the total project endDate
|
|
38
|
+
for (var i = 1; i < parentRecords.length; i++) {
|
|
39
|
+
if (parentRecords[i].ganttProperties.endDate >= checkEndDate) {
|
|
40
|
+
checkEndDate = parentRecords[i].ganttProperties.endDate;
|
|
41
|
+
checkEndDateTaskid = parentRecords[i].ganttProperties.taskId;
|
|
42
|
+
}
|
|
43
|
+
if (!parentRecords[i].ganttProperties.isAutoSchedule) {
|
|
44
|
+
if (parentRecords[i].ganttProperties.autoEndDate >= checkEndDate) {
|
|
45
|
+
checkEndDate = parentRecords[i].ganttProperties.autoEndDate;
|
|
46
|
+
checkEndDateTaskid = parentRecords[i].ganttProperties.taskId;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
this.maxEndDate = checkEndDate;
|
|
51
|
+
// find the tasks that ends on total project end date that stored in checkBeyondEnddate
|
|
52
|
+
// find the tasks with predecessor that stored in totalPredecessorsCollectionId.
|
|
53
|
+
for (var j = 0; j < totalRecords.length; j++) {
|
|
54
|
+
totalRecords[j].isCritical = false;
|
|
55
|
+
totalRecords[j].ganttProperties.isCritical = false;
|
|
56
|
+
/* eslint-disable-next-line */
|
|
57
|
+
dateDifference = this.parent.dataOperation.getDuration(totalRecords[j].ganttProperties.endDate, checkEndDate, totalRecords[j].ganttProperties.durationUnit, totalRecords[j].ganttProperties.isAutoSchedule, totalRecords[j].ganttProperties.isMilestone);
|
|
58
|
+
totalRecords[j].slack = dateDifference + ' ' + totalRecords[j].ganttProperties.durationUnit;
|
|
59
|
+
totalRecords[j].ganttProperties.slack = dateDifference + ' ' + totalRecords[j].ganttProperties.durationUnit;
|
|
60
|
+
if (totalRecords[j].ganttProperties.endDate >= checkEndDate) {
|
|
61
|
+
checkBeyondEnddate.push(parseInt(totalRecords[j].ganttProperties.taskId, 10));
|
|
62
|
+
}
|
|
63
|
+
if (totalRecords[j].ganttProperties.predecessor) {
|
|
64
|
+
if (totalRecords[j].ganttProperties.predecessor.length !== 0) {
|
|
65
|
+
totalPredecessorsCollection.push(totalRecords[j]);
|
|
66
|
+
totalPredecessorsCollectionId.push(parseInt(totalRecords[j].ganttProperties.taskId, 10));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (this.parent.viewType === 'ResourceView') {
|
|
71
|
+
for (var i = 0; i < this.parent.taskIds.length; i++) {
|
|
72
|
+
this.resourceCollectionIds[i] = this.parent.taskIds[i].slice(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// seperate the predecessor connected taskes from the individual taskes that ends on total project end date
|
|
76
|
+
for (var k = 0; k < checkBeyondEnddate.length; k++) {
|
|
77
|
+
if (totalPredecessorsCollectionId.indexOf(checkBeyondEnddate[k]) === -1) {
|
|
78
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
79
|
+
predecessorIndex = modelIds.indexOf(checkBeyondEnddate[k].toString());
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
predecessorIndex = this.resourceCollectionIds.indexOf(checkBeyondEnddate[k].toString());
|
|
83
|
+
}
|
|
84
|
+
if (totalRecords[predecessorIndex].ganttProperties.progress < 100) {
|
|
85
|
+
totalRecords[predecessorIndex].isCritical = true;
|
|
86
|
+
totalRecords[predecessorIndex].ganttProperties.isCritical = true;
|
|
87
|
+
}
|
|
88
|
+
totalRecords[predecessorIndex]['slack'] = 0 + ' ' + totalRecords[predecessorIndex].ganttProperties.durationUnit;
|
|
89
|
+
taskBeyondEnddate.push(checkBeyondEnddate[k]);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
predecessorTaskBeyondEnddate.push(checkBeyondEnddate[k]);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
var predecessorLength = totalPredecessorsCollection.length;
|
|
96
|
+
var endTask = [];
|
|
97
|
+
// find the detail collection of predecessor for each taskes that stored in collection.
|
|
98
|
+
for (var x = 0; x < predecessorLength; x++) {
|
|
99
|
+
var to = -1;
|
|
100
|
+
var from = -1;
|
|
101
|
+
var toPredecessor = -1;
|
|
102
|
+
var fromPredecessor = -1;
|
|
103
|
+
var currentIndex = x;
|
|
104
|
+
var predecessor = totalPredecessorsCollection[x].ganttProperties.predecessor;
|
|
105
|
+
var individualPredecessorLength = totalPredecessorsCollection[x].ganttProperties.predecessor.length;
|
|
106
|
+
var taskid = (parseInt(totalPredecessorsCollection[x].ganttProperties.taskId, 10));
|
|
107
|
+
for (var y = 0; y < individualPredecessorLength; y++) {
|
|
108
|
+
if (parseInt(predecessor[y].from, 10) === taskid) {
|
|
109
|
+
if (to === -1) {
|
|
110
|
+
if (!predecessor[y].offset) {
|
|
111
|
+
to = predecessor[y].to;
|
|
112
|
+
toPredecessor = predecessor[y].type;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
to = predecessor[y].to + ':' + predecessor[y].offset + predecessor[y].offsetUnit;
|
|
116
|
+
toPredecessor = predecessor[y].type;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (!predecessor[y].offset) {
|
|
121
|
+
to = to + ',' + predecessor[y].to;
|
|
122
|
+
toPredecessor = toPredecessor + ',' + predecessor[y].type;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
to = to + ',' + predecessor[y].to + ':' + predecessor[y].offset + predecessor[y].offsetUnit;
|
|
126
|
+
toPredecessor = toPredecessor + ',' + predecessor[y].type;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (parseInt(predecessor[y].to, 10) === taskid) {
|
|
131
|
+
if (from === -1) {
|
|
132
|
+
if (!predecessor[y].offset) {
|
|
133
|
+
from = predecessor[y].from;
|
|
134
|
+
fromPredecessor = predecessor[y].type;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
from = predecessor[y].from + ':' + predecessor[y].offset + predecessor[y].offsetUnit;
|
|
138
|
+
fromPredecessor = predecessor[y].type;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
if (!predecessor[y].offset) {
|
|
143
|
+
from = from + ',' + predecessor[y].from;
|
|
144
|
+
fromPredecessor = fromPredecessor + ',' + predecessor[y].type;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
from = from + ',' + predecessor[y].from + ':' + predecessor[y].offset + predecessor[y].offsetUnit;
|
|
148
|
+
fromPredecessor = fromPredecessor + ',' + predecessor[y].type;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (from === -1) {
|
|
154
|
+
from = null;
|
|
155
|
+
fromPredecessor = null;
|
|
156
|
+
}
|
|
157
|
+
if (to === -1) {
|
|
158
|
+
to = null;
|
|
159
|
+
toPredecessor = null;
|
|
160
|
+
}
|
|
161
|
+
/* eslint-disable-next-line */
|
|
162
|
+
collection.push({ from: from, fromPredecessor: fromPredecessor, taskid: taskid, to: to, toPredecessor: toPredecessor, currentIndex: currentIndex, slack: null, enddate: null });
|
|
163
|
+
collectionTaskId.push(taskid);
|
|
164
|
+
}
|
|
165
|
+
var collectionLength = collection.length;
|
|
166
|
+
var indexEnddate = 0;
|
|
167
|
+
var num = void 0;
|
|
168
|
+
// find the predecessors connected taskes that does not contains any successor.
|
|
169
|
+
for (var z = 0; z < collectionLength; z++) {
|
|
170
|
+
if (!collection[z]['to']) {
|
|
171
|
+
num = collection[z]['taskid'];
|
|
172
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
173
|
+
indexEnddate = modelIds.indexOf(num.toString());
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
indexEnddate = this.resourceCollectionIds.indexOf(num.toString());
|
|
177
|
+
}
|
|
178
|
+
var flatData = totalRecords[indexEnddate].ganttProperties;
|
|
179
|
+
/* eslint-disable-next-line */
|
|
180
|
+
dateDifference = this.parent.dataOperation.getDuration(flatData.endDate, checkEndDate, 'minute', flatData.isAutoSchedule, flatData.isMilestone);
|
|
181
|
+
collection[z]['slack'] = dateDifference;
|
|
182
|
+
collection[z]['fs'] = -1;
|
|
183
|
+
collection[z]['enddate'] = flatData.endDate;
|
|
184
|
+
endTask.push({
|
|
185
|
+
fromdata: collection[z]['from'], todateID: collection[z]['taskid'],
|
|
186
|
+
fromDataPredecessor: collection[z]['fromPredecessor']
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
for (var k = 0; k < endTask.length; k++) {
|
|
191
|
+
fromDataObject.push(endTask[k]);
|
|
192
|
+
this.slackCalculation(fromDataObject, collection, collectionTaskId, checkEndDate, totalRecords, modelIds);
|
|
193
|
+
}
|
|
194
|
+
criticalPathIds = this.finalCriticalPath(collection, taskBeyondEnddate, totalRecords, modelIds, checkEndDate);
|
|
195
|
+
this.criticalPathCollection = criticalPathIds;
|
|
196
|
+
this.detailPredecessorCollection = collection;
|
|
197
|
+
this.predecessorCollectionTaskIds = collectionTaskId;
|
|
198
|
+
}
|
|
199
|
+
if (isCritical === false && this.parent.flatData.length > 0 && !this.parent.enableMultiTaskbar) {
|
|
200
|
+
var pathIndex = void 0;
|
|
201
|
+
this.parent.enableCriticalPath = false;
|
|
202
|
+
for (var z = 0; z < this.criticalPathCollection.length; z++) {
|
|
203
|
+
pathIndex = modelIds.indexOf(this.criticalPathCollection[z].toString());
|
|
204
|
+
totalRecords[pathIndex].isCritical = false;
|
|
205
|
+
}
|
|
206
|
+
this.criticalPathCollection = [];
|
|
207
|
+
this.detailPredecessorCollection = [];
|
|
208
|
+
this.predecessorCollectionTaskIds = [];
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
/* eslint-disable-next-line */
|
|
212
|
+
CriticalPath.prototype.slackCalculation = function (fromDataObject, collection, collectionTaskId, checkEndDate, flatRecords, modelRecordIds) {
|
|
213
|
+
var fromDateArray = fromDataObject[0]['fromdata'].split(',');
|
|
214
|
+
var fromDataPredecessor = fromDataObject[0]['fromDataPredecessor'].split(',');
|
|
215
|
+
var fromDateArray1 = [];
|
|
216
|
+
var fromTaskIdIndex;
|
|
217
|
+
var indexFromTaskId;
|
|
218
|
+
var indexToTaskId;
|
|
219
|
+
var totaskId;
|
|
220
|
+
var dateDifference;
|
|
221
|
+
var prevTaskEnddate;
|
|
222
|
+
var offsetInMillSec;
|
|
223
|
+
var ffslack;
|
|
224
|
+
for (var i = 0; i < fromDateArray.length; i++) {
|
|
225
|
+
fromDateArray1 = fromDateArray[i].split(':');
|
|
226
|
+
fromTaskIdIndex = collectionTaskId.indexOf(parseInt(fromDateArray1[0], 10));
|
|
227
|
+
totaskId = collectionTaskId.indexOf(parseInt(fromDataObject[0]['todateID'], 10));
|
|
228
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
229
|
+
indexFromTaskId = modelRecordIds.indexOf(fromDateArray1[0].toString());
|
|
230
|
+
indexToTaskId = modelRecordIds.indexOf(fromDataObject[0]['todateID'].toString());
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
indexFromTaskId = this.resourceCollectionIds.indexOf(fromDateArray1[0].toString());
|
|
234
|
+
indexToTaskId = this.resourceCollectionIds.indexOf(fromDataObject[0]['todateID'].toString());
|
|
235
|
+
}
|
|
236
|
+
var fromIdFlatData = flatRecords[indexFromTaskId].ganttProperties;
|
|
237
|
+
var toIdFlatData = flatRecords[indexToTaskId].ganttProperties;
|
|
238
|
+
if (fromDateArray1.length > 1) {
|
|
239
|
+
if (fromDateArray1[1].indexOf('hour') !== -1) {
|
|
240
|
+
offsetInMillSec = parseFloat(fromDateArray1[1]) * 60;
|
|
241
|
+
}
|
|
242
|
+
else if (fromDateArray1[1].indexOf('day') !== -1) {
|
|
243
|
+
offsetInMillSec = parseFloat(fromDateArray1[1]) * (this.parent.secondsPerDay / 3600) * 60;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
offsetInMillSec = parseFloat(fromDateArray1[1]);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// calculate slack value for the task contains predecessor connection in "finish to start".
|
|
250
|
+
if (fromDataPredecessor[i] === 'FS') {
|
|
251
|
+
if (fromIdFlatData.endDate > toIdFlatData.startDate) {
|
|
252
|
+
/* eslint-disable-next-line */
|
|
253
|
+
dateDifference = -(this.parent.dataOperation.getDuration(toIdFlatData.startDate, fromIdFlatData.endDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone));
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
/* eslint-disable-next-line */
|
|
257
|
+
dateDifference = this.parent.dataOperation.getDuration(fromIdFlatData.endDate, toIdFlatData.startDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone);
|
|
258
|
+
}
|
|
259
|
+
// execute if the slack value is not set initially.
|
|
260
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
261
|
+
// execute if the offset value is not given.
|
|
262
|
+
if (fromDateArray1.length <= 1) {
|
|
263
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
264
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// execute if the current calculated slack value is less than the previous slack value.
|
|
272
|
+
else if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
273
|
+
// execute if the offset value is not given.
|
|
274
|
+
if (fromDateArray1.length <= 1) {
|
|
275
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
276
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// execute if the offset value is given.
|
|
284
|
+
if (fromDateArray1.length > 1) {
|
|
285
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
286
|
+
collection[fromTaskIdIndex]['slack'] = collection[fromTaskIdIndex]['slack'] - (offsetInMillSec);
|
|
287
|
+
if (collection[fromTaskIdIndex]['slack'] < 0) {
|
|
288
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
collection[fromTaskIdIndex]['fs'] = 1;
|
|
292
|
+
collection[fromTaskIdIndex]['fsslack'] = collection[fromTaskIdIndex]['slack'];
|
|
293
|
+
collection[fromTaskIdIndex]['enddate'] = fromIdFlatData.startDate;
|
|
294
|
+
if (fromIdFlatData.endDate >= checkEndDate && fromIdFlatData.endDate <= checkEndDate) {
|
|
295
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// calculate slack value for the task contains predecessor connection in "start to start".
|
|
299
|
+
if (fromDataPredecessor[i] === 'SS') {
|
|
300
|
+
// It execute if the task is in auto mode.
|
|
301
|
+
if (fromIdFlatData.isAutoSchedule) {
|
|
302
|
+
if (fromIdFlatData.startDate > toIdFlatData.startDate) {
|
|
303
|
+
/* eslint-disable-next-line */
|
|
304
|
+
dateDifference = -(this.parent.dataOperation.getDuration(toIdFlatData.endDate, fromIdFlatData.startDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone));
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
/* eslint-disable-next-line */
|
|
308
|
+
dateDifference = this.parent.dataOperation.getDuration(fromIdFlatData.startDate, toIdFlatData.startDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone);
|
|
309
|
+
}
|
|
310
|
+
// It execute while the slack value is not set to the corresponding task.
|
|
311
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
312
|
+
if (fromDateArray1.length <= 1) {
|
|
313
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
314
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
//It execute while already the slack value is set and it is higher than the datedifference.
|
|
322
|
+
else if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
323
|
+
if (fromDateArray1.length <= 1) {
|
|
324
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
325
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// execute if the offset value is given.
|
|
333
|
+
if (fromDateArray1.length > 1) {
|
|
334
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
335
|
+
collection[fromTaskIdIndex]['slack'] = collection[fromTaskIdIndex]['slack'] - (offsetInMillSec);
|
|
336
|
+
if (collection[fromTaskIdIndex]['slack'] < 0) {
|
|
337
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
collection[fromTaskIdIndex]['fs'] = 1;
|
|
341
|
+
collection[fromTaskIdIndex]['fsslack'] = collection[fromTaskIdIndex]['slack'];
|
|
342
|
+
collection[fromTaskIdIndex]['enddate'] = fromIdFlatData.startDate;
|
|
343
|
+
}
|
|
344
|
+
// It execute if the task is in not an auto mode task.
|
|
345
|
+
else if (!fromIdFlatData.isAutoSchedule) {
|
|
346
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
347
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
348
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
349
|
+
}
|
|
350
|
+
else if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
351
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (fromIdFlatData.endDate >= checkEndDate && fromIdFlatData.endDate <= checkEndDate) {
|
|
355
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// calculate slack value for the task contains predecessor connection in "finish to finish".
|
|
359
|
+
if (fromDataPredecessor[i] === 'FF') {
|
|
360
|
+
// execute if the previous task is from finish to start or finish to finish state.
|
|
361
|
+
if (collection[totaskId]['fs'] === 1 || collection[totaskId]['ff'] === 1 || collection[totaskId]['fs'] === -1) {
|
|
362
|
+
if (collection[totaskId]['fs'] === 1 || collection[totaskId]['ff'] === 1) {
|
|
363
|
+
prevTaskEnddate = toIdFlatData.endDate;
|
|
364
|
+
ffslack = collection[totaskId]['slack'];
|
|
365
|
+
}
|
|
366
|
+
if (collection[totaskId]['fs'] === -1) {
|
|
367
|
+
prevTaskEnddate = collection[totaskId]['enddate'];
|
|
368
|
+
ffslack = collection[totaskId]['slack'];
|
|
369
|
+
}
|
|
370
|
+
if (prevTaskEnddate > fromIdFlatData.endDate) {
|
|
371
|
+
dateDifference = -(this.getSlackDuration(fromIdFlatData.endDate, prevTaskEnddate, 'minute', flatRecords[indexFromTaskId]));
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
dateDifference = this.getSlackDuration(prevTaskEnddate, fromIdFlatData.endDate, 'minute', flatRecords[indexFromTaskId]);
|
|
375
|
+
}
|
|
376
|
+
// set the slack value if the slack value is not set initially.
|
|
377
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
378
|
+
// execute if the offset value is not given.
|
|
379
|
+
if (fromDateArray1.length <= 1) {
|
|
380
|
+
if (ffslack - dateDifference < 0) {
|
|
381
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
collection[fromTaskIdIndex]['slack'] = ffslack - dateDifference;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// overright the slack value if the current calculated slack value is less than the previous slack value.
|
|
389
|
+
else if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
390
|
+
// execute if the offset value is not given.
|
|
391
|
+
if (fromDateArray1.length <= 1) {
|
|
392
|
+
if (ffslack - dateDifference < 0) {
|
|
393
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
collection[fromTaskIdIndex]['slack'] = ffslack - dateDifference;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// execute if the offset value is given.
|
|
401
|
+
if (fromDateArray1.length > 1) {
|
|
402
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] - dateDifference;
|
|
403
|
+
collection[fromTaskIdIndex]['slack'] = collection[fromTaskIdIndex]['slack'] - (offsetInMillSec);
|
|
404
|
+
if (collection[fromTaskIdIndex]['slack'] < 0) {
|
|
405
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
collection[fromTaskIdIndex]['ff'] = 1;
|
|
409
|
+
collection[fromTaskIdIndex]['enddate'] = prevTaskEnddate;
|
|
410
|
+
collection[fromTaskIdIndex]['fsslack'] = ffslack;
|
|
411
|
+
}
|
|
412
|
+
if (fromIdFlatData.endDate >= checkEndDate && fromIdFlatData.endDate <= checkEndDate) {
|
|
413
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// calculate slack value for the task contains predecessor connection in "start to finish".
|
|
417
|
+
if (fromDataPredecessor[i] === 'SF') {
|
|
418
|
+
//It execute if the task is an auto mode task.
|
|
419
|
+
if (fromIdFlatData.isAutoSchedule) {
|
|
420
|
+
//execute if the slack value is not set initially.
|
|
421
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
422
|
+
// execute if the offset value is not given.
|
|
423
|
+
if (fromDateArray1.length <= 1) {
|
|
424
|
+
// execute if the previous task does no has sucessor.
|
|
425
|
+
if (isNullOrUndefined(collection[totaskId]['to'])) {
|
|
426
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
427
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
428
|
+
}
|
|
429
|
+
// execute if the previous task has sucessor.
|
|
430
|
+
else if (!isNullOrUndefined(collection[totaskId]['to'])) {
|
|
431
|
+
if (toIdFlatData.endDate > fromIdFlatData.startDate) {
|
|
432
|
+
/* eslint-disable-next-line */
|
|
433
|
+
dateDifference = -(this.parent.dataOperation.getDuration(fromIdFlatData.startDate, toIdFlatData.endDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
dateDifference = this.getSlackDuration(toIdFlatData.endDate, fromIdFlatData.startDate, 'minute', flatRecords[indexFromTaskId]);
|
|
437
|
+
}
|
|
438
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
439
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// execute if the offset value is given.
|
|
447
|
+
else if (fromDateArray1.length > 1) {
|
|
448
|
+
if (toIdFlatData.endDate >= fromIdFlatData.endDate) {
|
|
449
|
+
if (fromIdFlatData.startDate > toIdFlatData.endDate) {
|
|
450
|
+
/* eslint-disable-next-line */
|
|
451
|
+
dateDifference = -(this.getSlackDuration(toIdFlatData.endDate, fromIdFlatData.startDate, 'minute', flatRecords[indexFromTaskId]));
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
/* eslint-disable-next-line */
|
|
455
|
+
dateDifference = this.parent.dataOperation.getDuration(fromIdFlatData.startDate, toIdFlatData.endDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
460
|
+
}
|
|
461
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
462
|
+
collection[fromTaskIdIndex]['slack'] = collection[fromTaskIdIndex]['slack'] - (offsetInMillSec);
|
|
463
|
+
if (collection[fromTaskIdIndex]['slack'] < 0) {
|
|
464
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
collection[fromTaskIdIndex]['fs'] = 1;
|
|
468
|
+
collection[fromTaskIdIndex]['fsslack'] = collection[fromTaskIdIndex]['slack'];
|
|
469
|
+
collection[fromTaskIdIndex]['enddate'] = fromIdFlatData.startDate;
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
if (fromDateArray1.length <= 1) {
|
|
473
|
+
if (isNullOrUndefined(collection[totaskId]['to'])) {
|
|
474
|
+
/* eslint-disable-next-line */
|
|
475
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
476
|
+
}
|
|
477
|
+
else if (!isNullOrUndefined(collection[totaskId]['to'])) {
|
|
478
|
+
if (toIdFlatData.endDate > fromIdFlatData.startDate) {
|
|
479
|
+
// eslint-disable-next-line
|
|
480
|
+
dateDifference = -(this.parent.dataOperation.getDuration(fromIdFlatData.startDate, toIdFlatData.endDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone));
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
dateDifference = this.getSlackDuration(toIdFlatData.endDate, fromIdFlatData.startDate, 'minute', flatRecords[indexFromTaskId]);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// execute if the current calculated slack value is less than the previous slack value.
|
|
487
|
+
if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
488
|
+
if (isNullOrUndefined(collection[totaskId]['to'])) {
|
|
489
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
490
|
+
}
|
|
491
|
+
else if (!isNullOrUndefined(collection[totaskId]['to'])) {
|
|
492
|
+
if (collection[totaskId]['slack'] + dateDifference < 0) {
|
|
493
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
else if (fromDateArray1.length > 1) {
|
|
502
|
+
if (toIdFlatData.endDate > fromIdFlatData.endDate) {
|
|
503
|
+
if (fromIdFlatData.startDate > toIdFlatData.endDate) {
|
|
504
|
+
/* eslint-disable-next-line */
|
|
505
|
+
dateDifference = -(this.getSlackDuration(toIdFlatData.endDate, fromIdFlatData.startDate, 'minute', flatRecords[indexFromTaskId]));
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
// eslint-disable-next-line
|
|
509
|
+
dateDifference = this.parent.dataOperation.getDuration(fromIdFlatData.startDate, toIdFlatData.endDate, 'minute', fromIdFlatData.isAutoSchedule, fromIdFlatData.isMilestone);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
/* eslint-disable-next-line */
|
|
514
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
515
|
+
}
|
|
516
|
+
// execute if the current calculated slack value is less than the previous slack value.
|
|
517
|
+
if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
518
|
+
collection[fromTaskIdIndex]['slack'] = collection[totaskId]['slack'] + dateDifference;
|
|
519
|
+
collection[fromTaskIdIndex]['slack'] = collection[fromTaskIdIndex]['slack'] - (offsetInMillSec);
|
|
520
|
+
if (collection[fromTaskIdIndex]['slack'] < 0) {
|
|
521
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
collection[fromTaskIdIndex]['fs'] = 1;
|
|
526
|
+
collection[fromTaskIdIndex]['fsslack'] = collection[fromTaskIdIndex]['slack'];
|
|
527
|
+
collection[fromTaskIdIndex]['enddate'] = fromIdFlatData.startDate;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
//It execute if the task is an auto mode task.
|
|
531
|
+
else if (!fromIdFlatData.isAutoSchedule) {
|
|
532
|
+
dateDifference = this.getSlackDuration(fromIdFlatData.endDate, checkEndDate, 'minute', flatRecords[indexFromTaskId]);
|
|
533
|
+
if (isNullOrUndefined(collection[fromTaskIdIndex]['slack'])) {
|
|
534
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
535
|
+
}
|
|
536
|
+
else if (collection[fromTaskIdIndex]['slack'] > dateDifference && collection[fromTaskIdIndex]['slack'] !== 0) {
|
|
537
|
+
collection[fromTaskIdIndex]['slack'] = dateDifference;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (fromIdFlatData.endDate >= checkEndDate && fromIdFlatData.endDate <= checkEndDate) {
|
|
541
|
+
collection[fromTaskIdIndex]['slack'] = 0;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
if (collection[fromTaskIdIndex]['from']) {
|
|
545
|
+
fromDataObject.push({
|
|
546
|
+
fromdata: collection[fromTaskIdIndex]['from'], todateID: collection[fromTaskIdIndex]['taskid'],
|
|
547
|
+
fromDataPredecessor: collection[fromTaskIdIndex]['fromPredecessor']
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (fromDataObject) {
|
|
552
|
+
fromDataObject.splice(0, 1);
|
|
553
|
+
if (fromDataObject.length > 0) {
|
|
554
|
+
this.slackCalculation(fromDataObject, collection, collectionTaskId, checkEndDate, flatRecords, modelRecordIds);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
CriticalPath.prototype.getSlackDuration = function (sDate, eDate, durationUnit, record) {
|
|
559
|
+
var startDate = this.parent.dateValidationModule.checkStartDate(new Date(sDate));
|
|
560
|
+
var endDate = this.parent.dateValidationModule.checkEndDate(new Date(eDate));
|
|
561
|
+
if (this.parent.dataOperation['getTimeDifference'](startDate, endDate, true) <= 0) {
|
|
562
|
+
return 0;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
return this.parent.dataOperation.getDuration(startDate, endDate, durationUnit, record.ganttProperties.isAutoSchedule, true);
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
/* eslint-disable-next-line */
|
|
569
|
+
CriticalPath.prototype.finalCriticalPath = function (collection, taskBeyondEnddate, flatRecords, modelRecordIds, checkEndDate) {
|
|
570
|
+
var criticalPathIds = [];
|
|
571
|
+
var index;
|
|
572
|
+
for (var x = collection.length - 1; x >= 0; x--) {
|
|
573
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
574
|
+
index = modelRecordIds.indexOf(collection[x]['taskid'].toString());
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
index = this.resourceCollectionIds.indexOf(collection[x]['taskid'].toString());
|
|
578
|
+
}
|
|
579
|
+
var predecessorLength = flatRecords[index].ganttProperties.predecessor;
|
|
580
|
+
var noSlackValue = 0 + ' ' + flatRecords[index].ganttProperties.durationUnit;
|
|
581
|
+
for (var i = 0; i < predecessorLength.length; i++) {
|
|
582
|
+
var toID = void 0;
|
|
583
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
584
|
+
toID = this.parent.ids.indexOf(predecessorLength[i].to);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
toID = this.resourceCollectionIds.indexOf(predecessorLength[i].to);
|
|
588
|
+
}
|
|
589
|
+
var dateDifference = void 0;
|
|
590
|
+
var currentData = flatRecords[index].ganttProperties;
|
|
591
|
+
if (predecessorLength[i].type === 'FS') {
|
|
592
|
+
/* eslint-disable-next-line */
|
|
593
|
+
dateDifference = this.parent.dataOperation.getDuration(currentData.endDate, flatRecords[toID].ganttProperties.startDate, currentData.durationUnit, currentData.isAutoSchedule, currentData.isMilestone);
|
|
594
|
+
if (dateDifference === 0 && index !== toID && flatRecords[index].slack !== noSlackValue) {
|
|
595
|
+
flatRecords[index].slack = flatRecords[toID].slack;
|
|
596
|
+
flatRecords[index].ganttProperties.slack = flatRecords[toID].slack;
|
|
597
|
+
}
|
|
598
|
+
else if (dateDifference !== 0 && index !== toID && flatRecords[toID].isCritical) {
|
|
599
|
+
flatRecords[index].slack = dateDifference + ' ' + flatRecords[index].ganttProperties.durationUnit;
|
|
600
|
+
flatRecords[index].ganttProperties.slack = dateDifference + ' ' + flatRecords[index].ganttProperties.durationUnit;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else if (predecessorLength[i].type === 'SF') {
|
|
604
|
+
/* eslint-disable-next-line */
|
|
605
|
+
dateDifference = this.parent.dataOperation.getDuration(currentData.startDate, flatRecords[toID].ganttProperties.endDate, currentData.durationUnit, currentData.isAutoSchedule, currentData.isMilestone);
|
|
606
|
+
}
|
|
607
|
+
else if (predecessorLength[i].type === 'SS') {
|
|
608
|
+
/* eslint-disable-next-line */
|
|
609
|
+
dateDifference = this.parent.dataOperation.getDuration(currentData.startDate, flatRecords[toID].ganttProperties.startDate, currentData.durationUnit, currentData.isAutoSchedule, currentData.isMilestone);
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
/* eslint-disable-next-line */
|
|
613
|
+
dateDifference = this.parent.dataOperation.getDuration(currentData.endDate, flatRecords[toID].ganttProperties.endDate, currentData.durationUnit, currentData.isAutoSchedule, currentData.isMilestone);
|
|
614
|
+
}
|
|
615
|
+
if (parseInt(predecessorLength[i].from, 10) === flatRecords[index][this.parent.taskFields.id] &&
|
|
616
|
+
flatRecords[toID].slack === noSlackValue && dateDifference <= 0) {
|
|
617
|
+
flatRecords[index].slack = noSlackValue;
|
|
618
|
+
flatRecords[index].ganttProperties.slack = noSlackValue;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (flatRecords[index].slack === noSlackValue) {
|
|
622
|
+
if (flatRecords[index].ganttProperties.progress < 100) {
|
|
623
|
+
flatRecords[index].isCritical = true;
|
|
624
|
+
flatRecords[index].ganttProperties.isCritical = true;
|
|
625
|
+
this.criticalTasks.push(flatRecords[index]);
|
|
626
|
+
criticalPathIds.push(collection[x]['taskid']);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (taskBeyondEnddate.length > 0) {
|
|
631
|
+
for (var i = 0; i < taskBeyondEnddate.length; i++) {
|
|
632
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
633
|
+
index = modelRecordIds.indexOf(taskBeyondEnddate[i].toString());
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
index = this.resourceCollectionIds.indexOf(taskBeyondEnddate[i].toString());
|
|
637
|
+
}
|
|
638
|
+
if (index !== -1 && flatRecords[index].ganttProperties.progress < 100) {
|
|
639
|
+
this.criticalTasks.push(flatRecords[index]);
|
|
640
|
+
criticalPathIds = criticalPathIds.concat(taskBeyondEnddate[i]);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return criticalPathIds;
|
|
645
|
+
};
|
|
646
|
+
/* eslint-disable-next-line */
|
|
647
|
+
CriticalPath.prototype.criticalConnectorLine = function (criticalPathIds, collection, condition, collectionTaskId) {
|
|
648
|
+
var ganttChartElement = this.parent.ganttChartModule.chartElement;
|
|
649
|
+
removeClass(ganttChartElement.querySelectorAll('.e-gantt-child-taskbar-inner-div'), cls.criticalChildTaskBarInnerDiv);
|
|
650
|
+
removeClass(ganttChartElement.querySelectorAll('.e-gantt-child-progressbar-inner-div'), cls.criticalChildProgressBarInnerDiv);
|
|
651
|
+
removeClass(ganttChartElement.querySelectorAll('.e-milestone-top'), cls.criticalMilestoneTop);
|
|
652
|
+
removeClass(ganttChartElement.querySelectorAll('.e-milestone-bottom'), cls.criticalMilestoneBottom);
|
|
653
|
+
for (var i = 0; i < criticalPathIds.length; i++) {
|
|
654
|
+
var criticalData = void 0;
|
|
655
|
+
if (this.parent.viewType === 'ProjectView') {
|
|
656
|
+
criticalData = this.parent.flatData[this.parent.ids.indexOf(criticalPathIds[i].toString())];
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
criticalData = this.parent.flatData[this.resourceCollectionIds.indexOf(criticalPathIds[i].toString())];
|
|
660
|
+
}
|
|
661
|
+
var index = this.parent.currentViewData.indexOf(criticalData);
|
|
662
|
+
var element = this.parent.getRowByIndex(index);
|
|
663
|
+
var taskClass = void 0;
|
|
664
|
+
var columnFields = this.parent.taskFields;
|
|
665
|
+
/* eslint-disable-next-line */
|
|
666
|
+
if (this.parent.allowUnscheduledTasks && !criticalData[columnFields.startDate] && !criticalData[columnFields.endDate] && criticalData[columnFields.duration]) {
|
|
667
|
+
taskClass = cls.criticalUnscheduledTask;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
taskClass = cls.criticalChildProgressBarInnerDiv;
|
|
671
|
+
}
|
|
672
|
+
if (element) {
|
|
673
|
+
if (element.getElementsByClassName('e-milestone-top')[0]) {
|
|
674
|
+
addClass(element.querySelectorAll('.e-milestone-top'), cls.criticalMilestoneTop);
|
|
675
|
+
}
|
|
676
|
+
if (element.getElementsByClassName('e-milestone-bottom')[0]) {
|
|
677
|
+
addClass(element.querySelectorAll('.e-milestone-bottom'), cls.criticalMilestoneBottom);
|
|
678
|
+
}
|
|
679
|
+
if (element.getElementsByClassName('e-gantt-child-taskbar-inner-div').length > 0) {
|
|
680
|
+
addClass(element.querySelectorAll('.e-gantt-child-taskbar-inner-div'), cls.criticalChildTaskBarInnerDiv);
|
|
681
|
+
}
|
|
682
|
+
if (element.getElementsByClassName('e-gantt-child-progressbar-inner-div').length > 0) {
|
|
683
|
+
addClass(element.querySelectorAll('.e-gantt-child-progressbar-inner-div'), taskClass);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
removeClass(this.parent.element.querySelectorAll('.e-line'), cls.criticalConnectorLine);
|
|
688
|
+
removeClass(this.parent.element.querySelectorAll('.e-connector-line-right-arrow'), cls.criticalConnectorLineRightArrow);
|
|
689
|
+
removeClass(this.parent.element.querySelectorAll('.e-connector-line-left-arrow'), cls.criticalConnectorLineLeftArrow);
|
|
690
|
+
if (collection.length !== 0) {
|
|
691
|
+
var index = 0;
|
|
692
|
+
var currentdata = void 0;
|
|
693
|
+
var checking = [];
|
|
694
|
+
var checkint = void 0;
|
|
695
|
+
for (var i = 0; i < this.criticalPathCollection.length; i++) {
|
|
696
|
+
index = collectionTaskId.indexOf(this.criticalPathCollection[i]);
|
|
697
|
+
currentdata = collection[index];
|
|
698
|
+
if (index !== -1 && currentdata['to']) {
|
|
699
|
+
checking = currentdata['to'].split(',');
|
|
700
|
+
for (var j = 0; j < checking.length; j++) {
|
|
701
|
+
checkint = parseInt(checking[j], 10);
|
|
702
|
+
if (criticalPathIds.indexOf(checkint) !== -1) {
|
|
703
|
+
var lineElement = this.parent.element.querySelectorAll('#ConnectorLineparent' +
|
|
704
|
+
currentdata['taskid'] + 'child' + checkint);
|
|
705
|
+
if (lineElement.length > 0) {
|
|
706
|
+
addClass(this.parent.element.querySelectorAll('#ConnectorLineparent' + currentdata['taskid'] + 'child' +
|
|
707
|
+
checkint)[0].querySelectorAll('.e-line'), cls.criticalConnectorLine);
|
|
708
|
+
addClass(this.parent.element.querySelectorAll('#ConnectorLineparent' + currentdata['taskid'] + 'child' +
|
|
709
|
+
checkint)[0].querySelectorAll('.e-connector-line-right-arrow'), cls.criticalConnectorLineRightArrow);
|
|
710
|
+
addClass(this.parent.element.querySelectorAll('#ConnectorLineparent' + currentdata['taskid'] + 'child' +
|
|
711
|
+
checkint)[0].querySelectorAll('.e-connector-line-left-arrow'), cls.criticalConnectorLineLeftArrow);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
CriticalPath.prototype.getModuleName = function () {
|
|
720
|
+
return 'criticalPath';
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* Destroys the Critical Path of Gantt.
|
|
724
|
+
*
|
|
725
|
+
* @returns {void} .
|
|
726
|
+
* @private
|
|
727
|
+
*/
|
|
728
|
+
CriticalPath.prototype.destroy = function () {
|
|
729
|
+
if (!this.parent.enableCriticalPath && this.parent.criticalPathModule) {
|
|
730
|
+
this.parent.criticalPathModule = undefined;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
return CriticalPath;
|
|
734
|
+
}());
|
|
735
|
+
export { CriticalPath };
|