@plusscommunities/pluss-maintenance-web-forms 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: "maintenanceForms",
18
17
  aliases: ["maintenanceTrackingForms", "maintenanceTypesForms", "maintenancerequestForms"],
19
18
  serviceKey: "maintenanceForms",
@@ -92,7 +91,7 @@ var values = {
92
91
  };
93
92
 
94
93
  // import * as PlussCore from '../../pluss-core/src';
95
- var FeatureConfig = {
94
+ const FeatureConfig = {
96
95
  key: values.featureKey,
97
96
  aliases: values.aliases,
98
97
  singularName: values.textSingularName,
@@ -224,22 +223,22 @@ var FeatureConfig = {
224
223
  notificationPreference: values.notificationPreference
225
224
  };
226
225
 
227
- var JOBS_LOADED = values.actionJobsLoaded;
228
- var JOBS_LOADING = values.actionJobsLoading;
229
- var JOBS_REMOVED = values.actionJobsRemoved;
230
- var JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
231
- var JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
232
- var JOBS_HIDE_SEEN = values.actionJobsHideSeen;
226
+ const JOBS_LOADED = values.actionJobsLoaded;
227
+ const JOBS_LOADING = values.actionJobsLoading;
228
+ const JOBS_REMOVED = values.actionJobsRemoved;
229
+ const JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
230
+ const JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
231
+ const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
233
232
 
234
233
  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; }
235
234
  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; }
