@plusscommunities/pluss-maintenance-web-feedback 1.2.4-beta.2 → 1.3.0-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,123 +1,88 @@
1
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
3
  import { Component, useState, useEffect } from 'react';
2
4
  import { connect } from 'react-redux';
3
5
  import { withRouter } from 'react-router';
4
6
  import _ from 'lodash';
5
7
  import moment from 'moment';
6
- import FontAwesome from 'react-fontawesome';
8
+ import { Icon } from '@plusscommunities/pluss-icons';
7
9
  import * as PlussCore from '@plusscommunities/pluss-core-web';
8
- import { Colours as Colours$3 } from '@plusscommunities/pluss-core-web';
9
- import { Table, DropdownItem, DropdownButton } from 'react-bootstrap';
10
+ import { PERMISSION_CATEGORIES, IMPORTANCE_LEVELS, Colours as Colours$4 } from '@plusscommunities/pluss-core-web';
11
+ import { Table, MenuItem, DropdownButton } from 'react-bootstrap';
10
12
  import { Link } from 'react-router-dom';
11
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
14
  import Textarea from 'react-textarea-autosize';
13
- import { faWrench, faCircleCheck, faComment } from '@fortawesome/free-solid-svg-icons';
14
-
15
- function _typeof(o) {
16
- "@babel/helpers - typeof";
17
-
18
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19
- return typeof o;
20
- } : function (o) {
21
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
22
- }, _typeof(o);
23
- }
24
-
25
- function toPrimitive(t, r) {
26
- if ("object" != _typeof(t) || !t) return t;
27
- var e = t[Symbol.toPrimitive];
28
- if (void 0 !== e) {
29
- var i = e.call(t, r || "default");
30
- if ("object" != _typeof(i)) return i;
31
- throw new TypeError("@@toPrimitive must return a primitive value.");
32
- }
33
- return ("string" === r ? String : Number)(t);
34
- }
35
-
36
- function toPropertyKey(t) {
37
- var i = toPrimitive(t, "string");
38
- return "symbol" == _typeof(i) ? i : i + "";
39
- }
40
-
41
- function _defineProperty(e, r, t) {
42
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
43
- value: t,
44
- enumerable: !0,
45
- configurable: !0,
46
- writable: !0
47
- }) : e[r] = t, e;
48
- }
49
15
 
50
16
  var values = {
51
- featureKey: 'maintenanceFeedback',
52
- aliases: ['maintenanceTrackingFeedback', 'maintenanceTypesFeedback', 'maintenancerequestFeedback'],
53
- serviceKey: 'maintenanceFeedback',
54
- reducerKey: 'maintenanceFeedback',
55
- analyticsKey: 'maintenancerequestFeedback',
56
- commentKey: 'maintenancerequestFeedback',
57
- actionJobsLoaded: 'JOBS_LOADEDFeedback',
58
- actionJobsAdded: 'JOBS_ADDEDFeedback',
59
- actionJobsRemoved: 'JOBS_REMOVEDFeedback',
60
- actionJobsTypesLoaded: 'JOBS_TYPES_LOADEDFeedback',
61
- actionJobsStatusesLoaded: 'JOBS_STATUSES_LOADEDFeedback',
62
- actionJobsHideSeen: 'JOBS_HIDE_SEENFeedback',
63
- actionJobsLoading: 'JOBS_LOADINGFeedback',
64
- permissionMaintenanceTracking: 'maintenanceTrackingFeedback',
65
- permissionMaintenanceTypes: 'maintenanceTypesFeedback',
66
- permissionMaintenanceAssignment: 'maintenanceAssignmentFeedback',
67
- activityMaintenanceJobStatusChanged: 'MaintenanceJobStatusChangedFeedback',
68
- activityAddMaintenanceJob: 'AddMaintenanceJobFeedback',
69
- activityEditMaintenanceJob: 'EditMaintenanceJobFeedback',
70
- activityDeleteMaintenanceJob: 'DeleteMaintenanceJobFeedback',
71
- routeRequestsHub: '/requestsHubFeedback',
72
- routeAddRequest: '/requestsHubFeedback/job',
73
- routeAddRequestType: '/requestsHubFeedback/requestType',
74
- routeRequestDetails: '/requestsHubFeedback/jobDetails',
75
- routeRequestTypes: '/requestTypesFeedback',
76
- screenRequestsHub: 'RequestsHubFeedback',
77
- screenAddJob: 'AddJobFeedback',
78
- screenAddJobType: 'AddJobTypeFeedback',
79
- screenJob: 'JobFeedback',
80
- screenJobTypes: 'JobTypesFeedback',
81
- menuIcon: 'form',
17
+ featureKey: "maintenanceFeedback",
18
+ aliases: ["maintenanceTrackingFeedback", "maintenanceTypesFeedback", "maintenancerequestFeedback"],
19
+ serviceKey: "maintenanceFeedback",
20
+ reducerKey: "maintenanceFeedback",
21
+ analyticsKey: "maintenancerequestFeedback",
22
+ commentKey: "maintenancerequestFeedback",
23
+ actionJobsLoaded: "JOBS_LOADEDFeedback",
24
+ actionJobsRemoved: "JOBS_REMOVEDFeedback",
25
+ actionJobsTypesLoaded: "JOBS_TYPES_LOADEDFeedback",
26
+ actionJobsStatusesLoaded: "JOBS_STATUSES_LOADEDFeedback",
27
+ actionJobsHideSeen: "JOBS_HIDE_SEENFeedback",
28
+ actionJobsLoading: "JOBS_LOADINGFeedback",
29
+ permissionMaintenanceTracking: "maintenanceTrackingFeedback",
30
+ permissionMaintenanceTypes: "maintenanceTypesFeedback",
31
+ permissionMaintenanceAssignment: "maintenanceAssignmentFeedback",
32
+ activityMaintenanceJobStatusChanged: "MaintenanceJobStatusChangedFeedback",
33
+ activityAddMaintenanceJob: "AddMaintenanceJobFeedback",
34
+ activityEditMaintenanceJob: "EditMaintenanceJobFeedback",
35
+ activityDeleteMaintenanceJob: "DeleteMaintenanceJobFeedback",
36
+ routeRequestsHub: "/requestsHubFeedback",
37
+ routeAddRequest: "/requestsHubFeedback/job",
38
+ routeAddRequestType: "/requestsHubFeedback/requestType",
39
+ routeRequestDetails: "/requestsHubFeedback/jobDetails",
40
+ routeRequestTypes: "/requestTypesFeedback",
41
+ screenRequestsHub: "RequestsHubFeedback",
42
+ screenAddJob: "AddJobFeedback",
43
+ screenAddJobType: "AddJobTypeFeedback",
44
+ screenJob: "JobFeedback",
45
+ screenJobTypes: "JobTypesFeedback",
46
+ menuIcon: "form",
82
47
  isFontAwesomeIcon: false,
83
48
  isSVGIcon: true,
84
- svgPathGridIcon: 'M164,152a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,152Zm-4-36H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm52-68V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V48A12,12,0,0,1,56,36H94.08a44,44,0,0,1,67.84,0H200A12,12,0,0,1,212,48ZM92,64v4h72V64a36,36,0,0,0-72,0ZM204,48a4,4,0,0,0-4-4H167.17A43.71,43.71,0,0,1,172,64v8a4,4,0,0,1-4,4H88a4,4,0,0,1-4-4V64a43.71,43.71,0,0,1,4.83-20H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200a4,4,0,0,0,4-4Z',
85
- svgPathGridIconViewBox: '0 0 256 256',
49
+ svgPathGridIcon: "M164,152a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,152Zm-4-36H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm52-68V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V48A12,12,0,0,1,56,36H94.08a44,44,0,0,1,67.84,0H200A12,12,0,0,1,212,48ZM92,64v4h72V64a36,36,0,0,0-72,0ZM204,48a4,4,0,0,0-4-4H167.17A43.71,43.71,0,0,1,172,64v8a4,4,0,0,1-4,4H88a4,4,0,0,1-4-4V64a43.71,43.71,0,0,1,4.83-20H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200a4,4,0,0,0,4-4Z",
50
+ svgPathGridIconViewBox: "0 0 256 256",
86
51
  menuOrder: 10,
87
- optionOnlyForResidents: 'onlyForResidentsMaintenanceFeedback',
88
- textEmptyDescription: 'allows your users to submit Feedback.',
89
- textEmptyExample: 'Example might be; General Feedback form, Complaint form, Compliment form.',
90
- textEmptyJobTypes: 'Please add the different forms.',
91
- textEmptyJobTypesExample: 'Example might be; General Feedback form, Complaint form, Compliment form.',
92
- textNewTypeButton: 'NEW FEEDBACK FORM',
93
- textTitleJobTypes: 'Feedback Forms',
94
- textJobType: 'Form',
95
- textAreYouSureYouWantToDelete: 'Are you sure you want to delete that feedback submission?',
96
- textAreYouSureYouWantToDeleteNote: 'Are you sure you want to delete that note?',
52
+ optionOnlyForResidents: "onlyForResidentsMaintenanceFeedback",
53
+ textEmptyDescription: "allows your users to submit Feedback.",
54
+ textEmptyExample: "Example might be; General Feedback form, Complaint form, Compliment form.",
55
+ textEmptyJobTypes: "Please add the different forms.",
56
+ textEmptyJobTypesExample: "Example might be; General Feedback form, Complaint form, Compliment form.",
57
+ textNewTypeButton: "NEW FEEDBACK FORM",
58
+ textTitleJobTypes: "Feedback Forms",
59
+ textJobType: "Form",
60
+ textAreYouSureYouWantToDelete: "Are you sure you want to delete that feedback submission?",
61
+ textAreYouSureYouWantToDeleteNote: "Are you sure you want to delete that note?",
97
62
  textChangedRequestStatus: "changed a feedback submission's status:",
98
- textAddedRequest: 'added a feedback submission:',
99
- textEditedRequest: 'edited a feedback submission:',
100
- textRemovedRequest: 'removed a feedback submission:',
101
- textSingularName: 'Feedback Submission',
102
- textYourRequestHere: 'Your Feedback Submissions will show here',
103
- textTitleRequests: 'Feedback Submissions',
104
- textMenuTitle: 'Feedback',
105
- textPermissionMaintenanceTracking: 'Manage Feedback Submissions',
106
- textPermissionManageMaintenanceTypes: 'Manage and Set Up Feedback Forms',
107
- textPermissionManageAssignedMaintenance: 'Manage Assigned Feedback Submissions',
108
- textHiddenSectionMaintenanceRequests: 'Feedback Submissions',
109
- keyHiddenSectionMaintenanceRequests: 'maintenanceRequestFeedback',
63
+ textAddedRequest: "added a feedback submission:",
64
+ textEditedRequest: "edited a feedback submission:",
65
+ textRemovedRequest: "removed a feedback submission:",
66
+ textSingularName: "Feedback Submission",
67
+ textYourRequestHere: "Your Feedback Submissions will show here",
68
+ textTitleRequests: "Feedback Submissions",
69
+ textMenuTitle: "Feedback",
70
+ textPermissionMaintenanceTracking: "Manage Feedback Submissions",
71
+ textPermissionManageMaintenanceTypes: "Manage and Set Up Feedback Forms",
72
+ textPermissionManageAssignedMaintenance: "Manage Assigned Feedback Submissions",
73
+ textHiddenSectionMaintenanceRequests: "Feedback Submissions",
74
+ keyHiddenSectionMaintenanceRequests: "maintenanceRequestFeedback",
110
75
  hasMoreSection: false,
111
- textMoreSectionMaintenance: 'Feedback',
112
- featureKeyMoreSectionMaintenance: 'maintenanceFeedback',
113
- optionKeyMoreSectionMaintenance: 'maintenanceRequestFeedback',
114
- hiddenKeyMoreSectionMaintenance: 'maintenanceRequestFeedback',
76
+ textMoreSectionMaintenance: "Feedback",
77
+ featureKeyMoreSectionMaintenance: "maintenanceFeedback",
78
+ optionKeyMoreSectionMaintenance: "maintenanceRequestFeedback",
79
+ hiddenKeyMoreSectionMaintenance: "maintenanceRequestFeedback",
115
80
  forceCustomFields: false,
116
- textEntityName: 'Feedback',
81
+ textEntityName: "Feedback",
117
82
  hasHelpButton: true,
118
- helpGuideURL: '',
119
- stringConfigJobStatus: 'maintenanceJobStatusFeedback',
120
- stringConfigHideSeen: 'maintenanceDisableSeenFeedback'
83
+ helpGuideURL: "",
84
+ stringConfigJobStatus: "maintenanceJobStatusFeedback",
85
+ stringConfigHideSeen: "maintenanceDisableSeenFeedback"
121
86
  };
122
87
 
123
88
  // import * as PlussCore from '../../pluss-core/src';
