@plusscommunities/pluss-maintenance-web-feedback 1.3.1-beta.0 → 1.3.3-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.js CHANGED
@@ -1,4 +1,3 @@
1
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
2
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
2
  import { Component, useState, useEffect } from 'react';
4
3
  import { connect } from 'react-redux';
@@ -8,12 +7,12 @@ import moment from 'moment';
8
7
  import { Icon } from '@plusscommunities/pluss-icons';
9
8
  import * as PlussCore from '@plusscommunities/pluss-core-web';
10
9
  import { PERMISSION_CATEGORIES, IMPORTANCE_LEVELS, Colours as Colours$4 } from '@plusscommunities/pluss-core-web';
11
- import { Table, MenuItem, DropdownButton } from 'react-bootstrap';
10
+ import { Table } from 'react-bootstrap';
12
11
  import { Link } from 'react-router-dom';
13
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
13
  import Textarea from 'react-textarea-autosize';
15
14
 
16
- var values = {
15
+ const values = {
17
16
  featureKey: "maintenanceFeedback",
18
17
  aliases: ["maintenanceTrackingFeedback", "maintenanceTypesFeedback", "maintenancerequestFeedback"],
19
18
  serviceKey: "maintenanceFeedback",
@@ -86,7 +85,7 @@ var values = {
86
85
  };
87
86
 
88
87
  // import * as PlussCore from '../../pluss-core/src';
89
- var FeatureConfig = {
88
+ const FeatureConfig = {
90
89
  key: values.featureKey,
91
90
  aliases: values.aliases,
92
91
  singularName: values.textSingularName,
@@ -218,22 +217,22 @@ var FeatureConfig = {
218
217
  notificationPreference: values.notificationPreference
219
218
  };
220
219
 
221
- var JOBS_LOADED = values.actionJobsLoaded;
222
- var JOBS_LOADING = values.actionJobsLoading;
223
- var JOBS_REMOVED = values.actionJobsRemoved;
224
- var JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
225
- var JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
226
- var JOBS_HIDE_SEEN = values.actionJobsHideSeen;
220
+ const JOBS_LOADED = values.actionJobsLoaded;
221
+ const JOBS_LOADING = values.actionJobsLoading;
222
+ const JOBS_REMOVED = values.actionJobsRemoved;
223
+ const JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
224
+ const JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
225
+ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
227
226
 
228
227
  function ownKeys$8(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; }
229
228
  function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
230
- var {
229
+ const {
231
230
  Helper: Helper$6,
232
231
  Session: Session$9
233
232
  } = PlussCore;
234
- var maintenanceActions = {
233
+ const maintenanceActions = {
235
234
  getJobType: (site, typeId) => {
236
- var url = Helper$6.getUrl(values.serviceKey, "getjobtype");
235
+ let url = Helper$6.getUrl(values.serviceKey, "getjobtype");
237
236
  return Session$9.authedFunction({
238
237
  method: "POST",
239
238
  url,
@@ -244,7 +243,7 @@ var maintenanceActions = {
244
243
  });
245
244
  },
246
245
  getJobTypes: (site, id) => {
247
- var url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
246
+ let url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
248
247
  return Session$9.authedFunction({
249
248
  method: "POST",
250
249
  url,
@@ -254,7 +253,7 @@ var maintenanceActions = {
254
253
  });
255
254
  },
256
255
  getJob: (site, id) => {
257
- var url = Helper$6.getUrl(values.serviceKey, "getJob");
256
+ let url = Helper$6.getUrl(values.serviceKey, "getJob");
258
257
  return Session$9.authedFunction({
259
258
  method: "POST",
260
259
  url,
@@ -265,7 +264,7 @@ var maintenanceActions = {
265
264
  });
266
265
  },
267
266
  getJobByJobId: (site, jobId) => {
268
- var url = Helper$6.getUrl(values.serviceKey, "getJob");
267
+ let url = Helper$6.getUrl(values.serviceKey, "getJob");
269
268
  return Session$9.authedFunction({
270
269
  method: "POST",
271
270
  url,
@@ -275,9 +274,9 @@ var maintenanceActions = {
275
274
  }
276
275
  });
277
276
  },
278
- getJobs: function getJobs(site) {
279
- var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
280
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
277
+ getJobs: function (site) {
278
+ let status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
279
+ let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
281
280
  return Session$9.authedFunction({
282
281
  method: "POST",
283
282
  url: Helper$6.getUrl(values.serviceKey, "getJobs"),
@@ -289,7 +288,7 @@ var maintenanceActions = {
289
288
  });
290
289
  },
291
290
  getJobs2: (site, status, type, lastKey) => {
292
- var query = {
291
+ const query = {
293
292
  site
294
293
  };
295
294
  if (status) {
@@ -306,11 +305,11 @@ var maintenanceActions = {
306
305
  url: Helper$6.getUrl(values.serviceKey, "get/requests", query)
307
306
  });
308
307
  },
309
- getJobsRecursive: function getJobsRecursive(site, status, type, lastKey) {
310
- var jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
308
+ getJobsRecursive: function (site, status, type, lastKey) {
309
+ let jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
311
310
  return new Promise(resolve => {
312
311
  maintenanceActions.getJobs2(site, status, type, lastKey).then(jobRes => {
313
- var newJobs = [...jobs, ...jobRes.data.Items];
312
+ const newJobs = [...jobs, ...jobRes.data.Items];
314
313
  if (!jobRes.data.LastKey) {
315
314
  return resolve(newJobs);
316
315
  }
@@ -422,7 +421,7 @@ var maintenanceActions = {
422
421
  });
423
422
  },
424
423
  addJobType: (site, name, email, description, level, hasCustomFields, customFields) => {
425
- var data = {
424
+ const data = {
426
425
  site,
427
426
  name,
428
427
  email,
@@ -438,7 +437,7 @@ var maintenanceActions = {
438
437
  });
439
438
  },
440
439
  editJobType: (site, id, name, email, description, level, hasCustomFields, customFields) => {
441
- var data = {
440
+ const data = {
442
441
  site,
443
442
  id,
444
443
  name,
@@ -484,13 +483,13 @@ var maintenanceActions = {
484
483
  }
485
484
  };
486
485
 
487
- var {
486
+ const {
488
487
  Helper: Helper$5,
489
488
  Session: Session$8
490
489
  } = PlussCore;
491
- var reactionActions = {
490
+ const reactionActions = {
492
491
  addComment: (entityId, entityType, entityName, site, comment, image, parentId) => {
493
- var data = {
492
+ const data = {
494
493
  entityId,
495
494
  entityType,
496
495
  entityName,
@@ -517,7 +516,7 @@ var reactionActions = {
517
516
  // });
518
517
  // },
519
518
  getComments: (entityId, entityType, minTime) => {
520
- var query = {
519
+ const query = {
521
520
  entityId,
522
521
  entityType
523
522
  };
@@ -531,12 +530,12 @@ var reactionActions = {
531
530
  }
532
531
  };
533
532
 
534
- var {
533
+ const {
535
534
  Apis: Apis$2
536
535
  } = PlussCore;
537
- var analyticsActions = Apis$2.analyticsActions;
538
- var userActions = Apis$2.userActions;
539
- var stringActions = Apis$2.stringActions;
536
+ const analyticsActions = Apis$2.analyticsActions;
537
+ const userActions = Apis$2.userActions;
538
+ const stringActions = Apis$2.stringActions;
540
539
 
541
540
  var jobStatusOptions = [
542
541
  {
@@ -559,16 +558,16 @@ var jobStatusOptions = [
559
558
  }
560
559
  ];
561
560
 
562
- var {
561
+ const {
563
562
  Helper: Helper$4
564
563
  } = PlussCore;
565
- var jobsUpdate = (site, isdashboard) => {
564
+ const jobsUpdate = (site, isdashboard) => {
566
565
  return dispatch => {
567
566
  if (isdashboard) dispatch({
568
567
  type: JOBS_LOADING
569
568
  });
570
569
  maintenanceActions.getJobsRecursive(site).then(res => {
571
- var currentSite = Helper$4.readStorageWithCookie("site");
570
+ const currentSite = Helper$4.readStorageWithCookie("site");
572
571
  if (!_.isEmpty(res) && res[0].site === currentSite) {
573
572
  dispatch({
574
573
  type: JOBS_LOADED,
@@ -583,19 +582,19 @@ var jobsUpdate = (site, isdashboard) => {
583
582
  });
584
583
  };
585
584
  };
586
- var jobsLoaded = events => {
585
+ const jobsLoaded = events => {
587
586
  return {
588
587
  type: JOBS_LOADED,
589
588
  payload: events
590
589
  };
591
590
  };
592
- var removeJob = id => {
591
+ const removeJob = id => {
593
592
  return {
594
593
  type: JOBS_REMOVED,
595
594
  payload: id
596
595
  };
597
596
  };
598
- var jobTypesUpdate = site => {
597
+ const jobTypesUpdate = site => {
599
598
  return dispatch => {
600
599
  maintenanceActions.getJobTypes(site).then(res => {
601
600
  dispatch({
@@ -605,14 +604,14 @@ var jobTypesUpdate = site => {
605
604
  });
606
605
  };
607
606
  };
608
- var jobTypesLoaded = events => {
607
+ const jobTypesLoaded = events => {
609
608
  return {
610
609
  type: JOBS_TYPES_LOADED,
611
610
  payload: events
612
611
  };
613
612
  };
614
- var jobStatusesUpdate = function jobStatusesUpdate(site) {
615
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
613
+ const jobStatusesUpdate = function (site) {
614
+ let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
616
615
  return dispatch => {
617
616
  stringActions.getString(site, values.stringConfigJobStatus).then(res => {
618
617
  dispatch({
@@ -629,14 +628,14 @@ var jobStatusesUpdate = function jobStatusesUpdate(site) {
629
628
  });
630
629
  };
631
630
  };
632
- var jobStatusesLoaded = statuses => {
631
+ const jobStatusesLoaded = statuses => {
633
632
  return {
634
633
  type: JOBS_STATUSES_LOADED,
635
634
  payload: statuses
636
635
  };
637
636
  };
638
- var jobHideSeenUpdate = function jobHideSeenUpdate(site) {
639
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
637
+ const jobHideSeenUpdate = function (site) {
638
+ let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
640
639
  return dispatch => {
641
640
  stringActions.getString(site, values.stringConfigHideSeen).then(res => {
642
641
  dispatch({
@@ -653,7 +652,7 @@ var jobHideSeenUpdate = function jobHideSeenUpdate(site) {
653
652
  });
654
653
  };
655
654
  };
656
- var jobHideSeenLoaded = hide => {
655
+ const jobHideSeenLoaded = hide => {
657
656
  return {
658
657
  type: JOBS_HIDE_SEEN,
659
658
  payload: hide
@@ -709,31 +708,29 @@ var jobPriorityOptions = [
709
708
  }
710
709
  ];
711
710
 
712
- var STATUS_IMCOMPLETE = "All Incomplete";
713
- var STATUS_NOT_ACTIONED = "Not Actioned";
714
- var STATUS_IN_PROGRESS = "In Progress";
715
- var STATUS_COMPLETED = "Completed";
716
- var getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
717
- var getJobPriority = priority => {
718
- var priorityOption = null;
711
+ const STATUS_IMCOMPLETE = "All Incomplete";
712
+ const STATUS_NOT_ACTIONED = "Not Actioned";
713
+ const STATUS_IN_PROGRESS = "In Progress";
714
+ const STATUS_COMPLETED = "Completed";
715
+ const getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
716
+ const getJobPriority = priority => {
717
+ let priorityOption = null;
719
718
  if (priority) priorityOption = jobPriorityOptions.find(p => p.name === priority);
720
719
  return priorityOption || getDefaultPriority();
721
720
  };
722
721
 
723
722
  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; }
724
723
  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; }
725
- var {
724
+ const {
726
725
  Session: Session$7,
727
726
  Components: Components$7,
728
727
  Analytics: Analytics$2
729
728
  } = PlussCore;
730
729
  class JobList extends Component {
731
730
  constructor(props) {
732
- var _this;
733
731
  super(props);
734
- _this = this;
735
732
  _defineProperty(this, "setRequesters", jobs => {
736
- var requesters = _.orderBy(_.uniqBy(jobs.map(j => ({
733
+ const requesters = _.orderBy(_.uniqBy(jobs.map(j => ({
737
734
  id: j.userID,
738
735
  displayName: j.userName,
739
736
  profilePic: j.userProfilePic
@@ -742,32 +739,32 @@ class JobList extends Component {
742
739
  requesters
743
740
  });
744
741
  });
745
- _defineProperty(this, "getJobs", /*#__PURE__*/_asyncToGenerator(function* () {
746
- var {
742
+ _defineProperty(this, "getJobs", async () => {
743
+ const {
747
744
  auth
748
- } = _this.props;
745
+ } = this.props;
749
746
  try {
750
- var res = yield maintenanceActions.getJobsRecursive(auth.site);
747
+ const res = await maintenanceActions.getJobsRecursive(auth.site);
751
748
  if (!_.isEmpty(res) && res[0].site === auth.site) {
752
- _this.setRequesters(res);
753
- _this.props.jobsLoaded(res);
749
+ this.setRequesters(res);
750
+ this.props.jobsLoaded(res);
754
751
  }
755
752
  } catch (error) {
756
753
  console.error("getJobs", error);
757
754
  }
758
- }));
759
- _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
755
+ });
756
+ _defineProperty(this, "getAssignees", async () => {
760
757
  try {
761
- var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
762
- _this.setState({
758
+ const res = await maintenanceActions.getAssignees(this.props.auth.site);
759
+ this.setState({
763
760
  assignees: res.data.Users
764
761
  });
765
762
  } catch (error) {
766
763
  console.error("getAssignees", error);
767
764
  }
768
- }));
765
+ });
769
766
  _defineProperty(this, "sortByCol", col => {
770
- var {
767
+ const {
771
768
  sortColumn,
772
769
  sortDesc
773
770
  } = this.state;
@@ -782,23 +779,18 @@ class JobList extends Component {
782
779
  });
783
780
  }
784
781
  });
785
- _defineProperty(this, "onRemoveRequest", /*#__PURE__*/function () {
786
- var _ref3 = _asyncToGenerator(function* (request) {
787
- if (window.confirm(values.textAreYouSureYouWantToDelete)) {
788
- _this.props.removeJob(request.id);
789
- try {
790
- yield maintenanceActions.deleteJob(_this.props.auth.site, request.id);
791
- _this.getJobs();
792
- } catch (error) {
793
- console.log("onRemoveRequest", error);
794
- alert("Something went wrong with the request. Please try again.");
795
- }
782
+ _defineProperty(this, "onRemoveRequest", async request => {
783
+ if (window.confirm(values.textAreYouSureYouWantToDelete)) {
784
+ this.props.removeJob(request.id);
785
+ try {
786
+ await maintenanceActions.deleteJob(this.props.auth.site, request.id);
787
+ this.getJobs();
788
+ } catch (error) {
789
+ console.log("onRemoveRequest", error);
790
+ alert("Something went wrong with the request. Please try again.");
796
791
  }
797
- });
798
- return function (_x) {
799
- return _ref3.apply(this, arguments);
800
- };
801
- }());
792
+ }
793
+ });
802
794
  _defineProperty(this, "openFilter", filter => {
803
795
  this.setState({
804
796
  filterOpen: filter
@@ -851,15 +843,15 @@ class JobList extends Component {
851
843
  if (!this.isValidTimeFilter()) {
852
844
  return;
853
845
  }
854
- var startTime = 0;
855
- var endTime = moment().endOf("d").valueOf();
856
- var text = "";
846
+ let startTime = 0;
847
+ let endTime = moment().endOf("d").valueOf();
848
+ let text = "";
857
849
  if (this.state.selectedTimeFilter.dayCount > 0) {
858
850
  startTime = moment().add(-this.state.selectedTimeFilter.dayCount, "d").startOf("d").valueOf();
859
851
  text = this.state.selectedTimeFilter.text;
860
852
  } else {
861
- var startDate = moment(this.state.timeFilterStart).startOf("d");
862
- var endDate = moment(this.state.timeFilterEnd).endOf("d");
853
+ const startDate = moment(this.state.timeFilterStart).startOf("d");
854
+ const endDate = moment(this.state.timeFilterEnd).endOf("d");
863
855
  startTime = startDate.valueOf();
864
856
  endTime = endDate.valueOf();
865
857
  text = "".concat(startDate.format("DD/MM/YYYY"), " to ").concat(endDate.format("DD/MM/YYYY"));
@@ -930,7 +922,7 @@ class JobList extends Component {
930
922
  this.closeFilter();
931
923
  });
932
924
  _defineProperty(this, "onHandleSearchChange", event => {
933
- var thisSearchTime = moment().valueOf();
925
+ const thisSearchTime = moment().valueOf();
934
926
  this.setState({
935
927
  search: event.target.value,
936
928
  lastSearch: thisSearchTime
@@ -945,7 +937,7 @@ class JobList extends Component {
945
937
  }, 500);
946
938
  });
947
939
  _defineProperty(this, "getSource", () => {
948
- var source = this.props.source;
940
+ let source = this.props.source;
949
941
 
950
942
  // filter by time
951
943
  if (this.state.selectedTimeFilterStart && this.state.selectedTimeFilterEnd) {
@@ -963,7 +955,7 @@ class JobList extends Component {
963
955
 
964
956
  // filter by priority
965
957
  if (this.state.selectedPriorityFilter) {
966
- var defaultPriority = getDefaultPriority().name;
958
+ const defaultPriority = getDefaultPriority().name;
967
959
  source = _.filter(source, r => {
968
960
  return r.priority === this.state.selectedPriorityFilter || this.state.selectedPriorityFilter === defaultPriority && _.isNil(r.priority);
969
961
  });
@@ -971,12 +963,12 @@ class JobList extends Component {
971
963
 
972
964
  // filter by status
973
965
  if (this.state.selectedStatusFilter) {
974
- var {
966
+ const {
975
967
  statusTypes
976
968
  } = this.props;
977
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
969
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
978
970
  source = _.filter(source, r => {
979
- var status = statusTypes.find(s => s.text === r.status) || defaultStatus;
971
+ const status = statusTypes.find(s => s.text === r.status) || defaultStatus;
980
972
  if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
981
973
  return status.category !== STATUS_COMPLETED;
982
974
  }
@@ -1032,18 +1024,18 @@ class JobList extends Component {
1032
1024
  }
1033
1025
  });
1034
1026
  _defineProperty(this, "getCustomFields", (job, customColumns) => {
1035
- var {
1027
+ const {
1036
1028
  customFields,
1037
1029
  type
1038
1030
  } = job;
1039
- var customValues = {};
1031
+ const customValues = {};
1040
1032
  if (customFields && Array.isArray(customFields)) {
1041
1033
  customFields.forEach(field => {
1042
1034
  // Exclude un-exportable fields
1043
1035
  if (["image", "document", "staticTitle", "staticText"].includes(field.type)) return;
1044
- var fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1036
+ const fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1045
1037
  // Build custom columns
1046
- var exists = customColumns.find(c => c.key === fieldKey);
1038
+ const exists = customColumns.find(c => c.key === fieldKey);
1047
1039
  if (!exists) {
1048
1040
  customColumns.push({
1049
1041
  label: field.label,
@@ -1057,20 +1049,20 @@ class JobList extends Component {
1057
1049
  return customValues;
1058
1050
  });
1059
1051
  _defineProperty(this, "getExportSource", () => {
1060
- var customColumns = [];
1061
- var defaultPriority = getDefaultPriority().name;
1062
- var source = this.getSource().map(r => {
1063
- var history = r.history || [];
1064
- var progressEntry = _.find(history, e => {
1052
+ const customColumns = [];
1053
+ const defaultPriority = getDefaultPriority().name;
1054
+ const source = this.getSource().map(r => {
1055
+ const history = r.history || [];
1056
+ const progressEntry = _.find(history, e => {
1065
1057
  return e.status !== "Unassigned";
1066
1058
  });
1067
- var completedEntry = _.find(history, e => {
1059
+ const completedEntry = _.find(history, e => {
1068
1060
  return e.status === "Completed";
1069
1061
  });
1070
- var progressTime = null;
1071
- var completedTime = null;
1072
- var progressDuration = null;
1073
- var completedDuration = null;
1062
+ let progressTime = null;
1063
+ let completedTime = null;
1064
+ let progressDuration = null;
1065
+ let completedDuration = null;
1074
1066
  if (progressEntry) {
1075
1067
  progressTime = moment.utc(progressEntry.timestamp).format();
1076
1068
  progressDuration = moment.utc(progressEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
@@ -1079,7 +1071,7 @@ class JobList extends Component {
1079
1071
  completedTime = moment.utc(completedEntry.timestamp).format();
1080
1072
  completedDuration = moment.utc(completedEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
1081
1073
  }
1082
- var notes = "";
1074
+ let notes = "";
1083
1075
  (r.Notes || []).forEach((note, index) => {
1084
1076
  if (index > 0) {
1085
1077
  notes += "\n\n";
@@ -1092,8 +1084,8 @@ class JobList extends Component {
1092
1084
  }
1093
1085
  notes += note.Note;
1094
1086
  });
1095
- var customFieldValues = this.getCustomFields(r, customColumns);
1096
- var priority = r.priority || defaultPriority;
1087
+ const customFieldValues = this.getCustomFields(r, customColumns);
1088
+ const priority = r.priority || defaultPriority;
1097
1089
  return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, r), customFieldValues), {}, {
1098
1090
  notes,
1099
1091
  progressTime,
@@ -1105,8 +1097,8 @@ class JobList extends Component {
1105
1097
  });
1106
1098
 
1107
1099
  // Compose revised columns list with custom fields
1108
- var index = this.exportColumns.findIndex(c => c.key === "notes");
1109
- var columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1100
+ const index = this.exportColumns.findIndex(c => c.key === "notes");
1101
+ const columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1110
1102
  return {
1111
1103
  columns,
1112
1104
  source
@@ -1236,7 +1228,7 @@ class JobList extends Component {
1236
1228
  });
1237
1229
  }
1238
1230
  if (this.state.filterOpen === "status") {
1239
- var {
1231
+ const {
1240
1232
  statusTypes
1241
1233
  } = this.props;
1242
1234
  return /*#__PURE__*/jsx(Components$7.Popup, {
@@ -1282,7 +1274,7 @@ class JobList extends Component {
1282
1274
  });
1283
1275
  }
1284
1276
  if (this.state.filterOpen === "user") {
1285
- var userContent = null;
1277
+ let userContent = null;
1286
1278
  if (this.state.selectedAssignee) {
1287
1279
  userContent = /*#__PURE__*/jsx("div", {
1288
1280
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
@@ -1337,9 +1329,9 @@ class JobList extends Component {
1337
1329
  });
1338
1330
  }
1339
1331
  if (this.state.filterOpen === "requester") {
1340
- var _userContent = null;
1332
+ let userContent = null;
1341
1333
  if (this.state.selectedRequester) {
1342
- _userContent = /*#__PURE__*/jsx("div", {
1334
+ userContent = /*#__PURE__*/jsx("div", {
1343
1335
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1344
1336
  user: this.state.selectedRequester,
1345
1337
  rightContent: /*#__PURE__*/jsx(Icon, {
@@ -1353,7 +1345,7 @@ class JobList extends Component {
1353
1345
  }, this.state.selectedRequester.id)
1354
1346
  });
1355
1347
  } else {
1356
- _userContent = /*#__PURE__*/jsxs("div", {
1348
+ userContent = /*#__PURE__*/jsxs("div", {
1357
1349
  children: [/*#__PURE__*/jsx(Components$7.GenericInput, {
1358
1350
  id: "requesterSearch",
1359
1351
  type: "text"
@@ -1388,22 +1380,22 @@ class JobList extends Component {
1388
1380
  text: "Select",
1389
1381
  isActive: true
1390
1382
  }],
1391
- children: _userContent
1383
+ children: userContent
1392
1384
  });
1393
1385
  }
1394
1386
  return null;
1395
1387
  }
1396
1388
  renderRequests() {
1397
- var {
1389
+ const {
1398
1390
  statusTypes
1399
1391
  } = this.props;
1400
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1392
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1401
1393
  return this.getSource().map((ev, index) => {
1402
1394
  if (!ev) {
1403
1395
  return null;
1404
1396
  }
1405
- var status = ev.status && statusTypes.find(s => s.text === ev.status) || defaultStatus;
1406
- var priority = getJobPriority(ev.priority);
1397
+ const status = ev.status && statusTypes.find(s => s.text === ev.status) || defaultStatus;
1398
+ const priority = getJobPriority(ev.priority);
1407
1399
  return /*#__PURE__*/jsxs("tr", {
1408
1400
  children: [/*#__PURE__*/jsx("td", {
1409
1401
  children: ev.jobId
@@ -1496,7 +1488,7 @@ class JobList extends Component {
1496
1488
  });
1497
1489
  }
1498
1490
  renderSort(col) {
1499
- var {
1491
+ const {
1500
1492
  sortColumn,
1501
1493
  sortDesc
1502
1494
  } = this.state;
@@ -1513,7 +1505,7 @@ class JobList extends Component {
1513
1505
  return " table--columnActive";
1514
1506
  }
1515
1507
  renderEmpty() {
1516
- var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1508
+ const title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1517
1509
  return /*#__PURE__*/jsxs("div", {
1518
1510
  style: {
1519
1511
  display: "flex",
@@ -1652,42 +1644,42 @@ class JobList extends Component {
1652
1644
  });
1653
1645
  }
1654
1646
  renderFilters() {
1655
- var typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1647
+ let typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1656
1648
  className: "marginRight-10",
1657
1649
  onClick: () => {
1658
1650
  this.openFilter("type");
1659
1651
  },
1660
1652
  text: values.textJobType
1661
1653
  });
1662
- var statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1654
+ let statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1663
1655
  className: "marginRight-10",
1664
1656
  onClick: () => {
1665
1657
  this.openFilter("status");
1666
1658
  },
1667
1659
  text: "Status"
1668
1660
  });
1669
- var priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1661
+ let priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1670
1662
  className: "marginRight-10",
1671
1663
  onClick: () => {
1672
1664
  this.openFilter("priority");
1673
1665
  },
1674
1666
  text: "Priority"
1675
1667
  });
1676
- var timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1668
+ let timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1677
1669
  className: "marginRight-10",
1678
1670
  onClick: () => {
1679
1671
  this.openFilter("time");
1680
1672
  },
1681
1673
  text: "Time"
1682
1674
  });
1683
- var userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1675
+ let userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1684
1676
  className: "marginRight-10",
1685
1677
  onClick: () => {
1686
1678
  this.openFilter("user");
1687
1679
  },
1688
1680
  text: "Assigned To"
1689
1681
  });
1690
- var requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1682
+ let requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1691
1683
  className: "marginRight-10",
1692
1684
  onClick: () => {
1693
1685
  this.openFilter("requester");
@@ -1813,7 +1805,7 @@ class JobList extends Component {
1813
1805
  if (!this.state.exportCsvOpen) {
1814
1806
  return null;
1815
1807
  }
1816
- var {
1808
+ const {
1817
1809
  columns,
1818
1810
  source
1819
1811
  } = this.getExportSource();
@@ -1833,8 +1825,8 @@ class JobList extends Component {
1833
1825
  });
1834
1826
  }
1835
1827
  }
1836
- var mapStateToProps$7 = state => {
1837
- var {
1828
+ const mapStateToProps$7 = state => {
1829
+ const {
1838
1830
  auth
1839
1831
  } = state;
1840
1832
  return {
@@ -1850,27 +1842,25 @@ var JobList$1 = connect(mapStateToProps$7, {
1850
1842
  jobStatusesUpdate
1851
1843
  })(withRouter(JobList));
1852
1844
 
1853
- var {
1845
+ const {
1854
1846
  Session: Session$6,
1855
1847
  Components: Components$6
1856
1848
  } = PlussCore;
1857
1849
  class JobTypes extends Component {
1858
1850
  constructor(props) {
1859
- var _this;
1860
1851
  super(props);
1861
- _this = this;
1862
- _defineProperty(this, "getJobTypes", /*#__PURE__*/_asyncToGenerator(function* () {
1852
+ _defineProperty(this, "getJobTypes", async () => {
1863
1853
  try {
1864
- var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
1865
- if (res.data != null) _this.props.jobTypesLoaded(res.data);
1854
+ const res = await maintenanceActions.getJobTypes(this.props.auth.site);
1855
+ if (res.data != null) this.props.jobTypesLoaded(res.data);
1866
1856
  } catch (error) {
1867
1857
  console.error("getJobTypes", error);
1868
1858
  } finally {
1869
- _this.setState({
1859
+ this.setState({
1870
1860
  loading: false
1871
1861
  });
1872
1862
  }
1873
- }));
1863
+ });
1874
1864
  _defineProperty(this, "sortByCol", col => {
1875
1865
  if (this.state.sortColumn === col) {
1876
1866
  this.setState({
@@ -1883,28 +1873,23 @@ class JobTypes extends Component {
1883
1873
  });
1884
1874
  }
1885
1875
  });
1886
- _defineProperty(this, "onRemoveJobType", /*#__PURE__*/function () {
1887
- var _ref2 = _asyncToGenerator(function* (ev) {
1888
- if (!window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) return;
1889
- try {
1890
- yield maintenanceActions.deleteJobType(_this.props.auth.site, ev.id);
1891
- var index = _.findIndex(_this.state.jobList, job => {
1892
- return job != null && job.id === ev.id;
1893
- });
1894
- if (index > -1) {
1895
- var newJobTypes = [..._this.state.jobList];
1896
- newJobTypes[index].Deleted = true;
1897
- _this.props.jobTypesLoaded(newJobTypes);
1898
- }
1899
- } catch (error) {
1900
- console.error("onRemoveJobType", error);
1901
- alert("Something went wrong with the request. Please try again.");
1876
+ _defineProperty(this, "onRemoveJobType", async ev => {
1877
+ if (!window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) return;
1878
+ try {
1879
+ await maintenanceActions.deleteJobType(this.props.auth.site, ev.id);
1880
+ const index = _.findIndex(this.state.jobList, job => {
1881
+ return job != null && job.id === ev.id;
1882
+ });
1883
+ if (index > -1) {
1884
+ const newJobTypes = [...this.state.jobList];
1885
+ newJobTypes[index].Deleted = true;
1886
+ this.props.jobTypesLoaded(newJobTypes);
1902
1887
  }
1903
- });
1904
- return function (_x) {
1905
- return _ref2.apply(this, arguments);
1906
- };
1907
- }());
1888
+ } catch (error) {
1889
+ console.error("onRemoveJobType", error);
1890
+ alert("Something went wrong with the request. Please try again.");
1891
+ }
1892
+ });
1908
1893
  this.state = {
1909
1894
  jobList: [],
1910
1895
  sortColumn: "name",
@@ -1928,7 +1913,7 @@ class JobTypes extends Component {
1928
1913
  });
1929
1914
  }
1930
1915
  renderList() {
1931
- var source = _.sortBy(this.state.jobList, this.state.sortColumn);
1916
+ let source = _.sortBy(this.state.jobList, this.state.sortColumn);
1932
1917
  if (this.state.sortDesc) source.reverse();
1933
1918
  source = _.filter(source, ev => {
1934
1919
  if (!ev) return false;
@@ -2063,7 +2048,7 @@ class JobTypes extends Component {
2063
2048
  return this.renderView();
2064
2049
  }
2065
2050
  renderJobTypes() {
2066
- var {
2051
+ const {
2067
2052
  jobList,
2068
2053
  loading
2069
2054
  } = this.state;
@@ -2115,8 +2100,8 @@ class JobTypes extends Component {
2115
2100
  });
2116
2101
  }
2117
2102
  }
2118
- var mapStateToProps$6 = state => {
2119
- var {
2103
+ const mapStateToProps$6 = state => {
2104
+ const {
2120
2105
  auth
2121
2106
  } = state;
2122
2107
  return {
@@ -2131,7 +2116,7 @@ var JobTypes$1 = connect(mapStateToProps$6, {
2131
2116
 
2132
2117
  function ownKeys$6(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; }
2133
2118
  function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2134
- var {
2119
+ const {
2135
2120
  Session: Session$5,
2136
2121
  Components: Components$5,
2137
2122
  Colours: Colours$3
@@ -2148,9 +2133,9 @@ class Configuration extends Component {
2148
2133
  return true;
2149
2134
  });
2150
2135
  _defineProperty(this, "onMoveStatus", function (index) {
2151
- var up = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2136
+ let up = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2152
2137
  if (_this.state.fetchingStatusTypes) return;
2153
- var statusTypes = _.cloneDeep(_this.state.statusTypes);
2138
+ const statusTypes = _.cloneDeep(_this.state.statusTypes);
2154
2139
  if (up && index > 0) {
2155
2140
  // Moving up
2156
2141
  [statusTypes[index - 1], statusTypes[index]] = [statusTypes[index], statusTypes[index - 1]];
@@ -2166,7 +2151,7 @@ class Configuration extends Component {
2166
2151
  });
2167
2152
  _defineProperty(this, "onEditStatus", index => {
2168
2153
  if (this.state.fetchingStatusTypes) return;
2169
- var status = this.state.statusTypes[index];
2154
+ const status = this.state.statusTypes[index];
2170
2155
  this.setState({
2171
2156
  showWarnings: false,
2172
2157
  showStatusPopup: true,
@@ -2178,14 +2163,14 @@ class Configuration extends Component {
2178
2163
  });
2179
2164
  _defineProperty(this, "onDeleteStatus", index => {
2180
2165
  if (this.state.fetchingStatusTypes) return;
2181
- var statusTypes = _.cloneDeep(this.state.statusTypes);
2166
+ const statusTypes = _.cloneDeep(this.state.statusTypes);
2182
2167
  statusTypes.splice(index, 1);
2183
2168
  this.setState({
2184
2169
  statusTypes
2185
2170
  });
2186
2171
  });
2187
2172
  _defineProperty(this, "onAddStatus", () => {
2188
- var defaultStatus = this.props.statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2173
+ const defaultStatus = this.props.statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2189
2174
  this.setState({
2190
2175
  showWarnings: false,
2191
2176
  showStatusPopup: true,
@@ -2196,13 +2181,13 @@ class Configuration extends Component {
2196
2181
  });
2197
2182
  });
2198
2183
  _defineProperty(this, "onSaveStatus", () => {
2199
- var {
2184
+ const {
2200
2185
  selectedStatusIndex,
2201
2186
  statusLabel,
2202
2187
  statusCategory,
2203
2188
  statusColour
2204
2189
  } = this.state;
2205
- var statusTypes = _.cloneDeep(this.state.statusTypes);
2190
+ const statusTypes = _.cloneDeep(this.state.statusTypes);
2206
2191
  if (selectedStatusIndex < 0) {
2207
2192
  statusTypes.push({
2208
2193
  text: statusLabel,
@@ -2211,7 +2196,7 @@ class Configuration extends Component {
2211
2196
  category: statusCategory
2212
2197
  });
2213
2198
  } else {
2214
- var status = statusTypes[selectedStatusIndex];
2199
+ const status = statusTypes[selectedStatusIndex];
2215
2200
  status.text = statusLabel;
2216
2201
  status.color = statusColour;
2217
2202
  status.category = statusCategory;
@@ -2243,30 +2228,30 @@ class Configuration extends Component {
2243
2228
  this.setState({
2244
2229
  success: false,
2245
2230
  submitting: true
2246
- }, /*#__PURE__*/_asyncToGenerator(function* () {
2231
+ }, async () => {
2247
2232
  try {
2248
- var {
2233
+ const {
2249
2234
  statusTypes,
2250
2235
  hideSeen
2251
- } = _this.state;
2252
- yield stringActions.setString(_this.props.auth.site, values.stringConfigJobStatus, statusTypes);
2253
- yield stringActions.setString(_this.props.auth.site, values.stringConfigHideSeen, hideSeen);
2254
- _this.props.jobStatusesLoaded(statusTypes);
2255
- _this.props.jobHideSeenLoaded(hideSeen);
2256
- _this.setState({
2236
+ } = this.state;
2237
+ await stringActions.setString(this.props.auth.site, values.stringConfigJobStatus, statusTypes);
2238
+ await stringActions.setString(this.props.auth.site, values.stringConfigHideSeen, hideSeen);
2239
+ this.props.jobStatusesLoaded(statusTypes);
2240
+ this.props.jobHideSeenLoaded(hideSeen);
2241
+ this.setState({
2257
2242
  success: true
2258
2243
  });
2259
2244
  } catch (error) {
2260
2245
  console.log("onSaveConfig - error", error);
2261
- _this.setState({
2246
+ this.setState({
2262
2247
  success: false
2263
2248
  });
2264
2249
  } finally {
2265
- _this.setState({
2250
+ this.setState({
2266
2251
  submitting: false
2267
2252
  });
2268
2253
  }
2269
- }));
2254
+ });
2270
2255
  });
2271
2256
  this.state = {
2272
2257
  success: false,
@@ -2300,15 +2285,15 @@ class Configuration extends Component {
2300
2285
  }
2301
2286
  }
2302
2287
  validateForm() {
2303
- var {
2288
+ const {
2304
2289
  submitting,
2305
2290
  statusTypes
2306
2291
  } = this.state;
2307
2292
  if (submitting) return false;
2308
2293
 
2309
2294
  // Validate statuses
2310
- var statusesValid = statusTypes.map(status => {
2311
- var {
2295
+ const statusesValid = statusTypes.map(status => {
2296
+ const {
2312
2297
  text,
2313
2298
  category,
2314
2299
  color
@@ -2319,7 +2304,7 @@ class Configuration extends Component {
2319
2304
  return true;
2320
2305
  }
2321
2306
  renderStatuses() {
2322
- var {
2307
+ const {
2323
2308
  statusTypes
2324
2309
  } = this.state;
2325
2310
  return /*#__PURE__*/jsxs("div", {
@@ -2431,7 +2416,7 @@ class Configuration extends Component {
2431
2416
  });
2432
2417
  }
2433
2418
  renderNewStatusPopup() {
2434
- var {
2419
+ const {
2435
2420
  submitting,
2436
2421
  showStatusPopup,
2437
2422
  showWarnings,
@@ -2441,7 +2426,7 @@ class Configuration extends Component {
2441
2426
  statusColour
2442
2427
  } = this.state;
2443
2428
  if (!showStatusPopup) return null;
2444
- var canSave = !submitting && this.isStatusValid(statusLabel, statusCategory, statusColour);
2429
+ const canSave = !submitting && this.isStatusValid(statusLabel, statusCategory, statusColour);
2445
2430
  return /*#__PURE__*/jsxs(Components$5.Popup, {
2446
2431
  maxWidth: 800,
2447
2432
  minWidth: 450,
@@ -2550,7 +2535,7 @@ class Configuration extends Component {
2550
2535
  });
2551
2536
  }
2552
2537
  }
2553
- var styles$6 = {
2538
+ const styles$6 = {
2554
2539
  statusCategoryHeading: {
2555
2540
  marginLeft: 130,
2556
2541
  width: 160,
@@ -2584,8 +2569,8 @@ var styles$6 = {
2584
2569
  marginLeft: 15
2585
2570
  }
2586
2571
  };
2587
- var mapStateToProps$5 = state => {
2588
- var {
2572
+ const mapStateToProps$5 = state => {
2573
+ const {
2589
2574
  auth
2590
2575
  } = state;
2591
2576
  return {
@@ -2601,27 +2586,25 @@ var Configuration$1 = connect(mapStateToProps$5, {
2601
2586
  jobHideSeenLoaded
2602
2587
  })(withRouter(Configuration));
2603
2588
 
2604
- var {
2589
+ const {
2605
2590
  Components: Components$4,
2606
2591
  Session: Session$4,
2607
2592
  Urls
2608
2593
  } = PlussCore;
2609
2594
  class RequestsHub extends Component {
2610
2595
  constructor(props) {
2611
- var _this;
2612
2596
  super(props);
2613
- _this = this;
2614
2597
  _defineProperty(this, "setData", () => {
2615
- var allList = [];
2598
+ const allList = [];
2616
2599
  this.state.allList.forEach(ev => {
2617
2600
  if (ev != null && !ev.Deleted) allList.push(ev);
2618
2601
  });
2619
- var upcoming = _.filter(allList, ev => {
2602
+ const upcoming = _.filter(allList, ev => {
2620
2603
  if (!ev) return false;
2621
2604
  if (ev.status && ev.status === "Completed") return false;
2622
2605
  return true;
2623
2606
  });
2624
- var completed = _.filter(allList, ev => {
2607
+ const completed = _.filter(allList, ev => {
2625
2608
  if (!ev) return false;
2626
2609
  if (ev.status && ev.status === "Completed") return true;
2627
2610
  return false;
@@ -2635,30 +2618,30 @@ class RequestsHub extends Component {
2635
2618
  });
2636
2619
  });
2637
2620
  _defineProperty(this, "getData", () => {
2638
- var {
2621
+ const {
2639
2622
  auth
2640
2623
  } = this.props;
2641
2624
  this.setState({
2642
2625
  loadingAll: true
2643
- }, /*#__PURE__*/_asyncToGenerator(function* () {
2626
+ }, async () => {
2644
2627
  try {
2645
- var res = yield maintenanceActions.getJobsRecursive(auth.site);
2646
- _this.setState({
2628
+ const res = await maintenanceActions.getJobsRecursive(auth.site);
2629
+ this.setState({
2647
2630
  loadingAll: false
2648
2631
  });
2649
2632
  if (!_.isEmpty(res) && res[0].site === auth.site) {
2650
- _this.props.jobsLoaded(res);
2633
+ this.props.jobsLoaded(res);
2651
2634
  }
2652
2635
  } catch (error) {
2653
2636
  console.error("getData", error);
2654
- _this.setState({
2637
+ this.setState({
2655
2638
  loadingAll: false
2656
2639
  });
2657
2640
  }
2658
- }));
2641
+ });
2659
2642
  });
2660
2643
  _defineProperty(this, "onAddNew", () => {
2661
- var {
2644
+ const {
2662
2645
  auth
2663
2646
  } = this.props;
2664
2647
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) {
@@ -2666,7 +2649,7 @@ class RequestsHub extends Component {
2666
2649
  }
2667
2650
  });
2668
2651
  _defineProperty(this, "onAddRequestType", () => {
2669
- var {
2652
+ const {
2670
2653
  auth
2671
2654
  } = this.props;
2672
2655
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTypes, auth)) {
@@ -2674,7 +2657,7 @@ class RequestsHub extends Component {
2674
2657
  }
2675
2658
  });
2676
2659
  _defineProperty(this, "canAddNew", isClass => {
2677
- var {
2660
+ const {
2678
2661
  auth
2679
2662
  } = this.props;
2680
2663
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? "" : true;
@@ -2718,7 +2701,7 @@ class RequestsHub extends Component {
2718
2701
  }, this.setData);
2719
2702
  }
2720
2703
  renderLeftBar() {
2721
- var sectionItems = [];
2704
+ const sectionItems = [];
2722
2705
  if (this.canAddNew()) {
2723
2706
  sectionItems.push({
2724
2707
  type: "newButton",
@@ -2766,7 +2749,7 @@ class RequestsHub extends Component {
2766
2749
  }
2767
2750
  });
2768
2751
  }
2769
- var helpGuide = {
2752
+ const helpGuide = {
2770
2753
  text: "Help with ".concat(values.textTitleRequests),
2771
2754
  url: Urls.HelpGuide.Maintenance
2772
2755
  } ;
@@ -2803,7 +2786,7 @@ class RequestsHub extends Component {
2803
2786
  });
2804
2787
  }
2805
2788
  }
2806
- var styles$5 = {
2789
+ const styles$5 = {
2807
2790
  sideBarTitleSection: {
2808
2791
  lineHeight: "40px",
2809
2792
  marginTop: 30,
@@ -2826,8 +2809,8 @@ var styles$5 = {
2826
2809
  color: FeatureConfig.env.colourBrandingOff
2827
2810
  }
2828
2811
  };
2829
- var mapStateToProps$4 = state => {
2830
- var {
2812
+ const mapStateToProps$4 = state => {
2813
+ const {
2831
2814
  auth
2832
2815
  } = state;
2833
2816
  return {
@@ -2842,48 +2825,46 @@ var RequestsHub$1 = connect(mapStateToProps$4, {
2842
2825
 
2843
2826
  function ownKeys$5(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; }
2844
2827
  function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2845
- var {
2828
+ const {
2846
2829
  Apis: Apis$1,
2847
2830
  Helper: Helper$3,
2848
2831
  Session: Session$3,
2849
2832
  Colours: Colours$2,
2850
2833
  Components: Components$3
2851
2834
  } = PlussCore;
2852
- var IMAGE_SIZE_NOTE = 72;
2835
+ const IMAGE_SIZE_NOTE = 72;
2853
2836
  class Job extends Component {
2854
2837
  constructor(props) {
2855
- var _this;
2856
2838
  super(props);
2857
- _this = this;
2858
- _defineProperty(this, "getJob", /*#__PURE__*/_asyncToGenerator(function* () {
2839
+ _defineProperty(this, "getJob", async () => {
2859
2840
  try {
2860
- var res = yield maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
2861
- _this.setState({
2841
+ const res = await maintenanceActions.getJob(this.props.auth.site, this.state.jobId);
2842
+ this.setState({
2862
2843
  updating: false
2863
2844
  });
2864
2845
  res.data.location = res.data.site;
2865
- _this.setJob(res.data);
2846
+ this.setJob(res.data);
2866
2847
  } catch (error) {
2867
2848
  console.error("getJob", error);
2868
2849
  }
2869
- }));
2870
- _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
2850
+ });
2851
+ _defineProperty(this, "getAssignees", async () => {
2871
2852
  try {
2872
- var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
2873
- _this.setState({
2853
+ const res = await maintenanceActions.getAssignees(this.props.auth.site);
2854
+ this.setState({
2874
2855
  assignees: res.data.Users
2875
2856
  });
2876
2857
  } catch (error) {
2877
2858
  console.error("getAssignees", error);
2878
2859
  }
2879
- }));
2880
- _defineProperty(this, "getExternalSync", /*#__PURE__*/_asyncToGenerator(function* () {
2860
+ });
2861
+ _defineProperty(this, "getExternalSync", async () => {
2881
2862
  try {
2882
- _this.setState({
2863
+ this.setState({
2883
2864
  loadingExternalSync: true
2884
2865
  });
2885
- var res = yield maintenanceActions.getExternalSync(_this.state.jobId);
2886
- _this.setState({
2866
+ const res = await maintenanceActions.getExternalSync(this.state.jobId);
2867
+ this.setState({
2887
2868
  externalSync: res.data,
2888
2869
  loadingExternalSync: false
2889
2870
  });
@@ -2892,44 +2873,44 @@ class Job extends Component {
2892
2873
  if (error && error.response && error.response.status !== 404) {
2893
2874
  console.error("getExternalSync", error);
2894
2875
  }
2895
- _this.setState({
2876
+ this.setState({
2896
2877
  loadingExternalSync: false
2897
2878
  });
2898
2879
  }
2899
- }));
2900
- _defineProperty(this, "onRetrySync", /*#__PURE__*/_asyncToGenerator(function* () {
2901
- var {
2880
+ });
2881
+ _defineProperty(this, "onRetrySync", async () => {
2882
+ const {
2902
2883
  job
2903
- } = _this.state;
2904
- if (!job || _this.state.retryingSync) return;
2905
- _this.setState({
2884
+ } = this.state;
2885
+ if (!job || this.state.retryingSync) return;
2886
+ this.setState({
2906
2887
  retryingSync: true,
2907
2888
  retrySyncError: null
2908
2889
  });
2909
2890
  try {
2910
- yield maintenanceActions.retrySync(job.id);
2891
+ await maintenanceActions.retrySync(job.id);
2911
2892
  // Refresh job data to get updated history
2912
- yield _this.getJob();
2913
- _this.setState({
2893
+ await this.getJob();
2894
+ this.setState({
2914
2895
  retryingSync: false,
2915
2896
  retrySyncInitiated: true
2916
2897
  });
2917
2898
  } catch (error) {
2918
2899
  console.error("onRetrySync", error);
2919
- var errorMessage = error && error.response && error.response.data && error.response.data.error || "Failed to retry sync. Please try again.";
2920
- _this.setState({
2900
+ const errorMessage = error && error.response && error.response.data && error.response.data.error || "Failed to retry sync. Please try again.";
2901
+ this.setState({
2921
2902
  retryingSync: false,
2922
2903
  retrySyncError: errorMessage
2923
2904
  });
2924
2905
  }
2925
- }));
2906
+ });
2926
2907
  _defineProperty(this, "getStatusType", status => {
2927
- var {
2908
+ const {
2928
2909
  statusTypes
2929
2910
  } = this.props;
2930
- var statusType = statusTypes.find(s => s.text === status);
2911
+ let statusType = statusTypes.find(s => s.text === status);
2931
2912
  if (!statusType) {
2932
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2913
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2933
2914
  statusType = _objectSpread$5(_objectSpread$5({}, defaultStatus), {}, {
2934
2915
  text: status
2935
2916
  });
@@ -2951,7 +2932,7 @@ class Job extends Component {
2951
2932
  isEmpty: true
2952
2933
  }];
2953
2934
  }
2954
- var needToMarkSeen = false;
2935
+ let needToMarkSeen = false;
2955
2936
  if (!job.seen) {
2956
2937
  job.seen = true;
2957
2938
  needToMarkSeen = true;
@@ -2965,7 +2946,7 @@ class Job extends Component {
2965
2946
  });
2966
2947
  _defineProperty(this, "editJob", () => {});
2967
2948
  _defineProperty(this, "isReadyToSaveNote", () => {
2968
- var {
2949
+ const {
2969
2950
  noteAttachments,
2970
2951
  noteInput,
2971
2952
  noteImages
@@ -2980,7 +2961,7 @@ class Job extends Component {
2980
2961
  });
2981
2962
  });
2982
2963
  _defineProperty(this, "onCloseAddNote", () => {
2983
- var newState = {
2964
+ const newState = {
2984
2965
  addNoteOpen: false,
2985
2966
  editingNote: null
2986
2967
  };
@@ -3003,10 +2984,10 @@ class Job extends Component {
3003
2984
  }
3004
2985
  });
3005
2986
  _defineProperty(this, "onHandlePDFFileChange", event => {
3006
- var file = event.target.files[0];
2987
+ const file = event.target.files[0];
3007
2988
  if (!file || this.state.uploadingNoteAttachment) return;
3008
- var noteAttachments = [...this.state.noteAttachments];
3009
- var newAttachment = {
2989
+ const noteAttachments = [...this.state.noteAttachments];
2990
+ const newAttachment = {
3010
2991
  Uploading: true,
3011
2992
  Title: file.name
3012
2993
  };
@@ -3030,9 +3011,9 @@ class Job extends Component {
3030
3011
  event.target.value = "";
3031
3012
  });
3032
3013
  _defineProperty(this, "onRemoveAttachment", a => {
3033
- var index = this.state.noteAttachments.indexOf(a);
3014
+ const index = this.state.noteAttachments.indexOf(a);
3034
3015
  if (index > -1) {
3035
- var newAttachments = [...this.state.noteAttachments];
3016
+ const newAttachments = [...this.state.noteAttachments];
3036
3017
  newAttachments.splice(index, 1);
3037
3018
  this.setState({
3038
3019
  noteAttachments: newAttachments
@@ -3054,54 +3035,49 @@ class Job extends Component {
3054
3035
  selectedAssignee: user
3055
3036
  });
3056
3037
  });
3057
- _defineProperty(this, "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator(function* () {
3058
- _this.setState({
3038
+ _defineProperty(this, "onConfirmAssignee", async () => {
3039
+ this.setState({
3059
3040
  confirmingAssignee: true
3060
3041
  });
3061
3042
  try {
3062
- if (_this.state.selectedAssignee) {
3063
- yield _this.onAssignUser(_this.state.selectedAssignee.id);
3043
+ if (this.state.selectedAssignee) {
3044
+ await this.onAssignUser(this.state.selectedAssignee.id);
3064
3045
  }
3065
- _this.onCloseSelectAssignee();
3046
+ this.onCloseSelectAssignee();
3066
3047
  } catch (error) {
3067
3048
  console.error("onConfirmAssignee", error);
3068
3049
  }
3069
- _this.setState({
3050
+ this.setState({
3070
3051
  confirmingAssignee: false
3071
3052
  });
3072
- }));
3053
+ });
3073
3054
  // Method to handle user assignment
3074
- _defineProperty(this, "onAssignUser", /*#__PURE__*/function () {
3075
- var _ref6 = _asyncToGenerator(function* (userId) {
3076
- try {
3077
- var res = yield maintenanceActions.assignJob(_this.state.jobId, userId);
3078
- _this.getJob();
3079
- } catch (err) {
3080
- console.error("onAssignUser", err);
3081
- }
3082
- });
3083
- return function (_x) {
3084
- return _ref6.apply(this, arguments);
3085
- };
3086
- }());
3087
- _defineProperty(this, "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator(function* () {
3088
- if (!_this.isReadyToSaveNote()) return;
3055
+ _defineProperty(this, "onAssignUser", async userId => {
3056
+ try {
3057
+ const res = await maintenanceActions.assignJob(this.state.jobId, userId);
3058
+ this.getJob();
3059
+ } catch (err) {
3060
+ console.error("onAssignUser", err);
3061
+ }
3062
+ });
3063
+ _defineProperty(this, "onConfirmAddNote", async () => {
3064
+ if (!this.isReadyToSaveNote()) return;
3089
3065
  try {
3090
- _this.setState({
3066
+ this.setState({
3091
3067
  submittingNote: true
3092
3068
  });
3093
- var res = yield _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(a => {
3069
+ const res = await (this.state.editingNote ? maintenanceActions.editNote(this.state.jobId, this.state.editingNote, this.state.noteInput, this.state.noteAttachments.map(a => {
3094
3070
  return {
3095
3071
  Title: a.Title,
3096
3072
  Source: a.Source
3097
3073
  };
3098
- }), _this.state.noteImages) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(a => {
3074
+ }), this.state.noteImages) : maintenanceActions.addNote(this.state.jobId, this.state.noteInput, this.state.noteAttachments.map(a => {
3099
3075
  return {
3100
3076
  Title: a.Title,
3101
3077
  Source: a.Source
3102
3078
  };
3103
- }), _this.state.noteImages);
3104
- _this.setState({
3079
+ }), this.state.noteImages));
3080
+ this.setState({
3105
3081
  job: res.data.job,
3106
3082
  submittingNote: false,
3107
3083
  addNoteOpen: false,
@@ -3110,12 +3086,12 @@ class Job extends Component {
3110
3086
  noteImages: [],
3111
3087
  editingNote: null
3112
3088
  }, () => {
3113
- _this.props.jobsLoaded([_this.state.job]);
3089
+ this.props.jobsLoaded([this.state.job]);
3114
3090
  });
3115
3091
  } catch (err) {
3116
3092
  console.error("onConfirmAddNote", err);
3117
3093
  }
3118
- }));
3094
+ });
3119
3095
  _defineProperty(this, "onDeleteNote", n => {
3120
3096
  if (!window.confirm(values.textAreYouSureYouWantToDeleteNote)) {
3121
3097
  this.setState({
@@ -3124,8 +3100,8 @@ class Job extends Component {
3124
3100
  return;
3125
3101
  }
3126
3102
  maintenanceActions.deleteNote(this.state.jobId, n.Id);
3127
- var newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3128
- var newJob = _objectSpread$5({}, this.state.job);
3103
+ const newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3104
+ const newJob = _objectSpread$5({}, this.state.job);
3129
3105
  newJob.Notes = newNotes;
3130
3106
  this.setState({
3131
3107
  job: newJob,
@@ -3143,10 +3119,10 @@ class Job extends Component {
3143
3119
  }, this.checkSetImage);
3144
3120
  });
3145
3121
  _defineProperty(this, "markSeen", () => {
3146
- var {
3122
+ const {
3147
3123
  job
3148
3124
  } = this.state;
3149
- var {
3125
+ const {
3150
3126
  auth
3151
3127
  } = this.props;
3152
3128
  // Must have maintenance permission and not the requester
@@ -3154,22 +3130,22 @@ class Job extends Component {
3154
3130
  if (auth.user.Id === job.userID) return;
3155
3131
  this.setState({
3156
3132
  updating: true
3157
- }, /*#__PURE__*/_asyncToGenerator(function* () {
3133
+ }, async () => {
3158
3134
  try {
3159
- var update = {
3135
+ const update = {
3160
3136
  id: job.id,
3161
3137
  seen: true,
3162
3138
  status: job.status || "Unassigned"
3163
3139
  };
3164
- yield maintenanceActions.editJob(update, auth.site);
3140
+ await maintenanceActions.editJob(update, auth.site);
3165
3141
  } catch (error) {
3166
- _this.setState({
3142
+ this.setState({
3167
3143
  updating: false
3168
3144
  });
3169
3145
  console.log("markSeen error", error);
3170
3146
  alert("Something went wrong with the request. Please try again.");
3171
3147
  }
3172
- }));
3148
+ });
3173
3149
  });
3174
3150
  _defineProperty(this, "getComments", () => {
3175
3151
  reactionActions.getComments(this.state.jobId, values.commentKey, 0).then(res => {
@@ -3178,25 +3154,25 @@ class Job extends Component {
3178
3154
  });
3179
3155
  });
3180
3156
  });
3181
- _defineProperty(this, "onAddComment", /*#__PURE__*/_asyncToGenerator(function* () {
3182
- var {
3157
+ _defineProperty(this, "onAddComment", async () => {
3158
+ const {
3183
3159
  commentInput,
3184
3160
  jobId,
3185
3161
  job,
3186
3162
  comments
3187
- } = _this.state;
3163
+ } = this.state;
3188
3164
  try {
3189
- _this.setState({
3165
+ this.setState({
3190
3166
  commentInput: ""
3191
3167
  });
3192
- var res = yield reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3193
- _this.setState({
3168
+ const res = await reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3169
+ this.setState({
3194
3170
  comments: [...comments, res.data]
3195
3171
  });
3196
3172
  } catch (error) {
3197
3173
  console.error("onAddComment", error);
3198
3174
  }
3199
- }));
3175
+ });
3200
3176
  _defineProperty(this, "onHandleChange", event => {
3201
3177
  var stateChange = {};
3202
3178
  stateChange[event.target.getAttribute("id")] = event.target.value;
@@ -3207,61 +3183,51 @@ class Job extends Component {
3207
3183
  priorityChangerOpen: !this.state.priorityChangerOpen
3208
3184
  });
3209
3185
  });
3210
- _defineProperty(this, "onSelectPriority", /*#__PURE__*/function () {
3211
- var _ref0 = _asyncToGenerator(function* (priority) {
3212
- _this.setState({
3213
- job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3214
- priority
3215
- }),
3216
- priorityChangerOpen: false
3217
- });
3218
- try {
3219
- var res = yield maintenanceActions.editJobPriority(_this.state.job.id, priority);
3220
- var {
3221
- job
3222
- } = res.data;
3223
- _this.props.jobsLoaded([job]);
3224
- _this.setState({
3225
- job
3226
- });
3227
- } catch (error) {
3228
- console.error("onSelectPriority", error);
3229
- }
3186
+ _defineProperty(this, "onSelectPriority", async priority => {
3187
+ this.setState({
3188
+ job: _objectSpread$5(_objectSpread$5({}, this.state.job), {}, {
3189
+ priority
3190
+ }),
3191
+ priorityChangerOpen: false
3230
3192
  });
3231
- return function (_x2) {
3232
- return _ref0.apply(this, arguments);
3233
- };
3234
- }());
3193
+ try {
3194
+ const res = await maintenanceActions.editJobPriority(this.state.job.id, priority);
3195
+ const {
3196
+ job
3197
+ } = res.data;
3198
+ this.props.jobsLoaded([job]);
3199
+ this.setState({
3200
+ job
3201
+ });
3202
+ } catch (error) {
3203
+ console.error("onSelectPriority", error);
3204
+ }
3205
+ });
3235
3206
  _defineProperty(this, "onToggleStatusChanger", () => {
3236
3207
  this.setState({
3237
3208
  statusChangerOpen: !this.state.statusChangerOpen
3238
3209
  });
3239
3210
  });
3240
- _defineProperty(this, "onSelectStatus", /*#__PURE__*/function () {
3241
- var _ref1 = _asyncToGenerator(function* (status) {
3242
- _this.setState({
3243
- job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3244
- status: status
3245
- }),
3246
- statusChangerOpen: false
3247
- });
3248
- try {
3249
- var res = yield maintenanceActions.editJobStatus(_this.state.job.id, status);
3250
- var {
3251
- job
3252
- } = res.data;
3253
- _this.props.jobsLoaded([job]);
3254
- _this.setState({
3255
- job
3256
- });
3257
- } catch (error) {
3258
- console.error("onSelectStatus", error);
3259
- }
3211
+ _defineProperty(this, "onSelectStatus", async status => {
3212
+ this.setState({
3213
+ job: _objectSpread$5(_objectSpread$5({}, this.state.job), {}, {
3214
+ status: status
3215
+ }),
3216
+ statusChangerOpen: false
3260
3217
  });
3261
- return function (_x3) {
3262
- return _ref1.apply(this, arguments);
3263
- };
3264
- }());
3218
+ try {
3219
+ const res = await maintenanceActions.editJobStatus(this.state.job.id, status);
3220
+ const {
3221
+ job
3222
+ } = res.data;
3223
+ this.props.jobsLoaded([job]);
3224
+ this.setState({
3225
+ job
3226
+ });
3227
+ } catch (error) {
3228
+ console.error("onSelectStatus", error);
3229
+ }
3230
+ });
3265
3231
  this.state = {
3266
3232
  jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3267
3233
  job: null,
@@ -3323,15 +3289,15 @@ class Job extends Component {
3323
3289
  });
3324
3290
  }
3325
3291
  renderPriorityLabel() {
3326
- var {
3292
+ const {
3327
3293
  auth
3328
3294
  } = this.props;
3329
3295
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
3330
- var {
3296
+ const {
3331
3297
  job
3332
3298
  } = this.state;
3333
3299
  if (!job) return null;
3334
- var selectedPriority = getJobPriority(job.priority);
3300
+ const selectedPriority = getJobPriority(job.priority);
3335
3301
  return /*#__PURE__*/jsxs("div", {
3336
3302
  className: "statusLabel marginTop-5 pointer",
3337
3303
  onClick: this.onTogglePriorityChanger,
@@ -3346,8 +3312,8 @@ class Job extends Component {
3346
3312
  }
3347
3313
  renderStatusLabel() {
3348
3314
  if (!this.state.job.status) return null;
3349
- var statusType = this.getStatusType(this.state.job.status);
3350
- var {
3315
+ const statusType = this.getStatusType(this.state.job.status);
3316
+ const {
3351
3317
  auth
3352
3318
  } = this.props;
3353
3319
  if (Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) {
@@ -3375,7 +3341,7 @@ class Job extends Component {
3375
3341
  });
3376
3342
  }
3377
3343
  renderNotesButton() {
3378
- var {
3344
+ const {
3379
3345
  auth
3380
3346
  } = this.props;
3381
3347
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3393,7 +3359,7 @@ class Job extends Component {
3393
3359
  });
3394
3360
  }
3395
3361
  renderAssignButton() {
3396
- var {
3362
+ const {
3397
3363
  auth
3398
3364
  } = this.props;
3399
3365
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3412,7 +3378,7 @@ class Job extends Component {
3412
3378
  }
3413
3379
  renderStatusChanger() {
3414
3380
  if (!this.state.statusChangerOpen) return null;
3415
- var {
3381
+ const {
3416
3382
  statusTypes
3417
3383
  } = this.props;
3418
3384
  return /*#__PURE__*/jsx("div", {
@@ -3472,8 +3438,8 @@ class Job extends Component {
3472
3438
  });
3473
3439
  }
3474
3440
  renderImageGrid(images) {
3475
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3476
- var imagesToUse = images && images.length > 0 ? images : [];
3441
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3442
+ const imagesToUse = images && images.length > 0 ? images : [];
3477
3443
  return /*#__PURE__*/jsx("div", {
3478
3444
  className: "imageGrid",
3479
3445
  children: imagesToUse.map((image, i) => {
@@ -3494,7 +3460,7 @@ class Job extends Component {
3494
3460
  });
3495
3461
  }
3496
3462
  renderDocumentGrid(documents) {
3497
- var documentsToUse = documents && documents.length > 0 ? documents : [];
3463
+ const documentsToUse = documents && documents.length > 0 ? documents : [];
3498
3464
  return /*#__PURE__*/jsx("div", {
3499
3465
  className: "documentGrid",
3500
3466
  children: documentsToUse.map((doc, index) => /*#__PURE__*/jsx(Components$3.Attachment, {
@@ -3506,7 +3472,7 @@ class Job extends Component {
3506
3472
  }
3507
3473
  renderImages() {
3508
3474
  if (_.isEmpty(this.state.job.image) && _.isEmpty(this.state.job.images)) return null;
3509
- var imagesToUse = _.isEmpty(this.state.job.image) ? this.state.job.images : [this.state.job.image];
3475
+ const imagesToUse = _.isEmpty(this.state.job.image) ? this.state.job.images : [this.state.job.image];
3510
3476
  return /*#__PURE__*/jsxs("div", {
3511
3477
  className: "padding-60 paddingVertical-40 bottomDivideBorder",
3512
3478
  children: [/*#__PURE__*/jsx(Components$3.Text, {
@@ -3517,15 +3483,15 @@ class Job extends Component {
3517
3483
  });
3518
3484
  }
3519
3485
  renderCustomFields() {
3520
- var {
3486
+ const {
3521
3487
  job
3522
3488
  } = this.state;
3523
- var {
3489
+ const {
3524
3490
  customFields
3525
3491
  } = job;
3526
- var labelClass = "fieldLabel";
3527
- var answerClass = "fontRegular fontSize-16 text-dark marginTop-5";
3528
- var renderAnswer = field => {
3492
+ const labelClass = "fieldLabel";
3493
+ const answerClass = "fontRegular fontSize-16 text-dark marginTop-5";
3494
+ const renderAnswer = field => {
3529
3495
  switch (field.type) {
3530
3496
  case "date":
3531
3497
  return /*#__PURE__*/jsx("div", {
@@ -3575,10 +3541,10 @@ class Job extends Component {
3575
3541
  }
3576
3542
  renderInner() {
3577
3543
  if (this.state.job == null) return null;
3578
- var {
3544
+ const {
3579
3545
  customFields
3580
3546
  } = this.state.job;
3581
- var hasCustomFields = customFields && customFields.length > 0;
3547
+ const hasCustomFields = customFields && customFields.length > 0;
3582
3548
  return /*#__PURE__*/jsxs("div", {
3583
3549
  iconStyle: {
3584
3550
  paddingBottom: 40
@@ -3679,10 +3645,10 @@ class Job extends Component {
3679
3645
  });
3680
3646
  }
3681
3647
  renderHistoryEntry(e, i) {
3682
- var {
3648
+ const {
3683
3649
  job
3684
3650
  } = this.state;
3685
- var entryToUse = e || {
3651
+ const entryToUse = e || {
3686
3652
  timestamp: job.createdTime,
3687
3653
  status: "Unassigned",
3688
3654
  user: {
@@ -3691,7 +3657,7 @@ class Job extends Component {
3691
3657
  profilePic: job.userProfilePic
3692
3658
  }
3693
3659
  };
3694
- var statusType = this.getStatusType(entryToUse.status);
3660
+ const statusType = this.getStatusType(entryToUse.status);
3695
3661
  return /*#__PURE__*/jsxs("div", {
3696
3662
  className: "ticketHistoryEntry",
3697
3663
  children: [/*#__PURE__*/jsx("p", {
@@ -3755,7 +3721,7 @@ class Job extends Component {
3755
3721
  }, index);
3756
3722
  }
3757
3723
  renderAssignment() {
3758
- var {
3724
+ const {
3759
3725
  job
3760
3726
  } = this.state;
3761
3727
  if (!job) return null;
@@ -3803,8 +3769,8 @@ class Job extends Component {
3803
3769
  }, i);
3804
3770
  }
3805
3771
  renderExternalSyncEntry(e, i) {
3806
- var isSuccess = e.EntryType === "ExternalIDSet";
3807
- var backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3772
+ const isSuccess = e.EntryType === "ExternalIDSet";
3773
+ const backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3808
3774
 
3809
3775
  return /*#__PURE__*/jsxs("div", {
3810
3776
  className: "ticketHistoryEntry",
@@ -3824,7 +3790,7 @@ class Job extends Component {
3824
3790
  }, i);
3825
3791
  }
3826
3792
  renderPriority() {
3827
- var {
3793
+ const {
3828
3794
  auth
3829
3795
  } = this.props;
3830
3796
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3841,20 +3807,20 @@ class Job extends Component {
3841
3807
  });
3842
3808
  }
3843
3809
  hasSyncFailureWithoutSuccess() {
3844
- var {
3810
+ const {
3845
3811
  job
3846
3812
  } = this.state;
3847
3813
  if (!job || !job.history) return false;
3848
- var history = job.history || [];
3849
- var hasSuccess = history.some(entry => entry.EntryType === "ExternalIDSet");
3850
- var hasFailure = history.some(entry => entry.EntryType === "ExternalIDSetFailed");
3814
+ const history = job.history || [];
3815
+ const hasSuccess = history.some(entry => entry.EntryType === "ExternalIDSet");
3816
+ const hasFailure = history.some(entry => entry.EntryType === "ExternalIDSetFailed");
3851
3817
  return hasFailure && !hasSuccess;
3852
3818
  }
3853
3819
  renderRetrySyncButton() {
3854
- var {
3820
+ const {
3855
3821
  auth
3856
3822
  } = this.props;
3857
- var {
3823
+ const {
3858
3824
  retryingSync,
3859
3825
  retrySyncInitiated
3860
3826
  } = this.state;
@@ -3892,7 +3858,7 @@ class Job extends Component {
3892
3858
  });
3893
3859
  }
3894
3860
  renderExternalSyncStatus() {
3895
- var {
3861
+ const {
3896
3862
  retrySyncError,
3897
3863
  retrySyncInitiated
3898
3864
  } = this.state;
@@ -3941,14 +3907,14 @@ class Job extends Component {
3941
3907
  return null;
3942
3908
  }
3943
3909
  renderExternalSync() {
3944
- var {
3910
+ const {
3945
3911
  externalSync,
3946
3912
  loadingExternalSync
3947
3913
  } = this.state;
3948
3914
 
3949
3915
  // Check if we should show this section at all
3950
- var hasExternalSyncData = externalSync && !loadingExternalSync;
3951
- var hasSyncFailure = this.hasSyncFailureWithoutSuccess();
3916
+ const hasExternalSyncData = externalSync && !loadingExternalSync;
3917
+ const hasSyncFailure = this.hasSyncFailureWithoutSuccess();
3952
3918
 
3953
3919
  // Show section if we have sync data OR if there's a failure that can be retried
3954
3920
  if (!hasExternalSyncData && !hasSyncFailure) return null;
@@ -3988,11 +3954,11 @@ class Job extends Component {
3988
3954
  });
3989
3955
  }
3990
3956
  renderOverview() {
3991
- var {
3957
+ const {
3992
3958
  job
3993
3959
  } = this.state;
3994
3960
  if (!job || !job.history) return null;
3995
- var source = _.sortBy([...job.history.map(e => {
3961
+ const source = _.sortBy([...job.history.map(e => {
3996
3962
  return _objectSpread$5(_objectSpread$5({}, e), {}, {
3997
3963
  EntryType: e.EntryType || "status"
3998
3964
  });
@@ -4130,8 +4096,8 @@ class Job extends Component {
4130
4096
  children: "Add Attachment"
4131
4097
  })]
4132
4098
  }), /*#__PURE__*/jsx(Components$3.ImageInput, {
4133
- ref: _ref10 => {
4134
- this.imageInput = _ref10;
4099
+ ref: ref => {
4100
+ this.imageInput = ref;
4135
4101
  },
4136
4102
  multiple: true,
4137
4103
  refreshCallback: images => {
@@ -4143,7 +4109,7 @@ class Job extends Component {
4143
4109
  });
4144
4110
  }
4145
4111
  renderUsers() {
4146
- var content = null;
4112
+ let content = null;
4147
4113
  if (this.state.confirmingAssignee) {
4148
4114
  content = /*#__PURE__*/jsx("div", {
4149
4115
  className: "flex flex-center-row",
@@ -4237,8 +4203,8 @@ class Job extends Component {
4237
4203
  });
4238
4204
  }
4239
4205
  }
4240
- var mapStateToProps$3 = state => {
4241
- var {
4206
+ const mapStateToProps$3 = state => {
4207
+ const {
4242
4208
  auth
4243
4209
  } = state;
4244
4210
  return {
@@ -4253,7 +4219,7 @@ var Job$1 = connect(mapStateToProps$3, {
4253
4219
 
4254
4220
  function ownKeys$4(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; }
4255
4221
  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; }
4256
- var {
4222
+ const {
4257
4223
  Actions,
4258
4224
  Components: Components$2,
4259
4225
  Helper: Helper$2,
@@ -4266,18 +4232,18 @@ class AddJob extends Component {
4266
4232
  var _this;
4267
4233
  super(props);
4268
4234
  _this = this;
4269
- _defineProperty(this, "getJob", /*#__PURE__*/_asyncToGenerator(function* () {
4235
+ _defineProperty(this, "getJob", async () => {
4270
4236
  try {
4271
- var res = yield maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
4237
+ const res = await maintenanceActions.getJob(this.props.auth.site, this.state.jobId);
4272
4238
  res.data.location = res.data.site;
4273
- var {
4239
+ const {
4274
4240
  userID,
4275
4241
  userName,
4276
4242
  userProfilePic,
4277
4243
  type,
4278
4244
  customFields
4279
4245
  } = res.data;
4280
- _this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4246
+ this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4281
4247
  prevType: type,
4282
4248
  prevCustomFileds: customFields,
4283
4249
  type,
@@ -4288,39 +4254,39 @@ class AddJob extends Component {
4288
4254
  profilePic: userProfilePic
4289
4255
  }
4290
4256
  }));
4291
- _this.checkSetImages(_this.imageInput, res.data.images);
4257
+ this.checkSetImages(this.imageInput, res.data.images);
4292
4258
  if (customFields) {
4293
4259
  customFields.forEach((field, index) => {
4294
4260
  if (field.type === "image" && field.answer) {
4295
- _this.checkSetImages(_this.customImageInputs[index], field.answer);
4261
+ this.checkSetImages(this.customImageInputs[index], field.answer);
4296
4262
  }
4297
4263
  });
4298
4264
  }
4299
4265
  } catch (error) {
4300
4266
  console.error("getJob", error);
4301
4267
  }
4302
- }));
4303
- _defineProperty(this, "getJobTypes", /*#__PURE__*/_asyncToGenerator(function* () {
4268
+ });
4269
+ _defineProperty(this, "getJobTypes", async () => {
4304
4270
  try {
4305
- var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
4306
- _this.setState({
4271
+ const res = await maintenanceActions.getJobTypes(this.props.auth.site);
4272
+ this.setState({
4307
4273
  types: res.data
4308
4274
  });
4309
- _this.getDefaultJob();
4275
+ this.getDefaultJob();
4310
4276
  } catch (error) {
4311
4277
  console.error("getJobTypes", error);
4312
4278
  }
4313
- }));
4314
- _defineProperty(this, "getUsers", /*#__PURE__*/_asyncToGenerator(function* () {
4279
+ });
4280
+ _defineProperty(this, "getUsers", async () => {
4315
4281
  try {
4316
- var res = yield userActions.fetchUsers(_this.props.auth.site);
4282
+ const res = await userActions.fetchUsers(this.props.auth.site);
4317
4283
  if (res.userFetchFail) return;
4318
4284
  if (res.data != null && !_.isEmpty(res.data.results.Items)) {
4319
- var items = res.data.results.Items;
4320
- if (_this.props.optionOnlyForResidents) {
4285
+ let items = res.data.results.Items;
4286
+ if (this.props.optionOnlyForResidents) {
4321
4287
  items = _.filter(items, u => u.category === "resident");
4322
4288
  }
4323
- _this.setState({
4289
+ this.setState({
4324
4290
  users: _.sortBy(items, u => {
4325
4291
  return (u.displayName || "").toLowerCase();
4326
4292
  })
@@ -4329,15 +4295,15 @@ class AddJob extends Component {
4329
4295
  } catch (error) {
4330
4296
  console.error("getUsers", error);
4331
4297
  }
4332
- }));
4298
+ });
4333
4299
  _defineProperty(this, "getDefaultJob", () => {
4334
- var {
4300
+ const {
4335
4301
  types,
4336
4302
  jobId
4337
4303
  } = this.state;
4338
4304
  if (jobId == null) {
4339
4305
  if (types.length !== 0) {
4340
- var defaultType = types[0];
4306
+ const defaultType = types[0];
4341
4307
  this.setState({
4342
4308
  type: defaultType.typeName,
4343
4309
  customFields: defaultType.hasCustomFields && defaultType.customFields.length > 0 ? defaultType.customFields : []
@@ -4350,15 +4316,15 @@ class AddJob extends Component {
4350
4316
  }
4351
4317
  });
4352
4318
  _defineProperty(this, "onSelectType", (key, e) => {
4353
- var {
4319
+ const {
4354
4320
  types,
4355
4321
  prevType,
4356
4322
  prevCustomFileds
4357
4323
  } = this.state;
4358
- var selectedType = types.find(t => t.typeName === key);
4324
+ const selectedType = types.find(t => t.typeName === key);
4359
4325
  // If selected type had previously saved custom fields, use the previous version
4360
- var hasPrevCustomFields = prevType === selectedType.typeName && prevCustomFileds && prevCustomFileds.length > 0;
4361
- var update = {
4326
+ const hasPrevCustomFields = prevType === selectedType.typeName && prevCustomFileds && prevCustomFileds.length > 0;
4327
+ const update = {
4362
4328
  type: selectedType.typeName,
4363
4329
  customFields: hasPrevCustomFields ? prevCustomFileds : selectedType.hasCustomFields ? selectedType.customFields : []
4364
4330
  };
@@ -4383,7 +4349,7 @@ class AddJob extends Component {
4383
4349
  });
4384
4350
  });
4385
4351
  _defineProperty(this, "onSelectUser", user => {
4386
- var update = {
4352
+ const update = {
4387
4353
  selectedUser: user,
4388
4354
  userID: user.userId,
4389
4355
  userName: user.displayName,
@@ -4401,7 +4367,7 @@ class AddJob extends Component {
4401
4367
  // Fetch in background to avoid blocking UI
4402
4368
  userActions.fetchUser(this.props.auth.site, user.userId).then(response => {
4403
4369
  if (response.data && response.data.user) {
4404
- var contactUpdate = {};
4370
+ const contactUpdate = {};
4405
4371
  // Auto-populate phone and room from user profile
4406
4372
  if (response.data.user.phoneNumber) {
4407
4373
  contactUpdate.phone = response.data.user.phoneNumber;
@@ -4421,7 +4387,7 @@ class AddJob extends Component {
4421
4387
  });
4422
4388
  });
4423
4389
  _defineProperty(this, "onUnselectUser", () => {
4424
- var update = {
4390
+ const update = {
4425
4391
  selectedUser: null,
4426
4392
  userID: "",
4427
4393
  userName: "",
@@ -4434,78 +4400,78 @@ class AddJob extends Component {
4434
4400
  this.setState(update);
4435
4401
  });
4436
4402
  _defineProperty(this, "onChangeAnswer", (qId, answer) => {
4437
- var update = {
4403
+ const update = {
4438
4404
  customFields: _.cloneDeep(this.state.customFields)
4439
4405
  };
4440
- var field = update.customFields[qId];
4406
+ const field = update.customFields[qId];
4441
4407
  field.answer = answer;
4442
4408
  if (field.isTitle) update.title = field.answer;
4443
4409
  this.setState(update);
4444
4410
  });
4445
4411
  _defineProperty(this, "onChangeToggleAnswer", (qId, answer) => {
4446
- var update = {
4412
+ const update = {
4447
4413
  customFields: _.cloneDeep(this.state.customFields)
4448
4414
  };
4449
- var field = update.customFields[qId];
4415
+ const field = update.customFields[qId];
4450
4416
  field.answer = field.answer === answer ? undefined : answer;
4451
4417
  if (field.isTitle) update.title = field.answer;
4452
4418
  this.setState(update);
4453
4419
  });
4454
4420
  _defineProperty(this, "onChangeCheckboxAnswer", (qId, answer) => {
4455
- var update = {
4421
+ const update = {
4456
4422
  customFields: _.cloneDeep(this.state.customFields)
4457
4423
  };
4458
- var field = update.customFields[qId];
4424
+ const field = update.customFields[qId];
4459
4425
  field.answer = _.xor(field.answer || [], [answer]);
4460
4426
  if (field.isTitle) update.title = field.answer.join(", ");
4461
4427
  this.setState(update);
4462
4428
  });
4463
4429
  _defineProperty(this, "onChangeDateAnswer", function (qId, answer) {
4464
- var togglePicker = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4465
- var update = {
4430
+ let togglePicker = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4431
+ const update = {
4466
4432
  customFields: _.cloneDeep(_this.state.customFields)
4467
4433
  };
4468
- var field = update.customFields[qId];
4434
+ const field = update.customFields[qId];
4469
4435
  field.answer = answer;
4470
4436
  if (field.isTitle) update.title = moment(field.answer, "YYYY-MM-DD").format("DD-MMM-YYYY");
4471
4437
  _this.setState(update);
4472
4438
  if (togglePicker) _this.onToggleDatePicker(qId);
4473
4439
  });
4474
4440
  _defineProperty(this, "onChangeTimeAnswer", (qId, answer) => {
4475
- var update = {
4441
+ const update = {
4476
4442
  customFields: _.cloneDeep(this.state.customFields)
4477
4443
  };
4478
- var field = update.customFields[qId];
4444
+ const field = update.customFields[qId];
4479
4445
  field.answer = answer;
4480
4446
  if (field.isTitle) update.title = moment(field.answer, "HH:mm").format("h:mm a");
4481
4447
  this.setState(update);
4482
4448
  });
4483
4449
  _defineProperty(this, "onChangeImageAnswer", (qId, answer) => {
4484
- var update = {
4450
+ const update = {
4485
4451
  customFields: _.cloneDeep(this.state.customFields)
4486
4452
  };
4487
- var field = update.customFields[qId];
4453
+ const field = update.customFields[qId];
4488
4454
  field.answer = answer;
4489
4455
  this.setState(update);
4490
4456
  });
4491
4457
  _defineProperty(this, "onRemoveDocumentAnswer", (qId, document) => {
4492
- var update = {
4458
+ const update = {
4493
4459
  customFields: _.cloneDeep(this.state.customFields)
4494
4460
  };
4495
- var field = update.customFields[qId];
4461
+ const field = update.customFields[qId];
4496
4462
  field.answer = _.filter(field.answer, d => d.url !== document.url);
4497
4463
  this.setState(update);
4498
4464
  });
4499
4465
  _defineProperty(this, "onHandlePDFFileChange", (event, qId) => {
4500
- var file = event.target.files[0];
4466
+ const file = event.target.files[0];
4501
4467
  if (!file) return;
4502
- var update = {
4468
+ const update = {
4503
4469
  customFields: _.cloneDeep(this.state.customFields)
4504
4470
  };
4505
- var field = update.customFields[qId];
4506
- var attachments = field.answer || [];
4507
- var [name, ext] = file.name.split(".");
4508
- var newAttachment = {
4471
+ const field = update.customFields[qId];
4472
+ const attachments = field.answer || [];
4473
+ const [name, ext] = file.name.split(".");
4474
+ const newAttachment = {
4509
4475
  uploading: true,
4510
4476
  name,
4511
4477
  ext: ext.toLowerCase()
@@ -4525,7 +4491,7 @@ class AddJob extends Component {
4525
4491
  event.target.value = "";
4526
4492
  });
4527
4493
  _defineProperty(this, "onToggleDatePicker", qId => {
4528
- var showDate = _objectSpread$4({}, this.state.showDate);
4494
+ const showDate = _objectSpread$4({}, this.state.showDate);
4529
4495
  showDate[qId] = !showDate[qId];
4530
4496
  this.setState({
4531
4497
  showDate
@@ -4545,7 +4511,7 @@ class AddJob extends Component {
4545
4511
  this.setState({
4546
4512
  updating: true
4547
4513
  });
4548
- var job = {
4514
+ const job = {
4549
4515
  id: this.state.id,
4550
4516
  userID: this.state.userID,
4551
4517
  userName: this.state.userName,
@@ -4591,13 +4557,13 @@ class AddJob extends Component {
4591
4557
  }
4592
4558
  });
4593
4559
  _defineProperty(this, "isFieldValid", field => {
4594
- var {
4560
+ const {
4595
4561
  mandatory,
4596
4562
  type,
4597
4563
  answer
4598
4564
  } = field;
4599
4565
  if (["staticTitle", "staticText"].includes(type)) return true;
4600
- var checkMandatory = () => {
4566
+ const checkMandatory = () => {
4601
4567
  if (!mandatory) return true;
4602
4568
  switch (type) {
4603
4569
  case "yn":
@@ -4610,7 +4576,7 @@ class AddJob extends Component {
4610
4576
  return !_.isNil(answer) && !_.isEmpty(answer);
4611
4577
  }
4612
4578
  };
4613
- var checkFormat = () => {
4579
+ const checkFormat = () => {
4614
4580
  if (_.isNil(answer) || _.isEmpty(answer)) return true;
4615
4581
  switch (type) {
4616
4582
  case "email":
@@ -4623,12 +4589,12 @@ class AddJob extends Component {
4623
4589
  return true;
4624
4590
  }
4625
4591
  };
4626
- var valid = checkMandatory() && checkFormat();
4592
+ const valid = checkMandatory() && checkFormat();
4627
4593
  return valid;
4628
4594
  });
4629
4595
  _defineProperty(this, "getFieldContainerClass", function () {
4630
- var isValid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4631
- var showError = _this.state.showWarnings && !isValid;
4596
+ let isValid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4597
+ const showError = _this.state.showWarnings && !isValid;
4632
4598
  return "genericInputContainer ".concat(isValid ? "genericInput-valid" : "", " ").concat(showError ? "genericInput-error" : "").trim();
4633
4599
  });
4634
4600
  this.imageInput = null;
@@ -4687,25 +4653,18 @@ class AddJob extends Component {
4687
4653
  }, 100);
4688
4654
  }
4689
4655
  }
4690
- renderTypeOptions() {
4691
- var {
4692
- types,
4693
- type
4656
+ getTypeOptions() {
4657
+ const {
4658
+ types
4694
4659
  } = this.state;
4695
- return types.map(ev => {
4696
- if (ev != null) {
4697
- return /*#__PURE__*/jsx(MenuItem, {
4698
- eventKey: ev.typeName,
4699
- active: type === ev.typeName,
4700
- children: ev.typeName
4701
- }, ev.typeName);
4702
- }
4703
- return null;
4704
- });
4660
+ return types.filter(Boolean).map(ev => ({
4661
+ Key: ev.typeName,
4662
+ Title: ev.typeName
4663
+ }));
4705
4664
  }
4706
4665
  renderSuccess() {
4707
4666
  if (!this.state.success) return null;
4708
- var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
4667
+ const title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
4709
4668
  return /*#__PURE__*/jsx(Components$2.SuccessPopup, {
4710
4669
  text: "".concat(values.textEntityName, " has been ").concat(this.state.id != null ? "edited" : "added"),
4711
4670
  buttons: [{
@@ -4718,12 +4677,12 @@ class AddJob extends Component {
4718
4677
  });
4719
4678
  }
4720
4679
  validateCustomFields() {
4721
- var {
4680
+ const {
4722
4681
  customFields
4723
4682
  } = this.state;
4724
4683
  if (!customFields || customFields.length === 0) return true;
4725
4684
  return customFields.every(field => {
4726
- var isValid = this.isFieldValid(field);
4685
+ const isValid = this.isFieldValid(field);
4727
4686
  return isValid;
4728
4687
  });
4729
4688
  }
@@ -4763,11 +4722,11 @@ class AddJob extends Component {
4763
4722
  });
4764
4723
  }
4765
4724
  renderSelectUser() {
4766
- var {
4725
+ const {
4767
4726
  showWarnings,
4768
4727
  selectedUser
4769
4728
  } = this.state;
4770
- var isValid = !_.isNil(selectedUser);
4729
+ const isValid = !_.isNil(selectedUser);
4771
4730
  return /*#__PURE__*/jsxs("div", {
4772
4731
  className: this.getFieldContainerClass(isValid),
4773
4732
  children: [/*#__PURE__*/jsxs("div", {
@@ -4837,8 +4796,8 @@ class AddJob extends Component {
4837
4796
  className: "marginBottom-4",
4838
4797
  children: "Images"
4839
4798
  }), /*#__PURE__*/jsx(Components$2.ImageInput, {
4840
- ref: _ref4 => {
4841
- this.imageInput = _ref4;
4799
+ ref: ref => {
4800
+ this.imageInput = ref;
4842
4801
  },
4843
4802
  multiple: true,
4844
4803
  refreshCallback: images => {
@@ -5077,14 +5036,14 @@ class AddJob extends Component {
5077
5036
  className: "marginBottom-4",
5078
5037
  children: field.label
5079
5038
  }), /*#__PURE__*/jsx(Components$2.ImageInput, {
5080
- ref: _ref5 => this.customImageInputs[fieldId] = _ref5,
5039
+ ref: ref => this.customImageInputs[fieldId] = ref,
5081
5040
  multiple: true,
5082
5041
  refreshCallback: images => this.onChangeImageAnswer(fieldId, images)
5083
5042
  })]
5084
5043
  })]
5085
5044
  }, fieldId);
5086
5045
  case "document":
5087
- var documents = field.answer || [];
5046
+ const documents = field.answer || [];
5088
5047
  return /*#__PURE__*/jsxs("div", {
5089
5048
  className: this.getFieldContainerClass(this.isFieldValid(field)),
5090
5049
  style: styles$4.fieldContainer,
@@ -5129,7 +5088,7 @@ class AddJob extends Component {
5129
5088
  }
5130
5089
  }
5131
5090
  renderCustomFields() {
5132
- var {
5091
+ const {
5133
5092
  customFields
5134
5093
  } = this.state;
5135
5094
  if (!customFields || customFields.length === 0) return null;
@@ -5140,7 +5099,7 @@ class AddJob extends Component {
5140
5099
  });
5141
5100
  }
5142
5101
  renderMain() {
5143
- var {
5102
+ const {
5144
5103
  customFields
5145
5104
  } = this.state;
5146
5105
  return /*#__PURE__*/jsx("div", {
@@ -5178,29 +5137,20 @@ class AddJob extends Component {
5178
5137
  showError: () => {
5179
5138
  return this.state.showWarnings && _.isEmpty(this.state.room);
5180
5139
  }
5181
- }), /*#__PURE__*/jsxs("div", {
5182
- iconStyle: {
5140
+ }), /*#__PURE__*/jsx(Components$2.DropdownInput, {
5141
+ label: values.textJobType,
5142
+ value: this.state.type,
5143
+ options: this.getTypeOptions(),
5144
+ onSelect: this.onSelectType,
5145
+ style: {
5183
5146
  marginBottom: 15
5184
- },
5185
- children: [/*#__PURE__*/jsx(Components$2.Text, {
5186
- type: "formLabel",
5187
- children: values.textJobType
5188
- }), /*#__PURE__*/jsx(DropdownButton, {
5189
- style: {
5190
- minWidth: 80
5191
- },
5192
- bsStyle: "default",
5193
- title: this.state.type,
5194
- id: "typeSelect",
5195
- onSelect: this.onSelectType,
5196
- children: this.renderTypeOptions()
5197
- })]
5147
+ }
5198
5148
  }), !_.isEmpty(customFields) || values.forceCustomFields ? this.renderCustomFields() : this.renderDefaultFields()]
5199
5149
  })
5200
5150
  });
5201
5151
  }
5202
5152
  renderUserFilterPopup() {
5203
- var {
5153
+ const {
5204
5154
  userFilterOpen,
5205
5155
  userSearch,
5206
5156
  users
@@ -5240,7 +5190,7 @@ class AddJob extends Component {
5240
5190
  });
5241
5191
  }
5242
5192
  render() {
5243
- var {
5193
+ const {
5244
5194
  success
5245
5195
  } = this.state;
5246
5196
  return /*#__PURE__*/jsxs(Components$2.OverlayPage, {
@@ -5258,7 +5208,7 @@ class AddJob extends Component {
5258
5208
  });
5259
5209
  }
5260
5210
  }
5261
- var styles$4 = {
5211
+ const styles$4 = {
5262
5212
  userLabelContainer: {
5263
5213
  display: "flex",
5264
5214
  flexDirection: "row",
@@ -5272,8 +5222,8 @@ var styles$4 = {
5272
5222
  alignItems: "center"
5273
5223
  }
5274
5224
  };
5275
- var mapStateToProps$2 = state => {
5276
- var {
5225
+ const mapStateToProps$2 = state => {
5226
+ const {
5277
5227
  auth
5278
5228
  } = state;
5279
5229
  return {
@@ -5288,12 +5238,12 @@ var AddJob$1 = connect(mapStateToProps$2, {
5288
5238
  addRecentlyCreated: Actions.addRecentlyCreated
5289
5239
  })(withRouter(AddJob));
5290
5240
 
5291
- var {
5241
+ const {
5292
5242
  Components: Components$1,
5293
5243
  Session: Session$1,
5294
5244
  Helper: Helper$1
5295
5245
  } = PlussCore;
5296
- var DEFAULT_FIELD = {
5246
+ const DEFAULT_FIELD = {
5297
5247
  type: "text",
5298
5248
  label: "",
5299
5249
  mandatory: false,
@@ -5302,13 +5252,11 @@ var DEFAULT_FIELD = {
5302
5252
  };
5303
5253
  class AddJobType extends Component {
5304
5254
  constructor(props) {
5305
- var _this;
5306
5255
  super(props);
5307
- _this = this;
5308
- _defineProperty(this, "getJobType", /*#__PURE__*/_asyncToGenerator(function* () {
5256
+ _defineProperty(this, "getJobType", async () => {
5309
5257
  try {
5310
- var res = yield maintenanceActions.getJobType(_this.props.auth.site, _this.state.jobTypeId);
5311
- var {
5258
+ const res = await maintenanceActions.getJobType(this.props.auth.site, this.state.jobTypeId);
5259
+ const {
5312
5260
  typeName,
5313
5261
  email,
5314
5262
  description,
@@ -5316,7 +5264,7 @@ class AddJobType extends Component {
5316
5264
  hasCustomFields,
5317
5265
  customFields
5318
5266
  } = res.data;
5319
- _this.setState({
5267
+ this.setState({
5320
5268
  jobTypeName: typeName,
5321
5269
  jobTypeEmail: email,
5322
5270
  jobTypeDescription: description,
@@ -5327,19 +5275,19 @@ class AddJobType extends Component {
5327
5275
  } catch (error) {
5328
5276
  console.error("getJobType", error);
5329
5277
  }
5330
- }));
5278
+ });
5331
5279
  _defineProperty(this, "getFieldTypeTitle", type => {
5332
- var fieldType = this.fieldTypes.find(f => f.Key === type);
5280
+ const fieldType = this.fieldTypes.find(f => f.Key === type);
5333
5281
  return fieldType ? fieldType.Title : "";
5334
5282
  });
5335
5283
  _defineProperty(this, "validateEmail", () => {
5336
- var {
5284
+ const {
5337
5285
  jobTypeEmail
5338
5286
  } = this.state;
5339
5287
  return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
5340
5288
  });
5341
5289
  _defineProperty(this, "isJobTypeValid", () => {
5342
- var {
5290
+ const {
5343
5291
  jobTypeName,
5344
5292
  jobTypeDescription
5345
5293
  } = this.state;
@@ -5355,7 +5303,7 @@ class AddJobType extends Component {
5355
5303
  this.setState(stateChange);
5356
5304
  });
5357
5305
  _defineProperty(this, "onFieldTypeChanged", (fieldIndex, key) => {
5358
- var customFields = [...this.state.customFields];
5306
+ const customFields = [...this.state.customFields];
5359
5307
  if (customFields[fieldIndex].type === key) return;
5360
5308
  customFields[fieldIndex] = _.cloneDeep(DEFAULT_FIELD);
5361
5309
  customFields[fieldIndex].type = key;
@@ -5364,21 +5312,21 @@ class AddJobType extends Component {
5364
5312
  });
5365
5313
  });
5366
5314
  _defineProperty(this, "onFieldLabelChanged", (fieldIndex, event) => {
5367
- var customFields = [...this.state.customFields];
5315
+ const customFields = [...this.state.customFields];
5368
5316
  customFields[fieldIndex].label = event.target.value;
5369
5317
  this.setState({
5370
5318
  customFields
5371
5319
  });
5372
5320
  });
5373
5321
  _defineProperty(this, "onFieldPlaceHolderChanged", (fieldIndex, event) => {
5374
- var customFields = [...this.state.customFields];
5322
+ const customFields = [...this.state.customFields];
5375
5323
  customFields[fieldIndex].placeHolder = event.target.value;
5376
5324
  this.setState({
5377
5325
  customFields
5378
5326
  });
5379
5327
  });
5380
5328
  _defineProperty(this, "onFieldMandatoryChanged", fieldIndex => {
5381
- var customFields = [...this.state.customFields];
5329
+ const customFields = [...this.state.customFields];
5382
5330
  customFields[fieldIndex].mandatory = !customFields[fieldIndex].mandatory;
5383
5331
  if (!customFields[fieldIndex].mandatory) {
5384
5332
  // If a field is not mandatory, it cannot be a title field
@@ -5389,7 +5337,7 @@ class AddJobType extends Component {
5389
5337
  });
5390
5338
  });
5391
5339
  _defineProperty(this, "onFieldIsTitleChanged", fieldIndex => {
5392
- var customFields = [...this.state.customFields];
5340
+ const customFields = [...this.state.customFields];
5393
5341
  customFields[fieldIndex].isTitle = !customFields[fieldIndex].isTitle;
5394
5342
  if (customFields[fieldIndex].isTitle) {
5395
5343
  // If a field is title field, force mandatory
@@ -5400,33 +5348,33 @@ class AddJobType extends Component {
5400
5348
  });
5401
5349
  });
5402
5350
  _defineProperty(this, "onFieldOptionChanged", (fieldIndex, optionIndex, event) => {
5403
- var customFields = [...this.state.customFields];
5404
- var prevValue = customFields[fieldIndex].values[optionIndex];
5351
+ const customFields = [...this.state.customFields];
5352
+ const prevValue = customFields[fieldIndex].values[optionIndex];
5405
5353
  customFields[fieldIndex].values[optionIndex] = event.target.value;
5406
5354
  // Change corresponding validation if exists
5407
- var validations = customFields[fieldIndex].validation;
5408
- var validation = validations ? validations.find(val => val.value === prevValue) : null;
5355
+ const validations = customFields[fieldIndex].validation;
5356
+ let validation = validations ? validations.find(val => val.value === prevValue) : null;
5409
5357
  if (validation) validation.value = event.target.value;
5410
5358
  this.setState({
5411
5359
  customFields
5412
5360
  });
5413
5361
  });
5414
5362
  _defineProperty(this, "onAddNewOption", fieldIndex => {
5415
- var customFields = [...this.state.customFields];
5363
+ const customFields = [...this.state.customFields];
5416
5364
  customFields[fieldIndex].values.push("");
5417
5365
  this.setState({
5418
5366
  customFields
5419
5367
  });
5420
5368
  });
5421
5369
  _defineProperty(this, "onRemoveOption", (fieldIndex, optionIndex) => {
5422
- var customFields = [...this.state.customFields];
5370
+ const customFields = [...this.state.customFields];
5423
5371
  customFields[fieldIndex].values.splice(optionIndex, 1);
5424
5372
  this.setState({
5425
5373
  customFields
5426
5374
  });
5427
5375
  });
5428
5376
  _defineProperty(this, "onAddNewField", () => {
5429
- var customFields = [...this.state.customFields];
5377
+ const customFields = [...this.state.customFields];
5430
5378
  customFields.push(_.cloneDeep(DEFAULT_FIELD));
5431
5379
  this.setState({
5432
5380
  customFields
@@ -5434,17 +5382,17 @@ class AddJobType extends Component {
5434
5382
  });
5435
5383
  _defineProperty(this, "onMoveFieldPrev", fieldIndex => {
5436
5384
  if (fieldIndex === 0) return;
5437
- var customFields = [...this.state.customFields];
5438
- var item = customFields.splice(fieldIndex, 1)[0];
5385
+ const customFields = [...this.state.customFields];
5386
+ const item = customFields.splice(fieldIndex, 1)[0];
5439
5387
  customFields.splice(fieldIndex - 1, 0, item);
5440
5388
  this.setState({
5441
5389
  customFields
5442
5390
  });
5443
5391
  });
5444
5392
  _defineProperty(this, "onMoveFieldNext", fieldIndex => {
5445
- var customFields = [...this.state.customFields];
5393
+ const customFields = [...this.state.customFields];
5446
5394
  if (fieldIndex > customFields.length - 1) return;
5447
- var item = customFields.splice(fieldIndex, 1)[0];
5395
+ const item = customFields.splice(fieldIndex, 1)[0];
5448
5396
  customFields.splice(fieldIndex + 1, 0, item);
5449
5397
  this.setState({
5450
5398
  customFields
@@ -5454,10 +5402,10 @@ class AddJobType extends Component {
5454
5402
  window.history.back();
5455
5403
  });
5456
5404
  _defineProperty(this, "onSave", () => {
5457
- var {
5405
+ const {
5458
5406
  site
5459
5407
  } = this.props.auth;
5460
- var {
5408
+ const {
5461
5409
  submitting,
5462
5410
  jobTypeId,
5463
5411
  jobTypeName,
@@ -5476,26 +5424,26 @@ class AddJobType extends Component {
5476
5424
  }
5477
5425
  this.setState({
5478
5426
  submitting: true
5479
- }, /*#__PURE__*/_asyncToGenerator(function* () {
5427
+ }, async () => {
5480
5428
  try {
5481
5429
  if (jobTypeId) {
5482
- yield maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5430
+ await maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5483
5431
  } else {
5484
- yield maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5432
+ await maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5485
5433
  }
5486
- _this.props.jobTypesUpdate(site);
5487
- _this.setState({
5434
+ this.props.jobTypesUpdate(site);
5435
+ this.setState({
5488
5436
  submitting: false,
5489
5437
  success: true
5490
5438
  });
5491
5439
  } catch (error) {
5492
5440
  console.error("onSave", error);
5493
- _this.setState({
5441
+ this.setState({
5494
5442
  submitting: false
5495
5443
  });
5496
5444
  alert("Something went wrong with the request. Please try again.");
5497
5445
  }
5498
- }));
5446
+ });
5499
5447
  });
5500
5448
  this.fieldTypes = [{
5501
5449
  Title: "Text Input",
@@ -5556,7 +5504,7 @@ class AddJobType extends Component {
5556
5504
  if (this.state.jobTypeId) this.getJobType();
5557
5505
  }
5558
5506
  validateCustomFields() {
5559
- var {
5507
+ const {
5560
5508
  submitting,
5561
5509
  hasCustomFields,
5562
5510
  customFields
@@ -5564,13 +5512,13 @@ class AddJobType extends Component {
5564
5512
  if (submitting) return false;
5565
5513
 
5566
5514
  // Validate custom fields
5567
- var warnings = [];
5515
+ const warnings = [];
5568
5516
  if (hasCustomFields) {
5569
- var missingLabel = false;
5570
- var hasMandatoryField = false;
5571
- var titleFieldCount = 0;
5517
+ let missingLabel = false;
5518
+ let hasMandatoryField = false;
5519
+ let titleFieldCount = 0;
5572
5520
  customFields.forEach(field => {
5573
- var {
5521
+ const {
5574
5522
  type,
5575
5523
  label,
5576
5524
  values,
@@ -5602,7 +5550,7 @@ class AddJobType extends Component {
5602
5550
  return warnings.length === 0;
5603
5551
  }
5604
5552
  onRemoveField(fieldIndex) {
5605
- var customFields = [...this.state.customFields];
5553
+ const customFields = [...this.state.customFields];
5606
5554
  if (customFields.length < 2) return;
5607
5555
  customFields.splice(fieldIndex, 1);
5608
5556
  this.setState({
@@ -5610,7 +5558,7 @@ class AddJobType extends Component {
5610
5558
  });
5611
5559
  }
5612
5560
  renderBaseForm() {
5613
- var {
5561
+ const {
5614
5562
  success,
5615
5563
  jobTypeId,
5616
5564
  showWarnings,
@@ -5809,7 +5757,7 @@ class AddJobType extends Component {
5809
5757
  });
5810
5758
  }
5811
5759
  renderFieldMultiple(field, fieldIndex) {
5812
- var {
5760
+ const {
5813
5761
  customFields
5814
5762
  } = this.state;
5815
5763
  return /*#__PURE__*/jsxs("div", {
@@ -5880,7 +5828,7 @@ class AddJobType extends Component {
5880
5828
  });
5881
5829
  }
5882
5830
  renderFieldCheckbox(field, fieldIndex) {
5883
- var {
5831
+ const {
5884
5832
  customFields
5885
5833
  } = this.state;
5886
5834
  return /*#__PURE__*/jsxs("div", {
@@ -5975,10 +5923,10 @@ class AddJobType extends Component {
5975
5923
  });
5976
5924
  }
5977
5925
  renderField(field, fieldIndex) {
5978
- var {
5926
+ const {
5979
5927
  customFields
5980
5928
  } = this.state;
5981
- var renderFieldContent = () => {
5929
+ const renderFieldContent = () => {
5982
5930
  switch (field.type) {
5983
5931
  case "text":
5984
5932
  case "email":
@@ -6062,7 +6010,7 @@ class AddJobType extends Component {
6062
6010
  }, fieldIndex);
6063
6011
  }
6064
6012
  renderCustomForm() {
6065
- var {
6013
+ const {
6066
6014
  success,
6067
6015
  hasCustomFields,
6068
6016
  customFields
@@ -6097,7 +6045,7 @@ class AddJobType extends Component {
6097
6045
  });
6098
6046
  }
6099
6047
  renderWarnings() {
6100
- var {
6048
+ const {
6101
6049
  showWarnings,
6102
6050
  warnings
6103
6051
  } = this.state;
@@ -6119,7 +6067,7 @@ class AddJobType extends Component {
6119
6067
  });
6120
6068
  }
6121
6069
  renderSuccess() {
6122
- var {
6070
+ const {
6123
6071
  success,
6124
6072
  jobTypeId
6125
6073
  } = this.state;
@@ -6160,7 +6108,7 @@ class AddJobType extends Component {
6160
6108
  });
6161
6109
  }
6162
6110
  render() {
6163
- var {
6111
+ const {
6164
6112
  success
6165
6113
  } = this.state;
6166
6114
  return /*#__PURE__*/jsxs(Components$1.OverlayPage, {
@@ -6179,8 +6127,8 @@ class AddJobType extends Component {
6179
6127
  });
6180
6128
  }
6181
6129
  }
6182
- var mapStateToProps$1 = state => {
6183
- var {
6130
+ const mapStateToProps$1 = state => {
6131
+ const {
6184
6132
  auth
6185
6133
  } = state;
6186
6134
  return {
@@ -6194,14 +6142,14 @@ var AddJobType$1 = connect(mapStateToProps$1, {
6194
6142
 
6195
6143
  function ownKeys$3(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; }
6196
6144
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6197
- var {
6145
+ const {
6198
6146
  Analytics: Analytics$1,
6199
6147
  Session,
6200
6148
  Components,
6201
6149
  Helper,
6202
6150
  Colours
6203
6151
  } = PlussCore;
6204
- var getInitialState = () => ({
6152
+ const getInitialState = () => ({
6205
6153
  requests: 0,
6206
6154
  prevRequests: 0,
6207
6155
  completedRequests: 0,
@@ -6212,8 +6160,8 @@ var getInitialState = () => ({
6212
6160
  });
6213
6161
 
6214
6162
  // AnalyticsHub Component
6215
- var AnalyticsHub = _ref => {
6216
- var {
6163
+ const AnalyticsHub = _ref => {
6164
+ let {
6217
6165
  startTime,
6218
6166
  endTime,
6219
6167
  auth,
@@ -6224,27 +6172,27 @@ var AnalyticsHub = _ref => {
6224
6172
  userCategory,
6225
6173
  selectedSites
6226
6174
  } = _ref;
6227
- var [analyticsData, setAnalyticsData] = useState(getInitialState());
6228
- var [isExportOpen, setIsExportOpen] = useState(false);
6229
- var [failedSites, setFailedSites] = useState([]);
6230
- var [comparisonData, setComparisonData] = useState({
6175
+ const [analyticsData, setAnalyticsData] = useState(getInitialState());
6176
+ const [isExportOpen, setIsExportOpen] = useState(false);
6177
+ const [failedSites, setFailedSites] = useState([]);
6178
+ const [comparisonData, setComparisonData] = useState({
6231
6179
  requests: [],
6232
6180
  completedRequests: [],
6233
6181
  comments: [],
6234
6182
  isLoading: true
6235
6183
  });
6236
- var comparisonMode = selectedSites && selectedSites.length > 1;
6237
- var hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6184
+ const comparisonMode = selectedSites && selectedSites.length > 1;
6185
+ const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6238
6186
  if (!hasAccess) {
6239
6187
  return null;
6240
6188
  }
6241
- var featureTitle = (key => {
6189
+ const featureTitle = (key => {
6242
6190
  if (!strings || !strings.sideNav || !strings.sideNav[key]) {
6243
6191
  return values.textMenuTitle;
6244
6192
  }
6245
6193
  return strings.sideNav[key];
6246
6194
  })();
6247
- var exportColumns = [{
6195
+ const exportColumns = [{
6248
6196
  label: "Select All",
6249
6197
  key: ""
6250
6198
  }, ...(comparisonMode ? [{
@@ -6269,104 +6217,94 @@ var AnalyticsHub = _ref => {
6269
6217
  useEffect(() => {
6270
6218
  getData();
6271
6219
  }, [startTime, endTime, userType, userCategory, selectedSites]);
6272
- var getData = /*#__PURE__*/function () {
6273
- var _ref2 = _asyncToGenerator(function* () {
6274
- try {
6275
- setFailedSites([]);
6276
- if (comparisonMode) {
6277
- setComparisonData({
6278
- requests: [],
6279
- completedRequests: [],
6280
- comments: [],
6281
- isLoading: true
6282
- });
6283
- var multiSiteResultsObj = yield Analytics$1.fetchMultiSiteData(selectedSites, /*#__PURE__*/function () {
6284
- var _ref3 = _asyncToGenerator(function* (site) {
6285
- var {
6286
- data
6287
- } = yield analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6288
- userType,
6289
- userCategory
6290
- });
6291
- return data;
6292
- });
6293
- return function (_x) {
6294
- return _ref3.apply(this, arguments);
6295
- };
6296
- }());
6297
- var roles = auth.user.Roles;
6298
- var failed = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6299
- var [, data] = _ref4;
6300
- return data === null;
6301
- }).map(_ref5 => {
6302
- var [site] = _ref5;
6303
- return Helper.getSiteNameFromRoles(site, roles);
6304
- });
6305
- setFailedSites(failed);
6306
- var multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref6 => {
6307
- var [, data] = _ref6;
6308
- return data !== null;
6309
- }).map(_ref7 => {
6310
- var [site, data] = _ref7;
6311
- return {
6312
- site,
6313
- data
6314
- };
6315
- });
6316
- var buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6317
- name: Helper.getSiteNameFromRoles(result.site, roles),
6318
- value: Analytics$1.countActivities(result.data, activityKey, countType)
6319
- }));
6320
- setComparisonData({
6321
- requests: buildComparison("Request", "total"),
6322
- completedRequests: buildComparison("RequestCompleted", "unique"),
6323
- comments: buildComparison("Comment", "total"),
6324
- isLoading: false
6325
- });
6326
- } else {
6327
- setAnalyticsData(getInitialState());
6328
- var site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6329
- var timeDifference = endTime - startTime;
6330
- var [currentStatsResponse, prevStatsResponse] = yield Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6331
- userType,
6332
- userCategory
6333
- }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6220
+ const getData = async () => {
6221
+ try {
6222
+ setFailedSites([]);
6223
+ if (comparisonMode) {
6224
+ setComparisonData({
6225
+ requests: [],
6226
+ completedRequests: [],
6227
+ comments: [],
6228
+ isLoading: true
6229
+ });
6230
+ const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
6231
+ const {
6232
+ data
6233
+ } = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6334
6234
  userType,
6335
6235
  userCategory
6336
- })]);
6337
- var data = {
6338
- requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6339
- prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6340
- completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6341
- prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6342
- comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6343
- prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6344
- isLoading: false
6236
+ });
6237
+ return data;
6238
+ });
6239
+ const roles = auth.user.Roles;
6240
+ const failed = Object.entries(multiSiteResultsObj).filter(_ref2 => {
6241
+ let [, data] = _ref2;
6242
+ return data === null;
6243
+ }).map(_ref3 => {
6244
+ let [site] = _ref3;
6245
+ return Helper.getSiteNameFromRoles(site, roles);
6246
+ });
6247
+ setFailedSites(failed);
6248
+ const multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6249
+ let [, data] = _ref4;
6250
+ return data !== null;
6251
+ }).map(_ref5 => {
6252
+ let [site, data] = _ref5;
6253
+ return {
6254
+ site,
6255
+ data
6345
6256
  };
6346
- setAnalyticsData(data);
6347
- }
6348
- } catch (err) {
6349
- if (comparisonMode) {
6350
- setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6351
- isLoading: false
6352
- }));
6353
- } else {
6354
- setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6355
- isLoading: false
6356
- }));
6357
- }
6257
+ });
6258
+ const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6259
+ name: Helper.getSiteNameFromRoles(result.site, roles),
6260
+ value: Analytics$1.countActivities(result.data, activityKey, countType)
6261
+ }));
6262
+ setComparisonData({
6263
+ requests: buildComparison("Request", "total"),
6264
+ completedRequests: buildComparison("RequestCompleted", "unique"),
6265
+ comments: buildComparison("Comment", "total"),
6266
+ isLoading: false
6267
+ });
6268
+ } else {
6269
+ setAnalyticsData(getInitialState());
6270
+ const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6271
+ const timeDifference = endTime - startTime;
6272
+ const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6273
+ userType,
6274
+ userCategory
6275
+ }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6276
+ userType,
6277
+ userCategory
6278
+ })]);
6279
+ const data = {
6280
+ requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6281
+ prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6282
+ completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6283
+ prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6284
+ comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6285
+ prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6286
+ isLoading: false
6287
+ };
6288
+ setAnalyticsData(data);
6358
6289
  }
6359
- });
6360
- return function getData() {
6361
- return _ref2.apply(this, arguments);
6362
- };
6363
- }();
6364
- var isReadyToOpenCSV = () => {
6290
+ } catch (err) {
6291
+ if (comparisonMode) {
6292
+ setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6293
+ isLoading: false
6294
+ }));
6295
+ } else {
6296
+ setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6297
+ isLoading: false
6298
+ }));
6299
+ }
6300
+ }
6301
+ };
6302
+ const isReadyToOpenCSV = () => {
6365
6303
  return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
6366
6304
  };
6367
- var getExportSource = () => {
6305
+ const getExportSource = () => {
6368
6306
  if (comparisonMode) {
6369
- var sites = comparisonData.requests || [];
6307
+ const sites = comparisonData.requests || [];
6370
6308
  return sites.map((site, i) => ({
6371
6309
  site: site.name,
6372
6310
  startDate: moment(startTime + 1).format("D-MM-YYYY"),
@@ -6384,12 +6322,12 @@ var AnalyticsHub = _ref => {
6384
6322
  comments: analyticsData.comments
6385
6323
  }];
6386
6324
  };
6387
- var csvPopup = () => {
6325
+ const csvPopup = () => {
6388
6326
  if (!isExportOpen) {
6389
6327
  return null;
6390
6328
  }
6391
- var source = getExportSource();
6392
- var filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6329
+ const source = getExportSource();
6330
+ const filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6393
6331
  return /*#__PURE__*/jsx(Components.ExportCsvPopup, {
6394
6332
  onClose: () => {
6395
6333
  setIsExportOpen(false);
@@ -6427,7 +6365,7 @@ var AnalyticsHub = _ref => {
6427
6365
  }), /*#__PURE__*/jsx("div", {
6428
6366
  className: "analyticsSection dashboardSection_content",
6429
6367
  children: (() => {
6430
- var chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6368
+ const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6431
6369
  if (comparisonMode) {
6432
6370
  return /*#__PURE__*/jsxs("div", {
6433
6371
  style: {
@@ -6487,8 +6425,8 @@ var AnalyticsHub = _ref => {
6487
6425
  })]
6488
6426
  });
6489
6427
  };
6490
- var mapStateToProps = state => {
6491
- var {
6428
+ const mapStateToProps = state => {
6429
+ const {
6492
6430
  auth
6493
6431
  } = state;
6494
6432
  return {
@@ -6496,11 +6434,11 @@ var mapStateToProps = state => {
6496
6434
  strings: state.strings && state.strings.config || {}
6497
6435
  };
6498
6436
  };
6499
- var toExport = connect(mapStateToProps, {})(AnalyticsHub);
6437
+ const toExport = connect(mapStateToProps, {})(AnalyticsHub);
6500
6438
 
6501
6439
  function ownKeys$2(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; }
6502
6440
  function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6503
- var INITIAL_STATE = {
6441
+ const INITIAL_STATE = {
6504
6442
  jobs: [],
6505
6443
  jobtypes: [],
6506
6444
  jobstatuses: jobStatusOptions,
@@ -6508,15 +6446,15 @@ var INITIAL_STATE = {
6508
6446
  hideSeen: false
6509
6447
  };
6510
6448
  var MaintenanceReducer = (function () {
6511
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
6512
- var action = arguments.length > 1 ? arguments[1] : undefined;
6449
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
6450
+ let action = arguments.length > 1 ? arguments[1] : undefined;
6513
6451
  switch (action.type) {
6514
6452
  case JOBS_LOADING:
6515
6453
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6516
6454
  loading: true
6517
6455
  });
6518
6456
  case JOBS_LOADED:
6519
- var result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6457
+ const result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6520
6458
  return v1 != null && v2 != null && v1.id === v2.id;
6521
6459
  });
6522
6460
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
@@ -6526,11 +6464,11 @@ var MaintenanceReducer = (function () {
6526
6464
  loading: false
6527
6465
  });
6528
6466
  case JOBS_REMOVED:
6529
- var index = _.findIndex(state.jobs, event => {
6467
+ const index = _.findIndex(state.jobs, event => {
6530
6468
  return event != null && event.id === action.payload;
6531
6469
  });
6532
6470
  if (index > -1) {
6533
- var newJobs = [...state.jobs];
6471
+ const newJobs = [...state.jobs];
6534
6472
  newJobs.splice(index, 1);
6535
6473
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6536
6474
  jobs: newJobs
@@ -6538,14 +6476,14 @@ var MaintenanceReducer = (function () {
6538
6476
  }
6539
6477
  return state;
6540
6478
  case JOBS_TYPES_LOADED:
6541
- var jobtypes = _.unionWith(action.payload, state.jobtypes, (v1, v2) => {
6479
+ const jobtypes = _.unionWith(action.payload, state.jobtypes, (v1, v2) => {
6542
6480
  return v1 != null && v2 != null && v1.id === v2.id;
6543
6481
  });
6544
6482
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6545
6483
  jobtypes
6546
6484
  });
6547
6485
  case JOBS_STATUSES_LOADED:
6548
- var jobstatuses = _.orderBy(action.payload, "order", "asc");
6486
+ const jobstatuses = _.orderBy(action.payload, "order", "asc");
6549
6487
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6550
6488
  jobstatuses
6551
6489
  });
@@ -6560,7 +6498,7 @@ var MaintenanceReducer = (function () {
6560
6498
 
6561
6499
  class ActivityText extends Component {
6562
6500
  render() {
6563
- var {
6501
+ const {
6564
6502
  data,
6565
6503
  classes,
6566
6504
  clickableClasses,
@@ -6636,7 +6574,7 @@ var img$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxwAAAGGCAYAAADxZYcEA
6636
6574
 
6637
6575
  class ViewWidget extends Component {
6638
6576
  render() {
6639
- var src = img$3;
6577
+ let src = img$3;
6640
6578
  return /*#__PURE__*/jsx("img", {
6641
6579
  style: styles$3.image,
6642
6580
  src: src,
@@ -6644,7 +6582,7 @@ class ViewWidget extends Component {
6644
6582
  });
6645
6583
  }
6646
6584
  }
6647
- var styles$3 = {
6585
+ const styles$3 = {
6648
6586
  image: {
6649
6587
  width: 80
6650
6588
  }
@@ -6654,7 +6592,7 @@ var img$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmAAAASICAYAAAC0rHMFA
6654
6592
 
6655
6593
  class ViewFull extends Component {
6656
6594
  render() {
6657
- var src = img$2;
6595
+ let src = img$2;
6658
6596
  return /*#__PURE__*/jsx("img", {
6659
6597
  style: styles$2.image,
6660
6598
  src: src,
@@ -6662,7 +6600,7 @@ class ViewFull extends Component {
6662
6600
  });
6663
6601
  }
6664
6602
  }
6665
- var styles$2 = {
6603
+ const styles$2 = {
6666
6604
  image: {
6667
6605
  width: "100%",
6668
6606
  height: "100%",
@@ -6676,12 +6614,12 @@ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
6676
6614
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6677
6615
  class PreviewWidget extends Component {
6678
6616
  render() {
6679
- var {
6617
+ const {
6680
6618
  backgroundColor,
6681
6619
  widgetTitle,
6682
6620
  titleClassName
6683
6621
  } = this.props;
6684
- var src = img$1;
6622
+ let src = img$1;
6685
6623
  return /*#__PURE__*/jsxs("div", {
6686
6624
  style: styles$1.container,
6687
6625
  children: [/*#__PURE__*/jsx("img", {
@@ -6698,7 +6636,7 @@ class PreviewWidget extends Component {
6698
6636
  });
6699
6637
  }
6700
6638
  }
6701
- var styles$1 = {
6639
+ const styles$1 = {
6702
6640
  container: {
6703
6641
  position: "relative"
6704
6642
  },
@@ -6713,12 +6651,12 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6713
6651
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6714
6652
  class PreviewFull extends Component {
6715
6653
  render() {
6716
- var {
6654
+ const {
6717
6655
  backgroundColor,
6718
6656
  widgetTitle,
6719
6657
  titleClassName
6720
6658
  } = this.props;
6721
- var src = img;
6659
+ let src = img;
6722
6660
  return /*#__PURE__*/jsxs("div", {
6723
6661
  style: styles.container,
6724
6662
  children: [/*#__PURE__*/jsx("p", {
@@ -6734,7 +6672,7 @@ class PreviewFull extends Component {
6734
6672
  });
6735
6673
  }
6736
6674
  }
6737
- var styles = {
6675
+ const styles = {
6738
6676
  container: {
6739
6677
  position: "relative"
6740
6678
  },
@@ -6743,11 +6681,11 @@ var styles = {
6743
6681
  }
6744
6682
  };
6745
6683
 
6746
- var SVG_PATH = values.svgPathGridIcon;
6747
- var SVG_VIEWBOX = values.svgPathGridIconViewBox ;
6684
+ const SVG_PATH = values.svgPathGridIcon;
6685
+ const SVG_VIEWBOX = values.svgPathGridIconViewBox ;
6748
6686
  class PreviewGrid extends Component {
6749
6687
  render() {
6750
- var {
6688
+ const {
6751
6689
  colour
6752
6690
  } = this.props;
6753
6691
  if (Array.isArray(SVG_PATH)) {
@@ -6774,20 +6712,20 @@ class PreviewGrid extends Component {
6774
6712
  }
6775
6713
  }
6776
6714
 
6777
- var Reducers = (() => {
6778
- var reducers = {};
6715
+ const Reducers = (() => {
6716
+ const reducers = {};
6779
6717
  reducers[values.reducerKey] = MaintenanceReducer;
6780
6718
  return reducers;
6781
6719
  })();
6782
- var Screens = (() => {
6783
- var screens = {};
6720
+ const Screens = (() => {
6721
+ const screens = {};
6784
6722
  screens[values.screenRequestsHub] = RequestsHub$1;
6785
6723
  screens[values.screenJob] = Job$1;
6786
6724
  screens[values.screenAddJob] = AddJob$1;
6787
6725
  screens[values.screenAddJobType] = AddJobType$1;
6788
6726
  return screens;
6789
6727
  })();
6790
- var Analytics = [toExport];
6728
+ const Analytics = [toExport];
6791
6729
 
6792
6730
  export { ActivityText, Analytics, FeatureConfig as Config, PreviewFull, PreviewGrid, PreviewWidget, Reducers, Screens, ViewFull, ViewWidget };
6793
6731
  //# sourceMappingURL=index.js.map