236
- var {
235
+ const {
237
236
  Helper: Helper$6,
238
237
  Session: Session$9
239
238
  } = PlussCore;
240
- var maintenanceActions = {
239
+ const maintenanceActions = {
241
240
  getJobType: (site, typeId) => {
242
- var url = Helper$6.getUrl(values.serviceKey, "getjobtype");
241
+ let url = Helper$6.getUrl(values.serviceKey, "getjobtype");
243
242
  return Session$9.authedFunction({
244
243
  method: "POST",
245
244
  url,
@@ -250,7 +249,7 @@ var maintenanceActions = {
250
249
  });
251
250
  },
252
251
  getJobTypes: (site, id) => {
253
- var url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
252
+ let url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
254
253
  return Session$9.authedFunction({
255
254
  method: "POST",
256
255
  url,
@@ -260,7 +259,7 @@ var maintenanceActions = {
260
259
  });
261
260
  },
262
261
  getJob: (site, id) => {
263
- var url = Helper$6.getUrl(values.serviceKey, "getJob");
262
+ let url = Helper$6.getUrl(values.serviceKey, "getJob");
264
263
  return Session$9.authedFunction({
265
264
  method: "POST",
266
265
  url,
@@ -271,7 +270,7 @@ var maintenanceActions = {
271
270
  });
272
271
  },
273
272
  getJobByJobId: (site, jobId) => {
274
- var url = Helper$6.getUrl(values.serviceKey, "getJob");
273
+ let url = Helper$6.getUrl(values.serviceKey, "getJob");
275
274
  return Session$9.authedFunction({
276
275
  method: "POST",
277
276
  url,
@@ -281,9 +280,9 @@ var maintenanceActions = {
281
280
  }
282
281
  });
283
282
  },
284
- getJobs: function getJobs(site) {
285
- var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
286
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
283
+ getJobs: function (site) {
284
+ let status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
285
+ let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
287
286
  return Session$9.authedFunction({
288
287
  method: "POST",
289
288
  url: Helper$6.getUrl(values.serviceKey, "getJobs"),
@@ -295,7 +294,7 @@ var maintenanceActions = {
295
294
  });
296
295
  },
297
296
  getJobs2: (site, status, type, lastKey) => {
298
- var query = {
297
+ const query = {
299
298
  site
300
299
  };
301
300
  if (status) {
@@ -312,11 +311,11 @@ var maintenanceActions = {
312
311
  url: Helper$6.getUrl(values.serviceKey, "get/requests", query)
313
312
  });
314
313
  },
315
- getJobsRecursive: function getJobsRecursive(site, status, type, lastKey) {
316
- var jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
314
+ getJobsRecursive: function (site, status, type, lastKey) {
315
+ let jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
317
316
  return new Promise(resolve => {
318
317
  maintenanceActions.getJobs2(site, status, type, lastKey).then(jobRes => {
319
- var newJobs = [...jobs, ...jobRes.data.Items];
318
+ const newJobs = [...jobs, ...jobRes.data.Items];
320
319
  if (!jobRes.data.LastKey) {
321
320
  return resolve(newJobs);
322
321
  }
@@ -428,7 +427,7 @@ var maintenanceActions = {
428
427
  });
429
428
  },
430
429
  addJobType: (site, name, email, description, level, hasCustomFields, customFields) => {
431
- var data = {
430
+ const data = {
432
431
  site,
433
432
  name,
434
433
  email,
@@ -444,7 +443,7 @@ var maintenanceActions = {
444
443
  });
445
444
  },
446
445
  editJobType: (site, id, name, email, description, level, hasCustomFields, customFields) => {
447
- var data = {
446
+ const data = {
448
447
  site,
449
448
  id,
450
449
  name,
@@ -490,13 +489,13 @@ var maintenanceActions = {
490
489
  }
491
490
  };
492
491
 
493
- var {
492
+ const {
494
493
  Helper: Helper$5,
495
494
  Session: Session$8
496
495
  } = PlussCore;
497
- var reactionActions = {
496
+ const reactionActions = {
498
497
  addComment: (entityId, entityType, entityName, site, comment, image, parentId) => {
499
- var data = {
498
+ const data = {
500
499
  entityId,
501
500
  entityType,
502
501
  entityName,
@@ -523,7 +522,7 @@ var reactionActions = {
523
522
  // });
524
523
  // },
525
524
  getComments: (entityId, entityType, minTime) => {
526
- var query = {
525
+ const query = {
527
526
  entityId,
528
527
  entityType
529
528
  };
@@ -537,12 +536,12 @@ var reactionActions = {
537
536
  }
538
537
  };
539
538
 
540
- var {
539
+ const {
541
540
  Apis: Apis$2
542
541
  } = PlussCore;
543
- var analyticsActions = Apis$2.analyticsActions;
544
- var userActions = Apis$2.userActions;
545
- var stringActions = Apis$2.stringActions;
542
+ const analyticsActions = Apis$2.analyticsActions;
543
+ const userActions = Apis$2.userActions;
544
+ const stringActions = Apis$2.stringActions;
546
545
 
547
546
  var jobStatusOptions = [
548
547
  {
@@ -565,16 +564,16 @@ var jobStatusOptions = [
565
564
  }
566
565
  ];
567
566
 
568
- var {
567
+ const {
569
568
  Helper: Helper$4
570
569
  } = PlussCore;
571
- var jobsUpdate = (site, isdashboard) => {
570
+ const jobsUpdate = (site, isdashboard) => {
572
571
  return dispatch => {
573
572
  if (isdashboard) dispatch({
574
573
  type: JOBS_LOADING
575
574
  });
576
575
  maintenanceActions.getJobsRecursive(site).then(res => {
577
- var currentSite = Helper$4.readStorageWithCookie("site");
576
+ const currentSite = Helper$4.readStorageWithCookie("site");
578
577
  if (!_.isEmpty(res) && res[0].site === currentSite) {
579
578
  dispatch({
580
579
  type: JOBS_LOADED,
@@ -589,19 +588,19 @@ var jobsUpdate = (site, isdashboard) => {
589
588
  });
590
589
  };
591
590
  };
592
- var jobsLoaded = events => {
591
+ const jobsLoaded = events => {
593
592
  return {
594
593
  type: JOBS_LOADED,
595
594
  payload: events
596
595
  };
597
596
  };
598
- var removeJob = id => {
597
+ const removeJob = id => {
599
598
  return {
600
599
  type: JOBS_REMOVED,
601
600
  payload: id
602
601
  };
603
602
  };
604
- var jobTypesUpdate = site => {
603
+ const jobTypesUpdate = site => {
605
604
  return dispatch => {
606
605
  maintenanceActions.getJobTypes(site).then(res => {
607
606
  dispatch({
@@ -611,14 +610,14 @@ var jobTypesUpdate = site => {
611
610
  });
612
611
  };
613
612
  };
614
- var jobTypesLoaded = events => {
613
+ const jobTypesLoaded = events => {
615
614
  return {
616
615
  type: JOBS_TYPES_LOADED,
617
616
  payload: events
618
617
  };
619
618
  };
620
- var jobStatusesUpdate = function jobStatusesUpdate(site) {
621
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
619
+ const jobStatusesUpdate = function (site) {
620
+ let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
622
621
  return dispatch => {
623
622
  stringActions.getString(site, values.stringConfigJobStatus).then(res => {
624
623
  dispatch({
@@ -635,14 +634,14 @@ var jobStatusesUpdate = function jobStatusesUpdate(site) {
635
634
  });
636
635
  };
637
636
  };
638
- var jobStatusesLoaded = statuses => {
637
+ const jobStatusesLoaded = statuses => {
639
638
  return {
640
639
  type: JOBS_STATUSES_LOADED,
641
640
  payload: statuses
642
641
  };
643
642
  };
644
- var jobHideSeenUpdate = function jobHideSeenUpdate(site) {
645
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
643
+ const jobHideSeenUpdate = function (site) {
644
+ let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
646
645
  return dispatch => {
647
646
  stringActions.getString(site, values.stringConfigHideSeen).then(res => {
648
647
  dispatch({
@@ -659,7 +658,7 @@ var jobHideSeenUpdate = function jobHideSeenUpdate(site) {
659
658
  });
660
659
  };
661
660
  };
662
- var jobHideSeenLoaded = hide => {
661
+ const jobHideSeenLoaded = hide => {
663
662
  return {
664
663
  type: JOBS_HIDE_SEEN,
665
664
  payload: hide
@@ -715,31 +714,29 @@ var jobPriorityOptions = [
715
714
  }
716
715
  ];
717
716
 
718
- var STATUS_IMCOMPLETE = "All Incomplete";
719
- var STATUS_NOT_ACTIONED = "Not Actioned";
720
- var STATUS_IN_PROGRESS = "In Progress";
721
- var STATUS_COMPLETED = "Completed";
722
- var getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
723
- var getJobPriority = priority => {
724
- var priorityOption = null;
717
+ const STATUS_IMCOMPLETE = "All Incomplete";
718
+ const STATUS_NOT_ACTIONED = "Not Actioned";
719
+ const STATUS_IN_PROGRESS = "In Progress";
720
+ const STATUS_COMPLETED = "Completed";
721
+ const getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
722
+ const getJobPriority = priority => {
723
+ let priorityOption = null;
725
724
  if (priority) priorityOption = jobPriorityOptions.find(p => p.name === priority);
726
725
  return priorityOption || getDefaultPriority();
727
726
  };
728
727
 
729
728
  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; }
730
729
  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; }
731
- var {
730
+ const {
732
731
  Session: Session$7,
733
732
  Components: Components$7,
734
733
  Analytics: Analytics$2
735
734
  } = PlussCore;
736
735
  class JobList extends Component {
737
736
  constructor(props) {
738
- var _this;
739
737
  super(props);
740
- _this = this;
741
738
  _defineProperty(this, "setRequesters", jobs => {
742
- var requesters = _.orderBy(_.uniqBy(jobs.map(j => ({
739
+ const requesters = _.orderBy(_.uniqBy(jobs.map(j => ({
743
740
  id: j.userID,
744
741
  displayName: j.userName,
745
742
  profilePic: j.userProfilePic
@@ -748,32 +745,32 @@ class JobList extends Component {
748
745
  requesters
749
746
  });
750
747
  });
751
- _defineProperty(this, "getJobs", /*#__PURE__*/_asyncToGenerator(function* () {
752
- var {
748
+ _defineProperty(this, "getJobs", async () => {
749
+ const {
753
750
  auth
754
- } = _this.props;
751
+ } = this.props;
755
752
  try {
756
- var res = yield maintenanceActions.getJobsRecursive(auth.site);
753
+ const res = await maintenanceActions.getJobsRecursive(auth.site);
757
754
  if (!_.isEmpty(res) && res[0].site === auth.site) {
758
- _this.setRequesters(res);
759
- _this.props.jobsLoaded(res);
755
+ this.setRequesters(res);
756
+ this.props.jobsLoaded(res);
760
757
  }
761
758
  } catch (error) {
762
759
  console.error("getJobs", error);
763
760
  }
764
- }));
765
- _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
761
+ });
762
+ _defineProperty(this, "getAssignees", async () => {
766
763
  try {
767
- var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
768
- _this.setState({
764
+ const res = await maintenanceActions.getAssignees(this.props.auth.site);
765
+ this.setState({
769
766
  assignees: res.data.Users
770
767
  });
771
768
  } catch (error) {
772
769
  console.error("getAssignees", error);
773
770
  }
774
- }));
771
+ });
775
772
  _defineProperty(this, "sortByCol", col => {
776
- var {
773
+ const {
777
774
  sortColumn,
778
775
  sortDesc
779
776
  } = this.state;
@@ -788,23 +785,18 @@ class JobList extends Component {
788
785
  });
789
786
  }
790
787
  });
791
- _defineProperty(this, "onRemoveRequest", /*#__PURE__*/function () {
792
- var _ref3 = _asyncToGenerator(function* (request) {
793
- if (window.confirm(values.textAreYouSureYouWantToDelete)) {
794
- _this.props.removeJob(request.id);
795
- try {
796
- yield maintenanceActions.deleteJob(_this.props.auth.site, request.id);
797
- _this.getJobs();
798
- } catch (error) {
799
- console.log("onRemoveRequest", error);
800
- alert("Something went wrong with the request. Please try again.");
801
- }
788
+ _defineProperty(this, "onRemoveRequest", async request => {
789
+ if (window.confirm(values.textAreYouSureYouWantToDelete)) {
790
+ this.props.removeJob(request.id);
791
+ try {
792
+ await maintenanceActions.deleteJob(this.props.auth.site, request.id);
793
+ this.getJobs();
794
+ } catch (error) {
795
+ console.log("onRemoveRequest", error);
796
+ alert("Something went wrong with the request. Please try again.");
802
797
  }
803
- });
804
- return function (_x) {
805
- return _ref3.apply(this, arguments);
806
- };
807
- }());
798
+ }
799
+ });
808
800
  _defineProperty(this, "openFilter", filter => {
809
801
  this.setState({
810
802
  filterOpen: filter
@@ -857,15 +849,15 @@ class JobList extends Component {
857
849
  if (!this.isValidTimeFilter()) {
858
850
  return;
859
851
  }
860
- var startTime = 0;
861
- var endTime = moment().endOf("d").valueOf();
862
- var text = "";
852
+ let startTime = 0;
853
+ let endTime = moment().endOf("d").valueOf();
854
+ let text = "";
863
855
  if (this.state.selectedTimeFilter.dayCount > 0) {
864
856
  startTime = moment().add(-this.state.selectedTimeFilter.dayCount, "d").startOf("d").valueOf();
865
857
  text = this.state.selectedTimeFilter.text;
866
858
  } else {
867
- var startDate = moment(this.state.timeFilterStart).startOf("d");
868
- var endDate = moment(this.state.timeFilterEnd).endOf("d");
859
+ const startDate = moment(this.state.timeFilterStart).startOf("d");
860
+ const endDate = moment(this.state.timeFilterEnd).endOf("d");
869
861
  startTime = startDate.valueOf();
870
862
  endTime = endDate.valueOf();
871
863
  text = "".concat(startDate.format("DD/MM/YYYY"), " to ").concat(endDate.format("DD/MM/YYYY"));
@@ -936,7 +928,7 @@ class JobList extends Component {
936
928
  this.closeFilter();
937
929
  });
938
930
  _defineProperty(this, "onHandleSearchChange", event => {
939
- var thisSearchTime = moment().valueOf();
931
+ const thisSearchTime = moment().valueOf();
940
932
  this.setState({
941
933
  search: event.target.value,
942
934
  lastSearch: thisSearchTime
@@ -951,7 +943,7 @@ class JobList extends Component {
951
943
  }, 500);
952
944
  });
953
945
  _defineProperty(this, "getSource", () => {
954
- var source = this.props.source;
946
+ let source = this.props.source;
955
947
 
956
948
  // filter by time
957
949
  if (this.state.selectedTimeFilterStart && this.state.selectedTimeFilterEnd) {
@@ -969,7 +961,7 @@ class JobList extends Component {
969
961
 
970
962
  // filter by priority
971
963
  if (this.state.selectedPriorityFilter) {
972
- var defaultPriority = getDefaultPriority().name;
964
+ const defaultPriority = getDefaultPriority().name;
973
965
  source = _.filter(source, r => {
974
966
  return r.priority === this.state.selectedPriorityFilter || this.state.selectedPriorityFilter === defaultPriority && _.isNil(r.priority);
975
967
  });
@@ -977,12 +969,12 @@ class JobList extends Component {
977
969
 
978
970
  // filter by status
979
971
  if (this.state.selectedStatusFilter) {
980
- var {
972
+ const {
981
973
  statusTypes
982
974
  } = this.props;
983
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
975
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
984
976
  source = _.filter(source, r => {
985
- var status = statusTypes.find(s => s.text === r.status) || defaultStatus;
977
+ const status = statusTypes.find(s => s.text === r.status) || defaultStatus;
986
978
  if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
987
979
  return status.category !== STATUS_COMPLETED;
988
980
  }
@@ -1038,18 +1030,18 @@ class JobList extends Component {
1038
1030
  }
1039
1031
  });
1040
1032
  _defineProperty(this, "getCustomFields", (job, customColumns) => {
1041
- var {
1033
+ const {
1042
1034
  customFields,
1043
1035
  type
1044
1036
  } = job;
1045
- var customValues = {};
1037
+ const customValues = {};
1046
1038
  if (customFields && Array.isArray(customFields)) {
1047
1039
  customFields.forEach(field => {
1048
1040
  // Exclude un-exportable fields
1049
1041
  if (["image", "document", "staticTitle", "staticText"].includes(field.type)) return;
1050
- var fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1042
+ const fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1051
1043
  // Build custom columns
1052
- var exists = customColumns.find(c => c.key === fieldKey);
1044
+ const exists = customColumns.find(c => c.key === fieldKey);
1053
1045
  if (!exists) {
1054
1046
  customColumns.push({
1055
1047
  label: field.label,
@@ -1063,20 +1055,20 @@ class JobList extends Component {
1063
1055
  return customValues;
1064
1056
  });
1065
1057
  _defineProperty(this, "getExportSource", () => {
1066
- var customColumns = [];
1067
- var defaultPriority = getDefaultPriority().name;
1068
- var source = this.getSource().map(r => {
1069
- var history = r.history || [];
1070
- var progressEntry = _.find(history, e => {
1058
+ const customColumns = [];
1059
+ const defaultPriority = getDefaultPriority().name;
1060
+ const source = this.getSource().map(r => {
1061
+ const history = r.history || [];
1062
+ const progressEntry = _.find(history, e => {
1071
1063
  return e.status !== "Unassigned";
1072
1064
  });
1073
- var completedEntry = _.find(history, e => {
1065
+ const completedEntry = _.find(history, e => {
1074
1066
  return e.status === "Completed";
1075
1067
  });
1076
- var progressTime = null;
1077
- var completedTime = null;
1078
- var progressDuration = null;
1079
- var completedDuration = null;
1068
+ let progressTime = null;
1069
+ let completedTime = null;
1070
+ let progressDuration = null;
1071
+ let completedDuration = null;
1080
1072
  if (progressEntry) {
1081
1073
  progressTime = moment.utc(progressEntry.timestamp).format();
1082
1074
  progressDuration = moment.utc(progressEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
@@ -1085,7 +1077,7 @@ class JobList extends Component {
1085
1077
  completedTime = moment.utc(completedEntry.timestamp).format();
1086
1078
  completedDuration = moment.utc(completedEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
1087
1079
  }
1088
- var notes = "";
1080
+ let notes = "";
1089
1081
  (r.Notes || []).forEach((note, index) => {
1090
1082
  if (index > 0) {
1091
1083
  notes += "\n\n";
@@ -1098,8 +1090,8 @@ class JobList extends Component {
1098
1090
  }
1099
1091
  notes += note.Note;
1100
1092
  });
1101
- var customFieldValues = this.getCustomFields(r, customColumns);
1102
- var priority = r.priority || defaultPriority;
1093
+ const customFieldValues = this.getCustomFields(r, customColumns);
1094
+ const priority = r.priority || defaultPriority;
1103
1095
  return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, r), customFieldValues), {}, {
1104
1096
  notes,
1105
1097
  progressTime,
@@ -1111,8 +1103,8 @@ class JobList extends Component {
1111
1103
  });
1112
1104
 
1113
1105
  // Compose revised columns list with custom fields
1114
- var index = this.exportColumns.findIndex(c => c.key === "notes");
1115
- var columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1106
+ const index = this.exportColumns.findIndex(c => c.key === "notes");
1107
+ const columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1116
1108
  return {
1117
1109
  columns,
1118
1110
  source
@@ -1242,7 +1234,7 @@ class JobList extends Component {
1242
1234
  });
1243
1235
  }
1244
1236
  if (this.state.filterOpen === "status") {
1245
- var {
1237
+ const {
1246
1238
  statusTypes
1247
1239
  } = this.props;
1248
1240
  return /*#__PURE__*/jsx(Components$7.Popup, {
@@ -1288,7 +1280,7 @@ class JobList extends Component {
1288
1280
  });
1289
1281
  }
1290
1282
  if (this.state.filterOpen === "user") {
1291
- var userContent = null;
1283
+ let userContent = null;
1292
1284
  if (this.state.selectedAssignee) {
1293
1285
  userContent = /*#__PURE__*/jsx("div", {
1294
1286
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
@@ -1343,9 +1335,9 @@ class JobList extends Component {
1343
1335
  });
1344
1336
  }
1345
1337
  if (this.state.filterOpen === "requester") {
1346
- var _userContent = null;
1338
+ let userContent = null;
1347
1339
  if (this.state.selectedRequester) {
1348
- _userContent = /*#__PURE__*/jsx("div", {
1340
+ userContent = /*#__PURE__*/jsx("div", {
1349
1341
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1350
1342
  user: this.state.selectedRequester,
1351
1343
  rightContent: /*#__PURE__*/jsx(Icon, {
@@ -1359,7 +1351,7 @@ class JobList extends Component {
1359
1351
  }, this.state.selectedRequester.id)
1360
1352
  });
1361
1353
  } else {
1362
- _userContent = /*#__PURE__*/jsxs("div", {
1354
+ userContent = /*#__PURE__*/jsxs("div", {
1363
1355
  children: [/*#__PURE__*/jsx(Components$7.GenericInput, {
1364
1356
  id: "requesterSearch",
1365
1357
  type: "text"
@@ -1394,22 +1386,22 @@ class JobList extends Component {
1394
1386
  text: "Select",
1395
1387
  isActive: true
1396
1388
  }],
1397
- children: _userContent
1389
+ children: userContent
1398
1390
  });
1399
1391
  }
1400
1392
  return null;
1401
1393
  }
1402
1394
  renderRequests() {
1403
- var {
1395
+ const {
1404
1396
  statusTypes
1405
1397
  } = this.props;
1406
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1398
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1407
1399
  return this.getSource().map((ev, index) => {
1408
1400
  if (!ev) {
1409
1401
  return null;
1410
1402
  }
1411
- var status = ev.status && statusTypes.find(s => s.text === ev.status) || defaultStatus;
1412
- var priority = getJobPriority(ev.priority);
1403
+ const status = ev.status && statusTypes.find(s => s.text === ev.status) || defaultStatus;
1404
+ const priority = getJobPriority(ev.priority);
1413
1405
  return /*#__PURE__*/jsxs("tr", {
1414
1406
  children: [/*#__PURE__*/jsx("td", {
1415
1407
  children: ev.jobId
@@ -1502,7 +1494,7 @@ class JobList extends Component {
1502
1494
  });
1503
1495
  }
1504
1496
  renderSort(col) {
1505
- var {
1497
+ const {
1506
1498
  sortColumn,
1507
1499
  sortDesc
1508
1500
  } = this.state;
@@ -1519,7 +1511,7 @@ class JobList extends Component {
1519
1511
  return " table--columnActive";
1520
1512
  }
1521
1513
  renderEmpty() {
1522
- var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1514
+ const title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1523
1515
  return /*#__PURE__*/jsxs("div", {
1524
1516
  style: {
1525
1517
  display: "flex",
@@ -1658,42 +1650,42 @@ class JobList extends Component {
1658
1650
  });
1659
1651
  }
1660
1652
  renderFilters() {
1661
- var typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1653
+ let typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1662
1654
  className: "marginRight-10",
1663
1655
  onClick: () => {
1664
1656
  this.openFilter("type");
1665
1657
  },
1666
1658
  text: values.textJobType
1667
1659
  });
1668
- var statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1660
+ let statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1669
1661
  className: "marginRight-10",
1670
1662
  onClick: () => {
1671
1663
  this.openFilter("status");
1672
1664
  },
1673
1665
  text: "Status"
1674
1666
  });
1675
- var priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1667
+ let priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1676
1668
  className: "marginRight-10",
1677
1669
  onClick: () => {
1678
1670
  this.openFilter("priority");
1679
1671
  },
1680
1672
  text: "Priority"
1681
1673
  });
1682
- var timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1674
+ let timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1683
1675
  className: "marginRight-10",
1684
1676
  onClick: () => {
1685
1677
  this.openFilter("time");
1686
1678
  },
1687
1679
  text: "Time"
1688
1680
  });
1689
- var userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1681
+ let userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1690
1682
  className: "marginRight-10",
1691
1683
  onClick: () => {
1692
1684
  this.openFilter("user");
1693
1685
  },
1694
1686
  text: "Assigned To"
1695
1687
  });
1696
- var requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1688
+ let requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1697
1689
  className: "marginRight-10",
1698
1690
  onClick: () => {
1699
1691
  this.openFilter("requester");
@@ -1819,7 +1811,7 @@ class JobList extends Component {
1819
1811
  if (!this.state.exportCsvOpen) {
1820
1812
  return null;
1821
1813
  }
1822
- var {
1814
+ const {
1823
1815
  columns,
1824
1816
  source
1825
1817
  } = this.getExportSource();
@@ -1839,8 +1831,8 @@ class JobList extends Component {
1839
1831
  });
1840
1832
  }
1841
1833
  }
1842
- var mapStateToProps$7 = state => {
1843
- var {
1834
+ const mapStateToProps$7 = state => {
1835
+ const {
1844
1836
  auth
1845
1837
  } = state;
1846
1838
  return {
@@ -1856,27 +1848,25 @@ var JobList$1 = connect(mapStateToProps$7, {
1856
1848
  jobStatusesUpdate
1857
1849
  })(withRouter(JobList));
1858
1850
 
1859
- var {
1851
+ const {
1860
1852
  Session: Session$6,
1861
1853
  Components: Components$6
1862
1854
  } = PlussCore;
1863
1855
  class JobTypes extends Component {
1864
1856
  constructor(props) {
1865
- var _this;
1866
1857
  super(props);
1867
- _this = this;
1868
- _defineProperty(this, "getJobTypes", /*#__PURE__*/_asyncToGenerator(function* () {
1858
+ _defineProperty(this, "getJobTypes", async () => {
1869
1859
  try {
1870
- var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
1871
- if (res.data != null) _this.props.jobTypesLoaded(res.data);
1860
+ const res = await maintenanceActions.getJobTypes(this.props.auth.site);
1861
+ if (res.data != null) this.props.jobTypesLoaded(res.data);
1872
1862
  } catch (error) {
1873
1863
  console.error("getJobTypes", error);
1874
1864
  } finally {
1875
- _this.setState({
1865
+ this.setState({
1876
1866
  loading: false
1877
1867
  });
1878
1868
  }
1879
- }));
1869
+ });
1880
1870
  _defineProperty(this, "sortByCol", col => {
1881
1871
  if (this.state.sortColumn === col) {
1882
1872
  this.setState({
@@ -1889,28 +1879,23 @@ class JobTypes extends Component {
1889
1879
  });
1890
1880
  }
1891
1881
  });
1892
- _defineProperty(this, "onRemoveJobType", /*#__PURE__*/function () {
1893
- var _ref2 = _asyncToGenerator(function* (ev) {
1894
- if (!window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) return;
1895
- try {
1896
- yield maintenanceActions.deleteJobType(_this.props.auth.site, ev.id);
1897
- var index = _.findIndex(_this.state.jobList, job => {
1898
- return job != null && job.id === ev.id;
1899
- });
1900
- if (index > -1) {
1901
- var newJobTypes = [..._this.state.jobList];
1902
- newJobTypes[index].Deleted = true;
1903
- _this.props.jobTypesLoaded(newJobTypes);
1904
- }
1905
- } catch (error) {
1906
- console.error("onRemoveJobType", error);
1907
- alert("Something went wrong with the request. Please try again.");
1882
+ _defineProperty(this, "onRemoveJobType", async ev => {
1883
+ if (!window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) return;
1884
+ try {
1885
+ await maintenanceActions.deleteJobType(this.props.auth.site, ev.id);
1886
+ const index = _.findIndex(this.state.jobList, job => {
1887
+ return job != null && job.id === ev.id;
1888
+ });
1889
+ if (index > -1) {
1890
+ const newJobTypes = [...this.state.jobList];
1891
+ newJobTypes[index].Deleted = true;
1892
+ this.props.jobTypesLoaded(newJobTypes);
1908
1893
  }
1909
- });
1910
- return function (_x) {
1911
- return _ref2.apply(this, arguments);
1912
- };
1913
- }());
1894
+ } catch (error) {
1895
+ console.error("onRemoveJobType", error);
1896
+ alert("Something went wrong with the request. Please try again.");
1897
+ }
1898
+ });
1914
1899
  this.state = {
1915
1900
  jobList: [],
1916
1901
  sortColumn: "name",
@@ -1934,7 +1919,7 @@ class JobTypes extends Component {
1934
1919
  });
1935
1920
  }
1936
1921
  renderList() {
1937
- var source = _.sortBy(this.state.jobList, this.state.sortColumn);
1922
+ let source = _.sortBy(this.state.jobList, this.state.sortColumn);
1938
1923
  if (this.state.sortDesc) source.reverse();
1939
1924
  source = _.filter(source, ev => {
1940
1925
  if (!ev) return false;
@@ -2069,7 +2054,7 @@ class JobTypes extends Component {
2069
2054
  return this.renderView();
2070
2055
  }
2071
2056
  renderJobTypes() {
2072
- var {
2057
+ const {
2073
2058
  jobList,
2074
2059
  loading
2075
2060
  } = this.state;
@@ -2121,8 +2106,8 @@ class JobTypes extends Component {
2121
2106
  });
2122
2107
  }
2123
2108
  }
2124
- var mapStateToProps$6 = state => {
2125
- var {
2109
+ const mapStateToProps$6 = state => {
2110
+ const {
2126
2111
  auth
2127
2112
  } = state;
2128
2113
  return {
@@ -2137,7 +2122,7 @@ var JobTypes$1 = connect(mapStateToProps$6, {
2137
2122
 
2138
2123
  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; }
2139
2124
  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; }
2140
- var {
2125
+ const {
2141
2126
  Session: Session$5,
2142
2127
  Components: Components$5,
2143
2128
  Colours: Colours$3
@@ -2154,9 +2139,9 @@ class Configuration extends Component {
2154
2139
  return true;
2155
2140
  });
2156
2141
  _defineProperty(this, "onMoveStatus", function (index) {
2157
- var up = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2142
+ let up = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2158
2143
  if (_this.state.fetchingStatusTypes) return;
2159
- var statusTypes = _.cloneDeep(_this.state.statusTypes);
2144
+ const statusTypes = _.cloneDeep(_this.state.statusTypes);
2160
2145
  if (up && index > 0) {
2161
2146
  // Moving up
2162
2147
  [statusTypes[index - 1], statusTypes[index]] = [statusTypes[index], statusTypes[index - 1]];
@@ -2172,7 +2157,7 @@ class Configuration extends Component {
2172
2157
  });
2173
2158
  _defineProperty(this, "onEditStatus", index => {
2174
2159
  if (this.state.fetchingStatusTypes) return;
2175
- var status = this.state.statusTypes[index];
2160
+ const status = this.state.statusTypes[index];
2176
2161
  this.setState({
2177
2162
  showWarnings: false,
2178
2163
  showStatusPopup: true,
@@ -2184,14 +2169,14 @@ class Configuration extends Component {
2184
2169
  });
2185
2170
  _defineProperty(this, "onDeleteStatus", index => {
2186
2171
  if (this.state.fetchingStatusTypes) return;
2187
- var statusTypes = _.cloneDeep(this.state.statusTypes);
2172
+ const statusTypes = _.cloneDeep(this.state.statusTypes);
2188
2173
  statusTypes.splice(index, 1);
2189
2174
  this.setState({
2190
2175
  statusTypes
2191
2176
  });
2192
2177
  });
2193
2178
  _defineProperty(this, "onAddStatus", () => {
2194
- var defaultStatus = this.props.statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2179
+ const defaultStatus = this.props.statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2195
2180
  this.setState({
2196
2181
  showWarnings: false,
2197
2182
  showStatusPopup: true,
@@ -2202,13 +2187,13 @@ class Configuration extends Component {
2202
2187
  });
2203
2188
  });
2204
2189
  _defineProperty(this, "onSaveStatus", () => {
2205
- var {
2190
+ const {
2206
2191
  selectedStatusIndex,
2207
2192
  statusLabel,
2208
2193
  statusCategory,
2209
2194
  statusColour
2210
2195
  } = this.state;
2211
- var statusTypes = _.cloneDeep(this.state.statusTypes);
2196
+ const statusTypes = _.cloneDeep(this.state.statusTypes);
2212
2197
  if (selectedStatusIndex < 0) {
2213
2198
  statusTypes.push({
2214
2199
  text: statusLabel,
@@ -2217,7 +2202,7 @@ class Configuration extends Component {
2217
2202
  category: statusCategory
2218
2203
  });
2219
2204
  } else {
2220
- var status = statusTypes[selectedStatusIndex];
2205
+ const status = statusTypes[selectedStatusIndex];
2221
2206
  status.text = statusLabel;
2222
2207
  status.color = statusColour;
2223
2208
  status.category = statusCategory;
@@ -2249,30 +2234,30 @@ class Configuration extends Component {
2249
2234
  this.setState({
2250
2235
  success: false,
2251
2236
  submitting: true
2252
- }, /*#__PURE__*/_asyncToGenerator(function* () {
2237
+ }, async () => {
2253
2238
  try {
2254
- var {
2239
+ const {
2255
2240
  statusTypes,
2256
2241
  hideSeen
2257
- } = _this.state;
2258
- yield stringActions.setString(_this.props.auth.site, values.stringConfigJobStatus, statusTypes);
2259
- yield stringActions.setString(_this.props.auth.site, values.stringConfigHideSeen, hideSeen);
2260
- _this.props.jobStatusesLoaded(statusTypes);
2261
- _this.props.jobHideSeenLoaded(hideSeen);
2262
- _this.setState({
2242
+ } = this.state;
2243
+ await stringActions.setString(this.props.auth.site, values.stringConfigJobStatus, statusTypes);
2244
+ await stringActions.setString(this.props.auth.site, values.stringConfigHideSeen, hideSeen);
2245
+ this.props.jobStatusesLoaded(statusTypes);
2246
+ this.props.jobHideSeenLoaded(hideSeen);
2247
+ this.setState({
2263
2248
  success: true
2264
2249
  });
2265
2250
  } catch (error) {
2266
2251
  console.log("onSaveConfig - error", error);
2267
- _this.setState({
2252
+ this.setState({
2268
2253
  success: false
2269
2254
  });
2270
2255
  } finally {
2271
- _this.setState({
2256
+ this.setState({
2272
2257
  submitting: false
2273
2258
  });
2274
2259
  }
2275
- }));
2260
+ });
2276
2261
  });
2277
2262
  this.state = {
2278
2263
  success: false,
@@ -2306,15 +2291,15 @@ class Configuration extends Component {
2306
2291
  }
2307
2292
  }
2308
2293
  validateForm() {
2309
- var {
2294
+ const {
2310
2295
  submitting,
2311
2296
  statusTypes
2312
2297
  } = this.state;
2313
2298
  if (submitting) return false;
2314
2299
 
2315
2300
  // Validate statuses
2316
- var statusesValid = statusTypes.map(status => {
2317
- var {
2301
+ const statusesValid = statusTypes.map(status => {
2302
+ const {
2318
2303
  text,
2319
2304
  category,
2320
2305
  color
@@ -2325,7 +2310,7 @@ class Configuration extends Component {
2325
2310
  return true;
2326
2311
  }
2327
2312
  renderStatuses() {
2328
- var {
2313
+ const {
2329
2314
  statusTypes
2330
2315
  } = this.state;
2331
2316
  return /*#__PURE__*/jsxs("div", {
@@ -2437,7 +2422,7 @@ class Configuration extends Component {
2437
2422
  });
2438
2423
  }
2439
2424
  renderNewStatusPopup() {
2440
- var {
2425
+ const {
2441
2426
  submitting,
2442
2427
  showStatusPopup,
2443
2428
  showWarnings,
@@ -2447,7 +2432,7 @@ class Configuration extends Component {
2447
2432
  statusColour
2448
2433
  } = this.state;
2449
2434
  if (!showStatusPopup) return null;
2450
- var canSave = !submitting && this.isStatusValid(statusLabel, statusCategory, statusColour);
2435
+ const canSave = !submitting && this.isStatusValid(statusLabel, statusCategory, statusColour);
2451
2436
  return /*#__PURE__*/jsxs(Components$5.Popup, {
2452
2437
  maxWidth: 800,
2453
2438
  minWidth: 450,
@@ -2556,7 +2541,7 @@ class Configuration extends Component {
2556
2541
  });
2557
2542
  }
2558
2543
  }
2559
- var styles$6 = {
2544
+ const styles$6 = {
2560
2545
  statusCategoryHeading: {
2561
2546
  marginLeft: 130,
2562
2547
  width: 160,
@@ -2590,8 +2575,8 @@ var styles$6 = {
2590
2575
  marginLeft: 15
2591
2576
  }
2592
2577
  };
2593
- var mapStateToProps$5 = state => {
2594
- var {
2578
+ const mapStateToProps$5 = state => {
2579
+ const {
2595
2580
  auth
2596
2581
  } = state;
2597
2582
  return {
@@ -2607,27 +2592,25 @@ var Configuration$1 = connect(mapStateToProps$5, {
2607
2592
  jobHideSeenLoaded
2608
2593
  })(withRouter(Configuration));
2609
2594
 
2610
- var {
2595
+ const {
2611
2596
  Components: Components$4,
2612
2597
  Session: Session$4,
2613
2598
  Urls
2614
2599
  } = PlussCore;
2615
2600
  class RequestsHub extends Component {
2616
2601
  constructor(props) {
2617
- var _this;
2618
2602
  super(props);
2619
- _this = this;
2620
2603
  _defineProperty(this, "setData", () => {
2621
- var allList = [];
2604
+ const allList = [];
2622
2605
  this.state.allList.forEach(ev => {
2623
2606
  if (ev != null && !ev.Deleted) allList.push(ev);
2624
2607
  });
2625
- var upcoming = _.filter(allList, ev => {
2608
+ const upcoming = _.filter(allList, ev => {
2626
2609
  if (!ev) return false;
2627
2610
  if (ev.status && ev.status === "Completed") return false;
2628
2611
  return true;
2629
2612
  });
2630
- var completed = _.filter(allList, ev => {
2613
+ const completed = _.filter(allList, ev => {
2631
2614
  if (!ev) return false;
2632
2615
  if (ev.status && ev.status === "Completed") return true;
2633
2616
  return false;
@@ -2641,30 +2624,30 @@ class RequestsHub extends Component {
2641
2624
  });
2642
2625
  });
2643
2626
  _defineProperty(this, "getData", () => {
2644
- var {
2627
+ const {
2645
2628
  auth
2646
2629
  } = this.props;
2647
2630
  this.setState({
2648
2631
  loadingAll: true
2649
- }, /*#__PURE__*/_asyncToGenerator(function* () {
2632
+ }, async () => {
2650
2633
  try {
2651
- var res = yield maintenanceActions.getJobsRecursive(auth.site);
2652
- _this.setState({
2634
+ const res = await maintenanceActions.getJobsRecursive(auth.site);
2635
+ this.setState({
2653
2636
  loadingAll: false
2654
2637
  });
2655
2638
  if (!_.isEmpty(res) && res[0].site === auth.site) {
2656
- _this.props.jobsLoaded(res);
2639
+ this.props.jobsLoaded(res);
2657
2640
  }
2658
2641
  } catch (error) {
2659
2642
  console.error("getData", error);
2660
- _this.setState({
2643
+ this.setState({
2661
2644
  loadingAll: false
2662
2645
  });
2663
2646
  }
2664
- }));
2647
+ });
2665
2648
  });
2666
2649
  _defineProperty(this, "onAddNew", () => {
2667
- var {
2650
+ const {
2668
2651
  auth
2669
2652
  } = this.props;
2670
2653
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) {
@@ -2672,7 +2655,7 @@ class RequestsHub extends Component {
2672
2655
  }
2673
2656
  });
2674
2657
  _defineProperty(this, "onAddRequestType", () => {
2675
- var {
2658
+ const {
2676
2659
  auth
2677
2660
  } = this.props;
2678
2661
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTypes, auth)) {
@@ -2680,7 +2663,7 @@ class RequestsHub extends Component {
2680
2663
  }
2681
2664
  });
2682
2665
  _defineProperty(this, "canAddNew", isClass => {
2683
- var {
2666
+ const {
2684
2667
  auth
2685
2668
  } = this.props;
2686
2669
  if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? "" : true;
@@ -2724,7 +2707,7 @@ class RequestsHub extends Component {
2724
2707
  }, this.setData);
2725
2708
  }
2726
2709
  renderLeftBar() {
2727
- var sectionItems = [];
2710
+ const sectionItems = [];
2728
2711
  if (this.canAddNew()) {
2729
2712
  sectionItems.push({
2730
2713
  type: "newButton",
@@ -2772,7 +2755,7 @@ class RequestsHub extends Component {
2772
2755
  }
2773
2756
  });
2774
2757
  }
2775
- var helpGuide = {
2758
+ const helpGuide = {
2776
2759
  text: "Help with ".concat(values.textTitleRequests),
2777
2760
  url: values.helpGuideURL
2778
2761
  } ;
@@ -2809,7 +2792,7 @@ class RequestsHub extends Component {
2809
2792
  });
2810
2793
  }
2811
2794
  }
2812
- var styles$5 = {
2795
+ const styles$5 = {
2813
2796
  sideBarTitleSection: {
2814
2797
  lineHeight: "40px",
2815
2798
  marginTop: 30,
@@ -2832,8 +2815,8 @@ var styles$5 = {
2832
2815
  color: FeatureConfig.env.colourBrandingOff
2833
2816
  }
2834
2817
  };
2835
- var mapStateToProps$4 = state => {
2836
- var {
2818
+ const mapStateToProps$4 = state => {
2819
+ const {
2837
2820
  auth
2838
2821
  } = state;
2839
2822
  return {
@@ -2848,48 +2831,46 @@ var RequestsHub$1 = connect(mapStateToProps$4, {
2848
2831
 
2849
2832
  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; }
2850
2833
  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; }
2851
- var {
2834
+ const {
2852
2835
  Apis: Apis$1,
2853
2836
  Helper: Helper$3,
2854
2837
  Session: Session$3,
2855
2838
  Colours: Colours$2,
2856
2839
  Components: Components$3
2857
2840
  } = PlussCore;
2858
- var IMAGE_SIZE_NOTE = 72;
2841
+ const IMAGE_SIZE_NOTE = 72;
2859
2842
  class Job extends Component {
2860
2843
  constructor(props) {
2861
- var _this;
2862
2844
  super(props);
2863
- _this = this;
2864
- _defineProperty(this, "getJob", /*#__PURE__*/_asyncToGenerator(function* () {
2845
+ _defineProperty(this, "getJob", async () => {
2865
2846
  try {
2866
- var res = yield maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
2867
- _this.setState({
2847
+ const res = await maintenanceActions.getJob(this.props.auth.site, this.state.jobId);
2848
+ this.setState({
2868
2849
  updating: false
2869
2850
  });
2870
2851
  res.data.location = res.data.site;
2871
- _this.setJob(res.data);
2852
+ this.setJob(res.data);
2872
2853
  } catch (error) {
2873
2854
  console.error("getJob", error);
2874
2855
  }
2875
- }));
2876
- _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
2856
+ });
2857
+ _defineProperty(this, "getAssignees", async () => {
2877
2858
  try {
2878
- var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
2879
- _this.setState({
2859
+ const res = await maintenanceActions.getAssignees(this.props.auth.site);
2860
+ this.setState({
2880
2861
  assignees: res.data.Users
2881
2862
  });
2882
2863
  } catch (error) {
2883
2864
  console.error("getAssignees", error);
2884
2865
  }
2885
- }));
2886
- _defineProperty(this, "getExternalSync", /*#__PURE__*/_asyncToGenerator(function* () {
2866
+ });
2867
+ _defineProperty(this, "getExternalSync", async () => {
2887
2868
  try {
2888
- _this.setState({
2869
+ this.setState({
2889
2870
  loadingExternalSync: true
2890
2871
  });
2891
- var res = yield maintenanceActions.getExternalSync(_this.state.jobId);
2892
- _this.setState({
2872
+ const res = await maintenanceActions.getExternalSync(this.state.jobId);
2873
+ this.setState({
2893
2874
  externalSync: res.data,
2894
2875
  loadingExternalSync: false
2895
2876
  });
@@ -2898,44 +2879,44 @@ class Job extends Component {
2898
2879
  if (error && error.response && error.response.status !== 404) {
2899
2880
  console.error("getExternalSync", error);
2900
2881
  }
2901
- _this.setState({
2882
+ this.setState({
2902
2883
  loadingExternalSync: false
2903
2884
  });
2904
2885
  }
2905
- }));
2906
- _defineProperty(this, "onRetrySync", /*#__PURE__*/_asyncToGenerator(function* () {
2907
- var {
2886
+ });
2887
+ _defineProperty(this, "onRetrySync", async () => {
2888
+ const {
2908
2889
  job
2909
- } = _this.state;
2910
- if (!job || _this.state.retryingSync) return;
2911
- _this.setState({
2890
+ } = this.state;
2891
+ if (!job || this.state.retryingSync) return;
2892
+ this.setState({
2912
2893
  retryingSync: true,
2913
2894
  retrySyncError: null
2914
2895
  });
2915
2896
  try {
2916
- yield maintenanceActions.retrySync(job.id);
2897
+ await maintenanceActions.retrySync(job.id);
2917
2898
  // Refresh job data to get updated history
2918
- yield _this.getJob();
2919
- _this.setState({
2899
+ await this.getJob();
2900
+ this.setState({
2920
2901
  retryingSync: false,
2921
2902
  retrySyncInitiated: true
2922
2903
  });
2923
2904
  } catch (error) {
2924
2905
  console.error("onRetrySync", error);
2925
- var errorMessage = error && error.response && error.response.data && error.response.data.error || "Failed to retry sync. Please try again.";
2926
- _this.setState({
2906
+ const errorMessage = error && error.response && error.response.data && error.response.data.error || "Failed to retry sync. Please try again.";
2907
+ this.setState({
2927
2908
  retryingSync: false,
2928
2909
  retrySyncError: errorMessage
2929
2910
  });
2930
2911
  }
2931
- }));
2912
+ });
2932
2913
  _defineProperty(this, "getStatusType", status => {
2933
- var {
2914
+ const {
2934
2915
  statusTypes
2935
2916
  } = this.props;
2936
- var statusType = statusTypes.find(s => s.text === status);
2917
+ let statusType = statusTypes.find(s => s.text === status);
2937
2918
  if (!statusType) {
2938
- var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2919
+ const defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2939
2920
  statusType = _objectSpread$5(_objectSpread$5({}, defaultStatus), {}, {
2940
2921
  text: status
2941
2922
  });
@@ -2957,7 +2938,7 @@ class Job extends Component {
2957
2938
  isEmpty: true
2958
2939
  }];
2959
2940
  }
2960
- var needToMarkSeen = false;
2941
+ let needToMarkSeen = false;
2961
2942
  if (!job.seen) {
2962
2943
  job.seen = true;
2963
2944
  needToMarkSeen = true;
@@ -2971,7 +2952,7 @@ class Job extends Component {
2971
2952
  });
2972
2953
  _defineProperty(this, "editJob", () => {});
2973
2954
  _defineProperty(this, "isReadyToSaveNote", () => {
2974
- var {
2955
+ const {
2975
2956
  noteAttachments,
2976
2957
  noteInput,
2977
2958
  noteImages
@@ -2986,7 +2967,7 @@ class Job extends Component {
2986
2967
  });
2987
2968
  });
2988
2969
  _defineProperty(this, "onCloseAddNote", () => {
2989
- var newState = {
2970
+ const newState = {
2990
2971
  addNoteOpen: false,
2991
2972
  editingNote: null
2992
2973
  };
@@ -3009,10 +2990,10 @@ class Job extends Component {
3009
2990
  }
3010
2991
  });
3011
2992
  _defineProperty(this, "onHandlePDFFileChange", event => {
3012
- var file = event.target.files[0];
2993
+ const file = event.target.files[0];
3013
2994
  if (!file || this.state.uploadingNoteAttachment) return;
3014
- var noteAttachments = [...this.state.noteAttachments];
3015
- var newAttachment = {
2995
+ const noteAttachments = [...this.state.noteAttachments];
2996
+ const newAttachment = {
3016
2997
  Uploading: true,
3017
2998
  Title: file.name
3018
2999
  };
@@ -3036,9 +3017,9 @@ class Job extends Component {
3036
3017
  event.target.value = "";
3037
3018
  });
3038
3019
  _defineProperty(this, "onRemoveAttachment", a => {
3039
- var index = this.state.noteAttachments.indexOf(a);
3020
+ const index = this.state.noteAttachments.indexOf(a);
3040
3021
  if (index > -1) {
3041
- var newAttachments = [...this.state.noteAttachments];
3022
+ const newAttachments = [...this.state.noteAttachments];
3042
3023
  newAttachments.splice(index, 1);
3043
3024
  this.setState({
3044
3025
  noteAttachments: newAttachments
@@ -3060,54 +3041,49 @@ class Job extends Component {
3060
3041
  selectedAssignee: user
3061
3042
  });
3062
3043
  });
3063
- _defineProperty(this, "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator(function* () {
3064
- _this.setState({
3044
+ _defineProperty(this, "onConfirmAssignee", async () => {
3045
+ this.setState({
3065
3046
  confirmingAssignee: true
3066
3047
  });
3067
3048
  try {
3068
- if (_this.state.selectedAssignee) {
3069
- yield _this.onAssignUser(_this.state.selectedAssignee.id);
3049
+ if (this.state.selectedAssignee) {
3050
+ await this.onAssignUser(this.state.selectedAssignee.id);
3070
3051
  }
3071
- _this.onCloseSelectAssignee();
3052
+ this.onCloseSelectAssignee();
3072
3053
  } catch (error) {
3073
3054
  console.error("onConfirmAssignee", error);
3074
3055
  }
3075
- _this.setState({
3056
+ this.setState({
3076
3057
  confirmingAssignee: false
3077
3058
  });
3078
- }));
3059
+ });
3079
3060
  // Method to handle user assignment
3080
- _defineProperty(this, "onAssignUser", /*#__PURE__*/function () {
3081
- var _ref6 = _asyncToGenerator(function* (userId) {
3082
- try {
3083
- var res = yield maintenanceActions.assignJob(_this.state.jobId, userId);
3084
- _this.getJob();
3085
- } catch (err) {
3086
- console.error("onAssignUser", err);
3087
- }
3088
- });
3089
- return function (_x) {
3090
- return _ref6.apply(this, arguments);
3091
- };
3092
- }());
3093
- _defineProperty(this, "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator(function* () {
3094
- if (!_this.isReadyToSaveNote()) return;
3061
+ _defineProperty(this, "onAssignUser", async userId => {
3062
+ try {
3063
+ const res = await maintenanceActions.assignJob(this.state.jobId, userId);
3064
+ this.getJob();
3065
+ } catch (err) {
3066
+ console.error("onAssignUser", err);
3067
+ }
3068
+ });
3069
+ _defineProperty(this, "onConfirmAddNote", async () => {
3070
+ if (!this.isReadyToSaveNote()) return;
3095
3071
  try {
3096
- _this.setState({
3072
+ this.setState({
3097
3073
  submittingNote: true
3098
3074
  });
3099
- var res = yield _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(a => {
3075
+ const res = await (this.state.editingNote ? maintenanceActions.editNote(this.state.jobId, this.state.editingNote, this.state.noteInput, this.state.noteAttachments.map(a => {
3100
3076
  return {
3101
3077
  Title: a.Title,
3102
3078
  Source: a.Source
3103
3079
  };
3104
- }), _this.state.noteImages) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(a => {
3080
+ }), this.state.noteImages) : maintenanceActions.addNote(this.state.jobId, this.state.noteInput, this.state.noteAttachments.map(a => {
3105
3081
  return {
3106
3082
  Title: a.Title,
3107
3083
  Source: a.Source
3108
3084
  };
3109
- }), _this.state.noteImages);
3110
- _this.setState({
3085
+ }), this.state.noteImages));
3086
+ this.setState({
3111
3087
  job: res.data.job,
3112
3088
  submittingNote: false,
3113
3089
  addNoteOpen: false,
@@ -3116,12 +3092,12 @@ class Job extends Component {
3116
3092
  noteImages: [],
3117
3093
  editingNote: null
3118
3094
  }, () => {
3119
- _this.props.jobsLoaded([_this.state.job]);
3095
+ this.props.jobsLoaded([this.state.job]);
3120
3096
  });
3121
3097
  } catch (err) {
3122
3098
  console.error("onConfirmAddNote", err);
3123
3099
  }
3124
- }));
3100
+ });
3125
3101
  _defineProperty(this, "onDeleteNote", n => {
3126
3102
  if (!window.confirm(values.textAreYouSureYouWantToDeleteNote)) {
3127
3103
  this.setState({
@@ -3130,8 +3106,8 @@ class Job extends Component {
3130
3106
  return;
3131
3107
  }
3132
3108
  maintenanceActions.deleteNote(this.state.jobId, n.Id);
3133
- var newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3134
- var newJob = _objectSpread$5({}, this.state.job);
3109
+ const newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3110
+ const newJob = _objectSpread$5({}, this.state.job);
3135
3111
  newJob.Notes = newNotes;
3136
3112
  this.setState({
3137
3113
  job: newJob,
@@ -3149,10 +3125,10 @@ class Job extends Component {
3149
3125
  }, this.checkSetImage);
3150
3126
  });
3151
3127
  _defineProperty(this, "markSeen", () => {
3152
- var {
3128
+ const {
3153
3129
  job
3154
3130
  } = this.state;
3155
- var {
3131
+ const {
3156
3132
  auth
3157
3133
  } = this.props;
3158
3134
  // Must have maintenance permission and not the requester
@@ -3160,22 +3136,22 @@ class Job extends Component {
3160
3136
  if (auth.user.Id === job.userID) return;
3161
3137
  this.setState({
3162
3138
  updating: true
3163
- }, /*#__PURE__*/_asyncToGenerator(function* () {
3139
+ }, async () => {
3164
3140
  try {
3165
- var update = {
3141
+ const update = {
3166
3142
  id: job.id,
3167
3143
  seen: true,
3168
3144
  status: job.status || "Unassigned"
3169
3145
  };
3170
- yield maintenanceActions.editJob(update, auth.site);
3146
+ await maintenanceActions.editJob(update, auth.site);
3171
3147
  } catch (error) {
3172
- _this.setState({
3148
+ this.setState({
3173
3149
  updating: false
3174
3150
  });
3175
3151
  console.log("markSeen error", error);
3176
3152
  alert("Something went wrong with the request. Please try again.");
3177
3153
  }
3178
- }));
3154
+ });
3179
3155
  });
3180
3156
  _defineProperty(this, "getComments", () => {
3181
3157
  reactionActions.getComments(this.state.jobId, values.commentKey, 0).then(res => {
@@ -3184,25 +3160,25 @@ class Job extends Component {
3184
3160
  });
3185
3161
  });
3186
3162
  });
3187
- _defineProperty(this, "onAddComment", /*#__PURE__*/_asyncToGenerator(function* () {
3188
- var {
3163
+ _defineProperty(this, "onAddComment", async () => {
3164
+ const {
3189
3165
  commentInput,
3190
3166
  jobId,
3191
3167
  job,
3192
3168
  comments
3193
- } = _this.state;
3169
+ } = this.state;
3194
3170
  try {
3195
- _this.setState({
3171
+ this.setState({
3196
3172
  commentInput: ""
3197
3173
  });
3198
- var res = yield reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3199
- _this.setState({
3174
+ const res = await reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3175
+ this.setState({
3200
3176
  comments: [...comments, res.data]
3201
3177
  });
3202
3178
  } catch (error) {
3203
3179
  console.error("onAddComment", error);
3204
3180
  }
3205
- }));
3181
+ });
3206
3182
  _defineProperty(this, "onHandleChange", event => {
3207
3183
  var stateChange = {};
3208
3184
  stateChange[event.target.getAttribute("id")] = event.target.value;
@@ -3213,61 +3189,51 @@ class Job extends Component {
3213
3189
  priorityChangerOpen: !this.state.priorityChangerOpen
3214
3190
  });
3215
3191
  });
3216
- _defineProperty(this, "onSelectPriority", /*#__PURE__*/function () {
3217
- var _ref0 = _asyncToGenerator(function* (priority) {
3218
- _this.setState({
3219
- job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3220
- priority
3221
- }),
3222
- priorityChangerOpen: false
3223
- });
3224
- try {
3225
- var res = yield maintenanceActions.editJobPriority(_this.state.job.id, priority);
3226
- var {
3227
- job
3228
- } = res.data;
3229
- _this.props.jobsLoaded([job]);
3230
- _this.setState({
3231
- job
3232
- });
3233
- } catch (error) {
3234
- console.error("onSelectPriority", error);
3235
- }
3192
+ _defineProperty(this, "onSelectPriority", async priority => {
3193
+ this.setState({
3194
+ job: _objectSpread$5(_objectSpread$5({}, this.state.job), {}, {
3195
+ priority
3196
+ }),
3197
+ priorityChangerOpen: false
3236
3198
  });
3237
- return function (_x2) {
3238
- return _ref0.apply(this, arguments);
3239
- };
3240
- }());
3199
+ try {
3200
+ const res = await maintenanceActions.editJobPriority(this.state.job.id, priority);
3201
+ const {
3202
+ job
3203
+ } = res.data;
3204
+ this.props.jobsLoaded([job]);
3205
+ this.setState({
3206
+ job
3207
+ });
3208
+ } catch (error) {
3209
+ console.error("onSelectPriority", error);
3210
+ }
3211
+ });
3241
3212
  _defineProperty(this, "onToggleStatusChanger", () => {
3242
3213
  this.setState({
3243
3214
  statusChangerOpen: !this.state.statusChangerOpen
3244
3215
  });
3245
3216
  });
3246
- _defineProperty(this, "onSelectStatus", /*#__PURE__*/function () {
3247
- var _ref1 = _asyncToGenerator(function* (status) {
3248
- _this.setState({
3249
- job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3250
- status: status
3251
- }),
3252
- statusChangerOpen: false
3253
- });
3254
- try {
3255
- var res = yield maintenanceActions.editJobStatus(_this.state.job.id, status);
3256
- var {
3257
- job
3258
- } = res.data;
3259
- _this.props.jobsLoaded([job]);
3260
- _this.setState({
3261
- job
3262
- });
3263
- } catch (error) {
3264
- console.error("onSelectStatus", error);
3265
- }
3217
+ _defineProperty(this, "onSelectStatus", async status => {
3218
+ this.setState({
3219
+ job: _objectSpread$5(_objectSpread$5({}, this.state.job), {}, {
3220
+ status: status
3221
+ }),
3222
+ statusChangerOpen: false
3266
3223
  });
3267
- return function (_x3) {
3268
- return _ref1.apply(this, arguments);
3269
- };
3270
- }());
3224
+ try {
3225
+ const res = await maintenanceActions.editJobStatus(this.state.job.id, status);
3226
+ const {
3227
+ job
3228
+ } = res.data;
3229
+ this.props.jobsLoaded([job]);
3230
+ this.setState({
3231
+ job
3232
+ });
3233
+ } catch (error) {
3234
+ console.error("onSelectStatus", error);
3235
+ }
3236
+ });
3271
3237
  this.state = {
3272
3238
  jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3273
3239
  job: null,
@@ -3329,15 +3295,15 @@ class Job extends Component {
3329
3295
  });
3330
3296
  }
3331
3297
  renderPriorityLabel() {
3332
- var {
3298
+ const {
3333
3299
  auth
3334
3300
  } = this.props;
3335
3301
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
3336
- var {
3302
+ const {
3337
3303
  job
3338
3304
  } = this.state;
3339
3305
  if (!job) return null;
3340
- var selectedPriority = getJobPriority(job.priority);
3306
+ const selectedPriority = getJobPriority(job.priority);
3341
3307
  return /*#__PURE__*/jsxs("div", {
3342
3308
  className: "statusLabel marginTop-5 pointer",
3343
3309
  onClick: this.onTogglePriorityChanger,
@@ -3352,8 +3318,8 @@ class Job extends Component {
3352
3318
  }
3353
3319
  renderStatusLabel() {
3354
3320
  if (!this.state.job.status) return null;
3355
- var statusType = this.getStatusType(this.state.job.status);
3356
- var {
3321
+ const statusType = this.getStatusType(this.state.job.status);
3322
+ const {
3357
3323
  auth
3358
3324
  } = this.props;
3359
3325
  if (Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) {
@@ -3381,7 +3347,7 @@ class Job extends Component {
3381
3347
  });
3382
3348
  }
3383
3349
  renderNotesButton() {
3384
- var {
3350
+ const {
3385
3351
  auth
3386
3352
  } = this.props;
3387
3353
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3399,7 +3365,7 @@ class Job extends Component {
3399
3365
  });
3400
3366
  }
3401
3367
  renderAssignButton() {
3402
- var {
3368
+ const {
3403
3369
  auth
3404
3370
  } = this.props;
3405
3371
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3418,7 +3384,7 @@ class Job extends Component {
3418
3384
  }
3419
3385
  renderStatusChanger() {
3420
3386
  if (!this.state.statusChangerOpen) return null;
3421
- var {
3387
+ const {
3422
3388
  statusTypes
3423
3389
  } = this.props;
3424
3390
  return /*#__PURE__*/jsx("div", {
@@ -3478,8 +3444,8 @@ class Job extends Component {
3478
3444
  });
3479
3445
  }
3480
3446
  renderImageGrid(images) {
3481
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3482
- var imagesToUse = images && images.length > 0 ? images : [];
3447
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3448
+ const imagesToUse = images && images.length > 0 ? images : [];
3483
3449
  return /*#__PURE__*/jsx("div", {
3484
3450
  className: "imageGrid",
3485
3451
  children: imagesToUse.map((image, i) => {
@@ -3500,7 +3466,7 @@ class Job extends Component {
3500
3466
  });
3501
3467
  }
3502
3468
  renderDocumentGrid(documents) {
3503
- var documentsToUse = documents && documents.length > 0 ? documents : [];
3469
+ const documentsToUse = documents && documents.length > 0 ? documents : [];
3504
3470
  return /*#__PURE__*/jsx("div", {
3505
3471
  className: "documentGrid",
3506
3472
  children: documentsToUse.map((doc, index) => /*#__PURE__*/jsx(Components$3.Attachment, {
@@ -3512,7 +3478,7 @@ class Job extends Component {
3512
3478
  }
3513
3479
  renderImages() {
3514
3480
  if (_.isEmpty(this.state.job.image) && _.isEmpty(this.state.job.images)) return null;
3515
- var imagesToUse = _.isEmpty(this.state.job.image) ? this.state.job.images : [this.state.job.image];
3481
+ const imagesToUse = _.isEmpty(this.state.job.image) ? this.state.job.images : [this.state.job.image];
3516
3482
  return /*#__PURE__*/jsxs("div", {
3517
3483
  className: "padding-60 paddingVertical-40 bottomDivideBorder",
3518
3484
  children: [/*#__PURE__*/jsx(Components$3.Text, {
@@ -3523,15 +3489,15 @@ class Job extends Component {
3523
3489
  });
3524
3490
  }
3525
3491
  renderCustomFields() {
3526
- var {
3492
+ const {
3527
3493
  job
3528
3494
  } = this.state;
3529
- var {
3495
+ const {
3530
3496
  customFields
3531
3497
  } = job;
3532
- var labelClass = "fieldLabel";
3533
- var answerClass = "fontRegular fontSize-16 text-dark marginTop-5";
3534
- var renderAnswer = field => {
3498
+ const labelClass = "fieldLabel";
3499
+ const answerClass = "fontRegular fontSize-16 text-dark marginTop-5";
3500
+ const renderAnswer = field => {
3535
3501
  switch (field.type) {
3536
3502
  case "date":
3537
3503
  return /*#__PURE__*/jsx("div", {
@@ -3581,10 +3547,10 @@ class Job extends Component {
3581
3547
  }
3582
3548
  renderInner() {
3583
3549
  if (this.state.job == null) return null;
3584
- var {
3550
+ const {
3585
3551
  customFields
3586
3552
  } = this.state.job;
3587
- var hasCustomFields = customFields && customFields.length > 0;
3553
+ const hasCustomFields = customFields && customFields.length > 0;
3588
3554
  return /*#__PURE__*/jsxs("div", {
3589
3555
  iconStyle: {
3590
3556
  paddingBottom: 40
@@ -3685,10 +3651,10 @@ class Job extends Component {
3685
3651
  });
3686
3652
  }
3687
3653
  renderHistoryEntry(e, i) {
3688
- var {
3654
+ const {
3689
3655
  job
3690
3656
  } = this.state;
3691
- var entryToUse = e || {
3657
+ const entryToUse = e || {
3692
3658
  timestamp: job.createdTime,
3693
3659
  status: "Unassigned",
3694
3660
  user: {
@@ -3697,7 +3663,7 @@ class Job extends Component {
3697
3663
  profilePic: job.userProfilePic
3698
3664
  }
3699
3665
  };
3700
- var statusType = this.getStatusType(entryToUse.status);
3666
+ const statusType = this.getStatusType(entryToUse.status);
3701
3667
  return /*#__PURE__*/jsxs("div", {
3702
3668
  className: "ticketHistoryEntry",
3703
3669
  children: [/*#__PURE__*/jsx("p", {
@@ -3761,7 +3727,7 @@ class Job extends Component {
3761
3727
  }, index);
3762
3728
  }
3763
3729
  renderAssignment() {
3764
- var {
3730
+ const {
3765
3731
  job
3766
3732
  } = this.state;
3767
3733
  if (!job) return null;
@@ -3809,8 +3775,8 @@ class Job extends Component {
3809
3775
  }, i);
3810
3776
  }
3811
3777
  renderExternalSyncEntry(e, i) {
3812
- var isSuccess = e.EntryType === "ExternalIDSet";
3813
- var backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3778
+ const isSuccess = e.EntryType === "ExternalIDSet";
3779
+ const backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3814
3780
 
3815
3781
  return /*#__PURE__*/jsxs("div", {
3816
3782
  className: "ticketHistoryEntry",
@@ -3830,7 +3796,7 @@ class Job extends Component {
3830
3796
  }, i);
3831
3797
  }
3832
3798
  renderPriority() {
3833
- var {
3799
+ const {
3834
3800
  auth
3835
3801
  } = this.props;
3836
3802
  if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
@@ -3847,20 +3813,20 @@ class Job extends Component {
3847
3813
  });
3848
3814
  }
3849
3815
  hasSyncFailureWithoutSuccess() {
3850
- var {
3816
+ const {
3851
3817
  job
3852
3818
  } = this.state;
3853
3819
  if (!job || !job.history) return false;
3854
- var history = job.history || [];
3855
- var hasSuccess = history.some(entry => entry.EntryType === "ExternalIDSet");
3856
- var hasFailure = history.some(entry => entry.EntryType === "ExternalIDSetFailed");
3820
+ const history = job.history || [];
3821
+ const hasSuccess = history.some(entry => entry.EntryType === "ExternalIDSet");
3822
+ const hasFailure = history.some(entry => entry.EntryType === "ExternalIDSetFailed");
3857
3823
  return hasFailure && !hasSuccess;
3858
3824
  }
3859
3825
  renderRetrySyncButton() {
3860
- var {
3826
+ const {
3861
3827
  auth
3862
3828
  } = this.props;
3863
- var {
3829
+ const {
3864
3830
  retryingSync,
3865
3831
  retrySyncInitiated
3866
3832
  } = this.state;
@@ -3898,7 +3864,7 @@ class Job extends Component {
3898
3864
  });
3899
3865
  }
3900
3866
  renderExternalSyncStatus() {
3901
- var {
3867
+ const {
3902
3868
  retrySyncError,
3903
3869
  retrySyncInitiated
3904
3870
  } = this.state;
@@ -3947,14 +3913,14 @@ class Job extends Component {
3947
3913
  return null;
3948
3914
  }
3949
3915
  renderExternalSync() {
3950
- var {
3916
+ const {
3951
3917
  externalSync,
3952
3918
  loadingExternalSync
3953
3919
  } = this.state;
3954
3920
 
3955
3921
  // Check if we should show this section at all
3956
- var hasExternalSyncData = externalSync && !loadingExternalSync;
3957
- var hasSyncFailure = this.hasSyncFailureWithoutSuccess();
3922
+ const hasExternalSyncData = externalSync && !loadingExternalSync;
3923
+ const hasSyncFailure = this.hasSyncFailureWithoutSuccess();
3958
3924
 
3959
3925
  // Show section if we have sync data OR if there's a failure that can be retried
3960
3926
  if (!hasExternalSyncData && !hasSyncFailure) return null;
@@ -3994,11 +3960,11 @@ class Job extends Component {
3994
3960
  });
3995
3961
  }
3996
3962
  renderOverview() {
3997
- var {
3963
+ const {
3998
3964
  job
3999
3965
  } = this.state;
4000
3966
  if (!job || !job.history) return null;
4001
- var source = _.sortBy([...job.history.map(e => {
3967
+ const source = _.sortBy([...job.history.map(e => {
4002
3968
  return _objectSpread$5(_objectSpread$5({}, e), {}, {
4003
3969
  EntryType: e.EntryType || "status"
4004
3970
  });
@@ -4136,8 +4102,8 @@ class Job extends Component {
4136
4102
  children: "Add Attachment"
4137
4103
  })]
4138
4104
  }), /*#__PURE__*/jsx(Components$3.ImageInput, {
4139
- ref: _ref10 => {
4140
- this.imageInput = _ref10;
4105
+ ref: ref => {
4106
+ this.imageInput = ref;
4141
4107
  },
4142
4108
  multiple: true,
4143
4109
  refreshCallback: images => {
@@ -4149,7 +4115,7 @@ class Job extends Component {
4149
4115
  });
4150
4116
  }
4151
4117
  renderUsers() {
4152
- var content = null;
4118
+ let content = null;
4153
4119
  if (this.state.confirmingAssignee) {
4154
4120
  content = /*#__PURE__*/jsx("div", {
4155
4121
  className: "flex flex-center-row",
@@ -4243,8 +4209,8 @@ class Job extends Component {
4243
4209
  });
4244
4210
  }
4245
4211
  }
4246
- var mapStateToProps$3 = state => {
4247
- var {
4212
+ const mapStateToProps$3 = state => {
4213
+ const {
4248
4214
  auth
4249
4215
  } = state;
4250
4216
  return {
@@ -4259,7 +4225,7 @@ var Job$1 = connect(mapStateToProps$3, {
4259
4225
 
4260
4226
  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; }
4261
4227
  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; }
4262
- var {
4228
+ const {
4263
4229
  Actions,
4264
4230
  Components: Components$2,
4265
4231
  Helper: Helper$2,
@@ -4272,18 +4238,18 @@ class AddJob extends Component {
4272
4238
  var _this;
4273
4239
  super(props);
4274
4240
  _this = this;
4275
- _defineProperty(this, "getJob", /*#__PURE__*/_asyncToGenerator(function* () {
4241
+ _defineProperty(this, "getJob", async () => {
4276
4242
  try {
4277
- var res = yield maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
4243
+ const res = await maintenanceActions.getJob(this.props.auth.site, this.state.jobId);
4278
4244
  res.data.location = res.data.site;
4279
- var {
4245
+ const {
4280
4246
  userID,
4281
4247
  userName,
4282
4248
  userProfilePic,
4283
4249
  type,
4284
4250
  customFields
4285
4251
  } = res.data;
4286
- _this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4252
+ this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4287
4253
  prevType: type,
4288
4254
  prevCustomFileds: customFields,
4289
4255
  type,
@@ -4294,39 +4260,39 @@ class AddJob extends Component {
4294
4260
  profilePic: userProfilePic
4295
4261
  }
4296
4262
  }));
4297
- _this.checkSetImages(_this.imageInput, res.data.images);
4263
+ this.checkSetImages(this.imageInput, res.data.images);
4298
4264
  if (customFields) {
4299
4265
  customFields.forEach((field, index) => {
4300
4266
  if (field.type === "image" && field.answer) {
4301
- _this.checkSetImages(_this.customImageInputs[index], field.answer);
4267
+ this.checkSetImages(this.customImageInputs[index], field.answer);
4302
4268
  }
4303
4269
  });
4304
4270
  }
4305
4271
  } catch (error) {
4306
4272
  console.error("getJob", error);
4307
4273
  }
4308
- }));
4309
- _defineProperty(this, "getJobTypes", /*#__PURE__*/_asyncToGenerator(function* () {
4274
+ });
4275
+ _defineProperty(this, "getJobTypes", async () => {
4310
4276
  try {
4311
- var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
4312
- _this.setState({
4277
+ const res = await maintenanceActions.getJobTypes(this.props.auth.site);
4278
+ this.setState({
4313
4279
  types: res.data
4314
4280
  });
4315
- _this.getDefaultJob();
4281
+ this.getDefaultJob();
4316
4282
  } catch (error) {
4317
4283
  console.error("getJobTypes", error);
4318
4284
  }
4319
- }));
4320
- _defineProperty(this, "getUsers", /*#__PURE__*/_asyncToGenerator(function* () {
4285
+ });
4286
+ _defineProperty(this, "getUsers", async () => {
4321
4287
  try {
4322
- var res = yield userActions.fetchUsers(_this.props.auth.site);
4288
+ const res = await userActions.fetchUsers(this.props.auth.site);
4323
4289
  if (res.userFetchFail) return;
4324
4290
  if (res.data != null && !_.isEmpty(res.data.results.Items)) {
4325
- var items = res.data.results.Items;
4326
- if (_this.props.optionOnlyForResidents) {
4291
+ let items = res.data.results.Items;
4292
+ if (this.props.optionOnlyForResidents) {
4327
4293
  items = _.filter(items, u => u.category === "resident");
4328
4294
  }
4329
- _this.setState({
4295
+ this.setState({
4330
4296
  users: _.sortBy(items, u => {
4331
4297
  return (u.displayName || "").toLowerCase();
4332
4298
  })
@@ -4335,15 +4301,15 @@ class AddJob extends Component {
4335
4301
  } catch (error) {
4336
4302
  console.error("getUsers", error);
4337
4303
  }
4338
- }));
4304
+ });
4339
4305
  _defineProperty(this, "getDefaultJob", () => {
4340
- var {
4306
+ const {
4341
4307
  types,
4342
4308
  jobId
4343
4309
  } = this.state;
4344
4310
  if (jobId == null) {
4345
4311
  if (types.length !== 0) {
4346
- var defaultType = types[0];
4312
+ const defaultType = types[0];
4347
4313
  this.setState({
4348
4314
  type: defaultType.typeName,
4349
4315
  customFields: defaultType.hasCustomFields && defaultType.customFields.length > 0 ? defaultType.customFields : []
@@ -4356,15 +4322,15 @@ class AddJob extends Component {
4356
4322
  }
4357
4323
  });
4358
4324
  _defineProperty(this, "onSelectType", (key, e) => {
4359
- var {
4325
+ const {
4360
4326
  types,
4361
4327
  prevType,
4362
4328
  prevCustomFileds
4363
4329
  } = this.state;
4364
- var selectedType = types.find(t => t.typeName === key);
4330
+ const selectedType = types.find(t => t.typeName === key);
4365
4331
  // If selected type had previously saved custom fields, use the previous version
4366
- var hasPrevCustomFields = prevType === selectedType.typeName && prevCustomFileds && prevCustomFileds.length > 0;
4367
- var update = {
4332
+ const hasPrevCustomFields = prevType === selectedType.typeName && prevCustomFileds && prevCustomFileds.length > 0;
4333
+ const update = {
4368
4334
  type: selectedType.typeName,
4369
4335
  customFields: hasPrevCustomFields ? prevCustomFileds : selectedType.hasCustomFields ? selectedType.customFields : []
4370
4336
  };
@@ -4389,7 +4355,7 @@ class AddJob extends Component {
4389
4355
  });
4390
4356
  });
4391
4357
  _defineProperty(this, "onSelectUser", user => {
4392
- var update = {
4358
+ const update = {
4393
4359
  selectedUser: user,
4394
4360
  userID: user.userId,
4395
4361
  userName: user.displayName,
@@ -4407,7 +4373,7 @@ class AddJob extends Component {
4407
4373
  // Fetch in background to avoid blocking UI
4408
4374
  userActions.fetchUser(this.props.auth.site, user.userId).then(response => {
4409
4375
  if (response.data && response.data.user) {
4410
- var contactUpdate = {};
4376
+ const contactUpdate = {};
4411
4377
  // Auto-populate phone and room from user profile
4412
4378
  if (response.data.user.phoneNumber) {
4413
4379
  contactUpdate.phone = response.data.user.phoneNumber;
@@ -4427,7 +4393,7 @@ class AddJob extends Component {
4427
4393
  });
4428
4394
  });
4429
4395
  _defineProperty(this, "onUnselectUser", () => {
4430
- var update = {
4396
+ const update = {
4431
4397
  selectedUser: null,
4432
4398
  userID: "",
4433
4399
  userName: "",
@@ -4440,78 +4406,78 @@ class AddJob extends Component {
4440
4406
  this.setState(update);
4441
4407
  });
4442
4408
  _defineProperty(this, "onChangeAnswer", (qId, answer) => {
4443
- var update = {
4409
+ const update = {
4444
4410
  customFields: _.cloneDeep(this.state.customFields)
4445
4411
  };
4446
- var field = update.customFields[qId];
4412
+ const field = update.customFields[qId];
4447
4413
  field.answer = answer;
4448
4414
  if (field.isTitle) update.title = field.answer;
4449
4415
  this.setState(update);
4450
4416
  });
4451
4417
  _defineProperty(this, "onChangeToggleAnswer", (qId, answer) => {
4452
- var update = {
4418
+ const update = {
4453
4419
  customFields: _.cloneDeep(this.state.customFields)
4454
4420
  };
4455
- var field = update.customFields[qId];
4421
+ const field = update.customFields[qId];
4456
4422
  field.answer = field.answer === answer ? undefined : answer;
4457
4423
  if (field.isTitle) update.title = field.answer;
4458
4424
  this.setState(update);
4459
4425
  });
4460
4426
  _defineProperty(this, "onChangeCheckboxAnswer", (qId, answer) => {
4461
- var update = {
4427
+ const update = {
4462
4428
  customFields: _.cloneDeep(this.state.customFields)
4463
4429
  };
4464
- var field = update.customFields[qId];
4430
+ const field = update.customFields[qId];
4465
4431
  field.answer = _.xor(field.answer || [], [answer]);
4466
4432
  if (field.isTitle) update.title = field.answer.join(", ");
4467
4433
  this.setState(update);
4468
4434
  });
4469
4435
  _defineProperty(this, "onChangeDateAnswer", function (qId, answer) {
4470
- var togglePicker = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4471
- var update = {
4436
+ let togglePicker = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4437
+ const update = {
4472
4438
  customFields: _.cloneDeep(_this.state.customFields)
4473
4439
  };
4474
- var field = update.customFields[qId];
4440
+ const field = update.customFields[qId];
4475
4441
  field.answer = answer;
4476
4442
  if (field.isTitle) update.title = moment(field.answer, "YYYY-MM-DD").format("DD-MMM-YYYY");
4477
4443
  _this.setState(update);
4478
4444
  if (togglePicker) _this.onToggleDatePicker(qId);
4479
4445
  });
4480
4446
  _defineProperty(this, "onChangeTimeAnswer", (qId, answer) => {
4481
- var update = {
4447
+ const update = {
4482
4448
  customFields: _.cloneDeep(this.state.customFields)
4483
4449
  };
4484
- var field = update.customFields[qId];
4450
+ const field = update.customFields[qId];
4485
4451
  field.answer = answer;
4486
4452
  if (field.isTitle) update.title = moment(field.answer, "HH:mm").format("h:mm a");
4487
4453
  this.setState(update);
4488
4454
  });
4489
4455
  _defineProperty(this, "onChangeImageAnswer", (qId, answer) => {
4490
- var update = {
4456
+ const update = {
4491
4457
  customFields: _.cloneDeep(this.state.customFields)
4492
4458
  };
4493
- var field = update.customFields[qId];
4459
+ const field = update.customFields[qId];
4494
4460
  field.answer = answer;
4495
4461
  this.setState(update);
4496
4462
  });
4497
4463
  _defineProperty(this, "onRemoveDocumentAnswer", (qId, document) => {
4498
- var update = {
4464
+ const update = {
4499
4465
  customFields: _.cloneDeep(this.state.customFields)
4500
4466
  };
4501
- var field = update.customFields[qId];
4467
+ const field = update.customFields[qId];
4502
4468
  field.answer = _.filter(field.answer, d => d.url !== document.url);
4503
4469
  this.setState(update);
4504
4470
  });
4505
4471
  _defineProperty(this, "onHandlePDFFileChange", (event, qId) => {
4506
- var file = event.target.files[0];
4472
+ const file = event.target.files[0];
4507
4473
  if (!file) return;
4508
- var update = {
4474
+ const update = {
4509
4475
  customFields: _.cloneDeep(this.state.customFields)
4510
4476
  };
4511
- var field = update.customFields[qId];
4512
- var attachments = field.answer || [];
4513
- var [name, ext] = file.name.split(".");
4514
- var newAttachment = {
4477
+ const field = update.customFields[qId];
4478
+ const attachments = field.answer || [];
4479
+ const [name, ext] = file.name.split(".");
4480
+ const newAttachment = {
4515
4481
  uploading: true,
4516
4482
  name,
4517
4483
  ext: ext.toLowerCase()
@@ -4531,7 +4497,7 @@ class AddJob extends Component {
4531
4497
  event.target.value = "";
4532
4498
  });
4533
4499
  _defineProperty(this, "onToggleDatePicker", qId => {
4534
- var showDate = _objectSpread$4({}, this.state.showDate);
4500
+ const showDate = _objectSpread$4({}, this.state.showDate);
4535
4501
  showDate[qId] = !showDate[qId];
4536
4502
  this.setState({
4537
4503
  showDate
@@ -4551,7 +4517,7 @@ class AddJob extends Component {
4551
4517
  this.setState({
4552
4518
  updating: true
4553
4519
  });
4554
- var job = {
4520
+ const job = {
4555
4521
  id: this.state.id,
4556
4522
  userID: this.state.userID,
4557
4523
  userName: this.state.userName,
@@ -4597,13 +4563,13 @@ class AddJob extends Component {
4597
4563
  }
4598
4564
  });
4599
4565
  _defineProperty(this, "isFieldValid", field => {
4600
- var {
4566
+ const {
4601
4567
  mandatory,
4602
4568
  type,
4603
4569
  answer
4604
4570
  } = field;
4605
4571
  if (["staticTitle", "staticText"].includes(type)) return true;
4606
- var checkMandatory = () => {
4572
+ const checkMandatory = () => {
4607
4573
  if (!mandatory) return true;
4608
4574
  switch (type) {
4609
4575
  case "yn":
@@ -4616,7 +4582,7 @@ class AddJob extends Component {
4616
4582
  return !_.isNil(answer) && !_.isEmpty(answer);
4617
4583
  }
4618
4584
  };
4619
- var checkFormat = () => {
4585
+ const checkFormat = () => {
4620
4586
  if (_.isNil(answer) || _.isEmpty(answer)) return true;
4621
4587
  switch (type) {
4622
4588
  case "email":
@@ -4629,12 +4595,12 @@ class AddJob extends Component {
4629
4595
  return true;
4630
4596
  }
4631
4597
  };
4632
- var valid = checkMandatory() && checkFormat();
4598
+ const valid = checkMandatory() && checkFormat();
4633
4599
  return valid;
4634
4600
  });
4635
4601
  _defineProperty(this, "getFieldContainerClass", function () {
4636
- var isValid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4637
- var showError = _this.state.showWarnings && !isValid;
4602
+ let isValid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4603
+ const showError = _this.state.showWarnings && !isValid;
4638
4604
  return "genericInputContainer ".concat(isValid ? "genericInput-valid" : "", " ").concat(showError ? "genericInput-error" : "").trim();
4639
4605
  });
4640
4606
  this.imageInput = null;
@@ -4693,25 +4659,18 @@ class AddJob extends Component {
4693
4659
  }, 100);
4694
4660
  }
4695
4661
  }
4696
- renderTypeOptions() {
4697
- var {
4698
- types,
4699
- type
4662
+ getTypeOptions() {
4663
+ const {
4664
+ types
4700
4665
  } = this.state;
4701
- return types.map(ev => {
4702
- if (ev != null) {
4703
- return /*#__PURE__*/jsx(MenuItem, {
4704
- eventKey: ev.typeName,
4705
- active: type === ev.typeName,
4706
- children: ev.typeName
4707
- }, ev.typeName);
4708
- }
4709
- return null;
4710
- });
4666
+ return types.filter(Boolean).map(ev => ({
4667
+ Key: ev.typeName,
4668
+ Title: ev.typeName
4669
+ }));
4711
4670
  }
4712
4671
  renderSuccess() {
4713
4672
  if (!this.state.success) return null;
4714
- var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
4673
+ const title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
4715
4674
  return /*#__PURE__*/jsx(Components$2.SuccessPopup, {
4716
4675
  text: "".concat(values.textEntityName, " has been ").concat(this.state.id != null ? "edited" : "added"),
4717
4676
  buttons: [{
@@ -4724,12 +4683,12 @@ class AddJob extends Component {
4724
4683
  });
4725
4684
  }
4726
4685
  validateCustomFields() {
4727
- var {
4686
+ const {
4728
4687
  customFields
4729
4688
  } = this.state;
4730
4689
  if (!customFields || customFields.length === 0) return true;
4731
4690
  return customFields.every(field => {
4732
- var isValid = this.isFieldValid(field);
4691
+ const isValid = this.isFieldValid(field);
4733
4692
  return isValid;
4734
4693
  });
4735
4694
  }
@@ -4769,11 +4728,11 @@ class AddJob extends Component {
4769
4728
  });
4770
4729
  }
4771
4730
  renderSelectUser() {
4772
- var {
4731
+ const {
4773
4732
  showWarnings,
4774
4733
  selectedUser
4775
4734
  } = this.state;
4776
- var isValid = !_.isNil(selectedUser);
4735
+ const isValid = !_.isNil(selectedUser);
4777
4736
  return /*#__PURE__*/jsxs("div", {
4778
4737
  className: this.getFieldContainerClass(isValid),
4779
4738
  children: [/*#__PURE__*/jsxs("div", {
@@ -4843,8 +4802,8 @@ class AddJob extends Component {
4843
4802
  className: "marginBottom-4",
4844
4803
  children: "Images"
4845
4804
  }), /*#__PURE__*/jsx(Components$2.ImageInput, {
4846
- ref: _ref4 => {
4847
- this.imageInput = _ref4;
4805
+ ref: ref => {
4806
+ this.imageInput = ref;
4848
4807
  },
4849
4808
  multiple: true,
4850
4809
  refreshCallback: images => {
@@ -5083,14 +5042,14 @@ class AddJob extends Component {
5083
5042
  className: "marginBottom-4",
5084
5043
  children: field.label
5085
5044
  }), /*#__PURE__*/jsx(Components$2.ImageInput, {
5086
- ref: _ref5 => this.customImageInputs[fieldId] = _ref5,
5045
+ ref: ref => this.customImageInputs[fieldId] = ref,
5087
5046
  multiple: true,
5088
5047
  refreshCallback: images => this.onChangeImageAnswer(fieldId, images)
5089
5048
  })]
5090
5049
  })]
5091
5050
  }, fieldId);
5092
5051
  case "document":
5093
- var documents = field.answer || [];
5052
+ const documents = field.answer || [];
5094
5053
  return /*#__PURE__*/jsxs("div", {
5095
5054
  className: this.getFieldContainerClass(this.isFieldValid(field)),
5096
5055
  style: styles$4.fieldContainer,
@@ -5135,7 +5094,7 @@ class AddJob extends Component {
5135
5094
  }
5136
5095
  }
5137
5096
  renderCustomFields() {
5138
- var {
5097
+ const {
5139
5098
  customFields
5140
5099
  } = this.state;
5141
5100
  if (!customFields || customFields.length === 0) return null;
@@ -5146,7 +5105,7 @@ class AddJob extends Component {
5146
5105
  });
5147
5106
  }
5148
5107
  renderMain() {
5149
- var {
5108
+ const {
5150
5109
  customFields
5151
5110
  } = this.state;
5152
5111
  return /*#__PURE__*/jsx("div", {
@@ -5184,29 +5143,20 @@ class AddJob extends Component {
5184
5143
  showError: () => {
5185
5144
  return this.state.showWarnings && _.isEmpty(this.state.room);
5186
5145
  }
5187
- }), /*#__PURE__*/jsxs("div", {
5188
- iconStyle: {
5146
+ }), /*#__PURE__*/jsx(Components$2.DropdownInput, {
5147
+ label: values.textJobType,
5148
+ value: this.state.type,
5149
+ options: this.getTypeOptions(),
5150
+ onSelect: this.onSelectType,
5151
+ style: {
5189
5152
  marginBottom: 15
5190
- },
5191
- children: [/*#__PURE__*/jsx(Components$2.Text, {
5192
- type: "formLabel",
5193
- children: values.textJobType
5194
- }), /*#__PURE__*/jsx(DropdownButton, {
5195
- style: {
5196
- minWidth: 80
5197
- },
5198
- bsStyle: "default",
5199
- title: this.state.type,
5200
- id: "typeSelect",
5201
- onSelect: this.onSelectType,
5202
- children: this.renderTypeOptions()
5203
- })]
5153
+ }
5204
5154
  }), !_.isEmpty(customFields) || values.forceCustomFields ? this.renderCustomFields() : this.renderDefaultFields()]
5205
5155
  })
5206
5156
  });
5207
5157
  }
5208
5158
  renderUserFilterPopup() {
5209
- var {
5159
+ const {
5210
5160
  userFilterOpen,
5211
5161
  userSearch,
5212
5162
  users
@@ -5246,7 +5196,7 @@ class AddJob extends Component {
5246
5196
  });
5247
5197
  }
5248
5198
  render() {
5249
- var {
5199
+ const {
5250
5200
  success
5251
5201
  } = this.state;
5252
5202
  return /*#__PURE__*/jsxs(Components$2.OverlayPage, {
@@ -5264,7 +5214,7 @@ class AddJob extends Component {
5264
5214
  });
5265
5215
  }
5266
5216
  }
5267
- var styles$4 = {
5217
+ const styles$4 = {
5268
5218
  userLabelContainer: {
5269
5219
  display: "flex",
5270
5220
  flexDirection: "row",
@@ -5278,8 +5228,8 @@ var styles$4 = {
5278
5228
  alignItems: "center"
5279
5229
  }
5280
5230
  };
5281
- var mapStateToProps$2 = state => {
5282
- var {
5231
+ const mapStateToProps$2 = state => {
5232
+ const {
5283
5233
  auth
5284
5234
  } = state;
5285
5235
  return {
@@ -5294,12 +5244,12 @@ var AddJob$1 = connect(mapStateToProps$2, {
5294
5244
  addRecentlyCreated: Actions.addRecentlyCreated
5295
5245
  })(withRouter(AddJob));
5296
5246
 
5297
- var {
5247
+ const {
5298
5248
  Components: Components$1,
5299
5249
  Session: Session$1,
5300
5250
  Helper: Helper$1
5301
5251
  } = PlussCore;
5302
- var DEFAULT_FIELD = {
5252
+ const DEFAULT_FIELD = {
5303
5253
  type: "text",
5304
5254
  label: "",
5305
5255
  mandatory: false,
@@ -5308,13 +5258,11 @@ var DEFAULT_FIELD = {
5308
5258
  };
5309
5259
  class AddJobType extends Component {
5310
5260
  constructor(props) {
5311
- var _this;
5312
5261
  super(props);
5313
- _this = this;
5314
- _defineProperty(this, "getJobType", /*#__PURE__*/_asyncToGenerator(function* () {
5262
+ _defineProperty(this, "getJobType", async () => {
5315
5263
  try {
5316
- var res = yield maintenanceActions.getJobType(_this.props.auth.site, _this.state.jobTypeId);
5317
- var {
5264
+ const res = await maintenanceActions.getJobType(this.props.auth.site, this.state.jobTypeId);
5265
+ const {
5318
5266
  typeName,
5319
5267
  email,
5320
5268
  description,
@@ -5322,7 +5270,7 @@ class AddJobType extends Component {
5322
5270
  hasCustomFields,
5323
5271
  customFields
5324
5272
  } = res.data;
5325
- _this.setState({
5273
+ this.setState({
5326
5274
  jobTypeName: typeName,
5327
5275
  jobTypeEmail: email,
5328
5276
  jobTypeDescription: description,
@@ -5333,19 +5281,19 @@ class AddJobType extends Component {
5333
5281
  } catch (error) {
5334
5282
  console.error("getJobType", error);
5335
5283
  }
5336
- }));
5284
+ });
5337
5285
  _defineProperty(this, "getFieldTypeTitle", type => {
5338
- var fieldType = this.fieldTypes.find(f => f.Key === type);
5286
+ const fieldType = this.fieldTypes.find(f => f.Key === type);
5339
5287
  return fieldType ? fieldType.Title : "";
5340
5288
  });
5341
5289
  _defineProperty(this, "validateEmail", () => {
5342
- var {
5290
+ const {
5343
5291
  jobTypeEmail
5344
5292
  } = this.state;
5345
5293
  return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
5346
5294
  });
5347
5295
  _defineProperty(this, "isJobTypeValid", () => {
5348
- var {
5296
+ const {
5349
5297
  jobTypeName,
5350
5298
  jobTypeDescription
5351
5299
  } = this.state;
@@ -5361,7 +5309,7 @@ class AddJobType extends Component {
5361
5309
  this.setState(stateChange);
5362
5310
  });
5363
5311
  _defineProperty(this, "onFieldTypeChanged", (fieldIndex, key) => {
5364
- var customFields = [...this.state.customFields];
5312
+ const customFields = [...this.state.customFields];
5365
5313
  if (customFields[fieldIndex].type === key) return;
5366
5314
  customFields[fieldIndex] = _.cloneDeep(DEFAULT_FIELD);
5367
5315
  customFields[fieldIndex].type = key;
@@ -5370,21 +5318,21 @@ class AddJobType extends Component {
5370
5318
  });
5371
5319
  });
5372
5320
  _defineProperty(this, "onFieldLabelChanged", (fieldIndex, event) => {
5373
- var customFields = [...this.state.customFields];
5321
+ const customFields = [...this.state.customFields];
5374
5322
  customFields[fieldIndex].label = event.target.value;
5375
5323
  this.setState({
5376
5324
  customFields
5377
5325
  });
5378
5326
  });
5379
5327
  _defineProperty(this, "onFieldPlaceHolderChanged", (fieldIndex, event) => {
5380
- var customFields = [...this.state.customFields];
5328
+ const customFields = [...this.state.customFields];
5381
5329
  customFields[fieldIndex].placeHolder = event.target.value;
5382
5330
  this.setState({
5383
5331
  customFields
5384
5332
  });
5385
5333
  });
5386
5334
  _defineProperty(this, "onFieldMandatoryChanged", fieldIndex => {
5387
- var customFields = [...this.state.customFields];
5335
+ const customFields = [...this.state.customFields];
5388
5336
  customFields[fieldIndex].mandatory = !customFields[fieldIndex].mandatory;
5389
5337
  if (!customFields[fieldIndex].mandatory) {
5390
5338
  // If a field is not mandatory, it cannot be a title field
@@ -5395,7 +5343,7 @@ class AddJobType extends Component {
5395
5343
  });
5396
5344
  });
5397
5345
  _defineProperty(this, "onFieldIsTitleChanged", fieldIndex => {
5398
- var customFields = [...this.state.customFields];
5346
+ const customFields = [...this.state.customFields];
5399
5347
  customFields[fieldIndex].isTitle = !customFields[fieldIndex].isTitle;
5400
5348
  if (customFields[fieldIndex].isTitle) {
5401
5349
  // If a field is title field, force mandatory
@@ -5406,33 +5354,33 @@ class AddJobType extends Component {
5406
5354
  });
5407
5355
  });
5408
5356
  _defineProperty(this, "onFieldOptionChanged", (fieldIndex, optionIndex, event) => {
5409
- var customFields = [...this.state.customFields];
5410
- var prevValue = customFields[fieldIndex].values[optionIndex];
5357
+ const customFields = [...this.state.customFields];
5358
+ const prevValue = customFields[fieldIndex].values[optionIndex];
5411
5359
  customFields[fieldIndex].values[optionIndex] = event.target.value;
5412
5360
  // Change corresponding validation if exists
5413
- var validations = customFields[fieldIndex].validation;
5414
- var validation = validations ? validations.find(val => val.value === prevValue) : null;
5361
+ const validations = customFields[fieldIndex].validation;
5362
+ let validation = validations ? validations.find(val => val.value === prevValue) : null;
5415
5363
  if (validation) validation.value = event.target.value;
5416
5364
  this.setState({
5417
5365
  customFields
5418
5366
  });
5419
5367
  });
5420
5368
  _defineProperty(this, "onAddNewOption", fieldIndex => {
5421
- var customFields = [...this.state.customFields];
5369
+ const customFields = [...this.state.customFields];
5422
5370
  customFields[fieldIndex].values.push("");
5423
5371
  this.setState({
5424
5372
  customFields
5425
5373
  });
5426
5374
  });
5427
5375
  _defineProperty(this, "onRemoveOption", (fieldIndex, optionIndex) => {
5428
- var customFields = [...this.state.customFields];
5376
+ const customFields = [...this.state.customFields];
5429
5377
  customFields[fieldIndex].values.splice(optionIndex, 1);
5430
5378
  this.setState({
5431
5379
  customFields
5432
5380
  });
5433
5381
  });
5434
5382
  _defineProperty(this, "onAddNewField", () => {
5435
- var customFields = [...this.state.customFields];
5383
+ const customFields = [...this.state.customFields];
5436
5384
  customFields.push(_.cloneDeep(DEFAULT_FIELD));
5437
5385
  this.setState({
5438
5386
  customFields
@@ -5440,17 +5388,17 @@ class AddJobType extends Component {
5440
5388
  });
5441
5389
  _defineProperty(this, "onMoveFieldPrev", fieldIndex => {
5442
5390
  if (fieldIndex === 0) return;
5443
- var customFields = [...this.state.customFields];
5444
- var item = customFields.splice(fieldIndex, 1)[0];
5391
+ const customFields = [...this.state.customFields];
5392
+ const item = customFields.splice(fieldIndex, 1)[0];
5445
5393
  customFields.splice(fieldIndex - 1, 0, item);
5446
5394
  this.setState({
5447
5395
  customFields
5448
5396
  });
5449
5397
  });
5450
5398
  _defineProperty(this, "onMoveFieldNext", fieldIndex => {
5451
- var customFields = [...this.state.customFields];
5399
+ const customFields = [...this.state.customFields];
5452
5400
  if (fieldIndex > customFields.length - 1) return;
5453
- var item = customFields.splice(fieldIndex, 1)[0];
5401
+ const item = customFields.splice(fieldIndex, 1)[0];
5454
5402
  customFields.splice(fieldIndex + 1, 0, item);
5455
5403
  this.setState({
5456
5404
  customFields
@@ -5460,10 +5408,10 @@ class AddJobType extends Component {
5460
5408
  window.history.back();
5461
5409
  });
5462
5410
  _defineProperty(this, "onSave", () => {
5463
- var {
5411
+ const {
5464
5412
  site
5465
5413
  } = this.props.auth;
5466
- var {
5414
+ const {
5467
5415
  submitting,
5468
5416
  jobTypeId,
5469
5417
  jobTypeName,
@@ -5482,26 +5430,26 @@ class AddJobType extends Component {
5482
5430
  }
5483
5431
  this.setState({
5484
5432
  submitting: true
5485
- }, /*#__PURE__*/_asyncToGenerator(function* () {
5433
+ }, async () => {
5486
5434
  try {
5487
5435
  if (jobTypeId) {
5488
- yield maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5436
+ await maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5489
5437
  } else {
5490
- yield maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5438
+ await maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel, hasCustomFields, customFields);
5491
5439
  }
5492
- _this.props.jobTypesUpdate(site);
5493
- _this.setState({
5440
+ this.props.jobTypesUpdate(site);
5441
+ this.setState({
5494
5442
  submitting: false,
5495
5443
  success: true
5496
5444
  });
5497
5445
  } catch (error) {
5498
5446
  console.error("onSave", error);
5499
- _this.setState({
5447
+ this.setState({
5500
5448
  submitting: false
5501
5449
  });
5502
5450
  alert("Something went wrong with the request. Please try again.");
5503
5451
  }
5504
- }));
5452
+ });
5505
5453
  });
5506
5454
  this.fieldTypes = [{
5507
5455
  Title: "Text Input",
@@ -5562,7 +5510,7 @@ class AddJobType extends Component {
5562
5510
  if (this.state.jobTypeId) this.getJobType();
5563
5511
  }
5564
5512
  validateCustomFields() {
5565
- var {
5513
+ const {
5566
5514
  submitting,
5567
5515
  hasCustomFields,
5568
5516
  customFields
@@ -5570,13 +5518,13 @@ class AddJobType extends Component {
5570
5518
  if (submitting) return false;
5571
5519
 
5572
5520
  // Validate custom fields
5573
- var warnings = [];
5521
+ const warnings = [];
5574
5522
  if (hasCustomFields) {
5575
- var missingLabel = false;
5576
- var hasMandatoryField = false;
5577
- var titleFieldCount = 0;
5523
+ let missingLabel = false;
5524
+ let hasMandatoryField = false;
5525
+ let titleFieldCount = 0;
5578
5526
  customFields.forEach(field => {
5579
- var {
5527
+ const {
5580
5528
  type,
5581
5529
  label,
5582
5530
  values,
@@ -5608,7 +5556,7 @@ class AddJobType extends Component {
5608
5556
  return warnings.length === 0;
5609
5557
  }
5610
5558
  onRemoveField(fieldIndex) {
5611
- var customFields = [...this.state.customFields];
5559
+ const customFields = [...this.state.customFields];
5612
5560
  if (customFields.length < 2) return;
5613
5561
  customFields.splice(fieldIndex, 1);
5614
5562
  this.setState({
@@ -5616,7 +5564,7 @@ class AddJobType extends Component {
5616
5564
  });
5617
5565
  }
5618
5566
  renderBaseForm() {
5619
- var {
5567
+ const {
5620
5568
  success,
5621
5569
  jobTypeId,
5622
5570
  showWarnings,
@@ -5799,7 +5747,7 @@ class AddJobType extends Component {
5799
5747
  });
5800
5748
  }
5801
5749
  renderFieldMultiple(field, fieldIndex) {
5802
- var {
5750
+ const {
5803
5751
  customFields
5804
5752
  } = this.state;
5805
5753
  return /*#__PURE__*/jsxs("div", {
@@ -5870,7 +5818,7 @@ class AddJobType extends Component {
5870
5818
  });
5871
5819
  }
5872
5820
  renderFieldCheckbox(field, fieldIndex) {
5873
- var {
5821
+ const {
5874
5822
  customFields
5875
5823
  } = this.state;
5876
5824
  return /*#__PURE__*/jsxs("div", {
@@ -5965,10 +5913,10 @@ class AddJobType extends Component {
5965
5913
  });
5966
5914
  }
5967
5915
  renderField(field, fieldIndex) {
5968
- var {
5916
+ const {
5969
5917
  customFields
5970
5918
  } = this.state;
5971
- var renderFieldContent = () => {
5919
+ const renderFieldContent = () => {
5972
5920
  switch (field.type) {
5973
5921
  case "text":
5974
5922
  case "email":
@@ -6052,7 +6000,7 @@ class AddJobType extends Component {
6052
6000
  }, fieldIndex);
6053
6001
  }
6054
6002
  renderCustomForm() {
6055
- var {
6003
+ const {
6056
6004
  success,
6057
6005
  hasCustomFields,
6058
6006
  customFields
@@ -6087,7 +6035,7 @@ class AddJobType extends Component {
6087
6035
  });
6088
6036
  }
6089
6037
  renderWarnings() {
6090
- var {
6038
+ const {
6091
6039
  showWarnings,
6092
6040
  warnings
6093
6041
  } = this.state;
@@ -6109,7 +6057,7 @@ class AddJobType extends Component {
6109
6057
  });
6110
6058
  }
6111
6059
  renderSuccess() {
6112
- var {
6060
+ const {
6113
6061
  success,
6114
6062
  jobTypeId
6115
6063
  } = this.state;
@@ -6150,7 +6098,7 @@ class AddJobType extends Component {
6150
6098
  });
6151
6099
  }
6152
6100
  render() {
6153
- var {
6101
+ const {
6154
6102
  success
6155
6103
  } = this.state;
6156
6104
  return /*#__PURE__*/jsxs(Components$1.OverlayPage, {
@@ -6169,8 +6117,8 @@ class AddJobType extends Component {
6169
6117
  });
6170
6118
  }
6171
6119
  }
6172
- var mapStateToProps$1 = state => {
6173
- var {
6120
+ const mapStateToProps$1 = state => {
6121
+ const {
6174
6122
  auth
6175
6123
  } = state;
6176
6124
  return {
@@ -6184,14 +6132,14 @@ var AddJobType$1 = connect(mapStateToProps$1, {
6184
6132
 
6185
6133
  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; }
6186
6134
  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; }
6187
- var {
6135
+ const {
6188
6136
  Analytics: Analytics$1,
6189
6137
  Session,
6190
6138
  Components,
6191
6139
  Helper,
6192
6140
  Colours
6193
6141
  } = PlussCore;
6194
- var getInitialState = () => ({
6142
+ const getInitialState = () => ({
6195
6143
  requests: 0,
6196
6144
  prevRequests: 0,
6197
6145
  completedRequests: 0,
@@ -6202,8 +6150,8 @@ var getInitialState = () => ({
6202
6150
  });
6203
6151
 
6204
6152
  // AnalyticsHub Component
6205
- var AnalyticsHub = _ref => {
6206
- var {
6153
+ const AnalyticsHub = _ref => {
6154
+ let {
6207
6155
  startTime,
6208
6156
  endTime,
6209
6157
  auth,
@@ -6214,27 +6162,27 @@ var AnalyticsHub = _ref => {
6214
6162
  userCategory,
6215
6163
  selectedSites
6216
6164
  } = _ref;
6217
- var [analyticsData, setAnalyticsData] = useState(getInitialState());
6218
- var [isExportOpen, setIsExportOpen] = useState(false);
6219
- var [failedSites, setFailedSites] = useState([]);
6220
- var [comparisonData, setComparisonData] = useState({
6165
+ const [analyticsData, setAnalyticsData] = useState(getInitialState());
6166
+ const [isExportOpen, setIsExportOpen] = useState(false);
6167
+ const [failedSites, setFailedSites] = useState([]);
6168
+ const [comparisonData, setComparisonData] = useState({
6221
6169
  requests: [],
6222
6170
  completedRequests: [],
6223
6171
  comments: [],
6224
6172
  isLoading: true
6225
6173
  });
6226
- var comparisonMode = selectedSites && selectedSites.length > 1;
6227
- var hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6174
+ const comparisonMode = selectedSites && selectedSites.length > 1;
6175
+ const hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6228
6176
  if (!hasAccess) {
6229
6177
  return null;
6230
6178
  }
6231
- var featureTitle = (key => {
6179
+ const featureTitle = (key => {
6232
6180
  if (!strings || !strings.sideNav || !strings.sideNav[key]) {
6233
6181
  return values.textMenuTitle;
6234
6182
  }
6235
6183
  return strings.sideNav[key];
6236
6184
  })();
6237
- var exportColumns = [{
6185
+ const exportColumns = [{
6238
6186
  label: "Select All",
6239
6187
  key: ""
6240
6188
  }, ...(comparisonMode ? [{
@@ -6259,104 +6207,94 @@ var AnalyticsHub = _ref => {
6259
6207
  useEffect(() => {
6260
6208
  getData();
6261
6209
  }, [startTime, endTime, userType, userCategory, selectedSites]);
6262
- var getData = /*#__PURE__*/function () {
6263
- var _ref2 = _asyncToGenerator(function* () {
6264
- try {
6265
- setFailedSites([]);
6266
- if (comparisonMode) {
6267
- setComparisonData({
6268
- requests: [],
6269
- completedRequests: [],
6270
- comments: [],
6271
- isLoading: true
6272
- });
6273
- var multiSiteResultsObj = yield Analytics$1.fetchMultiSiteData(selectedSites, /*#__PURE__*/function () {
6274
- var _ref3 = _asyncToGenerator(function* (site) {
6275
- var {
6276
- data
6277
- } = yield analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6278
- userType,
6279
- userCategory
6280
- });
6281
- return data;
6282
- });
6283
- return function (_x) {
6284
- return _ref3.apply(this, arguments);
6285
- };
6286
- }());
6287
- var roles = auth.user.Roles;
6288
- var failed = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6289
- var [, data] = _ref4;
6290
- return data === null;
6291
- }).map(_ref5 => {
6292
- var [site] = _ref5;
6293
- return Helper.getSiteNameFromRoles(site, roles);
6294
- });
6295
- setFailedSites(failed);
6296
- var multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref6 => {
6297
- var [, data] = _ref6;
6298
- return data !== null;
6299
- }).map(_ref7 => {
6300
- var [site, data] = _ref7;
6301
- return {
6302
- site,
6303
- data
6304
- };
6305
- });
6306
- var buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6307
- name: Helper.getSiteNameFromRoles(result.site, roles),
6308
- value: Analytics$1.countActivities(result.data, activityKey, countType)
6309
- }));
6310
- setComparisonData({
6311
- requests: buildComparison("Request", "total"),
6312
- completedRequests: buildComparison("RequestCompleted", "unique"),
6313
- comments: buildComparison("Comment", "total"),
6314
- isLoading: false
6315
- });
6316
- } else {
6317
- setAnalyticsData(getInitialState());
6318
- var site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6319
- var timeDifference = endTime - startTime;
6320
- var [currentStatsResponse, prevStatsResponse] = yield Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6321
- userType,
6322
- userCategory
6323
- }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6210
+ const getData = async () => {
6211
+ try {
6212
+ setFailedSites([]);
6213
+ if (comparisonMode) {
6214
+ setComparisonData({
6215
+ requests: [],
6216
+ completedRequests: [],
6217
+ comments: [],
6218
+ isLoading: true
6219
+ });
6220
+ const multiSiteResultsObj = await Analytics$1.fetchMultiSiteData(selectedSites, async site => {
6221
+ const {
6222
+ data
6223
+ } = await analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6324
6224
  userType,
6325
6225
  userCategory
6326
- })]);
6327
- var data = {
6328
- requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6329
- prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6330
- completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6331
- prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6332
- comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6333
- prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6334
- isLoading: false
6226
+ });
6227
+ return data;
6228
+ });
6229
+ const roles = auth.user.Roles;
6230
+ const failed = Object.entries(multiSiteResultsObj).filter(_ref2 => {
6231
+ let [, data] = _ref2;
6232
+ return data === null;
6233
+ }).map(_ref3 => {
6234
+ let [site] = _ref3;
6235
+ return Helper.getSiteNameFromRoles(site, roles);
6236
+ });
6237
+ setFailedSites(failed);
6238
+ const multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6239
+ let [, data] = _ref4;
6240
+ return data !== null;
6241
+ }).map(_ref5 => {
6242
+ let [site, data] = _ref5;
6243
+ return {
6244
+ site,
6245
+ data
6335
6246
  };
6336
- setAnalyticsData(data);
6337
- }
6338
- } catch (err) {
6339
- if (comparisonMode) {
6340
- setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6341
- isLoading: false
6342
- }));
6343
- } else {
6344
- setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6345
- isLoading: false
6346
- }));
6347
- }
6247
+ });
6248
+ const buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6249
+ name: Helper.getSiteNameFromRoles(result.site, roles),
6250
+ value: Analytics$1.countActivities(result.data, activityKey, countType)
6251
+ }));
6252
+ setComparisonData({
6253
+ requests: buildComparison("Request", "total"),
6254
+ completedRequests: buildComparison("RequestCompleted", "unique"),
6255
+ comments: buildComparison("Comment", "total"),
6256
+ isLoading: false
6257
+ });
6258
+ } else {
6259
+ setAnalyticsData(getInitialState());
6260
+ const site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6261
+ const timeDifference = endTime - startTime;
6262
+ const [currentStatsResponse, prevStatsResponse] = await Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6263
+ userType,
6264
+ userCategory
6265
+ }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6266
+ userType,
6267
+ userCategory
6268
+ })]);
6269
+ const data = {
6270
+ requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6271
+ prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6272
+ completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6273
+ prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6274
+ comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6275
+ prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6276
+ isLoading: false
6277
+ };
6278
+ setAnalyticsData(data);
6348
6279
  }
6349
- });
6350
- return function getData() {
6351
- return _ref2.apply(this, arguments);
6352
- };
6353
- }();
6354
- var isReadyToOpenCSV = () => {
6280
+ } catch (err) {
6281
+ if (comparisonMode) {
6282
+ setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6283
+ isLoading: false
6284
+ }));
6285
+ } else {
6286
+ setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6287
+ isLoading: false
6288
+ }));
6289
+ }
6290
+ }
6291
+ };
6292
+ const isReadyToOpenCSV = () => {
6355
6293
  return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
6356
6294
  };
6357
- var getExportSource = () => {
6295
+ const getExportSource = () => {
6358
6296
  if (comparisonMode) {
6359
- var sites = comparisonData.requests || [];
6297
+ const sites = comparisonData.requests || [];
6360
6298
  return sites.map((site, i) => ({
6361
6299
  site: site.name,
6362
6300
  startDate: moment(startTime + 1).format("D-MM-YYYY"),
@@ -6374,12 +6312,12 @@ var AnalyticsHub = _ref => {
6374
6312
  comments: analyticsData.comments
6375
6313
  }];
6376
6314
  };
6377
- var csvPopup = () => {
6315
+ const csvPopup = () => {
6378
6316
  if (!isExportOpen) {
6379
6317
  return null;
6380
6318
  }
6381
- var source = getExportSource();
6382
- var filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6319
+ const source = getExportSource();
6320
+ const filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6383
6321
  return /*#__PURE__*/jsx(Components.ExportCsvPopup, {
6384
6322
  onClose: () => {
6385
6323
  setIsExportOpen(false);
@@ -6417,7 +6355,7 @@ var AnalyticsHub = _ref => {
6417
6355
  }), /*#__PURE__*/jsx("div", {
6418
6356
  className: "analyticsSection dashboardSection_content",
6419
6357
  children: (() => {
6420
- var chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6358
+ const chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6421
6359
  if (comparisonMode) {
6422
6360
  return /*#__PURE__*/jsxs("div", {
6423
6361
  style: {
@@ -6477,8 +6415,8 @@ var AnalyticsHub = _ref => {
6477
6415
  })]
6478
6416
  });
6479
6417
  };
6480
- var mapStateToProps = state => {
6481
- var {
6418
+ const mapStateToProps = state => {
6419
+ const {
6482
6420
  auth
6483
6421
  } = state;
6484
6422
  return {
@@ -6486,11 +6424,11 @@ var mapStateToProps = state => {
6486
6424
  strings: state.strings && state.strings.config || {}
6487
6425
  };
6488
6426
  };
6489
- var toExport = connect(mapStateToProps, {})(AnalyticsHub);
6427
+ const toExport = connect(mapStateToProps, {})(AnalyticsHub);
6490
6428
 
6491
6429
  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; }
6492
6430
  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; }
6493
- var INITIAL_STATE = {
6431
+ const INITIAL_STATE = {
6494
6432
  jobs: [],
6495
6433
  jobtypes: [],
6496
6434
  jobstatuses: jobStatusOptions,
@@ -6498,15 +6436,15 @@ var INITIAL_STATE = {
6498
6436
  hideSeen: false
6499
6437
  };
6500
6438
  var MaintenanceReducer = (function () {
6501
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
6502
- var action = arguments.length > 1 ? arguments[1] : undefined;
6439
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
6440
+ let action = arguments.length > 1 ? arguments[1] : undefined;
6503
6441
  switch (action.type) {
6504
6442
  case JOBS_LOADING:
6505
6443
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6506
6444
  loading: true
6507
6445
  });
6508
6446
  case JOBS_LOADED:
6509
- var result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6447
+ const result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6510
6448
  return v1 != null && v2 != null && v1.id === v2.id;
6511
6449
  });
6512
6450
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
@@ -6516,11 +6454,11 @@ var MaintenanceReducer = (function () {
6516
6454
  loading: false
6517
6455
  });
6518
6456
  case JOBS_REMOVED:
6519
- var index = _.findIndex(state.jobs, event => {
6457
+ const index = _.findIndex(state.jobs, event => {
6520
6458
  return event != null && event.id === action.payload;
6521
6459
  });
6522
6460
  if (index > -1) {
6523
- var newJobs = [...state.jobs];
6461
+ const newJobs = [...state.jobs];
6524
6462
  newJobs.splice(index, 1);
6525
6463
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6526
6464
  jobs: newJobs
@@ -6528,14 +6466,14 @@ var MaintenanceReducer = (function () {
6528
6466
  }
6529
6467
  return state;
6530
6468
  case JOBS_TYPES_LOADED:
6531
- var jobtypes = _.unionWith(action.payload, state.jobtypes, (v1, v2) => {
6469
+ const jobtypes = _.unionWith(action.payload, state.jobtypes, (v1, v2) => {
6532
6470
  return v1 != null && v2 != null && v1.id === v2.id;
6533
6471
  });
6534
6472
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6535
6473
  jobtypes
6536
6474
  });
6537
6475
  case JOBS_STATUSES_LOADED:
6538
- var jobstatuses = _.orderBy(action.payload, "order", "asc");
6476
+ const jobstatuses = _.orderBy(action.payload, "order", "asc");
6539
6477
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6540
6478
  jobstatuses
6541
6479
  });
@@ -6550,7 +6488,7 @@ var MaintenanceReducer = (function () {
6550
6488
 
6551
6489
  class ActivityText extends Component {
6552
6490
  render() {
6553
- var {
6491
+ const {
6554
6492
  data,
6555
6493
  classes,
6556
6494
  clickableClasses,
@@ -6628,7 +6566,7 @@ var img$6 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxwAAAGGCAYAAADxZYcEA
6628
6566
 
6629
6567
  class ViewWidget extends Component {
6630
6568
  render() {
6631
- var src = img$7;
6569
+ let src = img$7;
6632
6570
  {
6633
6571
  src = img$6;
6634
6572
  }
@@ -6639,7 +6577,7 @@ class ViewWidget extends Component {
6639
6577
  });
6640
6578
  }
6641
6579
  }
6642
- var styles$3 = {
6580
+ const styles$3 = {
6643
6581
  image: {
6644
6582
  width: 80
6645
6583
  }
@@ -6651,7 +6589,7 @@ var img$4 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmAAAASICAYAAAC0rHMFA
6651
6589
 
6652
6590
  class ViewFull extends Component {
6653
6591
  render() {
6654
- var src = img$5;
6592
+ let src = img$5;
6655
6593
  {
6656
6594
  src = img$4;
6657
6595
  }
@@ -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%",
@@ -6678,12 +6616,12 @@ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
6678
6616
  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; }
6679
6617
  class PreviewWidget extends Component {
6680
6618
  render() {
6681
- var {
6619
+ const {
6682
6620
  backgroundColor,
6683
6621
  widgetTitle,
6684
6622
  titleClassName
6685
6623
  } = this.props;
6686
- var src = img$3;
6624
+ let src = img$3;
6687
6625
  {
6688
6626
  src = img$2;
6689
6627
  }
@@ -6703,7 +6641,7 @@ class PreviewWidget extends Component {
6703
6641
  });
6704
6642
  }
6705
6643
  }
6706
- var styles$1 = {
6644
+ const styles$1 = {
6707
6645
  container: {
6708
6646
  position: "relative"
6709
6647
  },
@@ -6720,12 +6658,12 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6720
6658
  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; }
6721
6659
  class PreviewFull extends Component {
6722
6660
  render() {
6723
- var {
6661
+ const {
6724
6662
  backgroundColor,
6725
6663
  widgetTitle,
6726
6664
  titleClassName
6727
6665
  } = this.props;
6728
- var src = img$1;
6666
+ let src = img$1;
6729
6667
  {
6730
6668
  src = img;
6731
6669
  }
@@ -6744,7 +6682,7 @@ class PreviewFull extends Component {
6744
6682
  });
6745
6683
  }
6746
6684
  }
6747
- var styles = {
6685
+ const styles = {
6748
6686
  container: {
6749
6687
  position: "relative"
6750
6688
  },
@@ -6753,11 +6691,11 @@ var styles = {
6753
6691
  }
6754
6692
  };
6755
6693
 
6756
- var SVG_PATH = values.svgPathGridIcon;
6757
- var SVG_VIEWBOX = values.svgPathGridIconViewBox ;
6694
+ const SVG_PATH = values.svgPathGridIcon;
6695
+ const SVG_VIEWBOX = values.svgPathGridIconViewBox ;
6758
6696
  class PreviewGrid extends Component {
6759
6697
  render() {
6760
- var {
6698
+ const {
6761
6699
  colour
6762
6700
  } = this.props;
6763
6701
  if (Array.isArray(SVG_PATH)) {
@@ -6784,20 +6722,20 @@ class PreviewGrid extends Component {
6784
6722
  }
6785
6723
  }
6786
6724
 
6787
- var Reducers = (() => {
6788
- var reducers = {};
6725
+ const Reducers = (() => {
6726
+ const reducers = {};
6789
6727
  reducers[values.reducerKey] = MaintenanceReducer;
6790
6728
  return reducers;
6791
6729
  })();
6792
- var Screens = (() => {
6793
- var screens = {};
6730
+ const Screens = (() => {
6731
+ const screens = {};
6794
6732
  screens[values.screenRequestsHub] = RequestsHub$1;
6795
6733
  screens[values.screenJob] = Job$1;
6796
6734
  screens[values.screenAddJob] = AddJob$1;
6797
6735
  screens[values.screenAddJobType] = AddJobType$1;
6798
6736
  return screens;
6799
6737
  })();
6800
- var Analytics = [toExport];
6738
+ const Analytics = [toExport];
6801
6739
 
6802
6740
  export { ActivityText, Analytics, FeatureConfig as Config, PreviewFull, PreviewGrid, PreviewWidget, Reducers, Screens, ViewFull, ViewWidget };
6803
6741
  //# sourceMappingURL=index.js.map