@@ -125,7 +90,7 @@ var FeatureConfig = {
125
90
  key: values.featureKey,
126
91
  aliases: values.aliases,
127
92
  singularName: values.textSingularName,
128
- description: 'Submit maintenance requests and track the progress.',
93
+ description: "Submit maintenance requests and track the progress.",
129
94
  emptyText: values.textYourRequestHere,
130
95
  widgetOptions: [{
131
96
  key: values.featureKey,
@@ -133,10 +98,10 @@ var FeatureConfig = {
133
98
  main: true,
134
99
  hideOnTabNumbers: [],
135
100
  optionKey: values.optionOnlyForResidents,
136
- type: 'toggle',
101
+ type: "toggle",
137
102
  inverseOption: false,
138
- title: 'Limit Admins to Only Submit on Behalf of Primary Users',
139
- description: 'This will limit admins to only make a submission on behalf of a primary users in the site. Otherwise they can also submit on behalf of other admins/staff users.',
103
+ title: "Limit Admins to Only Submit on Behalf of Primary Users",
104
+ description: "This will limit admins to only make a submission on behalf of a primary users in the site. Otherwise they can also submit on behalf of other admins/staff users.",
140
105
  defaultNew: false,
141
106
  default: false
142
107
  }],
@@ -149,20 +114,20 @@ var FeatureConfig = {
149
114
  url: values.routeRequestsHub,
150
115
  countProps: null,
151
116
  visibleExps: {
152
- type: 'and',
117
+ type: "and",
153
118
  exps: [{
154
- type: 'feature',
119
+ type: "feature",
155
120
  value: values.featureKey
156
121
  }, {
157
- type: 'or',
122
+ type: "or",
158
123
  exps: [{
159
- type: 'permission',
124
+ type: "permission",
160
125
  value: values.permissionMaintenanceTracking
161
126
  }, {
162
- type: 'permission',
127
+ type: "permission",
163
128
  value: values.permissionMaintenanceTypes
164
129
  }, {
165
- type: 'permission',
130
+ type: "permission",
166
131
  value: values.permissionMaintenanceAssignment
167
132
  }]
168
133
  }]
@@ -174,15 +139,24 @@ var FeatureConfig = {
174
139
  permissions: [{
175
140
  displayName: values.textPermissionMaintenanceTracking,
176
141
  key: values.permissionMaintenanceTracking,
177
- hq: false
142
+ hq: false,
143
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
144
+ helperText: "Allows tracking and managing maintenance requests and job status updates.",
145
+ importance: IMPORTANCE_LEVELS.IMPORTANT
178
146
  }, {
179
147
  displayName: values.textPermissionManageMaintenanceTypes,
180
148
  key: values.permissionMaintenanceTypes,
181
- hq: false
149
+ hq: false,
150
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
151
+ helperText: "Allows creating and configuring maintenance request types and categories.",
152
+ importance: IMPORTANCE_LEVELS.IMPORTANT
182
153
  }, {
183
154
  displayName: values.textPermissionManageAssignedMaintenance,
184
155
  key: values.permissionMaintenanceAssignment,
185
- hq: false
156
+ hq: false,
157
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
158
+ helperText: "Allows assigning and managing assigned maintenance requests.",
159
+ importance: IMPORTANCE_LEVELS.IMPORTANT
186
160
  }],
187
161
  hiddenSections: [{
188
162
  displayName: values.textHiddenSectionMaintenanceRequests,
@@ -221,21 +195,21 @@ var FeatureConfig = {
221
195
  exact: true
222
196
  }],
223
197
  env: {
224
- baseStage: '',
225
- baseAPIUrl: '',
226
- baseUploadsUrl: '',
227
- uploadBucket: '',
228
- colourBrandingMain: '',
229
- colourBrandingOff: '',
230
- colourBrandingApp: '',
231
- defaultProfileImage: '',
232
- utcOffset: '',
198
+ baseStage: "",
199
+ baseAPIUrl: "",
200
+ baseUploadsUrl: "",
201
+ uploadBucket: "",
202
+ colourBrandingMain: "",
203
+ colourBrandingOff: "",
204
+ colourBrandingApp: "",
205
+ defaultProfileImage: "",
206
+ utcOffset: "",
233
207
  hasAvailableNews: false,
234
208
  newsHaveTags: true,
235
209
  defaultAllowComments: true,
236
- makeApiKey: '',
237
- logo: '',
238
- clientName: ''
210
+ makeApiKey: "",
211
+ logo: "",
212
+ clientName: ""
239
213
  },
240
214
  init: environment => {
241
215
  FeatureConfig.env = environment;
@@ -244,51 +218,24 @@ var FeatureConfig = {
244
218
  notificationPreference: values.notificationPreference
245
219
  };
246
220
 
247
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
248
- try {
249
- var i = n[a](c),
250
- u = i.value;
251
- } catch (n) {
252
- return void e(n);
253
- }
254
- i.done ? t(u) : Promise.resolve(u).then(r, o);
255
- }
256
- function _asyncToGenerator(n) {
257
- return function () {
258
- var t = this,
259
- e = arguments;
260
- return new Promise(function (r, o) {
261
- var a = n.apply(t, e);
262
- function _next(n) {
263
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
264
- }
265
- function _throw(n) {
266
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
267
- }
268
- _next(void 0);
269
- });
270
- };
271
- }
272
-
273
221
  var JOBS_LOADED = values.actionJobsLoaded;
274
- var JOBS_ADDED = values.actionJobsAdded;
275
222
  var JOBS_LOADING = values.actionJobsLoading;
276
223
  var JOBS_REMOVED = values.actionJobsRemoved;
277
224
  var JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
278
225
  var JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
279
226
  var JOBS_HIDE_SEEN = values.actionJobsHideSeen;
280
227
 
281
- 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; }
282
- 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; }
228
+ function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
229
+ 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; }
283
230
  var {
284
- Helper: Helper$5,
231
+ Helper: Helper$6,
285
232
  Session: Session$9
286
233
  } = PlussCore;
287
234
  var maintenanceActions = {
288
235
  getJobType: (site, typeId) => {
289
- var url = Helper$5.getUrl(values.serviceKey, 'getjobtype');
236
+ var url = Helper$6.getUrl(values.serviceKey, "getjobtype");
290
237
  return Session$9.authedFunction({
291
- method: 'POST',
238
+ method: "POST",
292
239
  url,
293
240
  data: {
294
241
  site,
@@ -297,9 +244,9 @@ var maintenanceActions = {
297
244
  });
298
245
  },
299
246
  getJobTypes: (site, id) => {
300
- var url = Helper$5.getUrl(values.serviceKey, 'getjobtypes');
247
+ var url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
301
248
  return Session$9.authedFunction({
302
- method: 'POST',
249
+ method: "POST",
303
250
  url,
304
251
  data: {
305
252
  site
@@ -307,9 +254,9 @@ var maintenanceActions = {
307
254
  });
308
255
  },
309
256
  getJob: (site, id) => {
310
- var url = Helper$5.getUrl(values.serviceKey, 'getJob');
257
+ var url = Helper$6.getUrl(values.serviceKey, "getJob");
311
258
  return Session$9.authedFunction({
312
- method: 'POST',
259
+ method: "POST",
313
260
  url,
314
261
  data: {
315
262
  site,
@@ -318,9 +265,9 @@ var maintenanceActions = {
318
265
  });
319
266
  },
320
267
  getJobByJobId: (site, jobId) => {
321
- var url = Helper$5.getUrl(values.serviceKey, 'getJob');
268
+ var url = Helper$6.getUrl(values.serviceKey, "getJob");
322
269
  return Session$9.authedFunction({
323
- method: 'POST',
270
+ method: "POST",
324
271
  url,
325
272
  data: {
326
273
  site,
@@ -329,11 +276,11 @@ var maintenanceActions = {
329
276
  });
330
277
  },
331
278
  getJobs: function getJobs(site) {
332
- var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
333
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
279
+ var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
280
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
334
281
  return Session$9.authedFunction({
335
- method: 'POST',
336
- url: Helper$5.getUrl(values.serviceKey, 'getJobs'),
282
+ method: "POST",
283
+ url: Helper$6.getUrl(values.serviceKey, "getJobs"),
337
284
  data: {
338
285
  site,
339
286
  status,
@@ -341,67 +288,47 @@ var maintenanceActions = {
341
288
  }
342
289
  });
343
290
  },
344
- getJobs2: (site, status, priority, type, lastKey, assignee, startTime, endTime, search) => {
291
+ getJobs2: (site, status, type, lastKey) => {
345
292
  var query = {
346
293
  site
347
294
  };
348
295
  if (status) {
349
296
  query.status = status;
350
297
  }
351
- if (priority) {
352
- query.priority = priority;
353
- }
354
298
  if (type) {
355
299
  query.type = type;
356
300
  }
357
301
  if (lastKey) {
358
302
  query.lastKey = JSON.stringify(lastKey);
359
303
  }
360
- if (assignee) {
361
- query.assignee = assignee;
362
- }
363
- if (startTime) {
364
- query.startTime = startTime;
365
- }
366
- if (endTime) {
367
- query.endTime = endTime;
368
- }
369
- if (search) {
370
- query.search = search;
371
- }
372
304
  return Session$9.authedFunction({
373
- method: 'GET',
374
- url: Helper$5.getUrl(values.serviceKey, 'get/requests', query)
305
+ method: "GET",
306
+ url: Helper$6.getUrl(values.serviceKey, "get/requests", query)
375
307
  });
376
308
  },
377
- /**
378
- * @deprecated Use getJobs2 with pagination instead.
379
- * This method recursively fetches ALL pages which can be slow for large datasets.
380
- * For better performance, use getJobs2 directly and implement pagination in the UI.
381
- */
382
309
  getJobsRecursive: function getJobsRecursive(site, status, type, lastKey) {
383
310
  var jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
384
- return new Promise((resolve, reject) => {
385
- maintenanceActions.getJobs2(site, status, undefined, type, lastKey).then(jobRes => {
311
+ return new Promise(resolve => {
312
+ maintenanceActions.getJobs2(site, status, type, lastKey).then(jobRes => {
386
313
  var newJobs = [...jobs, ...jobRes.data.Items];
387
314
  if (!jobRes.data.LastKey) {
388
315
  return resolve(newJobs);
389
316
  }
390
- maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs).then(resolve).catch(reject);
391
- }).catch(reject);
317
+ return resolve(maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));
318
+ });
392
319
  });
393
320
  },
394
321
  createJob: job => {
395
322
  return Session$9.authedFunction({
396
- method: 'POST',
397
- url: Helper$5.getUrl(values.serviceKey, 'sendMaintenance'),
398
- data: _objectSpread$7({}, job)
323
+ method: "POST",
324
+ url: Helper$6.getUrl(values.serviceKey, "sendMaintenance"),
325
+ data: _objectSpread$8({}, job)
399
326
  });
400
327
  },
401
328
  editJob: (job, site) => {
402
329
  return Session$9.authedFunction({
403
- method: 'POST',
404
- url: Helper$5.getUrl(values.serviceKey, 'editJob'),
330
+ method: "POST",
331
+ url: Helper$6.getUrl(values.serviceKey, "editJob"),
405
332
  data: {
406
333
  job,
407
334
  site
@@ -410,8 +337,8 @@ var maintenanceActions = {
410
337
  },
411
338
  deleteJob: (site, id) => {
412
339
  return Session$9.authedFunction({
413
- method: 'POST',
414
- url: Helper$5.getUrl(values.serviceKey, 'requests/remove'),
340
+ method: "POST",
341
+ url: Helper$6.getUrl(values.serviceKey, "requests/remove"),
415
342
  data: {
416
343
  site,
417
344
  id
@@ -420,8 +347,8 @@ var maintenanceActions = {
420
347
  },
421
348
  editJobStatus: (id, status) => {
422
349
  return Session$9.authedFunction({
423
- method: 'POST',
424
- url: Helper$5.getUrl(values.serviceKey, 'editJobStatus'),
350
+ method: "POST",
351
+ url: Helper$6.getUrl(values.serviceKey, "editJobStatus"),
425
352
  data: {
426
353
  id,
427
354
  status
@@ -430,8 +357,8 @@ var maintenanceActions = {
430
357
  },
431
358
  editJobPriority: (id, priority) => {
432
359
  return Session$9.authedFunction({
433
- method: 'POST',
434
- url: Helper$5.getUrl(values.serviceKey, 'update/priority'),
360
+ method: "POST",
361
+ url: Helper$6.getUrl(values.serviceKey, "update/priority"),
435
362
  data: {
436
363
  id,
437
364
  priority
@@ -440,8 +367,8 @@ var maintenanceActions = {
440
367
  },
441
368
  assignJob: (jobId, userId) => {
442
369
  return Session$9.authedFunction({
443
- method: 'POST',
444
- url: Helper$5.getUrl(values.serviceKey, 'update/assign'),
370
+ method: "POST",
371
+ url: Helper$6.getUrl(values.serviceKey, "update/assign"),
445
372
  data: {
446
373
  id: jobId,
447
374
  userId
@@ -450,47 +377,47 @@ var maintenanceActions = {
450
377
  },
451
378
  getAssignees: site => {
452
379
  return Session$9.authedFunction({
453
- method: 'GET',
454
- url: Helper$5.getUrl(values.serviceKey, 'get/assignees', {
380
+ method: "GET",
381
+ url: Helper$6.getUrl(values.serviceKey, "get/assignees", {
455
382
  site
456
383
  })
457
384
  });
458
385
  },
459
386
  addNote: (jobId, note, attachments, images) => {
460
387
  return Session$9.authedFunction({
461
- method: 'POST',
462
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
388
+ method: "POST",
389
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
463
390
  data: {
464
391
  id: jobId,
465
392
  note,
466
393
  attachments,
467
394
  images,
468
- action: 'AddNote'
395
+ action: "AddNote"
469
396
  }
470
397
  });
471
398
  },
472
399
  editNote: (jobId, noteId, note, attachments, images) => {
473
400
  return Session$9.authedFunction({
474
- method: 'POST',
475
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
401
+ method: "POST",
402
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
476
403
  data: {
477
404
  id: jobId,
478
405
  note,
479
406
  attachments,
480
407
  images,
481
408
  noteId,
482
- action: 'EditNote'
409
+ action: "EditNote"
483
410
  }
484
411
  });
485
412
  },
486
413
  deleteNote: (jobId, noteId) => {
487
414
  return Session$9.authedFunction({
488
- method: 'POST',
489
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
415
+ method: "POST",
416
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
490
417
  data: {
491
418
  id: jobId,
492
419
  noteId,
493
- action: 'DeleteNote'
420
+ action: "DeleteNote"
494
421
  }
495
422
  });
496
423
  },
@@ -505,8 +432,8 @@ var maintenanceActions = {
505
432
  customFields: customFields || []
506
433
  };
507
434
  return Session$9.authedFunction({
508
- method: 'POST',
509
- url: Helper$5.getUrl(values.serviceKey, 'createJobType'),
435
+ method: "POST",
436
+ url: Helper$6.getUrl(values.serviceKey, "createJobType"),
510
437
  data
511
438
  });
512
439
  },
@@ -523,15 +450,15 @@ var maintenanceActions = {
523
450
  };
524
451
  if (hasCustomFields && customFields) data.customFields = customFields;
525
452
  return Session$9.authedFunction({
526
- method: 'POST',
527
- url: Helper$5.getUrl(values.serviceKey, 'editJobType'),
453
+ method: "POST",
454
+ url: Helper$6.getUrl(values.serviceKey, "editJobType"),
528
455
  data
529
456
  });
530
457
  },
531
458
  deleteJobType: (site, id) => {
532
459
  return Session$9.authedFunction({
533
- method: 'POST',
534
- url: Helper$5.getUrl(values.serviceKey, 'deleteJobType'),
460
+ method: "POST",
461
+ url: Helper$6.getUrl(values.serviceKey, "deleteJobType"),
535
462
  data: {
536
463
  site,
537
464
  id
@@ -540,16 +467,16 @@ var maintenanceActions = {
540
467
  },
541
468
  getExternalSync: jobId => {
542
469
  return Session$9.authedFunction({
543
- method: 'GET',
544
- url: Helper$5.getUrl(values.serviceKey, 'get/externalsync', {
470
+ method: "GET",
471
+ url: Helper$6.getUrl(values.serviceKey, "get/externalsync", {
545
472
  id: jobId
546
473
  })
547
474
  });
548
475
  },
549
476
  retrySync: jobId => {
550
477
  return Session$9.authedFunction({
551
- method: 'POST',
552
- url: Helper$5.getUrl(values.serviceKey, 'update/retrysync'),
478
+ method: "POST",
479
+ url: Helper$6.getUrl(values.serviceKey, "update/retrysync"),
553
480
  data: {
554
481
  id: jobId
555
482
  }
@@ -558,7 +485,7 @@ var maintenanceActions = {
558
485
  };
559
486
 
560
487
  var {
561
- Helper: Helper$4,
488
+ Helper: Helper$5,
562
489
  Session: Session$8
563
490
  } = PlussCore;
564
491
  var reactionActions = {
@@ -575,8 +502,8 @@ var reactionActions = {
575
502
  data.image = image;
576
503
  }
577
504
  return Session$8.authedFunction({
578
- method: 'POST',
579
- url: Helper$4.getUrl('reactions', 'comments/add'),
505
+ method: "POST",
506
+ url: Helper$5.getUrl("reactions", "comments/add"),
580
507
  data
581
508
  });
582
509
  },
@@ -598,8 +525,8 @@ var reactionActions = {
598
525
  query.minTime = minTime;
599
526
  }
600
527
  return Session$8.authedFunction({
601
- method: 'GET',
602
- url: Helper$4.getUrl('reactions', 'comments/get', query)
528
+ method: "GET",
529
+ url: Helper$5.getUrl("reactions", "comments/get", query)
603
530
  });
604
531
  }
605
532
  };
@@ -633,20 +560,19 @@ var jobStatusOptions = [
633
560
  ];
634
561
 
635
562
  var {
636
- Helper: Helper$3
563
+ Helper: Helper$4
637
564
  } = PlussCore;
638
565
  var jobsUpdate = (site, isdashboard) => {
639
566
  return dispatch => {
640
567
  if (isdashboard) dispatch({
641
568
  type: JOBS_LOADING
642
569
  });
643
- maintenanceActions.getJobs2(site).then(res => {
644
- var currentSite = Helper$3.readStorageWithCookie('site');
645
- var jobs = res.data.Items;
646
- if (!_.isEmpty(jobs) && jobs[0].site === currentSite) {
570
+ maintenanceActions.getJobsRecursive(site).then(res => {
571
+ var currentSite = Helper$4.readStorageWithCookie("site");
572
+ if (!_.isEmpty(res) && res[0].site === currentSite) {
647
573
  dispatch({
648
574
  type: JOBS_LOADED,
649
- payload: jobs
575
+ payload: res
650
576
  });
651
577
  } else {
652
578
  dispatch({
@@ -654,12 +580,6 @@ var jobsUpdate = (site, isdashboard) => {
654
580
  payload: []
655
581
  });
656
582
  }
657
- }).catch(error => {
658
- console.error('jobsUpdate error', error);
659
- dispatch({
660
- type: JOBS_LOADED,
661
- payload: []
662
- });
663
583
  });
664
584
  };
665
585
  };
@@ -669,12 +589,6 @@ var jobsLoaded = events => {
669
589
  payload: events
670
590
  };
671
591
  };
672
- var jobsAdded = events => {
673
- return {
674
- type: JOBS_ADDED,
675
- payload: events
676
- };
677
- };
678
592
  var removeJob = id => {
679
593
  return {
680
594
  type: JOBS_REMOVED,
@@ -795,10 +709,10 @@ var jobPriorityOptions = [
795
709
  }
796
710
  ];
797
711
 
798
- var STATUS_IMCOMPLETE = 'All Incomplete';
799
- var STATUS_NOT_ACTIONED = 'Not Actioned';
800
- var STATUS_IN_PROGRESS = 'In Progress';
801
- var STATUS_COMPLETED = 'Completed';
712
+ var STATUS_IMCOMPLETE = "All Incomplete";
713
+ var STATUS_NOT_ACTIONED = "Not Actioned";
714
+ var STATUS_IN_PROGRESS = "In Progress";
715
+ var STATUS_COMPLETED = "Completed";
802
716
  var getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
803
717
  var getJobPriority = priority => {
804
718
  var priorityOption = null;
@@ -806,8 +720,8 @@ var getJobPriority = priority => {
806
720
  return priorityOption || getDefaultPriority();
807
721
  };
808
722
 
809
- 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; }
810
- 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; }
723
+ function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
724
+ 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; }
811
725
  var {
812
726
  Session: Session$7,
813
727
  Components: Components$7,
@@ -823,75 +737,25 @@ class JobList extends Component {
823
737
  id: j.userID,
824
738
  displayName: j.userName,
825
739
  profilePic: j.userProfilePic
826
- })), 'id'), 'displayName', 'asc');
740
+ })), "id"), "displayName", "asc");
827
741
  this.setState({
828
742
  requesters
829
743
  });
830
744
  });
831
- _defineProperty(this, "refresh", () => {
832
- var {
833
- auth
834
- } = this.props;
835
- this.setState({
836
- loading: true,
837
- lastKey: null,
838
- hasMore: true
839
- }, /*#__PURE__*/_asyncToGenerator(function* () {
840
- try {
841
- var statusForApi = _this.state.selectedStatusFilter === STATUS_IMCOMPLETE ? undefined : _this.state.selectedStatusFilter;
842
- var res = yield maintenanceActions.getJobs2(auth.site, statusForApi, _this.state.selectedPriorityFilter, _this.state.selectedTypeFilter, null,
843
- // first page
844
- _this.state.selectedUserFilter, _this.state.selectedTimeFilterStart, _this.state.selectedTimeFilterEnd, _this.state.search);
845
- var jobs = res.data.Items;
846
- var lastKey = res.data.LastKey;
847
- _this.setRequesters(jobs);
848
- _this.props.jobsLoaded(jobs);
849
- _this.setState({
850
- lastKey,
851
- hasMore: !!lastKey,
852
- loading: false
853
- });
854
- } catch (error) {
855
- console.error('refresh error', error);
856
- _this.setState({
857
- loading: false
858
- });
859
- }
860
- }));
861
- });
862
- _defineProperty(this, "loadMore", () => {
745
+ _defineProperty(this, "getJobs", /*#__PURE__*/_asyncToGenerator(function* () {
863
746
  var {
864
747
  auth
865
- } = this.props;
866
- var {
867
- loading,
868
- loadingMore,
869
- hasMore,
870
- lastKey
871
- } = this.state;
872
- if (loading || loadingMore || !hasMore || !lastKey) return;
873
- this.setState({
874
- loadingMore: true
875
- }, /*#__PURE__*/_asyncToGenerator(function* () {
876
- try {
877
- var statusForApi = _this.state.selectedStatusFilter === STATUS_IMCOMPLETE ? undefined : _this.state.selectedStatusFilter;
878
- var res = yield maintenanceActions.getJobs2(auth.site, statusForApi, _this.state.selectedPriorityFilter, _this.state.selectedTypeFilter, lastKey, _this.state.selectedUserFilter, _this.state.selectedTimeFilterStart, _this.state.selectedTimeFilterEnd, _this.state.search);
879
- var newJobs = res.data.Items;
880
- var newLastKey = res.data.LastKey;
881
- _this.props.jobsAdded(newJobs);
882
- _this.setState({
883
- lastKey: newLastKey,
884
- hasMore: !!newLastKey,
885
- loadingMore: false
886
- });
887
- } catch (error) {
888
- console.error('loadMore error', error);
889
- _this.setState({
890
- loadingMore: false
891
- });
748
+ } = _this.props;
749
+ try {
750
+ var res = yield maintenanceActions.getJobsRecursive(auth.site);
751
+ if (!_.isEmpty(res) && res[0].site === auth.site) {
752
+ _this.setRequesters(res);
753
+ _this.props.jobsLoaded(res);
892
754
  }
893
- }));
894
- });
755
+ } catch (error) {
756
+ console.error("getJobs", error);
757
+ }
758
+ }));
895
759
  _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
896
760
  try {
897
761
  var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
@@ -899,7 +763,7 @@ class JobList extends Component {
899
763
  assignees: res.data.Users
900
764
  });
901
765
  } catch (error) {
902
- console.error('getAssignees', error);
766
+ console.error("getAssignees", error);
903
767
  }
904
768
  }));
905
769
  _defineProperty(this, "sortByCol", col => {
@@ -919,20 +783,20 @@ class JobList extends Component {
919
783
  }
920
784
  });
921
785
  _defineProperty(this, "onRemoveRequest", /*#__PURE__*/function () {
922
- var _ref4 = _asyncToGenerator(function* (request) {
786
+ var _ref3 = _asyncToGenerator(function* (request) {
923
787
  if (window.confirm(values.textAreYouSureYouWantToDelete)) {
924
788
  _this.props.removeJob(request.id);
925
789
  try {
926
790
  yield maintenanceActions.deleteJob(_this.props.auth.site, request.id);
927
- _this.refresh();
791
+ _this.getJobs();
928
792
  } catch (error) {
929
- console.log('onRemoveRequest', error);
930
- alert('Something went wrong with the request. Please try again.');
793
+ console.log("onRemoveRequest", error);
794
+ alert("Something went wrong with the request. Please try again.");
931
795
  }
932
796
  }
933
797
  });
934
798
  return function (_x) {
935
- return _ref4.apply(this, arguments);
799
+ return _ref3.apply(this, arguments);
936
800
  };
937
801
  }());
938
802
  _defineProperty(this, "openFilter", filter => {
@@ -946,22 +810,22 @@ class JobList extends Component {
946
810
  });
947
811
  });
948
812
  _defineProperty(this, "selectTypeFilter", filter => {
949
- this.closeFilter();
950
813
  this.setState({
951
814
  selectedTypeFilter: filter
952
- }, () => this.refresh());
815
+ });
816
+ this.closeFilter();
953
817
  });
954
818
  _defineProperty(this, "selectPriorityFilter", filter => {
955
- this.closeFilter();
956
819
  this.setState({
957
820
  selectedPriorityFilter: filter
958
- }, () => this.refresh());
821
+ });
822
+ this.closeFilter();
959
823
  });
960
824
  _defineProperty(this, "selectStatusFilter", filter => {
961
- this.closeFilter();
962
825
  this.setState({
963
826
  selectedStatusFilter: filter
964
- }, () => this.refresh());
827
+ });
828
+ this.closeFilter();
965
829
  });
966
830
  _defineProperty(this, "timeFilterChanged", selectedTimeFilter => {
967
831
  this.setState({
@@ -981,42 +845,42 @@ class JobList extends Component {
981
845
  if (this.state.selectedTimeFilter.dayCount > 0) {
982
846
  return true;
983
847
  }
984
- return moment(this.state.timeFilterStart).startOf('d').valueOf() < moment(this.state.timeFilterEnd).endOf('d').valueOf();
848
+ return moment(this.state.timeFilterStart).startOf("d").valueOf() < moment(this.state.timeFilterEnd).endOf("d").valueOf();
985
849
  });
986
850
  _defineProperty(this, "saveTimeFilter", () => {
987
851
  if (!this.isValidTimeFilter()) {
988
852
  return;
989
853
  }
990
854
  var startTime = 0;
991
- var endTime = moment().endOf('d').valueOf();
992
- var text = '';
855
+ var endTime = moment().endOf("d").valueOf();
856
+ var text = "";
993
857
  if (this.state.selectedTimeFilter.dayCount > 0) {
994
- startTime = moment().add(-this.state.selectedTimeFilter.dayCount, 'd').startOf('d').valueOf();
858
+ startTime = moment().add(-this.state.selectedTimeFilter.dayCount, "d").startOf("d").valueOf();
995
859
  text = this.state.selectedTimeFilter.text;
996
860
  } else {
997
- var startDate = moment(this.state.timeFilterStart).startOf('d');
998
- var endDate = moment(this.state.timeFilterEnd).endOf('d');
861
+ var startDate = moment(this.state.timeFilterStart).startOf("d");
862
+ var endDate = moment(this.state.timeFilterEnd).endOf("d");
999
863
  startTime = startDate.valueOf();
1000
864
  endTime = endDate.valueOf();
1001
- text = "".concat(startDate.format('DD/MM/YYYY'), " to ").concat(endDate.format('DD/MM/YYYY'));
865
+ text = "".concat(startDate.format("DD/MM/YYYY"), " to ").concat(endDate.format("DD/MM/YYYY"));
1002
866
  }
1003
- this.closeFilter();
1004
867
  this.setState({
1005
868
  selectedTimeFilterStart: startTime,
1006
869
  selectedTimeFilterEnd: endTime,
1007
870
  selectedTimeFilterText: text
1008
- }, () => this.refresh());
871
+ });
872
+ this.closeFilter();
1009
873
  });
1010
874
  _defineProperty(this, "removeTimeFilter", () => {
1011
875
  this.setState({
1012
876
  selectedTimeFilterStart: null,
1013
877
  selectedTimeFilterEnd: null,
1014
878
  selectedTimeFilterText: null
1015
- }, () => this.refresh());
879
+ });
1016
880
  });
1017
881
  _defineProperty(this, "onHandleChange", event => {
1018
882
  var stateChange = {};
1019
- stateChange[event.target.getAttribute('id')] = event.target.value;
883
+ stateChange[event.target.getAttribute("id")] = event.target.value;
1020
884
  this.setState(stateChange);
1021
885
  });
1022
886
  _defineProperty(this, "onSelectAssignee", user => {
@@ -1028,10 +892,9 @@ class JobList extends Component {
1028
892
  this.setState({
1029
893
  selectedUserFilter: null,
1030
894
  selectedUserFilterText: null
1031
- }, () => this.refresh());
895
+ });
1032
896
  });
1033
897
  _defineProperty(this, "saveUserFilter", () => {
1034
- this.closeFilter();
1035
898
  if (!this.state.selectedAssignee) {
1036
899
  this.removeUserFilter();
1037
900
  } else {
@@ -1039,8 +902,9 @@ class JobList extends Component {
1039
902
  selectedUserFilter: this.state.selectedAssignee.id,
1040
903
  selectedUserFilterText: this.state.selectedAssignee.displayName,
1041
904
  selectedAssignee: null
1042
- }, () => this.refresh());
905
+ });
1043
906
  }
907
+ this.closeFilter();
1044
908
  });
1045
909
  _defineProperty(this, "onSelectRequester", user => {
1046
910
  this.setState({
@@ -1072,41 +936,82 @@ class JobList extends Component {
1072
936
  lastSearch: thisSearchTime
1073
937
  });
1074
938
  setTimeout(() => {
1075
- // Debounced: trigger server-side refresh after user stops typing
939
+ // delayed setter to avoid filtering on every keypress
1076
940
  if (this.state.lastSearch === thisSearchTime) {
1077
- this.refresh();
941
+ this.setState({
942
+ searchTerm: this.state.search
943
+ });
1078
944
  }
1079
945
  }, 500);
1080
946
  });
1081
947
  _defineProperty(this, "getSource", () => {
1082
948
  var source = this.props.source;
1083
949
 
1084
- // Client-side filter: Incomplete status (composite filter, not supported server-side)
1085
- if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
950
+ // filter by time
951
+ if (this.state.selectedTimeFilterStart && this.state.selectedTimeFilterEnd) {
952
+ source = _.filter(source, r => {
953
+ return r.createdUnix >= this.state.selectedTimeFilterStart && r.createdUnix <= this.state.selectedTimeFilterEnd;
954
+ });
955
+ }
956
+
957
+ // filter by type
958
+ if (this.state.selectedTypeFilter) {
959
+ source = _.filter(source, r => {
960
+ return r.type === this.state.selectedTypeFilter;
961
+ });
962
+ }
963
+
964
+ // filter by priority
965
+ if (this.state.selectedPriorityFilter) {
966
+ var defaultPriority = getDefaultPriority().name;
967
+ source = _.filter(source, r => {
968
+ return r.priority === this.state.selectedPriorityFilter || this.state.selectedPriorityFilter === defaultPriority && _.isNil(r.priority);
969
+ });
970
+ }
971
+
972
+ // filter by status
973
+ if (this.state.selectedStatusFilter) {
1086
974
  var {
1087
975
  statusTypes
1088
976
  } = this.props;
977
+ var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1089
978
  source = _.filter(source, r => {
1090
- var status = statusTypes.find(s => s.text === r.status);
1091
- return !status || status.category !== STATUS_COMPLETED;
979
+ var status = statusTypes.find(s => s.text === r.status) || defaultStatus;
980
+ if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
981
+ return status.category !== STATUS_COMPLETED;
982
+ }
983
+ return status.text === this.state.selectedStatusFilter;
984
+ });
985
+ }
986
+ if (this.state.selectedUserFilter) {
987
+ source = _.filter(source, r => {
988
+ return r.AssigneeId === this.state.selectedUserFilter;
1092
989
  });
1093
990
  }
1094
-
1095
- // Client-side filter: requester (not supported server-side)
1096
991
  if (this.state.selectedRequesterFilter) {
1097
992
  source = _.filter(source, r => {
1098
993
  return r.userID === this.state.selectedRequesterFilter;
1099
994
  });
1100
995
  }
1101
-
1102
- // Note: status, type, priority, assignee, time range, and search filters
1103
- // are all applied server-side via getJobs2 pagination.
1104
-
996
+ if (!_.isEmpty(this.state.searchTerm)) {
997
+ source = _.filter(source, r => {
998
+ if (r.jobId && r.jobId === this.state.searchTerm) {
999
+ return true;
1000
+ }
1001
+ if (r.room && r.room.toLowerCase().indexOf(this.state.searchTerm.toLowerCase()) > -1) {
1002
+ return true;
1003
+ }
1004
+ if (r.title && r.title.toLowerCase().indexOf(this.state.searchTerm.toLowerCase()) > -1) {
1005
+ return true;
1006
+ }
1007
+ return false;
1008
+ });
1009
+ }
1105
1010
  source = _.sortBy(source, event => {
1106
- if (this.state.sortColumn === 'assigned') {
1107
- return event.Assignee ? event.Assignee.displayName : 'Unassigned';
1011
+ if (this.state.sortColumn === "assigned") {
1012
+ return event.Assignee ? event.Assignee.displayName : "Unassigned";
1108
1013
  }
1109
- if (this.state.sortColumn !== 'createdUnix') return event[this.state.sortColumn];
1014
+ if (this.state.sortColumn !== "createdUnix") return event[this.state.sortColumn];
1110
1015
  return event.createdUnix;
1111
1016
  });
1112
1017
  if (this.state.sortDesc) source.reverse();
@@ -1114,14 +1019,14 @@ class JobList extends Component {
1114
1019
  });
1115
1020
  _defineProperty(this, "getCustomFieldValue", field => {
1116
1021
  switch (field.type) {
1117
- case 'date':
1118
- return field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD-MMM-YYYY') : '';
1119
- case 'time':
1120
- return field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : '';
1121
- case 'yn':
1122
- return field.answer ? 'Yes' : 'No';
1123
- case 'checkbox':
1124
- return field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '';
1022
+ case "date":
1023
+ return field.answer ? moment(field.answer, "YYYY-MM-DD").format("DD-MMM-YYYY") : "";
1024
+ case "time":
1025
+ return field.answer ? moment(field.answer, "HH:mm").format("h:mm a") : "";
1026
+ case "yn":
1027
+ return field.answer ? "Yes" : "No";
1028
+ case "checkbox":
1029
+ return field.answer && Array.isArray(field.answer) ? field.answer.join(", ") : "";
1125
1030
  default:
1126
1031
  return field.answer;
1127
1032
  }
@@ -1135,7 +1040,7 @@ class JobList extends Component {
1135
1040
  if (customFields && Array.isArray(customFields)) {
1136
1041
  customFields.forEach(field => {
1137
1042
  // Exclude un-exportable fields
1138
- if (['image', 'document', 'staticTitle', 'staticText'].includes(field.type)) return;
1043
+ if (["image", "document", "staticTitle", "staticText"].includes(field.type)) return;
1139
1044
  var fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1140
1045
  // Build custom columns
1141
1046
  var exists = customColumns.find(c => c.key === fieldKey);
@@ -1157,10 +1062,10 @@ class JobList extends Component {
1157
1062
  var source = this.getSource().map(r => {
1158
1063
  var history = r.history || [];
1159
1064
  var progressEntry = _.find(history, e => {
1160
- return e.status !== 'Unassigned';
1065
+ return e.status !== "Unassigned";
1161
1066
  });
1162
1067
  var completedEntry = _.find(history, e => {
1163
- return e.status === 'Completed';
1068
+ return e.status === "Completed";
1164
1069
  });
1165
1070
  var progressTime = null;
1166
1071
  var completedTime = null;
@@ -1174,22 +1079,22 @@ class JobList extends Component {
1174
1079
  completedTime = moment.utc(completedEntry.timestamp).format();
1175
1080
  completedDuration = moment.utc(completedEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
1176
1081
  }
1177
- var notes = '';
1082
+ var notes = "";
1178
1083
  (r.Notes || []).forEach((note, index) => {
1179
1084
  if (index > 0) {
1180
- notes += '\n\n';
1085
+ notes += "\n\n";
1181
1086
  }
1182
1087
  if (note.User && !_.isEmpty(note.User.displayName)) {
1183
1088
  notes += "".concat(note.User.displayName, ":\n");
1184
1089
  }
1185
1090
  if (note.Timestamp) {
1186
- notes += "".concat(moment(note.Timestamp).format('DD-MM-YYYY h:mma'), "\n");
1091
+ notes += "".concat(moment(note.Timestamp).format("DD-MM-YYYY h:mma"), "\n");
1187
1092
  }
1188
1093
  notes += note.Note;
1189
1094
  });
1190
1095
  var customFieldValues = this.getCustomFields(r, customColumns);
1191
1096
  var priority = r.priority || defaultPriority;
1192
- return _objectSpread$6(_objectSpread$6(_objectSpread$6({}, r), customFieldValues), {}, {
1097
+ return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, r), customFieldValues), {}, {
1193
1098
  notes,
1194
1099
  progressTime,
1195
1100
  completedTime,
@@ -1200,7 +1105,7 @@ class JobList extends Component {
1200
1105
  });
1201
1106
 
1202
1107
  // Compose revised columns list with custom fields
1203
- var index = this.exportColumns.findIndex(c => c.key === 'notes');
1108
+ var index = this.exportColumns.findIndex(c => c.key === "notes");
1204
1109
  var columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1205
1110
  return {
1206
1111
  columns,
@@ -1222,67 +1127,64 @@ class JobList extends Component {
1222
1127
  });
1223
1128
  });
1224
1129
  this.state = {
1225
- sortColumn: 'createdUnix',
1130
+ showCompleted: false,
1131
+ sortColumn: "createdUnix",
1226
1132
  sortDesc: true,
1227
1133
  selectedTimeFilter: Analytics$2.getAnalyticsFilterOptions()[1],
1228
1134
  assignees: [],
1229
- requesters: [],
1230
- loading: false,
1231
- loadingMore: false,
1232
- lastKey: null,
1233
- hasMore: true
1135
+ requesters: []
1234
1136
  };
1235
1137
  this.exportColumns = [{
1236
- label: 'Select All',
1237
- key: ''
1138
+ label: "Select All",
1139
+ key: ""
1238
1140
  }, {
1239
- label: 'System Id',
1240
- key: 'id'
1141
+ label: "System Id",
1142
+ key: "id"
1241
1143
  }, {
1242
1144
  label: "".concat(values.textEntityName, " No."),
1243
- key: 'jobId'
1145
+ key: "jobId"
1244
1146
  }, {
1245
1147
  label: values.textJobType,
1246
- key: 'type'
1148
+ key: "type"
1247
1149
  }, {
1248
- label: 'Status',
1249
- key: 'status'
1150
+ label: "Status",
1151
+ key: "status"
1250
1152
  }, {
1251
- label: 'Priority',
1252
- key: 'priority'
1153
+ label: "Priority",
1154
+ key: "priority"
1253
1155
  }, {
1254
- label: 'Title',
1255
- key: 'title'
1156
+ label: "Title",
1157
+ key: "title"
1256
1158
  }, {
1257
- label: 'Address',
1258
- key: 'room'
1159
+ label: "Address",
1160
+ key: "room"
1259
1161
  }, {
1260
- label: 'Description',
1261
- key: 'description'
1162
+ label: "Description",
1163
+ key: "description"
1262
1164
  }, {
1263
- label: 'Notes',
1264
- key: 'notes'
1165
+ label: "Notes",
1166
+ key: "notes"
1265
1167
  }, {
1266
- label: 'User Name',
1267
- key: 'userName'
1168
+ label: "User Name",
1169
+ key: "userName"
1268
1170
  }, {
1269
- label: 'User ID',
1270
- key: 'userID'
1171
+ label: "User ID",
1172
+ key: "userID"
1271
1173
  }, {
1272
- label: 'Request Time',
1273
- key: 'createdTime'
1174
+ label: "Request Time",
1175
+ key: "createdTime"
1274
1176
  }, {
1275
- label: 'Progress Time',
1276
- key: 'progressTime'
1177
+ label: "Progress Time",
1178
+ key: "progressTime"
1277
1179
  }, {
1278
- label: 'Completed Time',
1279
- key: 'completedTime'
1180
+ label: "Completed Time",
1181
+ key: "completedTime"
1280
1182
  }, {
1281
- label: 'Time to Progress (in seconds)',
1282
- key: 'progressDuration'
1183
+ label: "Time to Progress (in seconds)",
1184
+ key: "progressDuration"
1283
1185
  }, {
1284
- label: 'Time to Complete (in seconds)',
1285
- key: 'completedDuration'
1186
+ label: "Time to Complete (in seconds)",
1187
+ key: "completedDuration"
1286
1188
  }];
1287
1189
  }
1288
1190
  UNSAFE_componentWillMount() {
@@ -1290,14 +1192,14 @@ class JobList extends Component {
1290
1192
  }
1291
1193
  componentDidMount() {
1292
1194
  this.props.jobStatusesUpdate(this.props.auth.site);
1293
- this.refresh();
1195
+ this.getJobs();
1294
1196
  this.getAssignees();
1295
1197
  }
1296
1198
  renderFilterPopup() {
1297
1199
  if (!this.state.filterOpen) {
1298
1200
  return null;
1299
1201
  }
1300
- if (this.state.filterOpen === 'type') {
1202
+ if (this.state.filterOpen === "type") {
1301
1203
  return /*#__PURE__*/jsx(Components$7.Popup, {
1302
1204
  title: "Select ".concat(values.textJobType),
1303
1205
  maxWidth: 600,
@@ -1315,7 +1217,7 @@ class JobList extends Component {
1315
1217
  })
1316
1218
  });
1317
1219
  }
1318
- if (this.state.filterOpen === 'priority') {
1220
+ if (this.state.filterOpen === "priority") {
1319
1221
  return /*#__PURE__*/jsx(Components$7.Popup, {
1320
1222
  title: "Select Priority",
1321
1223
  maxWidth: 600,
@@ -1333,7 +1235,7 @@ class JobList extends Component {
1333
1235
  })
1334
1236
  });
1335
1237
  }
1336
- if (this.state.filterOpen === 'status') {
1238
+ if (this.state.filterOpen === "status") {
1337
1239
  var {
1338
1240
  statusTypes
1339
1241
  } = this.props;
@@ -1354,7 +1256,7 @@ class JobList extends Component {
1354
1256
  })
1355
1257
  });
1356
1258
  }
1357
- if (this.state.filterOpen === 'time') {
1259
+ if (this.state.filterOpen === "time") {
1358
1260
  return /*#__PURE__*/jsx(Components$7.Popup, {
1359
1261
  title: "Select Time",
1360
1262
  maxWidth: 600,
@@ -1362,13 +1264,13 @@ class JobList extends Component {
1362
1264
  hasPadding: true,
1363
1265
  onClose: this.closeFilter,
1364
1266
  buttons: [{
1365
- type: 'primaryAction',
1267
+ type: "primaryAction",
1366
1268
  onClick: this.saveTimeFilter,
1367
- text: 'Select',
1269
+ text: "Select",
1368
1270
  isActive: this.isValidTimeFilter()
1369
1271
  }],
1370
1272
  children: /*#__PURE__*/jsx("div", {
1371
- style: {
1273
+ iconStyle: {
1372
1274
  minHeight: 150
1373
1275
  },
1374
1276
  children: /*#__PURE__*/jsx(Components$7.AnalyticsFilter, {
@@ -1379,19 +1281,19 @@ class JobList extends Component {
1379
1281
  })
1380
1282
  });
1381
1283
  }
1382
- if (this.state.filterOpen === 'user') {
1284
+ if (this.state.filterOpen === "user") {
1383
1285
  var userContent = null;
1384
1286
  if (this.state.selectedAssignee) {
1385
1287
  userContent = /*#__PURE__*/jsx("div", {
1386
1288
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1387
1289
  user: this.state.selectedAssignee,
1388
- rightContent: /*#__PURE__*/jsx(Components$7.SVGIcon, {
1290
+ rightContent: /*#__PURE__*/jsx(Icon, {
1389
1291
  className: "removeIcon",
1390
- icon: "close",
1292
+ icon: "xmark",
1391
1293
  onClick: () => {
1392
1294
  this.onSelectAssignee();
1393
1295
  },
1394
- colour: Colours$3.COLOUR_DUSK
1296
+ colour: Colours$4.COLOUR_DUSK
1395
1297
  })
1396
1298
  }, this.state.selectedAssignee.id)
1397
1299
  });
@@ -1426,27 +1328,27 @@ class JobList extends Component {
1426
1328
  hasPadding: true,
1427
1329
  onClose: this.closeFilter,
1428
1330
  buttons: [{
1429
- type: 'primaryAction',
1331
+ type: "primaryAction",
1430
1332
  onClick: this.saveUserFilter,
1431
- text: 'Select',
1333
+ text: "Select",
1432
1334
  isActive: true
1433
1335
  }],
1434
1336
  children: userContent
1435
1337
  });
1436
1338
  }
1437
- if (this.state.filterOpen === 'requester') {
1339
+ if (this.state.filterOpen === "requester") {
1438
1340
  var _userContent = null;
1439
1341
  if (this.state.selectedRequester) {
1440
1342
  _userContent = /*#__PURE__*/jsx("div", {
1441
1343
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1442
1344
  user: this.state.selectedRequester,
1443
- rightContent: /*#__PURE__*/jsx(Components$7.SVGIcon, {
1345
+ rightContent: /*#__PURE__*/jsx(Icon, {
1444
1346
  className: "removeIcon",
1445
- icon: "close",
1347
+ icon: "xmark",
1446
1348
  onClick: () => {
1447
1349
  this.onSelectRequester();
1448
1350
  },
1449
- colour: Colours$3.COLOUR_DUSK
1351
+ colour: Colours$4.COLOUR_DUSK
1450
1352
  })
1451
1353
  }, this.state.selectedRequester.id)
1452
1354
  });
@@ -1481,9 +1383,9 @@ class JobList extends Component {
1481
1383
  hasPadding: true,
1482
1384
  onClose: this.closeFilter,
1483
1385
  buttons: [{
1484
- type: 'primaryAction',
1386
+ type: "primaryAction",
1485
1387
  onClick: this.saveRequesterFilter,
1486
- text: 'Select',
1388
+ text: "Select",
1487
1389
  isActive: true
1488
1390
  }],
1489
1391
  children: _userContent
@@ -1516,7 +1418,7 @@ class JobList extends Component {
1516
1418
  }), /*#__PURE__*/jsx("td", {
1517
1419
  children: ev.type
1518
1420
  }), /*#__PURE__*/jsx("td", {
1519
- children: moment.utc(ev.createdTime).local().format('D MMM YY')
1421
+ children: moment.utc(ev.createdTime).local().format("D MMM YY")
1520
1422
  }), /*#__PURE__*/jsx("td", {
1521
1423
  children: ev.room
1522
1424
  }), /*#__PURE__*/jsx("td", {
@@ -1527,34 +1429,34 @@ class JobList extends Component {
1527
1429
  profilePic: ev.userProfilePic
1528
1430
  },
1529
1431
  textClass: "fontSize-13"
1530
- }) : 'Unknown'
1432
+ }) : "Unknown"
1531
1433
  }), /*#__PURE__*/jsx("td", {
1532
1434
  children: ev.Assignee ? /*#__PURE__*/jsx(Components$7.UserListing, {
1533
1435
  user: ev.Assignee,
1534
1436
  textClass: "fontSize-13"
1535
- }) : 'Unassigned'
1437
+ }) : "Unassigned"
1536
1438
  }), /*#__PURE__*/jsx("td", {
1537
1439
  children: /*#__PURE__*/jsx("div", {
1538
1440
  style: {
1539
- textAlign: 'center',
1441
+ textAlign: "center",
1540
1442
  borderRadius: 4,
1541
1443
  width: 100,
1542
1444
  paddingTop: 2,
1543
1445
  paddingBottom: 2,
1544
- color: '#fff',
1446
+ color: "#fff",
1545
1447
  backgroundColor: status ? status.color : undefined
1546
1448
  },
1547
- children: status ? status.text : ''
1449
+ children: status ? status.text : ""
1548
1450
  })
1549
1451
  }), /*#__PURE__*/jsx("td", {
1550
1452
  children: /*#__PURE__*/jsx("div", {
1551
1453
  style: {
1552
- textAlign: 'center',
1454
+ textAlign: "center",
1553
1455
  borderRadius: 4,
1554
1456
  width: 100,
1555
1457
  paddingTop: 2,
1556
1458
  paddingBottom: 2,
1557
- color: '#fff',
1459
+ color: "#fff",
1558
1460
  backgroundColor: priority.color
1559
1461
  },
1560
1462
  children: priority.name
@@ -1562,30 +1464,30 @@ class JobList extends Component {
1562
1464
  }), /*#__PURE__*/jsx("td", {
1563
1465
  className: "table-options",
1564
1466
  children: /*#__PURE__*/jsxs("div", {
1565
- style: {
1566
- display: 'flex',
1567
- alignItems: 'center'
1467
+ iconStyle: {
1468
+ display: "flex",
1469
+ alignItems: "center"
1568
1470
  },
1569
1471
  children: [/*#__PURE__*/jsx(Link, {
1570
1472
  to: "".concat(values.routeRequestDetails, "/").concat(ev.id),
1571
- children: /*#__PURE__*/jsx(FontAwesome, {
1473
+ children: /*#__PURE__*/jsx(Icon, {
1572
1474
  style: {
1573
1475
  fontSize: 20,
1574
1476
  padding: 5,
1575
- cursor: 'pointer'
1477
+ cursor: "pointer"
1576
1478
  },
1577
- name: "pencil"
1479
+ icon: "pencil"
1578
1480
  })
1579
1481
  }), Session$7.validateAccess(this.props.auth.site, values.permissionMaintenanceTracking, this.props.auth) && /*#__PURE__*/jsx("a", {
1580
1482
  onClick: () => this.onRemoveRequest(ev),
1581
- children: /*#__PURE__*/jsx(FontAwesome, {
1483
+ children: /*#__PURE__*/jsx(Icon, {
1582
1484
  style: {
1583
1485
  fontSize: 20,
1584
1486
  padding: 5,
1585
1487
  marginLeft: 8,
1586
- cursor: 'pointer'
1488
+ cursor: "pointer"
1587
1489
  },
1588
- name: "minus-circle"
1490
+ icon: "circle-minus"
1589
1491
  })
1590
1492
  })]
1591
1493
  })
@@ -1599,26 +1501,26 @@ class JobList extends Component {
1599
1501
  sortDesc
1600
1502
  } = this.state;
1601
1503
  if (col !== sortColumn) return null;
1602
- return /*#__PURE__*/jsx(FontAwesome, {
1504
+ return /*#__PURE__*/jsx(Icon, {
1603
1505
  style: {
1604
1506
  marginLeft: 5
1605
1507
  },
1606
- name: sortDesc ? 'chevron-up' : 'chevron-down'
1508
+ icon: sortDesc ? "fa-".concat("chevron-up") : "fa-".concat("chevron-down")
1607
1509
  });
1608
1510
  }
1609
1511
  sortIsActive(col) {
1610
- if (col !== this.state.sortColumn) return '';
1611
- return ' table--columnActive';
1512
+ if (col !== this.state.sortColumn) return "";
1513
+ return " table--columnActive";
1612
1514
  }
1613
1515
  renderEmpty() {
1614
1516
  var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1615
1517
  return /*#__PURE__*/jsxs("div", {
1616
1518
  style: {
1617
- display: 'flex',
1618
- flexDirection: 'column',
1519
+ display: "flex",
1520
+ flexDirection: "column",
1619
1521
  flex: 1,
1620
- justifyContent: 'center',
1621
- alignItems: 'center',
1522
+ justifyContent: "center",
1523
+ alignItems: "center",
1622
1524
  marginTop: 32
1623
1525
  },
1624
1526
  children: [/*#__PURE__*/jsx("div", {
@@ -1627,7 +1529,7 @@ class JobList extends Component {
1627
1529
  className: "marginTop-32",
1628
1530
  style: {
1629
1531
  maxWidth: 500,
1630
- textAlign: 'center'
1532
+ textAlign: "center"
1631
1533
  },
1632
1534
  children: /*#__PURE__*/jsxs("span", {
1633
1535
  className: "fontRegular fontSize-13",
@@ -1640,149 +1542,112 @@ class JobList extends Component {
1640
1542
  className: "marginTop-8 fontRegular fontSize-13",
1641
1543
  style: {
1642
1544
  maxWidth: 500,
1643
- textAlign: 'center'
1545
+ textAlign: "center"
1644
1546
  },
1645
1547
  children: values.textEmptyExample
1646
1548
  })]
1647
1549
  });
1648
1550
  }
1649
1551
  renderContent() {
1650
- if (this.state.loading) {
1651
- return /*#__PURE__*/jsx("div", {
1652
- style: {
1653
- display: 'flex',
1654
- justifyContent: 'center',
1655
- padding: 40
1656
- },
1657
- children: /*#__PURE__*/jsx(FontAwesome, {
1658
- style: {
1659
- fontSize: 32,
1660
- color: '#ccc'
1661
- },
1662
- name: "spinner fa-pulse fa-fw"
1663
- })
1664
- });
1665
- }
1666
1552
  if (_.isEmpty(this.props.source)) return this.renderEmpty();
1667
- return /*#__PURE__*/jsxs("div", {
1668
- children: [/*#__PURE__*/jsxs(Table, {
1669
- className: "plussTable",
1670
- striped: true,
1671
- bordered: true,
1672
- condensed: true,
1673
- hover: true,
1674
- style: {
1675
- minWidth: '100%'
1676
- },
1677
- children: [/*#__PURE__*/jsx("thead", {
1678
- children: /*#__PURE__*/jsxs("tr", {
1679
- children: [/*#__PURE__*/jsxs("th", {
1680
- className: "".concat(this.sortIsActive('jobId')),
1681
- style: {
1682
- cursor: 'pointer',
1683
- width: 70
1684
- },
1685
- onClick: () => {
1686
- this.sortByCol('jobId');
1687
- },
1688
- children: [values.textEntityName, " No.", this.renderSort('jobId')]
1689
- }), /*#__PURE__*/jsxs("th", {
1690
- className: "".concat(this.sortIsActive('title')),
1691
- style: {
1692
- cursor: 'pointer'
1693
- },
1694
- onClick: () => {
1695
- this.sortByCol('title');
1696
- },
1697
- children: ["Title", this.renderSort('title')]
1698
- }), /*#__PURE__*/jsxs("th", {
1699
- className: "".concat(this.sortIsActive('type')),
1700
- style: {
1701
- cursor: 'pointer',
1702
- width: 100
1703
- },
1704
- onClick: () => {
1705
- this.sortByCol('type');
1706
- },
1707
- children: [values.textJobType, this.renderSort('type')]
1708
- }), /*#__PURE__*/jsxs("th", {
1709
- className: "".concat(this.sortIsActive('createdUnix')),
1710
- style: {
1711
- cursor: 'pointer',
1712
- width: 80
1713
- },
1714
- onClick: () => {
1715
- this.sortByCol('createdUnix');
1716
- },
1717
- children: ["Date", this.renderSort('createdUnix')]
1718
- }), /*#__PURE__*/jsxs("th", {
1719
- className: "".concat(this.sortIsActive('room')),
1720
- style: {
1721
- cursor: 'pointer',
1722
- width: 100
1723
- },
1724
- onClick: () => {
1725
- this.sortByCol('room');
1726
- },
1727
- children: ["Address", this.renderSort('room')]
1728
- }), /*#__PURE__*/jsxs("th", {
1729
- className: "".concat(this.sortIsActive('userName')),
1730
- style: {
1731
- cursor: 'pointer',
1732
- width: 150
1733
- },
1734
- onClick: () => {
1735
- this.sortByCol('userName');
1736
- },
1737
- children: ["Submitted By", this.renderSort('userName')]
1738
- }), /*#__PURE__*/jsxs("th", {
1739
- className: "".concat(this.sortIsActive('assigned')),
1740
- style: {
1741
- cursor: 'pointer',
1742
- width: 150
1743
- },
1744
- onClick: () => {
1745
- this.sortByCol('assigned');
1746
- },
1747
- children: ["Assigned To", this.renderSort('assigned')]
1748
- }), /*#__PURE__*/jsx("th", {
1749
- style: {
1750
- width: 120
1751
- },
1752
- children: "Status"
1753
- }), /*#__PURE__*/jsx("th", {
1754
- style: {
1755
- width: 120
1756
- },
1757
- children: "Priority"
1758
- }), /*#__PURE__*/jsx("th", {
1759
- style: {
1760
- width: 50
1761
- }
1762
- })]
1763
- })
1764
- }), /*#__PURE__*/jsx("tbody", {
1765
- children: this.renderRequests()
1766
- })]
1767
- }), this.state.hasMore && /*#__PURE__*/jsx("div", {
1768
- style: {
1769
- display: 'flex',
1770
- justifyContent: 'center',
1771
- padding: '16px 0'
1772
- },
1773
- children: this.state.loadingMore ? /*#__PURE__*/jsx(FontAwesome, {
1774
- style: {
1775
- fontSize: 24,
1776
- color: '#ccc'
1777
- },
1778
- name: "spinner fa-pulse fa-fw"
1779
- }) : /*#__PURE__*/jsx(Components$7.Button, {
1780
- inline: true,
1781
- buttonType: "tertiary",
1782
- onClick: this.loadMore,
1783
- isActive: true,
1784
- children: "Load More"
1553
+ return /*#__PURE__*/jsxs(Table, {
1554
+ className: "plussTable",
1555
+ striped: true,
1556
+ bordered: true,
1557
+ condensed: true,
1558
+ hover: true,
1559
+ style: {
1560
+ minWidth: "100%"
1561
+ },
1562
+ children: [/*#__PURE__*/jsx("thead", {
1563
+ children: /*#__PURE__*/jsxs("tr", {
1564
+ children: [/*#__PURE__*/jsxs("th", {
1565
+ className: "".concat(this.sortIsActive("jobId")),
1566
+ style: {
1567
+ cursor: "pointer",
1568
+ width: 70
1569
+ },
1570
+ onClick: () => {
1571
+ this.sortByCol("jobId");
1572
+ },
1573
+ children: [values.textEntityName, " No.", this.renderSort("jobId")]
1574
+ }), /*#__PURE__*/jsxs("th", {
1575
+ className: "".concat(this.sortIsActive("title")),
1576
+ style: {
1577
+ cursor: "pointer"
1578
+ },
1579
+ onClick: () => {
1580
+ this.sortByCol("title");
1581
+ },
1582
+ children: ["Title", this.renderSort("title")]
1583
+ }), /*#__PURE__*/jsxs("th", {
1584
+ className: "".concat(this.sortIsActive("type")),
1585
+ style: {
1586
+ cursor: "pointer",
1587
+ width: 100
1588
+ },
1589
+ onClick: () => {
1590
+ this.sortByCol("type");
1591
+ },
1592
+ children: [values.textJobType, this.renderSort("type")]
1593
+ }), /*#__PURE__*/jsxs("th", {
1594
+ className: "".concat(this.sortIsActive("createdUnix")),
1595
+ style: {
1596
+ cursor: "pointer",
1597
+ width: 80
1598
+ },
1599
+ onClick: () => {
1600
+ this.sortByCol("createdUnix");
1601
+ },
1602
+ children: ["Date", this.renderSort("createdUnix")]
1603
+ }), /*#__PURE__*/jsxs("th", {
1604
+ className: "".concat(this.sortIsActive("room")),
1605
+ style: {
1606
+ cursor: "pointer",
1607
+ width: 100
1608
+ },
1609
+ onClick: () => {
1610
+ this.sortByCol("room");
1611
+ },
1612
+ children: ["Address", this.renderSort("room")]
1613
+ }), /*#__PURE__*/jsxs("th", {
1614
+ className: "".concat(this.sortIsActive("userName")),
1615
+ style: {
1616
+ cursor: "pointer",
1617
+ width: 150
1618
+ },
1619
+ onClick: () => {
1620
+ this.sortByCol("userName");
1621
+ },
1622
+ children: ["Submitted By", this.renderSort("userName")]
1623
+ }), /*#__PURE__*/jsxs("th", {
1624
+ className: "".concat(this.sortIsActive("assigned")),
1625
+ style: {
1626
+ cursor: "pointer",
1627
+ width: 150
1628
+ },
1629
+ onClick: () => {
1630
+ this.sortByCol("assigned");
1631
+ },
1632
+ children: ["Assigned To", this.renderSort("assigned")]
1633
+ }), /*#__PURE__*/jsx("th", {
1634
+ iconStyle: {
1635
+ width: 120
1636
+ },
1637
+ children: "Status"
1638
+ }), /*#__PURE__*/jsx("th", {
1639
+ iconStyle: {
1640
+ width: 120
1641
+ },
1642
+ children: "Priority"
1643
+ }), /*#__PURE__*/jsx("th", {
1644
+ iconStyle: {
1645
+ width: 50
1646
+ }
1647
+ })]
1785
1648
  })
1649
+ }), /*#__PURE__*/jsx("tbody", {
1650
+ children: this.renderRequests()
1786
1651
  })]
1787
1652
  });
1788
1653
  }
@@ -1790,42 +1655,42 @@ class JobList extends Component {
1790
1655
  var typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1791
1656
  className: "marginRight-10",
1792
1657
  onClick: () => {
1793
- this.openFilter('type');
1658
+ this.openFilter("type");
1794
1659
  },
1795
1660
  text: values.textJobType
1796
1661
  });
1797
1662
  var statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1798
1663
  className: "marginRight-10",
1799
1664
  onClick: () => {
1800
- this.openFilter('status');
1665
+ this.openFilter("status");
1801
1666
  },
1802
1667
  text: "Status"
1803
1668
  });
1804
1669
  var priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1805
1670
  className: "marginRight-10",
1806
1671
  onClick: () => {
1807
- this.openFilter('priority');
1672
+ this.openFilter("priority");
1808
1673
  },
1809
1674
  text: "Priority"
1810
1675
  });
1811
1676
  var timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1812
1677
  className: "marginRight-10",
1813
1678
  onClick: () => {
1814
- this.openFilter('time');
1679
+ this.openFilter("time");
1815
1680
  },
1816
1681
  text: "Time"
1817
1682
  });
1818
1683
  var userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1819
1684
  className: "marginRight-10",
1820
1685
  onClick: () => {
1821
- this.openFilter('user');
1686
+ this.openFilter("user");
1822
1687
  },
1823
1688
  text: "Assigned To"
1824
1689
  });
1825
1690
  var requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1826
1691
  className: "marginRight-10",
1827
1692
  onClick: () => {
1828
- this.openFilter('requester');
1693
+ this.openFilter("requester");
1829
1694
  },
1830
1695
  text: "Submitted By"
1831
1696
  });
@@ -1833,7 +1698,7 @@ class JobList extends Component {
1833
1698
  typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1834
1699
  className: "marginRight-10",
1835
1700
  onClick: () => {
1836
- this.openFilter('type');
1701
+ this.openFilter("type");
1837
1702
  },
1838
1703
  rightIcon: "close",
1839
1704
  rightClick: e => {
@@ -1847,7 +1712,7 @@ class JobList extends Component {
1847
1712
  priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1848
1713
  className: "marginRight-10",
1849
1714
  onClick: () => {
1850
- this.openFilter('priority');
1715
+ this.openFilter("priority");
1851
1716
  },
1852
1717
  rightIcon: "close",
1853
1718
  rightClick: e => {
@@ -1861,7 +1726,7 @@ class JobList extends Component {
1861
1726
  statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1862
1727
  className: "marginRight-10",
1863
1728
  onClick: () => {
1864
- this.openFilter('status');
1729
+ this.openFilter("status");
1865
1730
  },
1866
1731
  rightIcon: "close",
1867
1732
  rightClick: e => {
@@ -1875,7 +1740,7 @@ class JobList extends Component {
1875
1740
  timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1876
1741
  className: "marginRight-10",
1877
1742
  onClick: () => {
1878
- this.openFilter('time');
1743
+ this.openFilter("time");
1879
1744
  },
1880
1745
  rightIcon: "close",
1881
1746
  rightClick: e => {
@@ -1889,7 +1754,7 @@ class JobList extends Component {
1889
1754
  userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1890
1755
  className: "marginRight-10",
1891
1756
  onClick: () => {
1892
- this.openFilter('user');
1757
+ this.openFilter("user");
1893
1758
  },
1894
1759
  rightIcon: "close",
1895
1760
  rightClick: e => {
@@ -1903,7 +1768,7 @@ class JobList extends Component {
1903
1768
  requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1904
1769
  className: "marginRight-10",
1905
1770
  onClick: () => {
1906
- this.openFilter('requester');
1771
+ this.openFilter("requester");
1907
1772
  },
1908
1773
  rightIcon: "close",
1909
1774
  rightClick: e => {
@@ -1926,7 +1791,7 @@ class JobList extends Component {
1926
1791
  }), /*#__PURE__*/jsx(Components$7.Button, {
1927
1792
  inline: true,
1928
1793
  buttonType: "primaryAction",
1929
- leftIcon: "file-code-o",
1794
+ leftIcon: "file-code",
1930
1795
  onClick: this.onOpenExportCsv,
1931
1796
  isActive: !_.isEmpty(this.getSource()),
1932
1797
  children: "Export CSV"
@@ -1961,8 +1826,8 @@ class JobList extends Component {
1961
1826
  }
1962
1827
  render() {
1963
1828
  return /*#__PURE__*/jsxs("div", {
1964
- style: {
1965
- minWidth: '100%'
1829
+ iconStyle: {
1830
+ minWidth: "100%"
1966
1831
  },
1967
1832
  children: [this.renderFilterPopup(), this.renderCSVPopup(), this.renderFilters(), this.renderContent()]
1968
1833
  });
@@ -1981,7 +1846,6 @@ var mapStateToProps$7 = state => {
1981
1846
  };
1982
1847
  var JobList$1 = connect(mapStateToProps$7, {
1983
1848
  jobsLoaded,
1984
- jobsAdded,
1985
1849
  removeJob,
1986
1850
  jobStatusesUpdate
1987
1851
  })(withRouter(JobList));
@@ -2000,7 +1864,7 @@ class JobTypes extends Component {
2000
1864
  var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
2001
1865
  if (res.data != null) _this.props.jobTypesLoaded(res.data);
2002
1866
  } catch (error) {
2003
- console.error('getJobTypes', error);
1867
+ console.error("getJobTypes", error);
2004
1868
  } finally {
2005
1869
  _this.setState({
2006
1870
  loading: false
@@ -2033,8 +1897,8 @@ class JobTypes extends Component {
2033
1897
  _this.props.jobTypesLoaded(newJobTypes);
2034
1898
  }
2035
1899
  } catch (error) {
2036
- console.error('onRemoveJobType', error);
2037
- alert('Something went wrong with the request. Please try again.');
1900
+ console.error("onRemoveJobType", error);
1901
+ alert("Something went wrong with the request. Please try again.");
2038
1902
  }
2039
1903
  });
2040
1904
  return function (_x) {
@@ -2043,7 +1907,7 @@ class JobTypes extends Component {
2043
1907
  }());
2044
1908
  this.state = {
2045
1909
  jobList: [],
2046
- sortColumn: 'name',
1910
+ sortColumn: "name",
2047
1911
  sortDesc: false,
2048
1912
  loading: true
2049
1913
  };
@@ -2087,31 +1951,31 @@ class JobTypes extends Component {
2087
1951
  }), /*#__PURE__*/jsx("td", {
2088
1952
  className: "table-options",
2089
1953
  children: /*#__PURE__*/jsxs("div", {
2090
- style: {
2091
- display: 'flex',
2092
- alignItems: 'center'
1954
+ iconStyle: {
1955
+ display: "flex",
1956
+ alignItems: "center"
2093
1957
  },
2094
1958
  children: [Session$6.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && /*#__PURE__*/jsx(Link, {
2095
1959
  to: "".concat(values.routeAddRequestType, "/").concat(ev.id),
2096
- children: /*#__PURE__*/jsx(FontAwesome, {
1960
+ children: /*#__PURE__*/jsx(Icon, {
2097
1961
  style: {
2098
1962
  fontSize: 20,
2099
1963
  padding: 5,
2100
1964
  marginLeft: 12,
2101
- cursor: 'pointer'
1965
+ cursor: "pointer"
2102
1966
  },
2103
- name: "pencil"
1967
+ icon: "pencil"
2104
1968
  })
2105
1969
  }), Session$6.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && /*#__PURE__*/jsx("a", {
2106
1970
  onClick: () => this.onRemoveJobType(ev),
2107
- children: /*#__PURE__*/jsx(FontAwesome, {
1971
+ children: /*#__PURE__*/jsx(Icon, {
2108
1972
  style: {
2109
1973
  fontSize: 20,
2110
1974
  padding: 5,
2111
1975
  marginLeft: 8,
2112
- cursor: 'pointer'
1976
+ cursor: "pointer"
2113
1977
  },
2114
- name: "minus-circle"
1978
+ icon: "circle-minus"
2115
1979
  })
2116
1980
  })]
2117
1981
  })
@@ -2129,30 +1993,30 @@ class JobTypes extends Component {
2129
1993
  condensed: true,
2130
1994
  hover: true,
2131
1995
  style: {
2132
- minWidth: '100%'
1996
+ minWidth: "100%"
2133
1997
  },
2134
1998
  children: [/*#__PURE__*/jsx("thead", {
2135
1999
  children: /*#__PURE__*/jsxs("tr", {
2136
2000
  children: [/*#__PURE__*/jsxs("th", {
2137
2001
  style: {
2138
- cursor: 'pointer'
2002
+ cursor: "pointer"
2139
2003
  },
2140
- onClick: () => this.sortByCol('name'),
2004
+ onClick: () => this.sortByCol("name"),
2141
2005
  children: [values.textSingularName, " type"]
2142
2006
  }), /*#__PURE__*/jsx("th", {
2143
2007
  style: {
2144
- cursor: 'pointer'
2008
+ cursor: "pointer"
2145
2009
  },
2146
- onClick: () => this.sortByCol('name'),
2010
+ onClick: () => this.sortByCol("name"),
2147
2011
  children: "Type Description"
2148
2012
  }), /*#__PURE__*/jsx("th", {
2149
2013
  style: {
2150
- cursor: 'pointer'
2014
+ cursor: "pointer"
2151
2015
  },
2152
- onClick: () => this.sortByCol('email'),
2016
+ onClick: () => this.sortByCol("email"),
2153
2017
  children: "Email"
2154
2018
  }), /*#__PURE__*/jsx("th", {
2155
- style: {
2019
+ iconStyle: {
2156
2020
  width: 70
2157
2021
  }
2158
2022
  })]
@@ -2165,11 +2029,11 @@ class JobTypes extends Component {
2165
2029
  renderEmpty() {
2166
2030
  return /*#__PURE__*/jsxs("div", {
2167
2031
  style: {
2168
- display: 'flex',
2169
- flexDirection: 'column',
2032
+ display: "flex",
2033
+ flexDirection: "column",
2170
2034
  flex: 1,
2171
- justifyContent: 'center',
2172
- alignItems: 'center',
2035
+ justifyContent: "center",
2036
+ alignItems: "center",
2173
2037
  marginTop: 32
2174
2038
  },
2175
2039
  children: [/*#__PURE__*/jsx("div", {
@@ -2178,7 +2042,7 @@ class JobTypes extends Component {
2178
2042
  className: "marginTop-32",
2179
2043
  style: {
2180
2044
  maxWidth: 500,
2181
- textAlign: 'center'
2045
+ textAlign: "center"
2182
2046
  },
2183
2047
  children: /*#__PURE__*/jsx("span", {
2184
2048
  className: "fontRegular fontSize-13",
@@ -2188,7 +2052,7 @@ class JobTypes extends Component {
2188
2052
  className: "marginTop-8 fontRegular fontSize-13",
2189
2053
  style: {
2190
2054
  maxWidth: 500,
2191
- textAlign: 'center'
2055
+ textAlign: "center"
2192
2056
  },
2193
2057
  children: values.textEmptyJobTypesExample
2194
2058
  })]
@@ -2205,27 +2069,29 @@ class JobTypes extends Component {
2205
2069
  } = this.state;
2206
2070
  if (jobList.length === 0 && loading) {
2207
2071
  return /*#__PURE__*/jsx("div", {
2208
- style: {
2209
- minWidth: '100%'
2072
+ iconStyle: {
2073
+ minWidth: "100%"
2210
2074
  },
2211
2075
  children: /*#__PURE__*/jsx("div", {
2212
2076
  className: "padding-60 paddingVertical-40",
2213
2077
  style: {
2214
- textAlign: 'center'
2078
+ textAlign: "center"
2215
2079
  },
2216
- children: /*#__PURE__*/jsx(FontAwesome, {
2217
- style: {
2080
+ children: /*#__PURE__*/jsx(Icon, {
2081
+ iconStyle: {
2218
2082
  fontSize: 30,
2219
2083
  color: FeatureConfig.env.colourBrandingOff
2220
2084
  },
2221
- name: "spinner fa-pulse fa-fw"
2085
+ icon: "spinner",
2086
+ pulse: true,
2087
+ fixedWidth: true
2222
2088
  })
2223
2089
  })
2224
2090
  });
2225
2091
  }
2226
2092
  return /*#__PURE__*/jsxs("div", {
2227
- style: {
2228
- minWidth: '100%'
2093
+ iconStyle: {
2094
+ minWidth: "100%"
2229
2095
  },
2230
2096
  children: [/*#__PURE__*/jsx("div", {
2231
2097
  className: "marginBottom-32",
@@ -2238,8 +2104,8 @@ class JobTypes extends Component {
2238
2104
  }
2239
2105
  render() {
2240
2106
  return /*#__PURE__*/jsxs("div", {
2241
- style: {
2242
- minWidth: '100%'
2107
+ iconStyle: {
2108
+ minWidth: "100%"
2243
2109
  },
2244
2110
  children: [/*#__PURE__*/jsx("div", {
2245
2111
  children: this.renderJobTypes()
@@ -2263,12 +2129,12 @@ var JobTypes$1 = connect(mapStateToProps$6, {
2263
2129
  jobTypesUpdate
2264
2130
  })(withRouter(JobTypes));
2265
2131
 
2266
- 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; }
2267
- 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; }
2132
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2133
+ 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; }
2268
2134
  var {
2269
2135
  Session: Session$5,
2270
2136
  Components: Components$5,
2271
- Colours: Colours$2
2137
+ Colours: Colours$3
2272
2138
  } = PlussCore;
2273
2139
  class Configuration extends Component {
2274
2140
  constructor(props) {
@@ -2324,7 +2190,7 @@ class Configuration extends Component {
2324
2190
  showWarnings: false,
2325
2191
  showStatusPopup: true,
2326
2192
  selectedStatusIndex: -1,
2327
- statusLabel: '',
2193
+ statusLabel: "",
2328
2194
  statusCategory: STATUS_NOT_ACTIONED,
2329
2195
  statusColour: defaultStatus.color
2330
2196
  });
@@ -2363,7 +2229,7 @@ class Configuration extends Component {
2363
2229
  });
2364
2230
  _defineProperty(this, "onHandleChange", event => {
2365
2231
  var stateChange = {};
2366
- stateChange[event.target.getAttribute('id')] = event.target.value;
2232
+ stateChange[event.target.getAttribute("id")] = event.target.value;
2367
2233
  this.setState(stateChange);
2368
2234
  });
2369
2235
  _defineProperty(this, "onToggleDisableSeen", () => {
@@ -2391,7 +2257,7 @@ class Configuration extends Component {
2391
2257
  success: true
2392
2258
  });
2393
2259
  } catch (error) {
2394
- console.log('onSaveConfig - error', error);
2260
+ console.log("onSaveConfig - error", error);
2395
2261
  _this.setState({
2396
2262
  success: false
2397
2263
  });
@@ -2407,9 +2273,9 @@ class Configuration extends Component {
2407
2273
  submitting: false,
2408
2274
  selectedStatusIndex: -1,
2409
2275
  showStatusPopup: false,
2410
- statusLabel: '',
2276
+ statusLabel: "",
2411
2277
  statusCategory: STATUS_NOT_ACTIONED,
2412
- statusColour: '',
2278
+ statusColour: "",
2413
2279
  fetchingStatusTypes: true,
2414
2280
  statusTypes: this.props.statusTypes,
2415
2281
  fetchingHideSeen: true,
@@ -2420,8 +2286,8 @@ class Configuration extends Component {
2420
2286
  Session$5.checkLoggedIn(this);
2421
2287
  }
2422
2288
  componentDidMount() {
2423
- if (!Session$5.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth, true)) {
2424
- this.props.history.push('/mastermenu');
2289
+ if (!Session$5.validateAccess(this.props.auth.site, "featurePicker", this.props.auth, true)) {
2290
+ this.props.history.push("/mastermenu");
2425
2291
  } else {
2426
2292
  this.props.jobStatusesUpdate(this.props.auth.site, statusTypes => this.setState({
2427
2293
  statusTypes,
@@ -2471,7 +2337,7 @@ class Configuration extends Component {
2471
2337
  style: styles$6.statusTypeContainer,
2472
2338
  children: [/*#__PURE__*/jsx("div", {
2473
2339
  className: "statusLabel",
2474
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusTextContainer), {}, {
2340
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusTextContainer), {}, {
2475
2341
  backgroundColor: status.color
2476
2342
  }),
2477
2343
  children: /*#__PURE__*/jsx("span", {
@@ -2484,39 +2350,39 @@ class Configuration extends Component {
2484
2350
  className: "fontMedium fontSize-16 text-dark",
2485
2351
  children: status.category
2486
2352
  })
2487
- }), /*#__PURE__*/jsx(FontAwesome, {
2488
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2489
- visibility: index === 0 ? 'hidden' : 'visible'
2353
+ }), /*#__PURE__*/jsx(Icon, {
2354
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusIcon), {}, {
2355
+ visibility: index === 0 ? "hidden" : "visible"
2490
2356
  }),
2491
- name: 'arrow-up',
2357
+ name: "arrow-up",
2492
2358
  onClick: () => this.onMoveStatus(index, true)
2493
- }), /*#__PURE__*/jsx(FontAwesome, {
2494
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2495
- visibility: index === statusTypes.length - 1 ? 'hidden' : 'visible'
2359
+ }), /*#__PURE__*/jsx(Icon, {
2360
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusIcon), {}, {
2361
+ visibility: index === statusTypes.length - 1 ? "hidden" : "visible"
2496
2362
  }),
2497
- name: 'arrow-down',
2363
+ name: "arrow-down",
2498
2364
  onClick: () => this.onMoveStatus(index, false)
2499
- }), /*#__PURE__*/jsx(FontAwesome, {
2500
- style: _objectSpread$5({}, styles$6.statusIcon),
2501
- name: "pencil",
2365
+ }), /*#__PURE__*/jsx(Icon, {
2366
+ style: _objectSpread$6({}, styles$6.statusIcon),
2367
+ icon: "pencil",
2502
2368
  onClick: () => this.onEditStatus(index)
2503
- }), /*#__PURE__*/jsx(FontAwesome, {
2504
- style: _objectSpread$5({}, styles$6.statusIcon),
2505
- name: "minus-circle",
2369
+ }), /*#__PURE__*/jsx(Icon, {
2370
+ style: _objectSpread$6({}, styles$6.statusIcon),
2371
+ icon: "circle-minus",
2506
2372
  onClick: () => this.onDeleteStatus(index)
2507
2373
  })]
2508
2374
  }, "".concat(status.text, "_").concat(index));
2509
2375
  }), /*#__PURE__*/jsxs("div", {
2510
2376
  onClick: this.onAddStatus,
2511
2377
  style: {
2512
- display: 'flex',
2513
- flexDirection: 'row',
2514
- alignItems: 'center',
2378
+ display: "flex",
2379
+ flexDirection: "row",
2380
+ alignItems: "center",
2515
2381
  marginTop: 16
2516
2382
  },
2517
- children: [/*#__PURE__*/jsx(Components$5.P60Icon, {
2383
+ children: [/*#__PURE__*/jsx(Icon, {
2518
2384
  className: "addoption_plus",
2519
- icon: "add",
2385
+ icon: "plus",
2520
2386
  style: {
2521
2387
  fontSize: 12
2522
2388
  }
@@ -2558,8 +2424,8 @@ class Configuration extends Component {
2558
2424
  renderSuccess() {
2559
2425
  if (!this.state.success) return null;
2560
2426
  return /*#__PURE__*/jsx("span", {
2561
- style: _objectSpread$5(_objectSpread$5({}, styles$6.savedText), {}, {
2562
- color: Colours$2.COLOUR_GREEN
2427
+ iconStyle: _objectSpread$6(_objectSpread$6({}, styles$6.savedText), {}, {
2428
+ color: Colours$3.COLOUR_GREEN
2563
2429
  }),
2564
2430
  children: "Saved"
2565
2431
  });
@@ -2581,21 +2447,21 @@ class Configuration extends Component {
2581
2447
  minWidth: 450,
2582
2448
  hasPadding: true,
2583
2449
  buttons: [{
2584
- type: 'primaryAction',
2450
+ type: "primaryAction",
2585
2451
  onClick: this.onSaveStatus,
2586
2452
  isActive: canSave,
2587
2453
  isActive: true,
2588
- text: submitting ? 'Saving...' : 'Save',
2589
- className: 'popupButton'
2454
+ text: submitting ? "Saving..." : "Save",
2455
+ className: "popupButton"
2590
2456
  }, {
2591
- type: 'outlinedAction',
2457
+ type: "outlinedAction",
2592
2458
  onClick: this.onHideStatusPopup,
2593
2459
  isActive: !submitting,
2594
- text: 'Cancel',
2595
- className: 'popupButton'
2460
+ text: "Cancel",
2461
+ className: "popupButton"
2596
2462
  }],
2597
2463
  onClose: this.onHideStatusPopup,
2598
- title: selectedStatusIndex < 0 ? 'New Status' : 'Edit Status',
2464
+ title: selectedStatusIndex < 0 ? "New Status" : "Edit Status",
2599
2465
  children: [/*#__PURE__*/jsx(Components$5.GenericInput, {
2600
2466
  id: "statusLabel",
2601
2467
  type: "text",
@@ -2614,15 +2480,15 @@ class Configuration extends Component {
2614
2480
  className: "marginBottom-16",
2615
2481
  children: [/*#__PURE__*/jsx("div", {
2616
2482
  className: "marginBottom-4",
2617
- children: 'This is used to categorise statuses for filtering and analytics purposes'
2483
+ children: "This is used to categorise statuses for filtering and analytics purposes"
2618
2484
  }), /*#__PURE__*/jsx("div", {
2619
2485
  className: "text-bold",
2620
- children: 'This status is considered'
2486
+ children: "This status is considered"
2621
2487
  })]
2622
2488
  }),
2623
2489
  className: "marginBottom-20",
2624
2490
  rowStyle: {
2625
- flexDirection: 'column'
2491
+ flexDirection: "column"
2626
2492
  },
2627
2493
  buttonStyle: {
2628
2494
  marginBottom: 8
@@ -2648,7 +2514,7 @@ class Configuration extends Component {
2648
2514
  })
2649
2515
  }]
2650
2516
  }), /*#__PURE__*/jsx(Components$5.ColourOptions, {
2651
- options: ['vibrant', 'picker'],
2517
+ options: ["vibrant", "picker"],
2652
2518
  defaultTab: "vibrant",
2653
2519
  value: statusColour,
2654
2520
  onColourSelected: statusColour => this.setState({
@@ -2671,11 +2537,11 @@ class Configuration extends Component {
2671
2537
  }
2672
2538
  render() {
2673
2539
  return /*#__PURE__*/jsxs("div", {
2674
- style: {
2675
- minWidth: '100%'
2540
+ iconStyle: {
2541
+ minWidth: "100%"
2676
2542
  },
2677
2543
  children: [this.renderStatuses(), this.renderOtherOptions(), /*#__PURE__*/jsxs("div", {
2678
- style: {
2544
+ iconStyle: {
2679
2545
  paddingTop: 24,
2680
2546
  paddingBottom: 24
2681
2547
  },
@@ -2688,13 +2554,13 @@ var styles$6 = {
2688
2554
  statusCategoryHeading: {
2689
2555
  marginLeft: 130,
2690
2556
  width: 160,
2691
- textAlign: 'center',
2557
+ textAlign: "center",
2692
2558
  marginBottom: 12
2693
2559
  },
2694
2560
  statusTypeContainer: {
2695
- display: 'flex',
2696
- flexDirection: 'row',
2697
- alignItems: 'center',
2561
+ display: "flex",
2562
+ flexDirection: "row",
2563
+ alignItems: "center",
2698
2564
  marginBottom: 20
2699
2565
  },
2700
2566
  statusTextContainer: {
@@ -2702,19 +2568,19 @@ var styles$6 = {
2702
2568
  },
2703
2569
  statusCategoryContainer: {
2704
2570
  width: 160,
2705
- textAlign: 'center'
2571
+ textAlign: "center"
2706
2572
  },
2707
2573
  statusIcon: {
2708
- cursor: 'pointer',
2574
+ cursor: "pointer",
2709
2575
  fontSize: 20,
2710
2576
  padding: 5,
2711
2577
  marginLeft: 10,
2712
- color: Colours$2.COLOUR_BRANDING_ACTION,
2713
- visibility: 'visible'
2578
+ color: Colours$3.COLOUR_BRANDING_ACTION,
2579
+ visibility: "visible"
2714
2580
  },
2715
2581
  savedText: {
2716
2582
  fontSize: 14,
2717
- lineHeight: '33px',
2583
+ lineHeight: "33px",
2718
2584
  marginLeft: 15
2719
2585
  }
2720
2586
  };
@@ -2742,7 +2608,55 @@ var {
2742
2608
  } = PlussCore;
2743
2609
  class RequestsHub extends Component {
2744
2610
  constructor(props) {
2611
+ var _this;
2745
2612
  super(props);
2613
+ _this = this;
2614
+ _defineProperty(this, "setData", () => {
2615
+ var allList = [];
2616
+ this.state.allList.forEach(ev => {
2617
+ if (ev != null && !ev.Deleted) allList.push(ev);
2618
+ });
2619
+ var upcoming = _.filter(allList, ev => {
2620
+ if (!ev) return false;
2621
+ if (ev.status && ev.status === "Completed") return false;
2622
+ return true;
2623
+ });
2624
+ var completed = _.filter(allList, ev => {
2625
+ if (!ev) return false;
2626
+ if (ev.status && ev.status === "Completed") return true;
2627
+ return false;
2628
+ });
2629
+
2630
+ // console.log('setData', upcoming, completed);
2631
+ this.setState({
2632
+ allList,
2633
+ upcoming,
2634
+ completed
2635
+ });
2636
+ });
2637
+ _defineProperty(this, "getData", () => {
2638
+ var {
2639
+ auth
2640
+ } = this.props;
2641
+ this.setState({
2642
+ loadingAll: true
2643
+ }, /*#__PURE__*/_asyncToGenerator(function* () {
2644
+ try {
2645
+ var res = yield maintenanceActions.getJobsRecursive(auth.site);
2646
+ _this.setState({
2647
+ loadingAll: false
2648
+ });
2649
+ if (!_.isEmpty(res) && res[0].site === auth.site) {
2650
+ _this.props.jobsLoaded(res);
2651
+ }
2652
+ } catch (error) {
2653
+ console.error("getData", error);
2654
+ _this.setState({
2655
+ loadingAll: false
2656
+ });
2657
+ }
2658
+ }));
2659
+ });
2746
2660
  _defineProperty(this, "onAddNew", () => {
2747
2661
  var {
2748
2662
  auth
@@ -2763,74 +2677,91 @@ class RequestsHub extends Component {
2763
2677
  var {
2764
2678
  auth
2765
2679
  } = this.props;
2766
- if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? '' : true;
2767
- return isClass ? ' hub-sideContent-topButton--hide' : false;
2680
+ if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? "" : true;
2681
+ return isClass ? " hub-sideContent-topButton--hide" : false;
2768
2682
  });
2769
2683
  _defineProperty(this, "getSideBarSectionColour", id => this.state.selectedSection === id ? {
2770
- backgroundColor: '#fff'
2684
+ backgroundColor: "#fff"
2771
2685
  } : {});
2772
- _defineProperty(this, "renderStats", (stat, loading) => loading ? /*#__PURE__*/jsx(FontAwesome, {
2686
+ _defineProperty(this, "renderStats", (stat, loading) => loading ? /*#__PURE__*/jsx(Icon, {
2773
2687
  style: styles$5.spinner,
2774
- name: "spinner fa-pulse fa-fw"
2688
+ icon: "spinner",
2689
+ pulse: true,
2690
+ fixedWidth: true
2775
2691
  }) : stat);
2776
2692
  this.state = {
2777
- selectedSection: 'all',
2778
- location: '',
2693
+ selectedSection: "all",
2694
+ location: "",
2695
+ loadingAll: false,
2779
2696
  loadingSubmissions: false,
2780
2697
  submissionEntries: [],
2698
+ allList: [],
2699
+ completed: [],
2700
+ upcoming: [],
2781
2701
  now: moment.utc(),
2782
2702
  onlyFuture: true,
2783
- search: ''
2703
+ search: ""
2784
2704
  };
2785
2705
  }
2706
+ UNSAFE_componentWillMount() {
2707
+ this.updateProps(this.props);
2708
+ }
2786
2709
  componentDidMount() {
2787
- // Data fetching is now handled by JobList component with pagination
2710
+ this.getData();
2711
+ }
2712
+ UNSAFE_componentWillReceiveProps(nextProps) {
2713
+ if (!_.isEqual(this.props.jobs, nextProps.jobs)) this.updateProps(nextProps);
2714
+ }
2715
+ updateProps(props) {
2716
+ this.setState({
2717
+ allList: props.jobs
2718
+ }, this.setData);
2788
2719
  }
2789
2720
  renderLeftBar() {
2790
2721
  var sectionItems = [];
2791
2722
  if (this.canAddNew()) {
2792
2723
  sectionItems.push({
2793
- type: 'newButton',
2724
+ type: "newButton",
2794
2725
  text: "New ".concat(values.textSingularName),
2795
2726
  onClick: this.onAddNew
2796
2727
  });
2797
2728
  }
2798
2729
  sectionItems.push({
2799
- type: 'navItem',
2730
+ type: "navItem",
2800
2731
  text: "View ".concat(values.textSingularName, "s"),
2801
- icon: 'eye',
2732
+ icon: "eye",
2802
2733
  isFontAwesome: true,
2803
- selected: this.state.selectedSection === 'all',
2734
+ selected: this.state.selectedSection === "all",
2804
2735
  onClick: () => {
2805
2736
  this.setState({
2806
- selectedSection: 'all'
2737
+ selectedSection: "all"
2807
2738
  });
2808
2739
  }
2809
2740
  });
2810
2741
  if (Session$4.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth)) {
2811
2742
  sectionItems.push({
2812
- type: 'navItem',
2743
+ type: "navItem",
2813
2744
  text: values.textTitleJobTypes,
2814
2745
  // icon: 'maintenance2',
2815
2746
  // isSVG: true,
2816
- selected: this.state.selectedSection === 'requestTypes',
2747
+ selected: this.state.selectedSection === "requestTypes",
2817
2748
  onClick: () => {
2818
2749
  this.setState({
2819
- selectedSection: 'requestTypes'
2750
+ selectedSection: "requestTypes"
2820
2751
  });
2821
2752
  }
2822
2753
  });
2823
2754
  }
2824
- if (Session$4.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth)) {
2755
+ if (Session$4.validateAccess(this.props.auth.site, "featurePicker", this.props.auth)) {
2825
2756
  sectionItems.push({
2826
- type: 'navItem',
2827
- text: 'Feature Configuration',
2828
- icon: 'settings',
2757
+ type: "navItem",
2758
+ text: "Feature Configuration",
2759
+ icon: "settings",
2829
2760
  isFontAwesome: false,
2830
- selected: this.state.selectedSection === 'config',
2761
+ selected: this.state.selectedSection === "config",
2831
2762
  onClick: () => {
2832
2763
  this.setState({
2833
- selectedSection: 'config'
2764
+ selectedSection: "config"
2834
2765
  });
2835
2766
  }
2836
2767
  });
@@ -2848,14 +2779,16 @@ class RequestsHub extends Component {
2848
2779
  });
2849
2780
  }
2850
2781
  renderRight() {
2851
- if (this.state.selectedSection === 'requestTypes') {
2782
+ if (this.state.selectedSection === "requestTypes") {
2852
2783
  return /*#__PURE__*/jsx(JobTypes$1, {
2853
2784
  onNew: this.onAddRequestType
2854
2785
  });
2855
- } else if (this.state.selectedSection === 'config') {
2786
+ } else if (this.state.selectedSection === "config") {
2856
2787
  return /*#__PURE__*/jsx(Configuration$1, {});
2857
2788
  }
2858
- return /*#__PURE__*/jsx(JobList$1, {});
2789
+ return /*#__PURE__*/jsx(JobList$1, {
2790
+ source: this.state.allList
2791
+ });
2859
2792
  }
2860
2793
  render() {
2861
2794
  return /*#__PURE__*/jsxs("div", {
@@ -2872,21 +2805,21 @@ class RequestsHub extends Component {
2872
2805
  }
2873
2806
  var styles$5 = {
2874
2807
  sideBarTitleSection: {
2875
- lineHeight: '40px',
2808
+ lineHeight: "40px",
2876
2809
  marginTop: 30,
2877
2810
  marginBottom: 30,
2878
2811
  paddingLeft: 24,
2879
2812
  paddingRight: 24
2880
2813
  },
2881
2814
  sideBarSection: {
2882
- weight: '100%',
2815
+ weight: "100%",
2883
2816
  minWidth: 200,
2884
2817
  padding: 32,
2885
2818
  paddingLeft: 24,
2886
- cursor: 'pointer',
2887
- display: 'flex',
2888
- flexDirection: 'column',
2889
- justifyContent: 'center'
2819
+ cursor: "pointer",
2820
+ display: "flex",
2821
+ flexDirection: "column",
2822
+ justifyContent: "center"
2890
2823
  },
2891
2824
  spinner: {
2892
2825
  fontSize: 32,
@@ -2898,19 +2831,22 @@ var mapStateToProps$4 = state => {
2898
2831
  auth
2899
2832
  } = state;
2900
2833
  return {
2834
+ jobs: state[values.reducerKey].jobs,
2901
2835
  auth,
2902
2836
  strings: state.strings && state.strings.config || {}
2903
2837
  };
2904
2838
  };
2905
- var RequestsHub$1 = connect(mapStateToProps$4, {})(withRouter(RequestsHub));
2839
+ var RequestsHub$1 = connect(mapStateToProps$4, {
2840
+ jobsLoaded
2841
+ })(withRouter(RequestsHub));
2906
2842
 
2907
- 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; }
2908
- 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; }
2843
+ function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2844
+ 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; }
2909
2845
  var {
2910
2846
  Apis: Apis$1,
2911
- Helper: Helper$2,
2847
+ Helper: Helper$3,
2912
2848
  Session: Session$3,
2913
- Colours: Colours$1,
2849
+ Colours: Colours$2,
2914
2850
  Components: Components$3
2915
2851
  } = PlussCore;
2916
2852
  var IMAGE_SIZE_NOTE = 72;
@@ -2994,7 +2930,7 @@ class Job extends Component {
2994
2930
  var statusType = statusTypes.find(s => s.text === status);
2995
2931
  if (!statusType) {
2996
2932
  var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
2997
- statusType = _objectSpread$4(_objectSpread$4({}, defaultStatus), {}, {
2933
+ statusType = _objectSpread$5(_objectSpread$5({}, defaultStatus), {}, {
2998
2934
  text: status
2999
2935
  });
3000
2936
  }
@@ -3189,7 +3125,7 @@ class Job extends Component {
3189
3125
  }
3190
3126
  maintenanceActions.deleteNote(this.state.jobId, n.Id);
3191
3127
  var newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3192
- var newJob = _objectSpread$4({}, this.state.job);
3128
+ var newJob = _objectSpread$5({}, this.state.job);
3193
3129
  newJob.Notes = newNotes;
3194
3130
  this.setState({
3195
3131
  job: newJob,
@@ -3274,7 +3210,7 @@ class Job extends Component {
3274
3210
  _defineProperty(this, "onSelectPriority", /*#__PURE__*/function () {
3275
3211
  var _ref0 = _asyncToGenerator(function* (priority) {
3276
3212
  _this.setState({
3277
- job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
3213
+ job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3278
3214
  priority
3279
3215
  }),
3280
3216
  priorityChangerOpen: false
@@ -3304,7 +3240,7 @@ class Job extends Component {
3304
3240
  _defineProperty(this, "onSelectStatus", /*#__PURE__*/function () {
3305
3241
  var _ref1 = _asyncToGenerator(function* (status) {
3306
3242
  _this.setState({
3307
- job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
3243
+ job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3308
3244
  status: status
3309
3245
  }),
3310
3246
  statusChangerOpen: false
@@ -3327,7 +3263,7 @@ class Job extends Component {
3327
3263
  };
3328
3264
  }());
3329
3265
  this.state = {
3330
- jobId: Helper$2.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3266
+ jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3331
3267
  job: null,
3332
3268
  showingSelector: false,
3333
3269
  updating: false,
@@ -3519,9 +3455,9 @@ class Job extends Component {
3519
3455
  children: [/*#__PURE__*/jsx("div", {
3520
3456
  className: "commentReply_button".concat(!_.isEmpty(this.state.commentInput) ? " commentReply_button-active" : ""),
3521
3457
  onClick: this.onAddComment,
3522
- children: /*#__PURE__*/jsx(FontAwesome, {
3458
+ children: /*#__PURE__*/jsx(Icon, {
3523
3459
  className: "commentReply_icon",
3524
- name: "paper-plane-o"
3460
+ icon: "paper-plane"
3525
3461
  })
3526
3462
  }), /*#__PURE__*/jsx(Textarea, {
3527
3463
  id: "commentInput",
@@ -3548,7 +3484,7 @@ class Job extends Component {
3548
3484
  children: /*#__PURE__*/jsx("div", {
3549
3485
  className: "imageGrid_image",
3550
3486
  style: {
3551
- backgroundImage: "url('".concat(Helper$2.get1400(image), "')"),
3487
+ backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
3552
3488
  width: size,
3553
3489
  height: size
3554
3490
  }
@@ -3644,7 +3580,7 @@ class Job extends Component {
3644
3580
  } = this.state.job;
3645
3581
  var hasCustomFields = customFields && customFields.length > 0;
3646
3582
  return /*#__PURE__*/jsxs("div", {
3647
- style: {
3583
+ iconStyle: {
3648
3584
  paddingBottom: 40
3649
3585
  },
3650
3586
  children: [/*#__PURE__*/jsxs("div", {
@@ -3792,9 +3728,9 @@ class Job extends Component {
3792
3728
  className: "maintenanceNote",
3793
3729
  children: [/*#__PURE__*/jsxs("div", {
3794
3730
  className: "maintenanceNote_top",
3795
- children: [this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/jsx(Components$3.SVGIcon, {
3796
- colour: Colours$1.COLOUR_DUSK_LIGHT,
3797
- icon: "more15",
3731
+ children: [this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/jsx(Icon, {
3732
+ colour: Colours$2.COLOUR_DUSK_LIGHT,
3733
+ icon: "ellipsis-vertical",
3798
3734
  className: "maintenanceNote_moreIcon",
3799
3735
  onClick: () => this.onOpenNoteMenu(index)
3800
3736
  }), /*#__PURE__*/jsx("p", {
@@ -3813,7 +3749,7 @@ class Job extends Component {
3813
3749
  })]
3814
3750
  }), /*#__PURE__*/jsx("p", {
3815
3751
  className: "maintenanceNote_text",
3816
- children: Helper$2.toParagraphed(note.Note)
3752
+ children: Helper$3.toParagraphed(note.Note)
3817
3753
  }), note.Attachments.map((a, i) => this.renderAttachment(a, i)), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null]
3818
3754
  })]
3819
3755
  }, index);
@@ -3857,7 +3793,7 @@ class Job extends Component {
3857
3793
  }), /*#__PURE__*/jsx("div", {
3858
3794
  className: "statusLabel statusLabel-large statusLabel-full",
3859
3795
  style: {
3860
- backgroundColor: Colours$1.COLOUR_DUSK
3796
+ backgroundColor: Colours$2.COLOUR_DUSK
3861
3797
  },
3862
3798
  children: /*#__PURE__*/jsxs("span", {
3863
3799
  className: "statusLabel_text",
@@ -3868,7 +3804,7 @@ class Job extends Component {
3868
3804
  }
3869
3805
  renderExternalSyncEntry(e, i) {
3870
3806
  var isSuccess = e.EntryType === "ExternalIDSet";
3871
- var backgroundColor = isSuccess ? Colours$1.COLOUR_GREEN : Colours$1.COLOUR_RED; // Green for success, red for failure
3807
+ var backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3872
3808
 
3873
3809
  return /*#__PURE__*/jsxs("div", {
3874
3810
  className: "ticketHistoryEntry",
@@ -3931,20 +3867,22 @@ class Job extends Component {
3931
3867
 
3932
3868
  // Show spinner while retrying
3933
3869
  if (retryingSync) {
3934
- return /*#__PURE__*/jsx(FontAwesome, {
3870
+ return /*#__PURE__*/jsx(Icon, {
3935
3871
  style: {
3936
3872
  fontSize: 20,
3937
- color: Colours$1.COLOUR_DUSK_LIGHT,
3873
+ color: Colours$2.COLOUR_DUSK_LIGHT,
3938
3874
  marginLeft: 8
3939
3875
  },
3940
- name: "spinner fa-pulse fa-fw"
3876
+ icon: "spinner",
3877
+ pulse: true,
3878
+ fixedWidth: true
3941
3879
  });
3942
3880
  }
3943
3881
  return /*#__PURE__*/jsx("div", {
3944
3882
  className: "statusLabel pointer",
3945
3883
  onClick: this.onRetrySync,
3946
3884
  style: {
3947
- backgroundColor: Colours$1.COLOUR_RED,
3885
+ backgroundColor: Colours$2.COLOUR_RED,
3948
3886
  marginLeft: 8
3949
3887
  },
3950
3888
  children: /*#__PURE__*/jsx("span", {
@@ -3963,11 +3901,11 @@ class Job extends Component {
3963
3901
  if (retrySyncError) {
3964
3902
  return /*#__PURE__*/jsxs(Components$3.Text, {
3965
3903
  type: "body",
3966
- children: [/*#__PURE__*/jsx(FontAwesome, {
3904
+ children: [/*#__PURE__*/jsx(Icon, {
3967
3905
  className: "userStatusIcon",
3968
- name: "times-circle",
3906
+ icon: "circle-xmark",
3969
3907
  style: {
3970
- color: Colours$1.COLOUR_RED
3908
+ color: Colours$2.COLOUR_RED
3971
3909
  }
3972
3910
  }), " ", retrySyncError]
3973
3911
  });
@@ -3977,11 +3915,11 @@ class Job extends Component {
3977
3915
  if (retrySyncInitiated) {
3978
3916
  return /*#__PURE__*/jsxs(Components$3.Text, {
3979
3917
  type: "body",
3980
- children: [/*#__PURE__*/jsx(FontAwesome, {
3918
+ children: [/*#__PURE__*/jsx(Icon, {
3981
3919
  className: "userStatusIcon",
3982
- name: "check-circle",
3920
+ icon: "circle-check",
3983
3921
  style: {
3984
- color: Colours$1.COLOUR_GREEN
3922
+ color: Colours$2.COLOUR_GREEN
3985
3923
  }
3986
3924
  }), " ", "Sync retry initiated. Check back shortly for results."]
3987
3925
  });
@@ -3991,11 +3929,11 @@ class Job extends Component {
3991
3929
  if (this.hasSyncFailureWithoutSuccess()) {
3992
3930
  return /*#__PURE__*/jsxs(Components$3.Text, {
3993
3931
  type: "body",
3994
- children: [/*#__PURE__*/jsx(FontAwesome, {
3932
+ children: [/*#__PURE__*/jsx(Icon, {
3995
3933
  className: "userStatusIcon",
3996
- name: "times-circle",
3934
+ icon: "circle-xmark",
3997
3935
  style: {
3998
- color: Colours$1.COLOUR_RED
3936
+ color: Colours$2.COLOUR_RED
3999
3937
  }
4000
3938
  }), " ", "External sync failed. Use the retry button to attempt again."]
4001
3939
  });
@@ -4055,11 +3993,11 @@ class Job extends Component {
4055
3993
  } = this.state;
4056
3994
  if (!job || !job.history) return null;
4057
3995
  var source = _.sortBy([...job.history.map(e => {
4058
- return _objectSpread$4(_objectSpread$4({}, e), {}, {
3996
+ return _objectSpread$5(_objectSpread$5({}, e), {}, {
4059
3997
  EntryType: e.EntryType || "status"
4060
3998
  });
4061
3999
  }), ...(job.Notes || []).map(e => {
4062
- return _objectSpread$4(_objectSpread$4({}, e), {}, {
4000
+ return _objectSpread$5(_objectSpread$5({}, e), {}, {
4063
4001
  timestamp: e.Timestamp,
4064
4002
  EntryType: "note"
4065
4003
  });
@@ -4134,9 +4072,11 @@ class Job extends Component {
4134
4072
  hasPadding: true,
4135
4073
  children: /*#__PURE__*/jsx("div", {
4136
4074
  className: "flex flex-center-row",
4137
- children: /*#__PURE__*/jsx(FontAwesome, {
4075
+ children: /*#__PURE__*/jsx(Icon, {
4138
4076
  className: "spinner",
4139
- name: "spinner fa-pulse fa-fw"
4077
+ icon: "spinner",
4078
+ pulse: true,
4079
+ fixedWidth: true
4140
4080
  })
4141
4081
  })
4142
4082
  });
@@ -4182,9 +4122,9 @@ class Job extends Component {
4182
4122
  onClick: () => {
4183
4123
  this.attachmentInput.click();
4184
4124
  },
4185
- children: [/*#__PURE__*/jsx(FontAwesome, {
4125
+ children: [/*#__PURE__*/jsx(Icon, {
4186
4126
  className: "iconTextButton_icon",
4187
- name: "paperclip"
4127
+ icon: "paperclip"
4188
4128
  }), /*#__PURE__*/jsx("p", {
4189
4129
  className: "iconTextButton_text",
4190
4130
  children: "Add Attachment"
@@ -4207,22 +4147,24 @@ class Job extends Component {
4207
4147
  if (this.state.confirmingAssignee) {
4208
4148
  content = /*#__PURE__*/jsx("div", {
4209
4149
  className: "flex flex-center-row",
4210
- children: /*#__PURE__*/jsx(FontAwesome, {
4150
+ children: /*#__PURE__*/jsx(Icon, {
4211
4151
  className: "spinner",
4212
- name: "spinner fa-pulse fa-fw"
4152
+ icon: "spinner",
4153
+ pulse: true,
4154
+ fixedWidth: true
4213
4155
  })
4214
4156
  });
4215
4157
  } else if (this.state.selectedAssignee) {
4216
4158
  content = /*#__PURE__*/jsx("div", {
4217
4159
  children: /*#__PURE__*/jsx(Components$3.UserListing, {
4218
4160
  user: this.state.selectedAssignee,
4219
- rightContent: /*#__PURE__*/jsx(Components$3.SVGIcon, {
4161
+ rightContent: /*#__PURE__*/jsx(Icon, {
4220
4162
  className: "removeIcon",
4221
- icon: "close",
4163
+ icon: "xmark",
4222
4164
  onClick: () => {
4223
4165
  this.onSelectAssignee();
4224
4166
  },
4225
- colour: Colours$1.COLOUR_DUSK
4167
+ colour: Colours$2.COLOUR_DUSK
4226
4168
  })
4227
4169
  }, this.state.selectedAssignee.id)
4228
4170
  });
@@ -4309,14 +4251,14 @@ var Job$1 = connect(mapStateToProps$3, {
4309
4251
  jobStatusesUpdate
4310
4252
  })(withRouter(Job));
4311
4253
 
4312
- 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; }
4313
- 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; }
4254
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4255
+ 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; }
4314
4256
  var {
4315
4257
  Actions,
4316
4258
  Components: Components$2,
4317
- Helper: Helper$1,
4259
+ Helper: Helper$2,
4318
4260
  Session: Session$2,
4319
- Colours,
4261
+ Colours: Colours$1,
4320
4262
  Apis
4321
4263
  } = PlussCore;
4322
4264
  class AddJob extends Component {
@@ -4335,7 +4277,7 @@ class AddJob extends Component {
4335
4277
  type,
4336
4278
  customFields
4337
4279
  } = res.data;
4338
- _this.setState(_objectSpread$3(_objectSpread$3({}, res.data), {}, {
4280
+ _this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4339
4281
  prevType: type,
4340
4282
  prevCustomFileds: customFields,
4341
4283
  type,
@@ -4583,7 +4525,7 @@ class AddJob extends Component {
4583
4525
  event.target.value = "";
4584
4526
  });
4585
4527
  _defineProperty(this, "onToggleDatePicker", qId => {
4586
- var showDate = _objectSpread$3({}, this.state.showDate);
4528
+ var showDate = _objectSpread$4({}, this.state.showDate);
4587
4529
  showDate[qId] = !showDate[qId];
4588
4530
  this.setState({
4589
4531
  showDate
@@ -4672,7 +4614,7 @@ class AddJob extends Component {
4672
4614
  if (_.isNil(answer) || _.isEmpty(answer)) return true;
4673
4615
  switch (type) {
4674
4616
  case "email":
4675
- return Helper$1.isEmail(answer);
4617
+ return Helper$2.isEmail(answer);
4676
4618
  case "date":
4677
4619
  return moment(answer, "YYYY-MM-DD", true).isValid();
4678
4620
  case "time":
@@ -4693,7 +4635,7 @@ class AddJob extends Component {
4693
4635
  this.customImageInputs = {};
4694
4636
  this.customDocumentInputs = {};
4695
4637
  this.state = {
4696
- jobId: Helper$1.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
4638
+ jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
4697
4639
  job: null,
4698
4640
  showingSelector: false,
4699
4641
  updating: false,
@@ -4752,9 +4694,9 @@ class AddJob extends Component {
4752
4694
  } = this.state;
4753
4695
  return types.map(ev => {
4754
4696
  if (ev != null) {
4755
- return /*#__PURE__*/jsx(DropdownItem, {
4697
+ return /*#__PURE__*/jsx(MenuItem, {
4756
4698
  eventKey: ev.typeName,
4757
- ive: type === ev.typeName,
4699
+ active: type === ev.typeName,
4758
4700
  children: ev.typeName
4759
4701
  }, ev.typeName);
4760
4702
  }
@@ -5010,7 +4952,7 @@ class AddJob extends Component {
5010
4952
  className: "inputRequired "
5011
4953
  }) : null, /*#__PURE__*/jsxs("div", {
5012
4954
  className: "visitorSignIn_question",
5013
- style: {
4955
+ iconStyle: {
5014
4956
  flex: 1
5015
4957
  },
5016
4958
  children: [/*#__PURE__*/jsx("div", {
@@ -5060,7 +5002,7 @@ class AddJob extends Component {
5060
5002
  case "staticText":
5061
5003
  return /*#__PURE__*/jsx("p", {
5062
5004
  className: "visitorSignIn_text-staticText",
5063
- children: Helper$1.toParagraphed(field.label, {
5005
+ children: Helper$2.toParagraphed(field.label, {
5064
5006
  marginTop: 10
5065
5007
  })
5066
5008
  }, fieldId);
@@ -5078,9 +5020,9 @@ class AddJob extends Component {
5078
5020
  errorMessage: "Not a valid date",
5079
5021
  alwaysShowLabel: true,
5080
5022
  readOnly: true,
5081
- rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Components$2.SVGIcon, {
5082
- colour: Colours.COLOUR_DUSK_LIGHT,
5083
- icon: "close",
5023
+ rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Icon, {
5024
+ colour: Colours$1.COLOUR_DUSK_LIGHT,
5025
+ icon: "xmark",
5084
5026
  className: "timepicker_clear",
5085
5027
  onClick: () => this.onChangeDateAnswer(fieldId, undefined, false)
5086
5028
  })
@@ -5111,9 +5053,9 @@ class AddJob extends Component {
5111
5053
  width: "100%"
5112
5054
  }
5113
5055
  }),
5114
- rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Components$2.SVGIcon, {
5115
- colour: Colours.COLOUR_DUSK_LIGHT,
5116
- icon: "close",
5056
+ rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Icon, {
5057
+ colour: Colours$1.COLOUR_DUSK_LIGHT,
5058
+ icon: "xmark",
5117
5059
  className: "timepicker_clear",
5118
5060
  onClick: () => this.onChangeTimeAnswer(fieldId, undefined)
5119
5061
  })
@@ -5127,7 +5069,7 @@ class AddJob extends Component {
5127
5069
  className: "inputRequired "
5128
5070
  }) : null, /*#__PURE__*/jsxs("div", {
5129
5071
  className: "visitorSignIn_question",
5130
- style: {
5072
+ iconStyle: {
5131
5073
  flex: 1
5132
5074
  },
5133
5075
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5150,7 +5092,7 @@ class AddJob extends Component {
5150
5092
  className: "inputRequired "
5151
5093
  }) : null, /*#__PURE__*/jsxs("div", {
5152
5094
  className: "visitorSignIn_question",
5153
- style: {
5095
+ iconStyle: {
5154
5096
  flex: 1
5155
5097
  },
5156
5098
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5172,9 +5114,9 @@ class AddJob extends Component {
5172
5114
  }), /*#__PURE__*/jsxs("div", {
5173
5115
  className: "iconTextButton marginBottom-16",
5174
5116
  onClick: () => this.customDocumentInputs[fieldId].click(),
5175
- children: [/*#__PURE__*/jsx(FontAwesome, {
5117
+ children: [/*#__PURE__*/jsx(Icon, {
5176
5118
  className: "iconTextButton_icon",
5177
- name: "paperclip"
5119
+ icon: "paperclip"
5178
5120
  }), /*#__PURE__*/jsx("p", {
5179
5121
  className: "iconTextButton_text",
5180
5122
  children: "Add Attachment"
@@ -5202,7 +5144,7 @@ class AddJob extends Component {
5202
5144
  customFields
5203
5145
  } = this.state;
5204
5146
  return /*#__PURE__*/jsx("div", {
5205
- style: {
5147
+ iconStyle: {
5206
5148
  marginBottom: 15
5207
5149
  },
5208
5150
  children: /*#__PURE__*/jsxs("div", {
@@ -5237,7 +5179,7 @@ class AddJob extends Component {
5237
5179
  return this.state.showWarnings && _.isEmpty(this.state.room);
5238
5180
  }
5239
5181
  }), /*#__PURE__*/jsxs("div", {
5240
- style: {
5182
+ iconStyle: {
5241
5183
  marginBottom: 15
5242
5184
  },
5243
5185
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5337,7 +5279,7 @@ var mapStateToProps$2 = state => {
5337
5279
  return {
5338
5280
  auth,
5339
5281
  strings: state.strings && state.strings.config || {},
5340
- optionOnlyForResidents: Helper$1.getSiteSettingFromState(state, values.optionOnlyForResidents)
5282
+ optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
5341
5283
  };
5342
5284
  };
5343
5285
  var AddJob$1 = connect(mapStateToProps$2, {
@@ -5349,14 +5291,14 @@ var AddJob$1 = connect(mapStateToProps$2, {
5349
5291
  var {
5350
5292
  Components: Components$1,
5351
5293
  Session: Session$1,
5352
- Helper
5294
+ Helper: Helper$1
5353
5295
  } = PlussCore;
5354
5296
  var DEFAULT_FIELD = {
5355
- type: 'text',
5356
- label: '',
5297
+ type: "text",
5298
+ label: "",
5357
5299
  mandatory: false,
5358
5300
  isTitle: false,
5359
- values: ['']
5301
+ values: [""]
5360
5302
  };
5361
5303
  class AddJobType extends Component {
5362
5304
  constructor(props) {
@@ -5383,18 +5325,18 @@ class AddJobType extends Component {
5383
5325
  customFields: customFields || [_.cloneDeep(DEFAULT_FIELD)]
5384
5326
  });
5385
5327
  } catch (error) {
5386
- console.error('getJobType', error);
5328
+ console.error("getJobType", error);
5387
5329
  }
5388
5330
  }));
5389
5331
  _defineProperty(this, "getFieldTypeTitle", type => {
5390
5332
  var fieldType = this.fieldTypes.find(f => f.Key === type);
5391
- return fieldType ? fieldType.Title : '';
5333
+ return fieldType ? fieldType.Title : "";
5392
5334
  });
5393
5335
  _defineProperty(this, "validateEmail", () => {
5394
5336
  var {
5395
5337
  jobTypeEmail
5396
5338
  } = this.state;
5397
- return !_.isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
5339
+ return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
5398
5340
  });
5399
5341
  _defineProperty(this, "isJobTypeValid", () => {
5400
5342
  var {
@@ -5409,7 +5351,7 @@ class AddJobType extends Component {
5409
5351
  });
5410
5352
  _defineProperty(this, "onHandleChange", event => {
5411
5353
  var stateChange = {};
5412
- stateChange[event.target.getAttribute('id')] = event.target.value;
5354
+ stateChange[event.target.getAttribute("id")] = event.target.value;
5413
5355
  this.setState(stateChange);
5414
5356
  });
5415
5357
  _defineProperty(this, "onFieldTypeChanged", (fieldIndex, key) => {
@@ -5471,7 +5413,7 @@ class AddJobType extends Component {
5471
5413
  });
5472
5414
  _defineProperty(this, "onAddNewOption", fieldIndex => {
5473
5415
  var customFields = [...this.state.customFields];
5474
- customFields[fieldIndex].values.push('');
5416
+ customFields[fieldIndex].values.push("");
5475
5417
  this.setState({
5476
5418
  customFields
5477
5419
  });
@@ -5547,59 +5489,59 @@ class AddJobType extends Component {
5547
5489
  success: true
5548
5490
  });
5549
5491
  } catch (error) {
5550
- console.error('onSave', error);
5492
+ console.error("onSave", error);
5551
5493
  _this.setState({
5552
5494
  submitting: false
5553
5495
  });
5554
- alert('Something went wrong with the request. Please try again.');
5496
+ alert("Something went wrong with the request. Please try again.");
5555
5497
  }
5556
5498
  }));
5557
5499
  });
5558
5500
  this.fieldTypes = [{
5559
- Title: 'Text Input',
5560
- Key: 'text'
5501
+ Title: "Text Input",
5502
+ Key: "text"
5561
5503
  }, {
5562
- Title: 'Email Input',
5563
- Key: 'email'
5504
+ Title: "Email Input",
5505
+ Key: "email"
5564
5506
  }, {
5565
- Title: 'Phone Input',
5566
- Key: 'phone'
5507
+ Title: "Phone Input",
5508
+ Key: "phone"
5567
5509
  }, {
5568
- Title: 'Date Input',
5569
- Key: 'date'
5510
+ Title: "Date Input",
5511
+ Key: "date"
5570
5512
  }, {
5571
- Title: 'Time Input',
5572
- Key: 'time'
5513
+ Title: "Time Input",
5514
+ Key: "time"
5573
5515
  }, {
5574
- Title: 'Image Input',
5575
- Key: 'image'
5516
+ Title: "Image Input",
5517
+ Key: "image"
5576
5518
  },
5577
5519
  // {
5578
5520
  // Title: 'Document Input',
5579
5521
  // Key: 'document',
5580
5522
  // },
5581
5523
  {
5582
- Title: 'Yes/No Question',
5583
- Key: 'yn'
5524
+ Title: "Yes/No Question",
5525
+ Key: "yn"
5584
5526
  }, {
5585
- Title: 'Multiple Choice',
5586
- Key: 'multichoice'
5527
+ Title: "Multiple Choice",
5528
+ Key: "multichoice"
5587
5529
  }, {
5588
- Title: 'Checkboxes',
5589
- Key: 'checkbox'
5530
+ Title: "Checkboxes",
5531
+ Key: "checkbox"
5590
5532
  }, {
5591
- Title: 'Title Text',
5592
- Key: 'staticTitle'
5533
+ Title: "Title Text",
5534
+ Key: "staticTitle"
5593
5535
  }, {
5594
- Title: 'Paragraph Text',
5595
- Key: 'staticText'
5536
+ Title: "Paragraph Text",
5537
+ Key: "staticText"
5596
5538
  }];
5597
5539
  this.state = {
5598
5540
  loading: false,
5599
- jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
5600
- jobTypeName: '',
5601
- jobTypeEmail: '',
5602
- jobTypeDescription: '',
5541
+ jobTypeId: Helper$1.safeReadParams(this.props, "jobTypeId") ? this.props.match.params.jobTypeId : null,
5542
+ jobTypeName: "",
5543
+ jobTypeEmail: "",
5544
+ jobTypeDescription: "",
5603
5545
  hasCustomFields: false,
5604
5546
  customFields: [_.cloneDeep(DEFAULT_FIELD)],
5605
5547
  jobTypeLevel: 1,
@@ -5635,23 +5577,23 @@ class AddJobType extends Component {
5635
5577
  mandatory,
5636
5578
  isTitle
5637
5579
  } = field;
5638
- if (['staticTitle', 'staticText'].includes(type)) return;
5580
+ if (["staticTitle", "staticText"].includes(type)) return;
5639
5581
  if (_.isEmpty(label)) {
5640
5582
  missingLabel = true;
5641
- } else if (_.isEmpty(type) || (type === 'multichoice' || type === 'checkbox') && (!values || values.length < 2 || !values.every(value => !_.isEmpty(value)))) {
5583
+ } else if (_.isEmpty(type) || (type === "multichoice" || type === "checkbox") && (!values || values.length < 2 || !values.every(value => !_.isEmpty(value)))) {
5642
5584
  warnings.push("'".concat(label, "' is incomplete"));
5643
5585
  }
5644
5586
  if (mandatory) hasMandatoryField = true;
5645
5587
  if (isTitle) titleFieldCount += 1;
5646
5588
  });
5647
5589
  if (missingLabel) {
5648
- warnings.push('All inputs must have a label');
5590
+ warnings.push("All inputs must have a label");
5649
5591
  }
5650
5592
  if (!hasMandatoryField) {
5651
- warnings.push('There must be at least one required input');
5593
+ warnings.push("There must be at least one required input");
5652
5594
  }
5653
5595
  if (titleFieldCount > 1) {
5654
- warnings.push('Only one required input can be selected as title for the request');
5596
+ warnings.push("Only one required input can be selected as title for the request");
5655
5597
  }
5656
5598
  }
5657
5599
  this.setState({
@@ -5685,7 +5627,7 @@ class AddJobType extends Component {
5685
5627
  children: [/*#__PURE__*/jsxs(Components$1.Text, {
5686
5628
  type: "formTitleLarge",
5687
5629
  className: "marginBottom-24",
5688
- children: [!jobTypeId ? 'New' : 'Edit', " ", values.textJobType]
5630
+ children: [!jobTypeId ? "New" : "Edit", " ", values.textJobType]
5689
5631
  }), /*#__PURE__*/jsx(Components$1.GenericInput, {
5690
5632
  id: "jobTypeName",
5691
5633
  type: "text",
@@ -5725,13 +5667,13 @@ class AddJobType extends Component {
5725
5667
  label: "Do you want to create a custom form for this ".concat("".concat(values.textJobType), "?"),
5726
5668
  isActive: hasCustomFields,
5727
5669
  options: [{
5728
- Label: 'Yes',
5670
+ Label: "Yes",
5729
5671
  Value: true,
5730
5672
  onChange: () => this.setState({
5731
5673
  hasCustomFields: true
5732
5674
  })
5733
5675
  }, {
5734
- Label: 'No',
5676
+ Label: "No",
5735
5677
  Value: false,
5736
5678
  onChange: () => this.setState({
5737
5679
  hasCustomFields: false
@@ -5761,14 +5703,14 @@ class AddJobType extends Component {
5761
5703
  className: "fieldInner",
5762
5704
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5763
5705
  id: "fieldLabel".concat(fieldIndex),
5764
- className: 'textInput',
5765
- placeholder: 'Type your label here (required)',
5706
+ className: "textInput",
5707
+ placeholder: "Type your label here (required)",
5766
5708
  value: field.label,
5767
5709
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5768
5710
  }), /*#__PURE__*/jsx(Components$1.GenericInput, {
5769
5711
  id: "fieldPlaceHolder".concat(fieldIndex),
5770
- className: 'placeHolderInput',
5771
- placeholder: 'Insert placeholder (optional)',
5712
+ className: "placeHolderInput",
5713
+ placeholder: "Insert placeholder (optional)",
5772
5714
  value: field.placeHolder,
5773
5715
  onChange: e => this.onFieldPlaceHolderChanged(fieldIndex, e)
5774
5716
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5779,8 +5721,8 @@ class AddJobType extends Component {
5779
5721
  className: "fieldInner",
5780
5722
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5781
5723
  id: "fieldLabel".concat(fieldIndex),
5782
- className: 'textInput',
5783
- placeholder: 'Type your label here (required)',
5724
+ className: "textInput",
5725
+ placeholder: "Type your label here (required)",
5784
5726
  value: field.label,
5785
5727
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5786
5728
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5791,8 +5733,8 @@ class AddJobType extends Component {
5791
5733
  className: "fieldInner",
5792
5734
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5793
5735
  id: "fieldLabel".concat(fieldIndex),
5794
- className: 'textInput',
5795
- placeholder: 'Type your label here (required)',
5736
+ className: "textInput",
5737
+ placeholder: "Type your label here (required)",
5796
5738
  value: field.label,
5797
5739
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5798
5740
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5803,8 +5745,8 @@ class AddJobType extends Component {
5803
5745
  className: "fieldInner",
5804
5746
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5805
5747
  id: "fieldLabel".concat(fieldIndex),
5806
- className: 'textInput',
5807
- placeholder: 'Type your label here (required)',
5748
+ className: "textInput",
5749
+ placeholder: "Type your label here (required)",
5808
5750
  value: field.label,
5809
5751
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5810
5752
  }), this.renderOptionalCheckBox(field, fieldIndex)]
@@ -5815,8 +5757,8 @@ class AddJobType extends Component {
5815
5757
  className: "fieldInner",
5816
5758
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5817
5759
  id: "fieldLabel".concat(fieldIndex),
5818
- className: 'textInput',
5819
- placeholder: 'Type your label here (required)',
5760
+ className: "textInput",
5761
+ placeholder: "Type your label here (required)",
5820
5762
  value: field.label,
5821
5763
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5822
5764
  }), this.renderOptionalCheckBox(field, fieldIndex)]
@@ -5827,8 +5769,8 @@ class AddJobType extends Component {
5827
5769
  className: "fieldInner",
5828
5770
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5829
5771
  id: "fieldLabel".concat(fieldIndex),
5830
- className: 'textInput',
5831
- placeholder: 'Type your label here (required)',
5772
+ className: "textInput",
5773
+ placeholder: "Type your label here (required)",
5832
5774
  value: field.label,
5833
5775
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5834
5776
  }), /*#__PURE__*/jsxs(Table, {
@@ -5844,7 +5786,7 @@ class AddJobType extends Component {
5844
5786
  })]
5845
5787
  })
5846
5788
  }), /*#__PURE__*/jsx("tbody", {
5847
- children: ['Yes', 'No'].map((value, optionIndex) => {
5789
+ children: ["Yes", "No"].map((value, optionIndex) => {
5848
5790
  return /*#__PURE__*/jsxs("tr", {
5849
5791
  className: "option",
5850
5792
  children: [/*#__PURE__*/jsx("td", {
@@ -5874,8 +5816,8 @@ class AddJobType extends Component {
5874
5816
  className: "fieldInner",
5875
5817
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5876
5818
  id: "fieldLabel".concat(fieldIndex),
5877
- className: 'textInput',
5878
- placeholder: 'Type your label here (required)',
5819
+ className: "textInput",
5820
+ placeholder: "Type your label here (required)",
5879
5821
  value: field.label,
5880
5822
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5881
5823
  }), /*#__PURE__*/jsxs(Table, {
@@ -5905,15 +5847,15 @@ class AddJobType extends Component {
5905
5847
  }), /*#__PURE__*/jsx("td", {
5906
5848
  children: /*#__PURE__*/jsx(Components$1.GenericInput, {
5907
5849
  id: "fieldOption".concat(optionIndex),
5908
- placeholder: 'Enter option',
5850
+ placeholder: "Enter option",
5909
5851
  value: value,
5910
5852
  onChange: e => this.onFieldOptionChanged(fieldIndex, optionIndex, e)
5911
5853
  })
5912
5854
  }), /*#__PURE__*/jsx("td", {
5913
5855
  children: customFields[fieldIndex].values.length > 1 ? /*#__PURE__*/jsx("div", {
5914
5856
  onClick: () => this.onRemoveOption(fieldIndex, optionIndex),
5915
- children: /*#__PURE__*/jsx(FontAwesome, {
5916
- name: "minus-circle",
5857
+ children: /*#__PURE__*/jsx(Icon, {
5858
+ icon: "circle-minus",
5917
5859
  className: "cornerCancelButton_icon"
5918
5860
  })
5919
5861
  }) : null
@@ -5924,9 +5866,9 @@ class AddJobType extends Component {
5924
5866
  }), /*#__PURE__*/jsxs("div", {
5925
5867
  className: "clearfix addoption optionAdd marginBottom-10",
5926
5868
  onClick: () => this.onAddNewOption(fieldIndex),
5927
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
5869
+ children: [/*#__PURE__*/jsx(Icon, {
5928
5870
  className: "addoption_plus",
5929
- icon: "add-circle"
5871
+ icon: "circle-plus"
5930
5872
  }), /*#__PURE__*/jsx("div", {
5931
5873
  className: "fillSpace",
5932
5874
  children: /*#__PURE__*/jsx("p", {
@@ -5945,8 +5887,8 @@ class AddJobType extends Component {
5945
5887
  className: "fieldInner",
5946
5888
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5947
5889
  id: "fieldLabel".concat(fieldIndex),
5948
- className: 'textInput',
5949
- placeholder: 'Type your label here (required)',
5890
+ className: "textInput",
5891
+ placeholder: "Type your label here (required)",
5950
5892
  value: field.label,
5951
5893
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5952
5894
  }), /*#__PURE__*/jsxs(Table, {
@@ -5976,15 +5918,15 @@ class AddJobType extends Component {
5976
5918
  }), /*#__PURE__*/jsx("td", {
5977
5919
  children: /*#__PURE__*/jsx(Components$1.GenericInput, {
5978
5920
  id: "fieldOption".concat(optionIndex),
5979
- placeholder: 'Enter option',
5921
+ placeholder: "Enter option",
5980
5922
  value: value,
5981
5923
  onChange: e => this.onFieldOptionChanged(fieldIndex, optionIndex, e)
5982
5924
  })
5983
5925
  }), /*#__PURE__*/jsx("td", {
5984
5926
  children: customFields[fieldIndex].values.length > 1 ? /*#__PURE__*/jsx("div", {
5985
5927
  onClick: () => this.onRemoveOption(fieldIndex, optionIndex),
5986
- children: /*#__PURE__*/jsx(FontAwesome, {
5987
- name: "minus-circle",
5928
+ children: /*#__PURE__*/jsx(Icon, {
5929
+ icon: "circle-minus",
5988
5930
  className: "cornerCancelButton_icon"
5989
5931
  })
5990
5932
  }) : null
@@ -5995,9 +5937,9 @@ class AddJobType extends Component {
5995
5937
  }), /*#__PURE__*/jsxs("div", {
5996
5938
  className: "clearfix addoption optionAdd marginBottom-10",
5997
5939
  onClick: () => this.onAddNewOption(fieldIndex),
5998
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
5940
+ children: [/*#__PURE__*/jsx(Icon, {
5999
5941
  className: "addoption_plus",
6000
- icon: "add-circle"
5942
+ icon: "circle-plus"
6001
5943
  }), /*#__PURE__*/jsx("div", {
6002
5944
  className: "fillSpace",
6003
5945
  children: /*#__PURE__*/jsx("p", {
@@ -6038,27 +5980,27 @@ class AddJobType extends Component {
6038
5980
  } = this.state;
6039
5981
  var renderFieldContent = () => {
6040
5982
  switch (field.type) {
6041
- case 'text':
6042
- case 'email':
6043
- case 'phone':
5983
+ case "text":
5984
+ case "email":
5985
+ case "phone":
6044
5986
  return this.renderFieldText(field, fieldIndex);
6045
- case 'date':
5987
+ case "date":
6046
5988
  return this.renderFieldDate(field, fieldIndex);
6047
- case 'time':
5989
+ case "time":
6048
5990
  return this.renderFieldTime(field, fieldIndex);
6049
- case 'image':
5991
+ case "image":
6050
5992
  return this.renderFieldImage(field, fieldIndex);
6051
- case 'document':
5993
+ case "document":
6052
5994
  return this.renderFieldDocument(field, fieldIndex);
6053
- case 'yn':
5995
+ case "yn":
6054
5996
  return this.renderFieldYesNo(field, fieldIndex);
6055
- case 'multichoice':
5997
+ case "multichoice":
6056
5998
  return this.renderFieldMultiple(field, fieldIndex);
6057
- case 'checkbox':
5999
+ case "checkbox":
6058
6000
  return this.renderFieldCheckbox(field, fieldIndex);
6059
- case 'staticTitle':
6001
+ case "staticTitle":
6060
6002
  return this.renderFieldStaticTitle(field, fieldIndex);
6061
- case 'staticText':
6003
+ case "staticText":
6062
6004
  return this.renderFieldStaticText(field, fieldIndex);
6063
6005
  default:
6064
6006
  return null;
@@ -6104,15 +6046,15 @@ class AddJobType extends Component {
6104
6046
  children: [fieldIndex > 0 ? /*#__PURE__*/jsx("div", {
6105
6047
  className: "circle",
6106
6048
  onClick: () => this.onMoveFieldPrev(fieldIndex),
6107
- children: /*#__PURE__*/jsx(FontAwesome, {
6108
- name: "angle-up",
6049
+ children: /*#__PURE__*/jsx(Icon, {
6050
+ icon: "angle-up",
6109
6051
  className: "icon"
6110
6052
  })
6111
6053
  }) : null, fieldIndex < customFields.length - 1 ? /*#__PURE__*/jsx("div", {
6112
6054
  className: "circle",
6113
6055
  onClick: () => this.onMoveFieldNext(fieldIndex),
6114
- children: /*#__PURE__*/jsx(FontAwesome, {
6115
- name: "angle-down",
6056
+ children: /*#__PURE__*/jsx(Icon, {
6057
+ icon: "angle-down",
6116
6058
  className: "icon"
6117
6059
  })
6118
6060
  }) : null]
@@ -6132,7 +6074,7 @@ class AddJobType extends Component {
6132
6074
  type: "bodyLarge",
6133
6075
  className: "marginBottom-24 paddingLeft-40",
6134
6076
  style: {
6135
- color: Colours$3.COLOUR_LIGHTGREY
6077
+ color: Colours$4.COLOUR_LIGHTGREY
6136
6078
  },
6137
6079
  children: "By default, the form submission title will be the name of the person submitting the form. You can choose to select a different field to use as the title for the form submission."
6138
6080
  }), /*#__PURE__*/jsxs("div", {
@@ -6140,9 +6082,9 @@ class AddJobType extends Component {
6140
6082
  children: [customFields.map((field, fieldIndex) => this.renderField(field, fieldIndex)), /*#__PURE__*/jsxs("div", {
6141
6083
  className: "clearfix addoption addField",
6142
6084
  onClick: () => this.onAddNewField(),
6143
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
6085
+ children: [/*#__PURE__*/jsx(Icon, {
6144
6086
  className: "addoption_plus",
6145
- icon: "add-circle"
6087
+ icon: "circle-plus"
6146
6088
  }), /*#__PURE__*/jsx("div", {
6147
6089
  className: "fillSpace",
6148
6090
  children: /*#__PURE__*/jsx("p", {
@@ -6163,10 +6105,10 @@ class AddJobType extends Component {
6163
6105
  return /*#__PURE__*/jsxs("div", {
6164
6106
  className: "padding-60 paddingVertical-8 text-bodyLarge",
6165
6107
  style: {
6166
- color: Colours$3.COLOUR_RED
6108
+ color: Colours$4.COLOUR_RED
6167
6109
  },
6168
6110
  children: ["To save the form", /*#__PURE__*/jsx("ul", {
6169
- style: {
6111
+ iconStyle: {
6170
6112
  padding: 0,
6171
6113
  paddingLeft: 16
6172
6114
  },
@@ -6183,11 +6125,11 @@ class AddJobType extends Component {
6183
6125
  } = this.state;
6184
6126
  if (!success) return null;
6185
6127
  return /*#__PURE__*/jsx(Components$1.SuccessPopup, {
6186
- text: "".concat("".concat(values.textJobType), " has been ", !jobTypeId ? 'added' : 'edited'),
6128
+ text: "".concat("".concat(values.textJobType), " has been ", !jobTypeId ? "added" : "edited"),
6187
6129
  buttons: [{
6188
- type: 'outlined',
6130
+ type: "outlined",
6189
6131
  onClick: this.onBack,
6190
- text: 'Go to home'
6132
+ text: "Go to home"
6191
6133
  }]
6192
6134
  });
6193
6135
  }
@@ -6250,10 +6192,14 @@ var AddJobType$1 = connect(mapStateToProps$1, {
6250
6192
  jobTypesUpdate
6251
6193
  })(withRouter(AddJobType));
6252
6194
 
6195
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6196
+ 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; }
6253
6197
  var {
6254
6198
  Analytics: Analytics$1,
6255
6199
  Session,
6256
- Components
6200
+ Components,
6201
+ Helper,
6202
+ Colours
6257
6203
  } = PlussCore;
6258
6204
  var getInitialState = () => ({
6259
6205
  requests: 0,
@@ -6273,10 +6219,21 @@ var AnalyticsHub = _ref => {
6273
6219
  auth,
6274
6220
  prevText,
6275
6221
  dayCount,
6276
- strings
6222
+ strings,
6223
+ userType,
6224
+ userCategory,
6225
+ selectedSites
6277
6226
  } = _ref;
6278
6227
  var [analyticsData, setAnalyticsData] = useState(getInitialState());
6279
6228
  var [isExportOpen, setIsExportOpen] = useState(false);
6229
+ var [failedSites, setFailedSites] = useState([]);
6230
+ var [comparisonData, setComparisonData] = useState({
6231
+ requests: [],
6232
+ completedRequests: [],
6233
+ comments: [],
6234
+ isLoading: true
6235
+ });
6236
+ var comparisonMode = selectedSites && selectedSites.length > 1;
6280
6237
  var hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6281
6238
  if (!hasAccess) {
6282
6239
  return null;
@@ -6288,55 +6245,140 @@ var AnalyticsHub = _ref => {
6288
6245
  return strings.sideNav[key];
6289
6246
  })();
6290
6247
  var exportColumns = [{
6291
- label: 'Select All',
6292
- key: ''
6293
- }, {
6294
- label: 'Start Date',
6295
- key: 'startDate'
6248
+ label: "Select All",
6249
+ key: ""
6250
+ }, ...(comparisonMode ? [{
6251
+ label: "Site",
6252
+ key: "site"
6253
+ }] : []), {
6254
+ label: "Start Date",
6255
+ key: "startDate"
6296
6256
  }, {
6297
- label: 'End Date',
6298
- key: 'endDate'
6257
+ label: "End Date",
6258
+ key: "endDate"
6299
6259
  }, {
6300
6260
  label: "".concat(values.textSingularName, "s"),
6301
- key: 'requests'
6261
+ key: "requests"
6302
6262
  }, {
6303
6263
  label: "Completed ".concat(values.textSingularName, "s"),
6304
- key: 'completedRequests'
6264
+ key: "completedRequests"
6305
6265
  }, {
6306
- label: 'Comments',
6307
- key: 'comments'
6266
+ label: "Comments",
6267
+ key: "comments"
6308
6268
  }];
6309
6269
  useEffect(() => {
6310
6270
  getData();
6311
- }, [startTime, endTime]);
6271
+ }, [startTime, endTime, userType, userCategory, selectedSites]);
6312
6272
  var getData = /*#__PURE__*/function () {
6313
6273
  var _ref2 = _asyncToGenerator(function* () {
6314
- setAnalyticsData(getInitialState());
6315
- // Load analytics data here using startTime and endTime
6316
- var timeDifference = endTime - startTime;
6317
- var [currentStatsResponse, prevStatsResponse] = yield Promise.all([analyticsActions.getAggregateEntityStats(auth.site, values.analyticsKey, startTime, endTime, true), analyticsActions.getAggregateEntityStats(auth.site, values.analyticsKey, startTime - timeDifference, startTime, true)]);
6318
- var data = {
6319
- requests: Analytics$1.countActivities(currentStatsResponse.data, 'Request', 'total'),
6320
- prevRequests: Analytics$1.countActivities(prevStatsResponse.data, 'Request', 'total'),
6321
- completedRequests: Analytics$1.countActivities(currentStatsResponse.data, 'RequestCompleted', 'unique'),
6322
- prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, 'RequestCompleted', 'unique'),
6323
- comments: Analytics$1.countActivities(currentStatsResponse.data, 'Comment', 'total'),
6324
- prevComments: Analytics$1.countActivities(prevStatsResponse.data, 'Comment', 'total'),
6325
- isLoading: false
6326
- };
6327
- setAnalyticsData(data);
6274
+ try {
6275
+ setFailedSites([]);
6276
+ if (comparisonMode) {
6277
+ setComparisonData({
6278
+ requests: [],
6279
+ completedRequests: [],
6280
+ comments: [],
6281
+ isLoading: true
6282
+ });
6283
+ var multiSiteResultsObj = yield Analytics$1.fetchMultiSiteData(selectedSites, /*#__PURE__*/function () {
6284
+ var _ref3 = _asyncToGenerator(function* (site) {
6285
+ var {
6286
+ data
6287
+ } = yield analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6288
+ userType,
6289
+ userCategory
6290
+ });
6291
+ return data;
6292
+ });
6293
+ return function (_x) {
6294
+ return _ref3.apply(this, arguments);
6295
+ };
6296
+ }());
6297
+ var roles = auth.user.Roles;
6298
+ var failed = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6299
+ var [, data] = _ref4;
6300
+ return data === null;
6301
+ }).map(_ref5 => {
6302
+ var [site] = _ref5;
6303
+ return Helper.getSiteNameFromRoles(site, roles);
6304
+ });
6305
+ setFailedSites(failed);
6306
+ var multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref6 => {
6307
+ var [, data] = _ref6;
6308
+ return data !== null;
6309
+ }).map(_ref7 => {
6310
+ var [site, data] = _ref7;
6311
+ return {
6312
+ site,
6313
+ data
6314
+ };
6315
+ });
6316
+ var buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6317
+ name: Helper.getSiteNameFromRoles(result.site, roles),
6318
+ value: Analytics$1.countActivities(result.data, activityKey, countType)
6319
+ }));
6320
+ setComparisonData({
6321
+ requests: buildComparison("Request", "total"),
6322
+ completedRequests: buildComparison("RequestCompleted", "unique"),
6323
+ comments: buildComparison("Comment", "total"),
6324
+ isLoading: false
6325
+ });
6326
+ } else {
6327
+ setAnalyticsData(getInitialState());
6328
+ var site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6329
+ var timeDifference = endTime - startTime;
6330
+ var [currentStatsResponse, prevStatsResponse] = yield Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6331
+ userType,
6332
+ userCategory
6333
+ }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6334
+ userType,
6335
+ userCategory
6336
+ })]);
6337
+ var data = {
6338
+ requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6339
+ prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6340
+ completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6341
+ prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6342
+ comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6343
+ prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6344
+ isLoading: false
6345
+ };
6346
+ setAnalyticsData(data);
6347
+ }
6348
+ } catch (err) {
6349
+ if (comparisonMode) {
6350
+ setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6351
+ isLoading: false
6352
+ }));
6353
+ } else {
6354
+ setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6355
+ isLoading: false
6356
+ }));
6357
+ }
6358
+ }
6328
6359
  });
6329
6360
  return function getData() {
6330
6361
  return _ref2.apply(this, arguments);
6331
6362
  };
6332
6363
  }();
6333
6364
  var isReadyToOpenCSV = () => {
6334
- return !analyticsData.isLoading;
6365
+ return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
6335
6366
  };
6336
6367
  var getExportSource = () => {
6368
+ if (comparisonMode) {
6369
+ var sites = comparisonData.requests || [];
6370
+ return sites.map((site, i) => ({
6371
+ site: site.name,
6372
+ startDate: moment(startTime + 1).format("D-MM-YYYY"),
6373
+ endDate: moment(endTime).format("D-MM-YYYY"),
6374
+ requests: site.value,
6375
+ completedRequests: comparisonData.completedRequests[i] && comparisonData.completedRequests[i].value || 0,
6376
+ comments: comparisonData.comments[i] && comparisonData.comments[i].value || 0
6377
+ }));
6378
+ }
6337
6379
  return [{
6338
- startDate: moment(startTime + 1).format('D-MM-YYYY'),
6339
- endDate: moment(endTime).format('D-MM-YYYY'),
6380
+ startDate: moment(startTime + 1).format("D-MM-YYYY"),
6381
+ endDate: moment(endTime).format("D-MM-YYYY"),
6340
6382
  requests: analyticsData.requests,
6341
6383
  completedRequests: analyticsData.completedRequests,
6342
6384
  comments: analyticsData.comments
@@ -6347,13 +6389,14 @@ var AnalyticsHub = _ref => {
6347
6389
  return null;
6348
6390
  }
6349
6391
  var source = getExportSource();
6392
+ var filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6350
6393
  return /*#__PURE__*/jsx(Components.ExportCsvPopup, {
6351
6394
  onClose: () => {
6352
6395
  setIsExportOpen(false);
6353
6396
  },
6354
6397
  columns: exportColumns,
6355
6398
  source: source,
6356
- filename: "".concat(values.analyticsKey, "analytics_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
6399
+ filename: "".concat(values.analyticsKey, "analytics").concat(comparisonMode ? "_comparison" : "").concat(filterSuffix ? "_".concat(filterSuffix) : "", "_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
6357
6400
  });
6358
6401
  };
6359
6402
  return /*#__PURE__*/jsxs("div", {
@@ -6371,36 +6414,76 @@ var AnalyticsHub = _ref => {
6371
6414
  setIsExportOpen(true);
6372
6415
  },
6373
6416
  isActive: isReadyToOpenCSV(),
6374
- leftIcon: "file-code-o",
6417
+ leftIcon: "file-code",
6375
6418
  children: "Export CSV"
6376
6419
  })]
6377
- }), /*#__PURE__*/jsxs("div", {
6420
+ }), failedSites.length > 0 && /*#__PURE__*/jsxs(Components.Text, {
6421
+ type: "help",
6422
+ style: {
6423
+ color: Colours.COLOUR_RED,
6424
+ marginTop: 8
6425
+ },
6426
+ children: ["Data unavailable for: ", failedSites.join(", ")]
6427
+ }), /*#__PURE__*/jsx("div", {
6378
6428
  className: "analyticsSection dashboardSection_content",
6379
- children: [/*#__PURE__*/jsx(Components.StatBox, {
6380
- title: "".concat(featureTitle, " Requests"),
6381
- icon: faWrench,
6382
- value: analyticsData.requests,
6383
- previousValue: analyticsData.prevRequests,
6384
- prevText: prevText,
6385
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount),
6386
- isLoading: analyticsData.isLoading
6387
- }), /*#__PURE__*/jsx(Components.StatBox, {
6388
- title: "Completed ".concat(featureTitle, " Requests"),
6389
- icon: faCircleCheck,
6390
- value: analyticsData.completedRequests,
6391
- previousValue: analyticsData.prevCompletedRequests,
6392
- prevText: prevText,
6393
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount),
6394
- isLoading: analyticsData.isLoading
6395
- }), /*#__PURE__*/jsx(Components.StatBox, {
6396
- title: "".concat(featureTitle, " Comments"),
6397
- icon: faComment,
6398
- value: analyticsData.comments,
6399
- previousValue: analyticsData.prevComments,
6400
- prevText: prevText,
6401
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount),
6402
- isLoading: analyticsData.isLoading
6403
- })]
6429
+ children: (() => {
6430
+ var chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6431
+ if (comparisonMode) {
6432
+ return /*#__PURE__*/jsxs("div", {
6433
+ style: {
6434
+ display: "flex",
6435
+ flexDirection: "column",
6436
+ gap: 16
6437
+ },
6438
+ children: [/*#__PURE__*/jsx(Components.ComparisonStatBox, {
6439
+ title: "".concat(featureTitle, " Requests"),
6440
+ data: comparisonData.requests,
6441
+ prevText: prevText,
6442
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6443
+ isLoading: comparisonData.isLoading
6444
+ }), /*#__PURE__*/jsx(Components.ComparisonStatBox, {
6445
+ title: "Completed ".concat(featureTitle, " Requests"),
6446
+ data: comparisonData.completedRequests,
6447
+ prevText: prevText,
6448
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
6449
+ isLoading: comparisonData.isLoading
6450
+ }), /*#__PURE__*/jsx(Components.ComparisonStatBox, {
6451
+ title: "".concat(featureTitle, " Comments"),
6452
+ data: comparisonData.comments,
6453
+ prevText: prevText,
6454
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6455
+ isLoading: comparisonData.isLoading
6456
+ })]
6457
+ });
6458
+ }
6459
+ return /*#__PURE__*/jsxs(Fragment, {
6460
+ children: [/*#__PURE__*/jsx(Components.StatBox, {
6461
+ title: "".concat(featureTitle, " Requests"),
6462
+ icon: "wrench",
6463
+ value: analyticsData.requests,
6464
+ previousValue: analyticsData.prevRequests,
6465
+ prevText: prevText,
6466
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6467
+ isLoading: analyticsData.isLoading
6468
+ }), /*#__PURE__*/jsx(Components.StatBox, {
6469
+ title: "Completed ".concat(featureTitle, " Requests"),
6470
+ icon: "circle-check",
6471
+ value: analyticsData.completedRequests,
6472
+ previousValue: analyticsData.prevCompletedRequests,
6473
+ prevText: prevText,
6474
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
6475
+ isLoading: analyticsData.isLoading
6476
+ }), /*#__PURE__*/jsx(Components.StatBox, {
6477
+ title: "".concat(featureTitle, " Comments"),
6478
+ icon: "comment",
6479
+ value: analyticsData.comments,
6480
+ previousValue: analyticsData.prevComments,
6481
+ prevText: prevText,
6482
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6483
+ isLoading: analyticsData.isLoading
6484
+ })]
6485
+ });
6486
+ })()
6404
6487
  })]
6405
6488
  });
6406
6489
  };
@@ -6433,19 +6516,15 @@ var MaintenanceReducer = (function () {
6433
6516
  loading: true
6434
6517
  });
6435
6518
  case JOBS_LOADED:
6519
+ var result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6520
+ return v1 != null && v2 != null && v1.id === v2.id;
6521
+ });
6436
6522
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6437
- jobs: action.payload.map(job => _objectSpread$2({
6523
+ jobs: result.map(job => _objectSpread$2({
6438
6524
  title: job.title || job.description
6439
6525
  }, job)),
6440
6526
  loading: false
6441
6527
  });
6442
- case JOBS_ADDED:
6443
- var added = _.unionWith(action.payload.map(job => _objectSpread$2({
6444
- title: job.title || job.description
6445
- }, job)), state.jobs, (v1, v2) => v1 != null && v2 != null && v1.id === v2.id);
6446
- return _objectSpread$2(_objectSpread$2({}, state), {}, {
6447
- jobs: added
6448
- });
6449
6528
  case JOBS_REMOVED:
6450
6529
  var index = _.findIndex(state.jobs, event => {
6451
6530
  return event != null && event.id === action.payload;
@@ -6466,7 +6545,7 @@ var MaintenanceReducer = (function () {
6466
6545
  jobtypes
6467
6546
  });
6468
6547
  case JOBS_STATUSES_LOADED:
6469
- var jobstatuses = _.orderBy(action.payload, 'order', 'asc');
6548
+ var jobstatuses = _.orderBy(action.payload, "order", "asc");
6470
6549
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6471
6550
  jobstatuses
6472
6551
  });
@@ -6499,7 +6578,7 @@ class ActivityText extends Component {
6499
6578
  className: clickableClasses,
6500
6579
  children: _.truncate(data.Data.title || data.Data.description, {
6501
6580
  length: 30,
6502
- separator: '...'
6581
+ separator: "..."
6503
6582
  })
6504
6583
  })]
6505
6584
  });
@@ -6514,7 +6593,7 @@ class ActivityText extends Component {
6514
6593
  className: clickableClasses,
6515
6594
  children: _.truncate(data.Data.title || data.Data.description, {
6516
6595
  length: 30,
6517
- separator: '...'
6596
+ separator: "..."
6518
6597
  })
6519
6598
  })]
6520
6599
  });
@@ -6529,7 +6608,7 @@ class ActivityText extends Component {
6529
6608
  className: clickableClasses,
6530
6609
  children: _.truncate(data.Data.title || data.Data.description, {
6531
6610
  length: 30,
6532
- separator: '...'
6611
+ separator: "..."
6533
6612
  })
6534
6613
  })]
6535
6614
  });
@@ -6543,7 +6622,7 @@ class ActivityText extends Component {
6543
6622
  className: highlightedClasses,
6544
6623
  children: _.truncate(data.Data.title || data.Data.description, {
6545
6624
  length: 30,
6546
- separator: '...'
6625
+ separator: "..."
6547
6626
  })
6548
6627
  })]
6549
6628
  });
@@ -6585,9 +6664,9 @@ class ViewFull extends Component {
6585
6664
  }
6586
6665
  var styles$2 = {
6587
6666
  image: {
6588
- width: '100%',
6589
- height: '100%',
6590
- objectFit: 'contain'
6667
+ width: "100%",
6668
+ height: "100%",
6669
+ objectFit: "contain"
6591
6670
  }
6592
6671
  };
6593
6672
 
@@ -6621,10 +6700,10 @@ class PreviewWidget extends Component {
6621
6700
  }
6622
6701
  var styles$1 = {
6623
6702
  container: {
6624
- position: 'relative'
6703
+ position: "relative"
6625
6704
  },
6626
6705
  image: {
6627
- width: '100%'
6706
+ width: "100%"
6628
6707
  }
6629
6708
  };
6630
6709
 
@@ -6657,10 +6736,10 @@ class PreviewFull extends Component {
6657
6736
  }
6658
6737
  var styles = {
6659
6738
  container: {
6660
- position: 'relative'
6739
+ position: "relative"
6661
6740
  },
6662
6741
  image: {
6663
- width: '100%'
6742
+ width: "100%"
6664
6743
  }
6665
6744
  };
6666
6745