@plusscommunities/pluss-maintenance-web-forms 1.1.35 → 1.1.37-beta.0
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/dist/index.cjs.js +177 -94
- package/dist/index.esm.js +177 -94
- package/dist/index.umd.js +177 -94
- package/package.json +1 -1
- package/src/components/AnalyticsHub.js +308 -154
package/dist/index.esm.js
CHANGED
|
@@ -217,12 +217,12 @@ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
|
|
|
217
217
|
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
218
218
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
219
219
|
const {
|
|
220
|
-
Helper: Helper$
|
|
220
|
+
Helper: Helper$6,
|
|
221
221
|
Session: Session$9
|
|
222
222
|
} = PlussCore;
|
|
223
223
|
const maintenanceActions = {
|
|
224
224
|
getJobType: (site, typeId) => {
|
|
225
|
-
let url = Helper$
|
|
225
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtype');
|
|
226
226
|
return Session$9.authedFunction({
|
|
227
227
|
method: 'POST',
|
|
228
228
|
url,
|
|
@@ -233,7 +233,7 @@ const maintenanceActions = {
|
|
|
233
233
|
});
|
|
234
234
|
},
|
|
235
235
|
getJobTypes: (site, id) => {
|
|
236
|
-
let url = Helper$
|
|
236
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtypes');
|
|
237
237
|
return Session$9.authedFunction({
|
|
238
238
|
method: 'POST',
|
|
239
239
|
url,
|
|
@@ -243,7 +243,7 @@ const maintenanceActions = {
|
|
|
243
243
|
});
|
|
244
244
|
},
|
|
245
245
|
getJob: (site, id) => {
|
|
246
|
-
let url = Helper$
|
|
246
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
247
247
|
return Session$9.authedFunction({
|
|
248
248
|
method: 'POST',
|
|
249
249
|
url,
|
|
@@ -254,7 +254,7 @@ const maintenanceActions = {
|
|
|
254
254
|
});
|
|
255
255
|
},
|
|
256
256
|
getJobByJobId: (site, jobId) => {
|
|
257
|
-
let url = Helper$
|
|
257
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
258
258
|
return Session$9.authedFunction({
|
|
259
259
|
method: 'POST',
|
|
260
260
|
url,
|
|
@@ -269,7 +269,7 @@ const maintenanceActions = {
|
|
|
269
269
|
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
270
270
|
return Session$9.authedFunction({
|
|
271
271
|
method: 'POST',
|
|
272
|
-
url: Helper$
|
|
272
|
+
url: Helper$6.getUrl(values.serviceKey, 'getJobs'),
|
|
273
273
|
data: {
|
|
274
274
|
site,
|
|
275
275
|
status,
|
|
@@ -292,7 +292,7 @@ const maintenanceActions = {
|
|
|
292
292
|
}
|
|
293
293
|
return Session$9.authedFunction({
|
|
294
294
|
method: 'GET',
|
|
295
|
-
url: Helper$
|
|
295
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/requests', query)
|
|
296
296
|
});
|
|
297
297
|
},
|
|
298
298
|
getJobsRecursive: function (site, status, type, lastKey) {
|
|
@@ -310,14 +310,14 @@ const maintenanceActions = {
|
|
|
310
310
|
createJob: job => {
|
|
311
311
|
return Session$9.authedFunction({
|
|
312
312
|
method: 'POST',
|
|
313
|
-
url: Helper$
|
|
313
|
+
url: Helper$6.getUrl(values.serviceKey, 'sendMaintenance'),
|
|
314
314
|
data: _objectSpread$7({}, job)
|
|
315
315
|
});
|
|
316
316
|
},
|
|
317
317
|
editJob: (job, site) => {
|
|
318
318
|
return Session$9.authedFunction({
|
|
319
319
|
method: 'POST',
|
|
320
|
-
url: Helper$
|
|
320
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJob'),
|
|
321
321
|
data: {
|
|
322
322
|
job,
|
|
323
323
|
site
|
|
@@ -327,7 +327,7 @@ const maintenanceActions = {
|
|
|
327
327
|
deleteJob: (site, id) => {
|
|
328
328
|
return Session$9.authedFunction({
|
|
329
329
|
method: 'POST',
|
|
330
|
-
url: Helper$
|
|
330
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/remove'),
|
|
331
331
|
data: {
|
|
332
332
|
site,
|
|
333
333
|
id
|
|
@@ -337,7 +337,7 @@ const maintenanceActions = {
|
|
|
337
337
|
editJobStatus: (id, status) => {
|
|
338
338
|
return Session$9.authedFunction({
|
|
339
339
|
method: 'POST',
|
|
340
|
-
url: Helper$
|
|
340
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobStatus'),
|
|
341
341
|
data: {
|
|
342
342
|
id,
|
|
343
343
|
status
|
|
@@ -347,7 +347,7 @@ const maintenanceActions = {
|
|
|
347
347
|
editJobPriority: (id, priority) => {
|
|
348
348
|
return Session$9.authedFunction({
|
|
349
349
|
method: 'POST',
|
|
350
|
-
url: Helper$
|
|
350
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/priority'),
|
|
351
351
|
data: {
|
|
352
352
|
id,
|
|
353
353
|
priority
|
|
@@ -357,7 +357,7 @@ const maintenanceActions = {
|
|
|
357
357
|
assignJob: (jobId, userId) => {
|
|
358
358
|
return Session$9.authedFunction({
|
|
359
359
|
method: 'POST',
|
|
360
|
-
url: Helper$
|
|
360
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/assign'),
|
|
361
361
|
data: {
|
|
362
362
|
id: jobId,
|
|
363
363
|
userId
|
|
@@ -367,7 +367,7 @@ const maintenanceActions = {
|
|
|
367
367
|
getAssignees: site => {
|
|
368
368
|
return Session$9.authedFunction({
|
|
369
369
|
method: 'GET',
|
|
370
|
-
url: Helper$
|
|
370
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/assignees', {
|
|
371
371
|
site
|
|
372
372
|
})
|
|
373
373
|
});
|
|
@@ -375,7 +375,7 @@ const maintenanceActions = {
|
|
|
375
375
|
addNote: (jobId, note, attachments, images) => {
|
|
376
376
|
return Session$9.authedFunction({
|
|
377
377
|
method: 'POST',
|
|
378
|
-
url: Helper$
|
|
378
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
379
379
|
data: {
|
|
380
380
|
id: jobId,
|
|
381
381
|
note,
|
|
@@ -388,7 +388,7 @@ const maintenanceActions = {
|
|
|
388
388
|
editNote: (jobId, noteId, note, attachments, images) => {
|
|
389
389
|
return Session$9.authedFunction({
|
|
390
390
|
method: 'POST',
|
|
391
|
-
url: Helper$
|
|
391
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
392
392
|
data: {
|
|
393
393
|
id: jobId,
|
|
394
394
|
note,
|
|
@@ -402,7 +402,7 @@ const maintenanceActions = {
|
|
|
402
402
|
deleteNote: (jobId, noteId) => {
|
|
403
403
|
return Session$9.authedFunction({
|
|
404
404
|
method: 'POST',
|
|
405
|
-
url: Helper$
|
|
405
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
406
406
|
data: {
|
|
407
407
|
id: jobId,
|
|
408
408
|
noteId,
|
|
@@ -422,7 +422,7 @@ const maintenanceActions = {
|
|
|
422
422
|
};
|
|
423
423
|
return Session$9.authedFunction({
|
|
424
424
|
method: 'POST',
|
|
425
|
-
url: Helper$
|
|
425
|
+
url: Helper$6.getUrl(values.serviceKey, 'createJobType'),
|
|
426
426
|
data
|
|
427
427
|
});
|
|
428
428
|
},
|
|
@@ -440,14 +440,14 @@ const maintenanceActions = {
|
|
|
440
440
|
if (hasCustomFields && customFields) data.customFields = customFields;
|
|
441
441
|
return Session$9.authedFunction({
|
|
442
442
|
method: 'POST',
|
|
443
|
-
url: Helper$
|
|
443
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobType'),
|
|
444
444
|
data
|
|
445
445
|
});
|
|
446
446
|
},
|
|
447
447
|
deleteJobType: (site, id) => {
|
|
448
448
|
return Session$9.authedFunction({
|
|
449
449
|
method: 'POST',
|
|
450
|
-
url: Helper$
|
|
450
|
+
url: Helper$6.getUrl(values.serviceKey, 'deleteJobType'),
|
|
451
451
|
data: {
|
|
452
452
|
site,
|
|
453
453
|
id
|
|
@@ -457,7 +457,7 @@ const maintenanceActions = {
|
|
|
457
457
|
getExternalSync: jobId => {
|
|
458
458
|
return Session$9.authedFunction({
|
|
459
459
|
method: 'GET',
|
|
460
|
-
url: Helper$
|
|
460
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/externalsync', {
|
|
461
461
|
id: jobId
|
|
462
462
|
})
|
|
463
463
|
});
|
|
@@ -465,7 +465,7 @@ const maintenanceActions = {
|
|
|
465
465
|
retrySync: jobId => {
|
|
466
466
|
return Session$9.authedFunction({
|
|
467
467
|
method: 'POST',
|
|
468
|
-
url: Helper$
|
|
468
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/retrysync'),
|
|
469
469
|
data: {
|
|
470
470
|
id: jobId
|
|
471
471
|
}
|
|
@@ -474,7 +474,7 @@ const maintenanceActions = {
|
|
|
474
474
|
};
|
|
475
475
|
|
|
476
476
|
const {
|
|
477
|
-
Helper: Helper$
|
|
477
|
+
Helper: Helper$5,
|
|
478
478
|
Session: Session$8
|
|
479
479
|
} = PlussCore;
|
|
480
480
|
const reactionActions = {
|
|
@@ -492,7 +492,7 @@ const reactionActions = {
|
|
|
492
492
|
}
|
|
493
493
|
return Session$8.authedFunction({
|
|
494
494
|
method: 'POST',
|
|
495
|
-
url: Helper$
|
|
495
|
+
url: Helper$5.getUrl('reactions', 'comments/add'),
|
|
496
496
|
data
|
|
497
497
|
});
|
|
498
498
|
},
|
|
@@ -515,7 +515,7 @@ const reactionActions = {
|
|
|
515
515
|
}
|
|
516
516
|
return Session$8.authedFunction({
|
|
517
517
|
method: 'GET',
|
|
518
|
-
url: Helper$
|
|
518
|
+
url: Helper$5.getUrl('reactions', 'comments/get', query)
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
};
|
|
@@ -549,7 +549,7 @@ var jobStatusOptions = [
|
|
|
549
549
|
];
|
|
550
550
|
|
|
551
551
|
const {
|
|
552
|
-
Helper: Helper$
|
|
552
|
+
Helper: Helper$4
|
|
553
553
|
} = PlussCore;
|
|
554
554
|
const jobsUpdate = (site, isdashboard) => {
|
|
555
555
|
return dispatch => {
|
|
@@ -557,7 +557,7 @@ const jobsUpdate = (site, isdashboard) => {
|
|
|
557
557
|
type: JOBS_LOADING
|
|
558
558
|
});
|
|
559
559
|
maintenanceActions.getJobsRecursive(site).then(res => {
|
|
560
|
-
const currentSite = Helper$
|
|
560
|
+
const currentSite = Helper$4.readStorageWithCookie('site');
|
|
561
561
|
if (!_.isEmpty(res) && res[0].site === currentSite) {
|
|
562
562
|
dispatch({
|
|
563
563
|
type: JOBS_LOADED,
|
|
@@ -2694,7 +2694,7 @@ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
2694
2694
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2695
2695
|
const {
|
|
2696
2696
|
Apis: Apis$1,
|
|
2697
|
-
Helper: Helper$
|
|
2697
|
+
Helper: Helper$3,
|
|
2698
2698
|
Session: Session$3,
|
|
2699
2699
|
Colours: Colours$1,
|
|
2700
2700
|
Components: Components$3
|
|
@@ -3096,7 +3096,7 @@ class Job extends Component {
|
|
|
3096
3096
|
}
|
|
3097
3097
|
});
|
|
3098
3098
|
this.state = {
|
|
3099
|
-
jobId: Helper$
|
|
3099
|
+
jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
|
|
3100
3100
|
job: null,
|
|
3101
3101
|
showingSelector: false,
|
|
3102
3102
|
updating: false,
|
|
@@ -3299,7 +3299,7 @@ class Job extends Component {
|
|
|
3299
3299
|
}, /*#__PURE__*/React.createElement("div", {
|
|
3300
3300
|
className: "imageGrid_image",
|
|
3301
3301
|
style: {
|
|
3302
|
-
backgroundImage: "url('".concat(Helper$
|
|
3302
|
+
backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
|
|
3303
3303
|
width: size,
|
|
3304
3304
|
height: size
|
|
3305
3305
|
}
|
|
@@ -3514,7 +3514,7 @@ class Job extends Component {
|
|
|
3514
3514
|
}]
|
|
3515
3515
|
})), /*#__PURE__*/React.createElement("p", {
|
|
3516
3516
|
className: "maintenanceNote_text"
|
|
3517
|
-
}, Helper$
|
|
3517
|
+
}, Helper$3.toParagraphed(note.Note)), note.Attachments.map((a, i) => this.renderAttachment(a, i)), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null));
|
|
3518
3518
|
}
|
|
3519
3519
|
renderAssignment() {
|
|
3520
3520
|
const {
|
|
@@ -3948,7 +3948,7 @@ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
3948
3948
|
const {
|
|
3949
3949
|
Actions,
|
|
3950
3950
|
Components: Components$2,
|
|
3951
|
-
Helper: Helper$
|
|
3951
|
+
Helper: Helper$2,
|
|
3952
3952
|
Session: Session$2,
|
|
3953
3953
|
Colours,
|
|
3954
3954
|
Apis
|
|
@@ -4306,7 +4306,7 @@ class AddJob extends Component {
|
|
|
4306
4306
|
if (_.isNil(answer) || _.isEmpty(answer)) return true;
|
|
4307
4307
|
switch (type) {
|
|
4308
4308
|
case "email":
|
|
4309
|
-
return Helper$
|
|
4309
|
+
return Helper$2.isEmail(answer);
|
|
4310
4310
|
case "date":
|
|
4311
4311
|
return moment(answer, "YYYY-MM-DD", true).isValid();
|
|
4312
4312
|
case "time":
|
|
@@ -4327,7 +4327,7 @@ class AddJob extends Component {
|
|
|
4327
4327
|
this.customImageInputs = {};
|
|
4328
4328
|
this.customDocumentInputs = {};
|
|
4329
4329
|
this.state = {
|
|
4330
|
-
jobId: Helper$
|
|
4330
|
+
jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
|
|
4331
4331
|
job: null,
|
|
4332
4332
|
showingSelector: false,
|
|
4333
4333
|
updating: false,
|
|
@@ -4679,7 +4679,7 @@ class AddJob extends Component {
|
|
|
4679
4679
|
return /*#__PURE__*/React.createElement("p", {
|
|
4680
4680
|
className: "visitorSignIn_text-staticText",
|
|
4681
4681
|
key: fieldId
|
|
4682
|
-
}, Helper$
|
|
4682
|
+
}, Helper$2.toParagraphed(field.label, {
|
|
4683
4683
|
marginTop: 10
|
|
4684
4684
|
}));
|
|
4685
4685
|
case "date":
|
|
@@ -4934,7 +4934,7 @@ const mapStateToProps$2 = state => {
|
|
|
4934
4934
|
return {
|
|
4935
4935
|
auth,
|
|
4936
4936
|
strings: state.strings && state.strings.config || {},
|
|
4937
|
-
optionOnlyForResidents: Helper$
|
|
4937
|
+
optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
|
|
4938
4938
|
};
|
|
4939
4939
|
};
|
|
4940
4940
|
var AddJob$1 = connect(mapStateToProps$2, {
|
|
@@ -4946,7 +4946,7 @@ var AddJob$1 = connect(mapStateToProps$2, {
|
|
|
4946
4946
|
const {
|
|
4947
4947
|
Components: Components$1,
|
|
4948
4948
|
Session: Session$1,
|
|
4949
|
-
Helper
|
|
4949
|
+
Helper: Helper$1
|
|
4950
4950
|
} = PlussCore;
|
|
4951
4951
|
const DEFAULT_FIELD = {
|
|
4952
4952
|
type: 'text',
|
|
@@ -4989,7 +4989,7 @@ class AddJobType extends Component {
|
|
|
4989
4989
|
const {
|
|
4990
4990
|
jobTypeEmail
|
|
4991
4991
|
} = this.state;
|
|
4992
|
-
return !_.isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
4992
|
+
return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
|
|
4993
4993
|
});
|
|
4994
4994
|
_defineProperty(this, "isJobTypeValid", () => {
|
|
4995
4995
|
const {
|
|
@@ -5191,7 +5191,7 @@ class AddJobType extends Component {
|
|
|
5191
5191
|
}];
|
|
5192
5192
|
this.state = {
|
|
5193
5193
|
loading: false,
|
|
5194
|
-
jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5194
|
+
jobTypeId: Helper$1.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5195
5195
|
jobTypeName: '',
|
|
5196
5196
|
jobTypeEmail: '',
|
|
5197
5197
|
jobTypeDescription: '',
|
|
@@ -5743,7 +5743,8 @@ var AddJobType$1 = connect(mapStateToProps$1, {
|
|
|
5743
5743
|
const {
|
|
5744
5744
|
Analytics: Analytics$1,
|
|
5745
5745
|
Session,
|
|
5746
|
-
Components
|
|
5746
|
+
Components,
|
|
5747
|
+
Helper
|
|
5747
5748
|
} = PlussCore;
|
|
5748
5749
|
const getInitialState = () => ({
|
|
5749
5750
|
requests: 0,
|
|
@@ -5763,10 +5764,20 @@ const AnalyticsHub = _ref => {
|
|
|
5763
5764
|
auth,
|
|
5764
5765
|
prevText,
|
|
5765
5766
|
dayCount,
|
|
5766
|
-
strings
|
|
5767
|
+
strings,
|
|
5768
|
+
userType,
|
|
5769
|
+
userCategory,
|
|
5770
|
+
selectedSites
|
|
5767
5771
|
} = _ref;
|
|
5768
5772
|
const [analyticsData, setAnalyticsData] = useState(getInitialState());
|
|
5769
5773
|
const [isExportOpen, setIsExportOpen] = useState(false);
|
|
5774
|
+
const [comparisonData, setComparisonData] = useState({
|
|
5775
|
+
requests: [],
|
|
5776
|
+
completedRequests: [],
|
|
5777
|
+
comments: [],
|
|
5778
|
+
isLoading: true
|
|
5779
|
+
});
|
|
5780
|
+
const comparisonMode = selectedSites && selectedSites.length > 1;
|
|
5770
5781
|
const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
|
|
5771
5782
|
if (!hasAccess) {
|
|
5772
5783
|
return null;
|
|
@@ -5778,50 +5789,92 @@ const AnalyticsHub = _ref => {
|
|
|
5778
5789
|
return strings.sideNav[key];
|
|
5779
5790
|
})();
|
|
5780
5791
|
const exportColumns = [{
|
|
5781
|
-
label:
|
|
5782
|
-
key:
|
|
5792
|
+
label: "Select All",
|
|
5793
|
+
key: ""
|
|
5783
5794
|
}, {
|
|
5784
|
-
label:
|
|
5785
|
-
key:
|
|
5795
|
+
label: "Start Date",
|
|
5796
|
+
key: "startDate"
|
|
5786
5797
|
}, {
|
|
5787
|
-
label:
|
|
5788
|
-
key:
|
|
5798
|
+
label: "End Date",
|
|
5799
|
+
key: "endDate"
|
|
5789
5800
|
}, {
|
|
5790
5801
|
label: "".concat(values.textSingularName, "s"),
|
|
5791
|
-
key:
|
|
5802
|
+
key: "requests"
|
|
5792
5803
|
}, {
|
|
5793
5804
|
label: "Completed ".concat(values.textSingularName, "s"),
|
|
5794
|
-
key:
|
|
5805
|
+
key: "completedRequests"
|
|
5795
5806
|
}, {
|
|
5796
|
-
label:
|
|
5797
|
-
key:
|
|
5807
|
+
label: "Comments",
|
|
5808
|
+
key: "comments"
|
|
5798
5809
|
}];
|
|
5799
5810
|
useEffect(() => {
|
|
5800
5811
|
getData();
|
|
5801
|
-
}, [startTime, endTime]);
|
|
5812
|
+
}, [startTime, endTime, userType, userCategory, selectedSites]);
|
|
5802
5813
|
const getData = async () => {
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5814
|
+
if (comparisonMode) {
|
|
5815
|
+
setComparisonData({
|
|
5816
|
+
requests: [],
|
|
5817
|
+
completedRequests: [],
|
|
5818
|
+
comments: [],
|
|
5819
|
+
isLoading: true
|
|
5820
|
+
});
|
|
5821
|
+
const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
|
|
5822
|
+
const {
|
|
5823
|
+
data
|
|
5824
|
+
} = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5825
|
+
userType,
|
|
5826
|
+
userCategory
|
|
5827
|
+
});
|
|
5828
|
+
return data;
|
|
5829
|
+
});
|
|
5830
|
+
const multiSiteResults = Object.entries(multiSiteResultsObj).map(_ref2 => {
|
|
5831
|
+
let [site, data] = _ref2;
|
|
5832
|
+
return {
|
|
5833
|
+
site,
|
|
5834
|
+
data
|
|
5835
|
+
};
|
|
5836
|
+
});
|
|
5837
|
+
const roles = auth.user.Roles;
|
|
5838
|
+
const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
|
|
5839
|
+
name: Helper.getSiteNameFromRoles(result.site, roles),
|
|
5840
|
+
value: Analytics$1.countActivities(result.data, activityKey, countType)
|
|
5841
|
+
}));
|
|
5842
|
+
setComparisonData({
|
|
5843
|
+
requests: buildComparison("Request", "total"),
|
|
5844
|
+
completedRequests: buildComparison("RequestCompleted", "unique"),
|
|
5845
|
+
comments: buildComparison("Comment", "total"),
|
|
5846
|
+
isLoading: false
|
|
5847
|
+
});
|
|
5848
|
+
} else {
|
|
5849
|
+
setAnalyticsData(getInitialState());
|
|
5850
|
+
const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
|
|
5851
|
+
const timeDifference = endTime - startTime;
|
|
5852
|
+
const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5853
|
+
userType,
|
|
5854
|
+
userCategory
|
|
5855
|
+
}), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
|
|
5856
|
+
userType,
|
|
5857
|
+
userCategory
|
|
5858
|
+
})]);
|
|
5859
|
+
const data = {
|
|
5860
|
+
requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
|
|
5861
|
+
prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
|
|
5862
|
+
completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
|
|
5863
|
+
prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
|
|
5864
|
+
comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
|
|
5865
|
+
prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
|
|
5866
|
+
isLoading: false
|
|
5867
|
+
};
|
|
5868
|
+
setAnalyticsData(data);
|
|
5869
|
+
}
|
|
5817
5870
|
};
|
|
5818
5871
|
const isReadyToOpenCSV = () => {
|
|
5819
|
-
return !analyticsData.isLoading;
|
|
5872
|
+
return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
|
|
5820
5873
|
};
|
|
5821
5874
|
const getExportSource = () => {
|
|
5822
5875
|
return [{
|
|
5823
|
-
startDate: moment(startTime + 1).format(
|
|
5824
|
-
endDate: moment(endTime).format(
|
|
5876
|
+
startDate: moment(startTime + 1).format("D-MM-YYYY"),
|
|
5877
|
+
endDate: moment(endTime).format("D-MM-YYYY"),
|
|
5825
5878
|
requests: analyticsData.requests,
|
|
5826
5879
|
completedRequests: analyticsData.completedRequests,
|
|
5827
5880
|
comments: analyticsData.comments
|
|
@@ -5857,31 +5910,61 @@ const AnalyticsHub = _ref => {
|
|
|
5857
5910
|
leftIcon: "file-code-o"
|
|
5858
5911
|
}, "Export CSV")), /*#__PURE__*/React.createElement("div", {
|
|
5859
5912
|
className: "analyticsSection dashboardSection_content"
|
|
5860
|
-
},
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5913
|
+
}, (() => {
|
|
5914
|
+
const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
|
|
5915
|
+
if (comparisonMode) {
|
|
5916
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5917
|
+
style: {
|
|
5918
|
+
display: "flex",
|
|
5919
|
+
flexDirection: "column",
|
|
5920
|
+
gap: 16
|
|
5921
|
+
}
|
|
5922
|
+
}, /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5923
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5924
|
+
data: comparisonData.requests,
|
|
5925
|
+
prevText: prevText,
|
|
5926
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5927
|
+
isLoading: comparisonData.isLoading
|
|
5928
|
+
}), /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5929
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5930
|
+
data: comparisonData.completedRequests,
|
|
5931
|
+
prevText: prevText,
|
|
5932
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5933
|
+
isLoading: comparisonData.isLoading
|
|
5934
|
+
}), /*#__PURE__*/React.createElement(Components.ComparisonStatBox, {
|
|
5935
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5936
|
+
data: comparisonData.comments,
|
|
5937
|
+
prevText: prevText,
|
|
5938
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5939
|
+
isLoading: comparisonData.isLoading
|
|
5940
|
+
}));
|
|
5941
|
+
}
|
|
5942
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5943
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5944
|
+
icon: faWrench,
|
|
5945
|
+
value: analyticsData.requests,
|
|
5946
|
+
previousValue: analyticsData.prevRequests,
|
|
5947
|
+
prevText: prevText,
|
|
5948
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5949
|
+
isLoading: analyticsData.isLoading
|
|
5950
|
+
}), /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5951
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5952
|
+
icon: faCircleCheck,
|
|
5953
|
+
value: analyticsData.completedRequests,
|
|
5954
|
+
previousValue: analyticsData.prevCompletedRequests,
|
|
5955
|
+
prevText: prevText,
|
|
5956
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5957
|
+
isLoading: analyticsData.isLoading
|
|
5958
|
+
}), /*#__PURE__*/React.createElement(Components.StatBox, {
|
|
5959
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5960
|
+
icon: faComment,
|
|
5961
|
+
value: analyticsData.comments,
|
|
5962
|
+
previousValue: analyticsData.prevComments,
|
|
5963
|
+
prevText: prevText,
|
|
5964
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5965
|
+
isLoading: analyticsData.isLoading
|
|
5966
|
+
}));
|
|
5967
|
+
})()));
|
|
5885
5968
|
};
|
|
5886
5969
|
const mapStateToProps = state => {
|
|
5887
5970
|
const {
|