@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.cjs.js
CHANGED
|
@@ -248,12 +248,12 @@ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
|
|
|
248
248
|
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; }
|
|
249
249
|
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__default["default"](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; }
|
|
250
250
|
const {
|
|
251
|
-
Helper: Helper$
|
|
251
|
+
Helper: Helper$6,
|
|
252
252
|
Session: Session$9
|
|
253
253
|
} = PlussCore__namespace;
|
|
254
254
|
const maintenanceActions = {
|
|
255
255
|
getJobType: (site, typeId) => {
|
|
256
|
-
let url = Helper$
|
|
256
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtype');
|
|
257
257
|
return Session$9.authedFunction({
|
|
258
258
|
method: 'POST',
|
|
259
259
|
url,
|
|
@@ -264,7 +264,7 @@ const maintenanceActions = {
|
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
266
|
getJobTypes: (site, id) => {
|
|
267
|
-
let url = Helper$
|
|
267
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getjobtypes');
|
|
268
268
|
return Session$9.authedFunction({
|
|
269
269
|
method: 'POST',
|
|
270
270
|
url,
|
|
@@ -274,7 +274,7 @@ const maintenanceActions = {
|
|
|
274
274
|
});
|
|
275
275
|
},
|
|
276
276
|
getJob: (site, id) => {
|
|
277
|
-
let url = Helper$
|
|
277
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
278
278
|
return Session$9.authedFunction({
|
|
279
279
|
method: 'POST',
|
|
280
280
|
url,
|
|
@@ -285,7 +285,7 @@ const maintenanceActions = {
|
|
|
285
285
|
});
|
|
286
286
|
},
|
|
287
287
|
getJobByJobId: (site, jobId) => {
|
|
288
|
-
let url = Helper$
|
|
288
|
+
let url = Helper$6.getUrl(values.serviceKey, 'getJob');
|
|
289
289
|
return Session$9.authedFunction({
|
|
290
290
|
method: 'POST',
|
|
291
291
|
url,
|
|
@@ -300,7 +300,7 @@ const maintenanceActions = {
|
|
|
300
300
|
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
301
301
|
return Session$9.authedFunction({
|
|
302
302
|
method: 'POST',
|
|
303
|
-
url: Helper$
|
|
303
|
+
url: Helper$6.getUrl(values.serviceKey, 'getJobs'),
|
|
304
304
|
data: {
|
|
305
305
|
site,
|
|
306
306
|
status,
|
|
@@ -323,7 +323,7 @@ const maintenanceActions = {
|
|
|
323
323
|
}
|
|
324
324
|
return Session$9.authedFunction({
|
|
325
325
|
method: 'GET',
|
|
326
|
-
url: Helper$
|
|
326
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/requests', query)
|
|
327
327
|
});
|
|
328
328
|
},
|
|
329
329
|
getJobsRecursive: function (site, status, type, lastKey) {
|
|
@@ -341,14 +341,14 @@ const maintenanceActions = {
|
|
|
341
341
|
createJob: job => {
|
|
342
342
|
return Session$9.authedFunction({
|
|
343
343
|
method: 'POST',
|
|
344
|
-
url: Helper$
|
|
344
|
+
url: Helper$6.getUrl(values.serviceKey, 'sendMaintenance'),
|
|
345
345
|
data: _objectSpread$7({}, job)
|
|
346
346
|
});
|
|
347
347
|
},
|
|
348
348
|
editJob: (job, site) => {
|
|
349
349
|
return Session$9.authedFunction({
|
|
350
350
|
method: 'POST',
|
|
351
|
-
url: Helper$
|
|
351
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJob'),
|
|
352
352
|
data: {
|
|
353
353
|
job,
|
|
354
354
|
site
|
|
@@ -358,7 +358,7 @@ const maintenanceActions = {
|
|
|
358
358
|
deleteJob: (site, id) => {
|
|
359
359
|
return Session$9.authedFunction({
|
|
360
360
|
method: 'POST',
|
|
361
|
-
url: Helper$
|
|
361
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/remove'),
|
|
362
362
|
data: {
|
|
363
363
|
site,
|
|
364
364
|
id
|
|
@@ -368,7 +368,7 @@ const maintenanceActions = {
|
|
|
368
368
|
editJobStatus: (id, status) => {
|
|
369
369
|
return Session$9.authedFunction({
|
|
370
370
|
method: 'POST',
|
|
371
|
-
url: Helper$
|
|
371
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobStatus'),
|
|
372
372
|
data: {
|
|
373
373
|
id,
|
|
374
374
|
status
|
|
@@ -378,7 +378,7 @@ const maintenanceActions = {
|
|
|
378
378
|
editJobPriority: (id, priority) => {
|
|
379
379
|
return Session$9.authedFunction({
|
|
380
380
|
method: 'POST',
|
|
381
|
-
url: Helper$
|
|
381
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/priority'),
|
|
382
382
|
data: {
|
|
383
383
|
id,
|
|
384
384
|
priority
|
|
@@ -388,7 +388,7 @@ const maintenanceActions = {
|
|
|
388
388
|
assignJob: (jobId, userId) => {
|
|
389
389
|
return Session$9.authedFunction({
|
|
390
390
|
method: 'POST',
|
|
391
|
-
url: Helper$
|
|
391
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/assign'),
|
|
392
392
|
data: {
|
|
393
393
|
id: jobId,
|
|
394
394
|
userId
|
|
@@ -398,7 +398,7 @@ const maintenanceActions = {
|
|
|
398
398
|
getAssignees: site => {
|
|
399
399
|
return Session$9.authedFunction({
|
|
400
400
|
method: 'GET',
|
|
401
|
-
url: Helper$
|
|
401
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/assignees', {
|
|
402
402
|
site
|
|
403
403
|
})
|
|
404
404
|
});
|
|
@@ -406,7 +406,7 @@ const maintenanceActions = {
|
|
|
406
406
|
addNote: (jobId, note, attachments, images) => {
|
|
407
407
|
return Session$9.authedFunction({
|
|
408
408
|
method: 'POST',
|
|
409
|
-
url: Helper$
|
|
409
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
410
410
|
data: {
|
|
411
411
|
id: jobId,
|
|
412
412
|
note,
|
|
@@ -419,7 +419,7 @@ const maintenanceActions = {
|
|
|
419
419
|
editNote: (jobId, noteId, note, attachments, images) => {
|
|
420
420
|
return Session$9.authedFunction({
|
|
421
421
|
method: 'POST',
|
|
422
|
-
url: Helper$
|
|
422
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
423
423
|
data: {
|
|
424
424
|
id: jobId,
|
|
425
425
|
note,
|
|
@@ -433,7 +433,7 @@ const maintenanceActions = {
|
|
|
433
433
|
deleteNote: (jobId, noteId) => {
|
|
434
434
|
return Session$9.authedFunction({
|
|
435
435
|
method: 'POST',
|
|
436
|
-
url: Helper$
|
|
436
|
+
url: Helper$6.getUrl(values.serviceKey, 'requests/note'),
|
|
437
437
|
data: {
|
|
438
438
|
id: jobId,
|
|
439
439
|
noteId,
|
|
@@ -453,7 +453,7 @@ const maintenanceActions = {
|
|
|
453
453
|
};
|
|
454
454
|
return Session$9.authedFunction({
|
|
455
455
|
method: 'POST',
|
|
456
|
-
url: Helper$
|
|
456
|
+
url: Helper$6.getUrl(values.serviceKey, 'createJobType'),
|
|
457
457
|
data
|
|
458
458
|
});
|
|
459
459
|
},
|
|
@@ -471,14 +471,14 @@ const maintenanceActions = {
|
|
|
471
471
|
if (hasCustomFields && customFields) data.customFields = customFields;
|
|
472
472
|
return Session$9.authedFunction({
|
|
473
473
|
method: 'POST',
|
|
474
|
-
url: Helper$
|
|
474
|
+
url: Helper$6.getUrl(values.serviceKey, 'editJobType'),
|
|
475
475
|
data
|
|
476
476
|
});
|
|
477
477
|
},
|
|
478
478
|
deleteJobType: (site, id) => {
|
|
479
479
|
return Session$9.authedFunction({
|
|
480
480
|
method: 'POST',
|
|
481
|
-
url: Helper$
|
|
481
|
+
url: Helper$6.getUrl(values.serviceKey, 'deleteJobType'),
|
|
482
482
|
data: {
|
|
483
483
|
site,
|
|
484
484
|
id
|
|
@@ -488,7 +488,7 @@ const maintenanceActions = {
|
|
|
488
488
|
getExternalSync: jobId => {
|
|
489
489
|
return Session$9.authedFunction({
|
|
490
490
|
method: 'GET',
|
|
491
|
-
url: Helper$
|
|
491
|
+
url: Helper$6.getUrl(values.serviceKey, 'get/externalsync', {
|
|
492
492
|
id: jobId
|
|
493
493
|
})
|
|
494
494
|
});
|
|
@@ -496,7 +496,7 @@ const maintenanceActions = {
|
|
|
496
496
|
retrySync: jobId => {
|
|
497
497
|
return Session$9.authedFunction({
|
|
498
498
|
method: 'POST',
|
|
499
|
-
url: Helper$
|
|
499
|
+
url: Helper$6.getUrl(values.serviceKey, 'update/retrysync'),
|
|
500
500
|
data: {
|
|
501
501
|
id: jobId
|
|
502
502
|
}
|
|
@@ -505,7 +505,7 @@ const maintenanceActions = {
|
|
|
505
505
|
};
|
|
506
506
|
|
|
507
507
|
const {
|
|
508
|
-
Helper: Helper$
|
|
508
|
+
Helper: Helper$5,
|
|
509
509
|
Session: Session$8
|
|
510
510
|
} = PlussCore__namespace;
|
|
511
511
|
const reactionActions = {
|
|
@@ -523,7 +523,7 @@ const reactionActions = {
|
|
|
523
523
|
}
|
|
524
524
|
return Session$8.authedFunction({
|
|
525
525
|
method: 'POST',
|
|
526
|
-
url: Helper$
|
|
526
|
+
url: Helper$5.getUrl('reactions', 'comments/add'),
|
|
527
527
|
data
|
|
528
528
|
});
|
|
529
529
|
},
|
|
@@ -546,7 +546,7 @@ const reactionActions = {
|
|
|
546
546
|
}
|
|
547
547
|
return Session$8.authedFunction({
|
|
548
548
|
method: 'GET',
|
|
549
|
-
url: Helper$
|
|
549
|
+
url: Helper$5.getUrl('reactions', 'comments/get', query)
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
};
|
|
@@ -580,7 +580,7 @@ var jobStatusOptions = [
|
|
|
580
580
|
];
|
|
581
581
|
|
|
582
582
|
const {
|
|
583
|
-
Helper: Helper$
|
|
583
|
+
Helper: Helper$4
|
|
584
584
|
} = PlussCore__namespace;
|
|
585
585
|
const jobsUpdate = (site, isdashboard) => {
|
|
586
586
|
return dispatch => {
|
|
@@ -588,7 +588,7 @@ const jobsUpdate = (site, isdashboard) => {
|
|
|
588
588
|
type: JOBS_LOADING
|
|
589
589
|
});
|
|
590
590
|
maintenanceActions.getJobsRecursive(site).then(res => {
|
|
591
|
-
const currentSite = Helper$
|
|
591
|
+
const currentSite = Helper$4.readStorageWithCookie('site');
|
|
592
592
|
if (!___default["default"].isEmpty(res) && res[0].site === currentSite) {
|
|
593
593
|
dispatch({
|
|
594
594
|
type: JOBS_LOADED,
|
|
@@ -2725,7 +2725,7 @@ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
2725
2725
|
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__default["default"](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; }
|
|
2726
2726
|
const {
|
|
2727
2727
|
Apis: Apis$1,
|
|
2728
|
-
Helper: Helper$
|
|
2728
|
+
Helper: Helper$3,
|
|
2729
2729
|
Session: Session$3,
|
|
2730
2730
|
Colours: Colours$1,
|
|
2731
2731
|
Components: Components$3
|
|
@@ -3127,7 +3127,7 @@ class Job extends React.Component {
|
|
|
3127
3127
|
}
|
|
3128
3128
|
});
|
|
3129
3129
|
this.state = {
|
|
3130
|
-
jobId: Helper$
|
|
3130
|
+
jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
|
|
3131
3131
|
job: null,
|
|
3132
3132
|
showingSelector: false,
|
|
3133
3133
|
updating: false,
|
|
@@ -3330,7 +3330,7 @@ class Job extends React.Component {
|
|
|
3330
3330
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3331
3331
|
className: "imageGrid_image",
|
|
3332
3332
|
style: {
|
|
3333
|
-
backgroundImage: "url('".concat(Helper$
|
|
3333
|
+
backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
|
|
3334
3334
|
width: size,
|
|
3335
3335
|
height: size
|
|
3336
3336
|
}
|
|
@@ -3545,7 +3545,7 @@ class Job extends React.Component {
|
|
|
3545
3545
|
}]
|
|
3546
3546
|
})), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3547
3547
|
className: "maintenanceNote_text"
|
|
3548
|
-
}, Helper$
|
|
3548
|
+
}, 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));
|
|
3549
3549
|
}
|
|
3550
3550
|
renderAssignment() {
|
|
3551
3551
|
const {
|
|
@@ -3979,7 +3979,7 @@ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
3979
3979
|
const {
|
|
3980
3980
|
Actions,
|
|
3981
3981
|
Components: Components$2,
|
|
3982
|
-
Helper: Helper$
|
|
3982
|
+
Helper: Helper$2,
|
|
3983
3983
|
Session: Session$2,
|
|
3984
3984
|
Colours,
|
|
3985
3985
|
Apis
|
|
@@ -4337,7 +4337,7 @@ class AddJob extends React.Component {
|
|
|
4337
4337
|
if (___default["default"].isNil(answer) || ___default["default"].isEmpty(answer)) return true;
|
|
4338
4338
|
switch (type) {
|
|
4339
4339
|
case "email":
|
|
4340
|
-
return Helper$
|
|
4340
|
+
return Helper$2.isEmail(answer);
|
|
4341
4341
|
case "date":
|
|
4342
4342
|
return moment__default["default"](answer, "YYYY-MM-DD", true).isValid();
|
|
4343
4343
|
case "time":
|
|
@@ -4358,7 +4358,7 @@ class AddJob extends React.Component {
|
|
|
4358
4358
|
this.customImageInputs = {};
|
|
4359
4359
|
this.customDocumentInputs = {};
|
|
4360
4360
|
this.state = {
|
|
4361
|
-
jobId: Helper$
|
|
4361
|
+
jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
|
|
4362
4362
|
job: null,
|
|
4363
4363
|
showingSelector: false,
|
|
4364
4364
|
updating: false,
|
|
@@ -4710,7 +4710,7 @@ class AddJob extends React.Component {
|
|
|
4710
4710
|
return /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4711
4711
|
className: "visitorSignIn_text-staticText",
|
|
4712
4712
|
key: fieldId
|
|
4713
|
-
}, Helper$
|
|
4713
|
+
}, Helper$2.toParagraphed(field.label, {
|
|
4714
4714
|
marginTop: 10
|
|
4715
4715
|
}));
|
|
4716
4716
|
case "date":
|
|
@@ -4965,7 +4965,7 @@ const mapStateToProps$2 = state => {
|
|
|
4965
4965
|
return {
|
|
4966
4966
|
auth,
|
|
4967
4967
|
strings: state.strings && state.strings.config || {},
|
|
4968
|
-
optionOnlyForResidents: Helper$
|
|
4968
|
+
optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
|
|
4969
4969
|
};
|
|
4970
4970
|
};
|
|
4971
4971
|
var AddJob$1 = reactRedux.connect(mapStateToProps$2, {
|
|
@@ -4977,7 +4977,7 @@ var AddJob$1 = reactRedux.connect(mapStateToProps$2, {
|
|
|
4977
4977
|
const {
|
|
4978
4978
|
Components: Components$1,
|
|
4979
4979
|
Session: Session$1,
|
|
4980
|
-
Helper
|
|
4980
|
+
Helper: Helper$1
|
|
4981
4981
|
} = PlussCore__namespace;
|
|
4982
4982
|
const DEFAULT_FIELD = {
|
|
4983
4983
|
type: 'text',
|
|
@@ -5020,7 +5020,7 @@ class AddJobType extends React.Component {
|
|
|
5020
5020
|
const {
|
|
5021
5021
|
jobTypeEmail
|
|
5022
5022
|
} = this.state;
|
|
5023
|
-
return !___default["default"].isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
5023
|
+
return !___default["default"].isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
|
|
5024
5024
|
});
|
|
5025
5025
|
_defineProperty__default["default"](this, "isJobTypeValid", () => {
|
|
5026
5026
|
const {
|
|
@@ -5222,7 +5222,7 @@ class AddJobType extends React.Component {
|
|
|
5222
5222
|
}];
|
|
5223
5223
|
this.state = {
|
|
5224
5224
|
loading: false,
|
|
5225
|
-
jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5225
|
+
jobTypeId: Helper$1.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
|
|
5226
5226
|
jobTypeName: '',
|
|
5227
5227
|
jobTypeEmail: '',
|
|
5228
5228
|
jobTypeDescription: '',
|
|
@@ -5774,7 +5774,8 @@ var AddJobType$1 = reactRedux.connect(mapStateToProps$1, {
|
|
|
5774
5774
|
const {
|
|
5775
5775
|
Analytics: Analytics$1,
|
|
5776
5776
|
Session,
|
|
5777
|
-
Components
|
|
5777
|
+
Components,
|
|
5778
|
+
Helper
|
|
5778
5779
|
} = PlussCore__namespace;
|
|
5779
5780
|
const getInitialState = () => ({
|
|
5780
5781
|
requests: 0,
|
|
@@ -5794,10 +5795,20 @@ const AnalyticsHub = _ref => {
|
|
|
5794
5795
|
auth,
|
|
5795
5796
|
prevText,
|
|
5796
5797
|
dayCount,
|
|
5797
|
-
strings
|
|
5798
|
+
strings,
|
|
5799
|
+
userType,
|
|
5800
|
+
userCategory,
|
|
5801
|
+
selectedSites
|
|
5798
5802
|
} = _ref;
|
|
5799
5803
|
const [analyticsData, setAnalyticsData] = React.useState(getInitialState());
|
|
5800
5804
|
const [isExportOpen, setIsExportOpen] = React.useState(false);
|
|
5805
|
+
const [comparisonData, setComparisonData] = React.useState({
|
|
5806
|
+
requests: [],
|
|
5807
|
+
completedRequests: [],
|
|
5808
|
+
comments: [],
|
|
5809
|
+
isLoading: true
|
|
5810
|
+
});
|
|
5811
|
+
const comparisonMode = selectedSites && selectedSites.length > 1;
|
|
5801
5812
|
const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
|
|
5802
5813
|
if (!hasAccess) {
|
|
5803
5814
|
return null;
|
|
@@ -5809,50 +5820,92 @@ const AnalyticsHub = _ref => {
|
|
|
5809
5820
|
return strings.sideNav[key];
|
|
5810
5821
|
})();
|
|
5811
5822
|
const exportColumns = [{
|
|
5812
|
-
label:
|
|
5813
|
-
key:
|
|
5823
|
+
label: "Select All",
|
|
5824
|
+
key: ""
|
|
5814
5825
|
}, {
|
|
5815
|
-
label:
|
|
5816
|
-
key:
|
|
5826
|
+
label: "Start Date",
|
|
5827
|
+
key: "startDate"
|
|
5817
5828
|
}, {
|
|
5818
|
-
label:
|
|
5819
|
-
key:
|
|
5829
|
+
label: "End Date",
|
|
5830
|
+
key: "endDate"
|
|
5820
5831
|
}, {
|
|
5821
5832
|
label: "".concat(values.textSingularName, "s"),
|
|
5822
|
-
key:
|
|
5833
|
+
key: "requests"
|
|
5823
5834
|
}, {
|
|
5824
5835
|
label: "Completed ".concat(values.textSingularName, "s"),
|
|
5825
|
-
key:
|
|
5836
|
+
key: "completedRequests"
|
|
5826
5837
|
}, {
|
|
5827
|
-
label:
|
|
5828
|
-
key:
|
|
5838
|
+
label: "Comments",
|
|
5839
|
+
key: "comments"
|
|
5829
5840
|
}];
|
|
5830
5841
|
React.useEffect(() => {
|
|
5831
5842
|
getData();
|
|
5832
|
-
}, [startTime, endTime]);
|
|
5843
|
+
}, [startTime, endTime, userType, userCategory, selectedSites]);
|
|
5833
5844
|
const getData = async () => {
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5845
|
+
if (comparisonMode) {
|
|
5846
|
+
setComparisonData({
|
|
5847
|
+
requests: [],
|
|
5848
|
+
completedRequests: [],
|
|
5849
|
+
comments: [],
|
|
5850
|
+
isLoading: true
|
|
5851
|
+
});
|
|
5852
|
+
const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
|
|
5853
|
+
const {
|
|
5854
|
+
data
|
|
5855
|
+
} = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5856
|
+
userType,
|
|
5857
|
+
userCategory
|
|
5858
|
+
});
|
|
5859
|
+
return data;
|
|
5860
|
+
});
|
|
5861
|
+
const multiSiteResults = Object.entries(multiSiteResultsObj).map(_ref2 => {
|
|
5862
|
+
let [site, data] = _ref2;
|
|
5863
|
+
return {
|
|
5864
|
+
site,
|
|
5865
|
+
data
|
|
5866
|
+
};
|
|
5867
|
+
});
|
|
5868
|
+
const roles = auth.user.Roles;
|
|
5869
|
+
const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
|
|
5870
|
+
name: Helper.getSiteNameFromRoles(result.site, roles),
|
|
5871
|
+
value: Analytics$1.countActivities(result.data, activityKey, countType)
|
|
5872
|
+
}));
|
|
5873
|
+
setComparisonData({
|
|
5874
|
+
requests: buildComparison("Request", "total"),
|
|
5875
|
+
completedRequests: buildComparison("RequestCompleted", "unique"),
|
|
5876
|
+
comments: buildComparison("Comment", "total"),
|
|
5877
|
+
isLoading: false
|
|
5878
|
+
});
|
|
5879
|
+
} else {
|
|
5880
|
+
setAnalyticsData(getInitialState());
|
|
5881
|
+
const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
|
|
5882
|
+
const timeDifference = endTime - startTime;
|
|
5883
|
+
const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
|
|
5884
|
+
userType,
|
|
5885
|
+
userCategory
|
|
5886
|
+
}), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
|
|
5887
|
+
userType,
|
|
5888
|
+
userCategory
|
|
5889
|
+
})]);
|
|
5890
|
+
const data = {
|
|
5891
|
+
requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
|
|
5892
|
+
prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
|
|
5893
|
+
completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
|
|
5894
|
+
prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
|
|
5895
|
+
comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
|
|
5896
|
+
prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
|
|
5897
|
+
isLoading: false
|
|
5898
|
+
};
|
|
5899
|
+
setAnalyticsData(data);
|
|
5900
|
+
}
|
|
5848
5901
|
};
|
|
5849
5902
|
const isReadyToOpenCSV = () => {
|
|
5850
|
-
return !analyticsData.isLoading;
|
|
5903
|
+
return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
|
|
5851
5904
|
};
|
|
5852
5905
|
const getExportSource = () => {
|
|
5853
5906
|
return [{
|
|
5854
|
-
startDate: moment__default["default"](startTime + 1).format(
|
|
5855
|
-
endDate: moment__default["default"](endTime).format(
|
|
5907
|
+
startDate: moment__default["default"](startTime + 1).format("D-MM-YYYY"),
|
|
5908
|
+
endDate: moment__default["default"](endTime).format("D-MM-YYYY"),
|
|
5856
5909
|
requests: analyticsData.requests,
|
|
5857
5910
|
completedRequests: analyticsData.completedRequests,
|
|
5858
5911
|
comments: analyticsData.comments
|
|
@@ -5888,31 +5941,61 @@ const AnalyticsHub = _ref => {
|
|
|
5888
5941
|
leftIcon: "file-code-o"
|
|
5889
5942
|
}, "Export CSV")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5890
5943
|
className: "analyticsSection dashboardSection_content"
|
|
5891
|
-
},
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5944
|
+
}, (() => {
|
|
5945
|
+
const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
|
|
5946
|
+
if (comparisonMode) {
|
|
5947
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5948
|
+
style: {
|
|
5949
|
+
display: "flex",
|
|
5950
|
+
flexDirection: "column",
|
|
5951
|
+
gap: 16
|
|
5952
|
+
}
|
|
5953
|
+
}, /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5954
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5955
|
+
data: comparisonData.requests,
|
|
5956
|
+
prevText: prevText,
|
|
5957
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5958
|
+
isLoading: comparisonData.isLoading
|
|
5959
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5960
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5961
|
+
data: comparisonData.completedRequests,
|
|
5962
|
+
prevText: prevText,
|
|
5963
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5964
|
+
isLoading: comparisonData.isLoading
|
|
5965
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.ComparisonStatBox, {
|
|
5966
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5967
|
+
data: comparisonData.comments,
|
|
5968
|
+
prevText: prevText,
|
|
5969
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5970
|
+
isLoading: comparisonData.isLoading
|
|
5971
|
+
}));
|
|
5972
|
+
}
|
|
5973
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
5974
|
+
title: "".concat(featureTitle, " Requests"),
|
|
5975
|
+
icon: freeSolidSvgIcons.faWrench,
|
|
5976
|
+
value: analyticsData.requests,
|
|
5977
|
+
previousValue: analyticsData.prevRequests,
|
|
5978
|
+
prevText: prevText,
|
|
5979
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5980
|
+
isLoading: analyticsData.isLoading
|
|
5981
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
5982
|
+
title: "Completed ".concat(featureTitle, " Requests"),
|
|
5983
|
+
icon: freeSolidSvgIcons.faCircleCheck,
|
|
5984
|
+
value: analyticsData.completedRequests,
|
|
5985
|
+
previousValue: analyticsData.prevCompletedRequests,
|
|
5986
|
+
prevText: prevText,
|
|
5987
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5988
|
+
isLoading: analyticsData.isLoading
|
|
5989
|
+
}), /*#__PURE__*/React__default["default"].createElement(Components.StatBox, {
|
|
5990
|
+
title: "".concat(featureTitle, " Comments"),
|
|
5991
|
+
icon: freeSolidSvgIcons.faComment,
|
|
5992
|
+
value: analyticsData.comments,
|
|
5993
|
+
previousValue: analyticsData.prevComments,
|
|
5994
|
+
prevText: prevText,
|
|
5995
|
+
viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
|
|
5996
|
+
isLoading: analyticsData.isLoading
|
|
5997
|
+
}));
|
|
5998
|
+
})()));
|
|
5916
5999
|
};
|
|
5917
6000
|
const mapStateToProps = state => {
|
|
5918
6001
|
const {
|