@plusscommunities/pluss-maintenance-web-forms 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,128 +1,93 @@
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: 'maintenanceForms',
52
- aliases: ['maintenanceTrackingForms', 'maintenanceTypesForms', 'maintenancerequestForms'],
53
- serviceKey: 'maintenanceForms',
54
- reducerKey: 'maintenanceForms',
55
- analyticsKey: 'maintenancerequestForms',
56
- commentKey: 'maintenanceForms',
57
- actionJobsLoaded: 'JOBS_LOADEDForms',
58
- actionJobsAdded: 'JOBS_ADDEDForms',
59
- actionJobsRemoved: 'JOBS_REMOVEDForms',
60
- actionJobsTypesLoaded: 'JOBS_TYPES_LOADEDForms',
61
- actionJobsStatusesLoaded: 'JOBS_STATUSES_LOADEDForms',
62
- actionJobsHideSeen: 'JOBS_HIDE_UNSEENForms',
63
- actionJobsLoading: 'JOBS_LOADINGForms',
64
- permissionMaintenanceTracking: 'maintenanceTrackingForms',
65
- permissionMaintenanceTypes: 'maintenanceTypesForms',
66
- permissionMaintenanceAssignment: 'maintenanceAssignmentForms',
67
- activityMaintenanceJobStatusChanged: 'MaintenanceJobStatusChangedForms',
68
- activityAddMaintenanceJob: 'AddMaintenanceJobForms',
69
- activityEditMaintenanceJob: 'EditMaintenanceJobForms',
70
- activityDeleteMaintenanceJob: 'DeleteMaintenanceJobForms',
71
- routeRequestsHub: '/requestsHubForms',
72
- routeAddRequest: '/requestsHubForms/job',
73
- routeAddRequestType: '/requestsHubForms/requestType',
74
- routeRequestDetails: '/requestsHubForms/jobDetails',
75
- routeRequestTypes: '/requestTypesForms',
76
- screenRequestsHub: 'RequestsHubForms',
77
- screenAddJob: 'AddJobForms',
78
- screenAddJobType: 'AddJobTypeForms',
79
- screenJob: 'JobForms',
80
- screenJobTypes: 'JobTypesForms',
81
- menuIcon: 'form',
17
+ featureKey: "maintenanceForms",
18
+ aliases: ["maintenanceTrackingForms", "maintenanceTypesForms", "maintenancerequestForms"],
19
+ serviceKey: "maintenanceForms",
20
+ reducerKey: "maintenanceForms",
21
+ analyticsKey: "maintenancerequestForms",
22
+ commentKey: "maintenanceForms",
23
+ actionJobsLoaded: "JOBS_LOADEDForms",
24
+ actionJobsRemoved: "JOBS_REMOVEDForms",
25
+ actionJobsTypesLoaded: "JOBS_TYPES_LOADEDForms",
26
+ actionJobsStatusesLoaded: "JOBS_STATUSES_LOADEDForms",
27
+ actionJobsHideSeen: "JOBS_HIDE_UNSEENForms",
28
+ actionJobsLoading: "JOBS_LOADINGForms",
29
+ permissionMaintenanceTracking: "maintenanceTrackingForms",
30
+ permissionMaintenanceTypes: "maintenanceTypesForms",
31
+ permissionMaintenanceAssignment: "maintenanceAssignmentForms",
32
+ activityMaintenanceJobStatusChanged: "MaintenanceJobStatusChangedForms",
33
+ activityAddMaintenanceJob: "AddMaintenanceJobForms",
34
+ activityEditMaintenanceJob: "EditMaintenanceJobForms",
35
+ activityDeleteMaintenanceJob: "DeleteMaintenanceJobForms",
36
+ routeRequestsHub: "/requestsHubForms",
37
+ routeAddRequest: "/requestsHubForms/job",
38
+ routeAddRequestType: "/requestsHubForms/requestType",
39
+ routeRequestDetails: "/requestsHubForms/jobDetails",
40
+ routeRequestTypes: "/requestTypesForms",
41
+ screenRequestsHub: "RequestsHubForms",
42
+ screenAddJob: "AddJobForms",
43
+ screenAddJobType: "AddJobTypeForms",
44
+ screenJob: "JobForms",
45
+ screenJobTypes: "JobTypesForms",
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: 'onlyForResidentsMaintenanceForms',
88
- textEmptyDescription: 'allows your users to submit Forms.',
89
- textEmptyExample: 'Example might be; Absentee form, Inspection form, Feedback form.',
90
- textEmptyJobTypes: 'Please add the different forms',
91
- textEmptyJobTypesExample: 'Example might be; Absentee form, Inspection form, Feedback form.',
92
- textNewTypeButton: 'NEW FORM',
93
- textTitleJobTypes: 'Forms',
94
- textJobType: 'Form',
95
- textAreYouSureYouWantToDelete: 'Are you sure you want to delete that form submission?',
96
- textAreYouSureYouWantToDeleteNote: 'Are you sure you want to delete that note?',
52
+ optionOnlyForResidents: "onlyForResidentsMaintenanceForms",
53
+ textEmptyDescription: "allows your users to submit Forms.",
54
+ textEmptyExample: "Example might be; Absentee form, Inspection form, Feedback form.",
55
+ textEmptyJobTypes: "Please add the different forms",
56
+ textEmptyJobTypesExample: "Example might be; Absentee form, Inspection form, Feedback form.",
57
+ textNewTypeButton: "NEW FORM",
58
+ textTitleJobTypes: "Forms",
59
+ textJobType: "Form",
60
+ textAreYouSureYouWantToDelete: "Are you sure you want to delete that form submission?",
61
+ textAreYouSureYouWantToDeleteNote: "Are you sure you want to delete that note?",
97
62
  textChangedRequestStatus: "changed a form submission's status:",
98
- textAddedRequest: 'added a form submission:',
99
- textEditedRequest: 'edited a form submission:',
100
- textRemovedRequest: 'removed a form submission:',
101
- textSingularName: 'Form Submission',
102
- textYourRequestHere: 'Your Form Submissions will show here',
103
- textTitleRequests: 'Forms',
104
- textMenuTitle: 'Forms',
105
- textPermissionMaintenanceTracking: 'Manage Form Submissions',
106
- textPermissionManageMaintenanceTypes: 'Manage and Set Up Forms',
107
- textPermissionManageAssignedMaintenance: 'Manage Assigned Form Submissions',
108
- textHiddenSectionMaintenanceRequests: 'Forms',
109
- keyHiddenSectionMaintenanceRequests: 'maintenanceRequestForms',
63
+ textAddedRequest: "added a form submission:",
64
+ textEditedRequest: "edited a form submission:",
65
+ textRemovedRequest: "removed a form submission:",
66
+ textSingularName: "Form Submission",
67
+ textYourRequestHere: "Your Form Submissions will show here",
68
+ textTitleRequests: "Forms",
69
+ textMenuTitle: "Forms",
70
+ textPermissionMaintenanceTracking: "Manage Form Submissions",
71
+ textPermissionManageMaintenanceTypes: "Manage and Set Up Forms",
72
+ textPermissionManageAssignedMaintenance: "Manage Assigned Form Submissions",
73
+ textHiddenSectionMaintenanceRequests: "Forms",
74
+ keyHiddenSectionMaintenanceRequests: "maintenanceRequestForms",
110
75
  hasMoreSection: false,
111
- textMoreSectionMaintenance: 'Forms',
112
- featureKeyMoreSectionMaintenance: 'maintenanceForms',
113
- optionKeyMoreSectionMaintenance: 'maintenanceRequestForms',
114
- hiddenKeyMoreSectionMaintenance: 'maintenanceRequestForms',
76
+ textMoreSectionMaintenance: "Forms",
77
+ featureKeyMoreSectionMaintenance: "maintenanceForms",
78
+ optionKeyMoreSectionMaintenance: "maintenanceRequestForms",
79
+ hiddenKeyMoreSectionMaintenance: "maintenanceRequestForms",
115
80
  forceCustomFields: true,
116
- textEntityName: 'Form Submission',
81
+ textEntityName: "Form Submission",
117
82
  hasHelpButton: true,
118
- helpGuideURL: 'https://www.plusscommunities.com/forms-feature',
119
- stringConfigJobStatus: 'maintenanceJobStatusForms',
120
- stringConfigHideSeen: 'maintenanceDisableSeenForms',
83
+ helpGuideURL: "https://www.plusscommunities.com/forms-feature",
84
+ stringConfigJobStatus: "maintenanceJobStatusForms",
85
+ stringConfigHideSeen: "maintenanceDisableSeenForms",
121
86
  // Comment subscription notification preference
122
87
  notificationPreference: {
123
- key: 'maintenancerequestFormsComments',
124
- label: 'Forms comments',
125
- permission: 'maintenanceTrackingForms'
88
+ key: "maintenancerequestFormsComments",
89
+ label: "Forms comments",
90
+ permission: "maintenanceTrackingForms"
126
91
  }
127
92
  };
128
93
 
@@ -131,7 +96,7 @@ var FeatureConfig = {
131
96
  key: values.featureKey,
132
97
  aliases: values.aliases,
133
98
  singularName: values.textSingularName,
134
- description: 'Submit maintenance requests and track the progress.',
99
+ description: "Submit maintenance requests and track the progress.",
135
100
  emptyText: values.textYourRequestHere,
136
101
  widgetOptions: [{
137
102
  key: values.featureKey,
@@ -139,10 +104,10 @@ var FeatureConfig = {
139
104
  main: true,
140
105
  hideOnTabNumbers: [],
141
106
  optionKey: values.optionOnlyForResidents,
142
- type: 'toggle',
107
+ type: "toggle",
143
108
  inverseOption: false,
144
- title: 'Limit Admins to Only Submit on Behalf of Primary Users',
145
- 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.',
109
+ title: "Limit Admins to Only Submit on Behalf of Primary Users",
110
+ 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.",
146
111
  defaultNew: false,
147
112
  default: false
148
113
  }],
@@ -155,20 +120,20 @@ var FeatureConfig = {
155
120
  url: values.routeRequestsHub,
156
121
  countProps: null,
157
122
  visibleExps: {
158
- type: 'and',
123
+ type: "and",
159
124
  exps: [{
160
- type: 'feature',
125
+ type: "feature",
161
126
  value: values.featureKey
162
127
  }, {
163
- type: 'or',
128
+ type: "or",
164
129
  exps: [{
165
- type: 'permission',
130
+ type: "permission",
166
131
  value: values.permissionMaintenanceTracking
167
132
  }, {
168
- type: 'permission',
133
+ type: "permission",
169
134
  value: values.permissionMaintenanceTypes
170
135
  }, {
171
- type: 'permission',
136
+ type: "permission",
172
137
  value: values.permissionMaintenanceAssignment
173
138
  }]
174
139
  }]
@@ -180,15 +145,24 @@ var FeatureConfig = {
180
145
  permissions: [{
181
146
  displayName: values.textPermissionMaintenanceTracking,
182
147
  key: values.permissionMaintenanceTracking,
183
- hq: false
148
+ hq: false,
149
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
150
+ helperText: "Allows tracking and managing maintenance requests and job status updates.",
151
+ importance: IMPORTANCE_LEVELS.IMPORTANT
184
152
  }, {
185
153
  displayName: values.textPermissionManageMaintenanceTypes,
186
154
  key: values.permissionMaintenanceTypes,
187
- hq: false
155
+ hq: false,
156
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
157
+ helperText: "Allows creating and configuring maintenance request types and categories.",
158
+ importance: IMPORTANCE_LEVELS.IMPORTANT
188
159
  }, {
189
160
  displayName: values.textPermissionManageAssignedMaintenance,
190
161
  key: values.permissionMaintenanceAssignment,
191
- hq: false
162
+ hq: false,
163
+ category: PERMISSION_CATEGORIES.FACILITIES_BOOKINGS,
164
+ helperText: "Allows assigning and managing assigned maintenance requests.",
165
+ importance: IMPORTANCE_LEVELS.IMPORTANT
192
166
  }],
193
167
  hiddenSections: [{
194
168
  displayName: values.textHiddenSectionMaintenanceRequests,
@@ -227,21 +201,21 @@ var FeatureConfig = {
227
201
  exact: true
228
202
  }],
229
203
  env: {
230
- baseStage: '',
231
- baseAPIUrl: '',
232
- baseUploadsUrl: '',
233
- uploadBucket: '',
234
- colourBrandingMain: '',
235
- colourBrandingOff: '',
236
- colourBrandingApp: '',
237
- defaultProfileImage: '',
238
- utcOffset: '',
204
+ baseStage: "",
205
+ baseAPIUrl: "",
206
+ baseUploadsUrl: "",
207
+ uploadBucket: "",
208
+ colourBrandingMain: "",
209
+ colourBrandingOff: "",
210
+ colourBrandingApp: "",
211
+ defaultProfileImage: "",
212
+ utcOffset: "",
239
213
  hasAvailableNews: false,
240
214
  newsHaveTags: true,
241
215
  defaultAllowComments: true,
242
- makeApiKey: '',
243
- logo: '',
244
- clientName: ''
216
+ makeApiKey: "",
217
+ logo: "",
218
+ clientName: ""
245
219
  },
246
220
  init: environment => {
247
221
  FeatureConfig.env = environment;
@@ -250,51 +224,24 @@ var FeatureConfig = {
250
224
  notificationPreference: values.notificationPreference
251
225
  };
252
226
 
253
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
254
- try {
255
- var i = n[a](c),
256
- u = i.value;
257
- } catch (n) {
258
- return void e(n);
259
- }
260
- i.done ? t(u) : Promise.resolve(u).then(r, o);
261
- }
262
- function _asyncToGenerator(n) {
263
- return function () {
264
- var t = this,
265
- e = arguments;
266
- return new Promise(function (r, o) {
267
- var a = n.apply(t, e);
268
- function _next(n) {
269
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
270
- }
271
- function _throw(n) {
272
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
273
- }
274
- _next(void 0);
275
- });
276
- };
277
- }
278
-
279
227
  var JOBS_LOADED = values.actionJobsLoaded;
280
- var JOBS_ADDED = values.actionJobsAdded;
281
228
  var JOBS_LOADING = values.actionJobsLoading;
282
229
  var JOBS_REMOVED = values.actionJobsRemoved;
283
230
  var JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
284
231
  var JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
285
232
  var JOBS_HIDE_SEEN = values.actionJobsHideSeen;
286
233
 
287
- 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; }
288
- 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; }
234
+ function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
235
+ 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; }
289
236
  var {
290
- Helper: Helper$5,
237
+ Helper: Helper$6,
291
238
  Session: Session$9
292
239
  } = PlussCore;
293
240
  var maintenanceActions = {
294
241
  getJobType: (site, typeId) => {
295
- var url = Helper$5.getUrl(values.serviceKey, 'getjobtype');
242
+ var url = Helper$6.getUrl(values.serviceKey, "getjobtype");
296
243
  return Session$9.authedFunction({
297
- method: 'POST',
244
+ method: "POST",
298
245
  url,
299
246
  data: {
300
247
  site,
@@ -303,9 +250,9 @@ var maintenanceActions = {
303
250
  });
304
251
  },
305
252
  getJobTypes: (site, id) => {
306
- var url = Helper$5.getUrl(values.serviceKey, 'getjobtypes');
253
+ var url = Helper$6.getUrl(values.serviceKey, "getjobtypes");
307
254
  return Session$9.authedFunction({
308
- method: 'POST',
255
+ method: "POST",
309
256
  url,
310
257
  data: {
311
258
  site
@@ -313,9 +260,9 @@ var maintenanceActions = {
313
260
  });
314
261
  },
315
262
  getJob: (site, id) => {
316
- var url = Helper$5.getUrl(values.serviceKey, 'getJob');
263
+ var url = Helper$6.getUrl(values.serviceKey, "getJob");
317
264
  return Session$9.authedFunction({
318
- method: 'POST',
265
+ method: "POST",
319
266
  url,
320
267
  data: {
321
268
  site,
@@ -324,9 +271,9 @@ var maintenanceActions = {
324
271
  });
325
272
  },
326
273
  getJobByJobId: (site, jobId) => {
327
- var url = Helper$5.getUrl(values.serviceKey, 'getJob');
274
+ var url = Helper$6.getUrl(values.serviceKey, "getJob");
328
275
  return Session$9.authedFunction({
329
- method: 'POST',
276
+ method: "POST",
330
277
  url,
331
278
  data: {
332
279
  site,
@@ -335,11 +282,11 @@ var maintenanceActions = {
335
282
  });
336
283
  },
337
284
  getJobs: function getJobs(site) {
338
- var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
339
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
285
+ var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
286
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
340
287
  return Session$9.authedFunction({
341
- method: 'POST',
342
- url: Helper$5.getUrl(values.serviceKey, 'getJobs'),
288
+ method: "POST",
289
+ url: Helper$6.getUrl(values.serviceKey, "getJobs"),
343
290
  data: {
344
291
  site,
345
292
  status,
@@ -347,67 +294,47 @@ var maintenanceActions = {
347
294
  }
348
295
  });
349
296
  },
350
- getJobs2: (site, status, priority, type, lastKey, assignee, startTime, endTime, search) => {
297
+ getJobs2: (site, status, type, lastKey) => {
351
298
  var query = {
352
299
  site
353
300
  };
354
301
  if (status) {
355
302
  query.status = status;
356
303
  }
357
- if (priority) {
358
- query.priority = priority;
359
- }
360
304
  if (type) {
361
305
  query.type = type;
362
306
  }
363
307
  if (lastKey) {
364
308
  query.lastKey = JSON.stringify(lastKey);
365
309
  }
366
- if (assignee) {
367
- query.assignee = assignee;
368
- }
369
- if (startTime) {
370
- query.startTime = startTime;
371
- }
372
- if (endTime) {
373
- query.endTime = endTime;
374
- }
375
- if (search) {
376
- query.search = search;
377
- }
378
310
  return Session$9.authedFunction({
379
- method: 'GET',
380
- url: Helper$5.getUrl(values.serviceKey, 'get/requests', query)
311
+ method: "GET",
312
+ url: Helper$6.getUrl(values.serviceKey, "get/requests", query)
381
313
  });
382
314
  },
383
- /**
384
- * @deprecated Use getJobs2 with pagination instead.
385
- * This method recursively fetches ALL pages which can be slow for large datasets.
386
- * For better performance, use getJobs2 directly and implement pagination in the UI.
387
- */
388
315
  getJobsRecursive: function getJobsRecursive(site, status, type, lastKey) {
389
316
  var jobs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
390
- return new Promise((resolve, reject) => {
391
- maintenanceActions.getJobs2(site, status, undefined, type, lastKey).then(jobRes => {
317
+ return new Promise(resolve => {
318
+ maintenanceActions.getJobs2(site, status, type, lastKey).then(jobRes => {
392
319
  var newJobs = [...jobs, ...jobRes.data.Items];
393
320
  if (!jobRes.data.LastKey) {
394
321
  return resolve(newJobs);
395
322
  }
396
- maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs).then(resolve).catch(reject);
397
- }).catch(reject);
323
+ return resolve(maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));
324
+ });
398
325
  });
399
326
  },
400
327
  createJob: job => {
401
328
  return Session$9.authedFunction({
402
- method: 'POST',
403
- url: Helper$5.getUrl(values.serviceKey, 'sendMaintenance'),
404
- data: _objectSpread$7({}, job)
329
+ method: "POST",
330
+ url: Helper$6.getUrl(values.serviceKey, "sendMaintenance"),
331
+ data: _objectSpread$8({}, job)
405
332
  });
406
333
  },
407
334
  editJob: (job, site) => {
408
335
  return Session$9.authedFunction({
409
- method: 'POST',
410
- url: Helper$5.getUrl(values.serviceKey, 'editJob'),
336
+ method: "POST",
337
+ url: Helper$6.getUrl(values.serviceKey, "editJob"),
411
338
  data: {
412
339
  job,
413
340
  site
@@ -416,8 +343,8 @@ var maintenanceActions = {
416
343
  },
417
344
  deleteJob: (site, id) => {
418
345
  return Session$9.authedFunction({
419
- method: 'POST',
420
- url: Helper$5.getUrl(values.serviceKey, 'requests/remove'),
346
+ method: "POST",
347
+ url: Helper$6.getUrl(values.serviceKey, "requests/remove"),
421
348
  data: {
422
349
  site,
423
350
  id
@@ -426,8 +353,8 @@ var maintenanceActions = {
426
353
  },
427
354
  editJobStatus: (id, status) => {
428
355
  return Session$9.authedFunction({
429
- method: 'POST',
430
- url: Helper$5.getUrl(values.serviceKey, 'editJobStatus'),
356
+ method: "POST",
357
+ url: Helper$6.getUrl(values.serviceKey, "editJobStatus"),
431
358
  data: {
432
359
  id,
433
360
  status
@@ -436,8 +363,8 @@ var maintenanceActions = {
436
363
  },
437
364
  editJobPriority: (id, priority) => {
438
365
  return Session$9.authedFunction({
439
- method: 'POST',
440
- url: Helper$5.getUrl(values.serviceKey, 'update/priority'),
366
+ method: "POST",
367
+ url: Helper$6.getUrl(values.serviceKey, "update/priority"),
441
368
  data: {
442
369
  id,
443
370
  priority
@@ -446,8 +373,8 @@ var maintenanceActions = {
446
373
  },
447
374
  assignJob: (jobId, userId) => {
448
375
  return Session$9.authedFunction({
449
- method: 'POST',
450
- url: Helper$5.getUrl(values.serviceKey, 'update/assign'),
376
+ method: "POST",
377
+ url: Helper$6.getUrl(values.serviceKey, "update/assign"),
451
378
  data: {
452
379
  id: jobId,
453
380
  userId
@@ -456,47 +383,47 @@ var maintenanceActions = {
456
383
  },
457
384
  getAssignees: site => {
458
385
  return Session$9.authedFunction({
459
- method: 'GET',
460
- url: Helper$5.getUrl(values.serviceKey, 'get/assignees', {
386
+ method: "GET",
387
+ url: Helper$6.getUrl(values.serviceKey, "get/assignees", {
461
388
  site
462
389
  })
463
390
  });
464
391
  },
465
392
  addNote: (jobId, note, attachments, images) => {
466
393
  return Session$9.authedFunction({
467
- method: 'POST',
468
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
394
+ method: "POST",
395
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
469
396
  data: {
470
397
  id: jobId,
471
398
  note,
472
399
  attachments,
473
400
  images,
474
- action: 'AddNote'
401
+ action: "AddNote"
475
402
  }
476
403
  });
477
404
  },
478
405
  editNote: (jobId, noteId, note, attachments, images) => {
479
406
  return Session$9.authedFunction({
480
- method: 'POST',
481
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
407
+ method: "POST",
408
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
482
409
  data: {
483
410
  id: jobId,
484
411
  note,
485
412
  attachments,
486
413
  images,
487
414
  noteId,
488
- action: 'EditNote'
415
+ action: "EditNote"
489
416
  }
490
417
  });
491
418
  },
492
419
  deleteNote: (jobId, noteId) => {
493
420
  return Session$9.authedFunction({
494
- method: 'POST',
495
- url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
421
+ method: "POST",
422
+ url: Helper$6.getUrl(values.serviceKey, "requests/note"),
496
423
  data: {
497
424
  id: jobId,
498
425
  noteId,
499
- action: 'DeleteNote'
426
+ action: "DeleteNote"
500
427
  }
501
428
  });
502
429
  },
@@ -511,8 +438,8 @@ var maintenanceActions = {
511
438
  customFields: customFields || []
512
439
  };
513
440
  return Session$9.authedFunction({
514
- method: 'POST',
515
- url: Helper$5.getUrl(values.serviceKey, 'createJobType'),
441
+ method: "POST",
442
+ url: Helper$6.getUrl(values.serviceKey, "createJobType"),
516
443
  data
517
444
  });
518
445
  },
@@ -529,15 +456,15 @@ var maintenanceActions = {
529
456
  };
530
457
  if (hasCustomFields && customFields) data.customFields = customFields;
531
458
  return Session$9.authedFunction({
532
- method: 'POST',
533
- url: Helper$5.getUrl(values.serviceKey, 'editJobType'),
459
+ method: "POST",
460
+ url: Helper$6.getUrl(values.serviceKey, "editJobType"),
534
461
  data
535
462
  });
536
463
  },
537
464
  deleteJobType: (site, id) => {
538
465
  return Session$9.authedFunction({
539
- method: 'POST',
540
- url: Helper$5.getUrl(values.serviceKey, 'deleteJobType'),
466
+ method: "POST",
467
+ url: Helper$6.getUrl(values.serviceKey, "deleteJobType"),
541
468
  data: {
542
469
  site,
543
470
  id
@@ -546,16 +473,16 @@ var maintenanceActions = {
546
473
  },
547
474
  getExternalSync: jobId => {
548
475
  return Session$9.authedFunction({
549
- method: 'GET',
550
- url: Helper$5.getUrl(values.serviceKey, 'get/externalsync', {
476
+ method: "GET",
477
+ url: Helper$6.getUrl(values.serviceKey, "get/externalsync", {
551
478
  id: jobId
552
479
  })
553
480
  });
554
481
  },
555
482
  retrySync: jobId => {
556
483
  return Session$9.authedFunction({
557
- method: 'POST',
558
- url: Helper$5.getUrl(values.serviceKey, 'update/retrysync'),
484
+ method: "POST",
485
+ url: Helper$6.getUrl(values.serviceKey, "update/retrysync"),
559
486
  data: {
560
487
  id: jobId
561
488
  }
@@ -564,7 +491,7 @@ var maintenanceActions = {
564
491
  };
565
492
 
566
493
  var {
567
- Helper: Helper$4,
494
+ Helper: Helper$5,
568
495
  Session: Session$8
569
496
  } = PlussCore;
570
497
  var reactionActions = {
@@ -581,8 +508,8 @@ var reactionActions = {
581
508
  data.image = image;
582
509
  }
583
510
  return Session$8.authedFunction({
584
- method: 'POST',
585
- url: Helper$4.getUrl('reactions', 'comments/add'),
511
+ method: "POST",
512
+ url: Helper$5.getUrl("reactions", "comments/add"),
586
513
  data
587
514
  });
588
515
  },
@@ -604,8 +531,8 @@ var reactionActions = {
604
531
  query.minTime = minTime;
605
532
  }
606
533
  return Session$8.authedFunction({
607
- method: 'GET',
608
- url: Helper$4.getUrl('reactions', 'comments/get', query)
534
+ method: "GET",
535
+ url: Helper$5.getUrl("reactions", "comments/get", query)
609
536
  });
610
537
  }
611
538
  };
@@ -639,20 +566,19 @@ var jobStatusOptions = [
639
566
  ];
640
567
 
641
568
  var {
642
- Helper: Helper$3
569
+ Helper: Helper$4
643
570
  } = PlussCore;
644
571
  var jobsUpdate = (site, isdashboard) => {
645
572
  return dispatch => {
646
573
  if (isdashboard) dispatch({
647
574
  type: JOBS_LOADING
648
575
  });
649
- maintenanceActions.getJobs2(site).then(res => {
650
- var currentSite = Helper$3.readStorageWithCookie('site');
651
- var jobs = res.data.Items;
652
- if (!_.isEmpty(jobs) && jobs[0].site === currentSite) {
576
+ maintenanceActions.getJobsRecursive(site).then(res => {
577
+ var currentSite = Helper$4.readStorageWithCookie("site");
578
+ if (!_.isEmpty(res) && res[0].site === currentSite) {
653
579
  dispatch({
654
580
  type: JOBS_LOADED,
655
- payload: jobs
581
+ payload: res
656
582
  });
657
583
  } else {
658
584
  dispatch({
@@ -660,12 +586,6 @@ var jobsUpdate = (site, isdashboard) => {
660
586
  payload: []
661
587
  });
662
588
  }
663
- }).catch(error => {
664
- console.error('jobsUpdate error', error);
665
- dispatch({
666
- type: JOBS_LOADED,
667
- payload: []
668
- });
669
589
  });
670
590
  };
671
591
  };
@@ -675,12 +595,6 @@ var jobsLoaded = events => {
675
595
  payload: events
676
596
  };
677
597
  };
678
- var jobsAdded = events => {
679
- return {
680
- type: JOBS_ADDED,
681
- payload: events
682
- };
683
- };
684
598
  var removeJob = id => {
685
599
  return {
686
600
  type: JOBS_REMOVED,
@@ -801,10 +715,10 @@ var jobPriorityOptions = [
801
715
  }
802
716
  ];
803
717
 
804
- var STATUS_IMCOMPLETE = 'All Incomplete';
805
- var STATUS_NOT_ACTIONED = 'Not Actioned';
806
- var STATUS_IN_PROGRESS = 'In Progress';
807
- var STATUS_COMPLETED = 'Completed';
718
+ var STATUS_IMCOMPLETE = "All Incomplete";
719
+ var STATUS_NOT_ACTIONED = "Not Actioned";
720
+ var STATUS_IN_PROGRESS = "In Progress";
721
+ var STATUS_COMPLETED = "Completed";
808
722
  var getDefaultPriority = () => jobPriorityOptions.find(p => p.default);
809
723
  var getJobPriority = priority => {
810
724
  var priorityOption = null;
@@ -812,8 +726,8 @@ var getJobPriority = priority => {
812
726
  return priorityOption || getDefaultPriority();
813
727
  };
814
728
 
815
- 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; }
816
- 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; }
729
+ function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
730
+ 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; }
817
731
  var {
818
732
  Session: Session$7,
819
733
  Components: Components$7,
@@ -829,75 +743,25 @@ class JobList extends Component {
829
743
  id: j.userID,
830
744
  displayName: j.userName,
831
745
  profilePic: j.userProfilePic
832
- })), 'id'), 'displayName', 'asc');
746
+ })), "id"), "displayName", "asc");
833
747
  this.setState({
834
748
  requesters
835
749
  });
836
750
  });
837
- _defineProperty(this, "refresh", () => {
838
- var {
839
- auth
840
- } = this.props;
841
- this.setState({
842
- loading: true,
843
- lastKey: null,
844
- hasMore: true
845
- }, /*#__PURE__*/_asyncToGenerator(function* () {
846
- try {
847
- var statusForApi = _this.state.selectedStatusFilter === STATUS_IMCOMPLETE ? undefined : _this.state.selectedStatusFilter;
848
- var res = yield maintenanceActions.getJobs2(auth.site, statusForApi, _this.state.selectedPriorityFilter, _this.state.selectedTypeFilter, null,
849
- // first page
850
- _this.state.selectedUserFilter, _this.state.selectedTimeFilterStart, _this.state.selectedTimeFilterEnd, _this.state.search);
851
- var jobs = res.data.Items;
852
- var lastKey = res.data.LastKey;
853
- _this.setRequesters(jobs);
854
- _this.props.jobsLoaded(jobs);
855
- _this.setState({
856
- lastKey,
857
- hasMore: !!lastKey,
858
- loading: false
859
- });
860
- } catch (error) {
861
- console.error('refresh error', error);
862
- _this.setState({
863
- loading: false
864
- });
865
- }
866
- }));
867
- });
868
- _defineProperty(this, "loadMore", () => {
751
+ _defineProperty(this, "getJobs", /*#__PURE__*/_asyncToGenerator(function* () {
869
752
  var {
870
753
  auth
871
- } = this.props;
872
- var {
873
- loading,
874
- loadingMore,
875
- hasMore,
876
- lastKey
877
- } = this.state;
878
- if (loading || loadingMore || !hasMore || !lastKey) return;
879
- this.setState({
880
- loadingMore: true
881
- }, /*#__PURE__*/_asyncToGenerator(function* () {
882
- try {
883
- var statusForApi = _this.state.selectedStatusFilter === STATUS_IMCOMPLETE ? undefined : _this.state.selectedStatusFilter;
884
- 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);
885
- var newJobs = res.data.Items;
886
- var newLastKey = res.data.LastKey;
887
- _this.props.jobsAdded(newJobs);
888
- _this.setState({
889
- lastKey: newLastKey,
890
- hasMore: !!newLastKey,
891
- loadingMore: false
892
- });
893
- } catch (error) {
894
- console.error('loadMore error', error);
895
- _this.setState({
896
- loadingMore: false
897
- });
754
+ } = _this.props;
755
+ try {
756
+ var res = yield maintenanceActions.getJobsRecursive(auth.site);
757
+ if (!_.isEmpty(res) && res[0].site === auth.site) {
758
+ _this.setRequesters(res);
759
+ _this.props.jobsLoaded(res);
898
760
  }
899
- }));
900
- });
761
+ } catch (error) {
762
+ console.error("getJobs", error);
763
+ }
764
+ }));
901
765
  _defineProperty(this, "getAssignees", /*#__PURE__*/_asyncToGenerator(function* () {
902
766
  try {
903
767
  var res = yield maintenanceActions.getAssignees(_this.props.auth.site);
@@ -905,7 +769,7 @@ class JobList extends Component {
905
769
  assignees: res.data.Users
906
770
  });
907
771
  } catch (error) {
908
- console.error('getAssignees', error);
772
+ console.error("getAssignees", error);
909
773
  }
910
774
  }));
911
775
  _defineProperty(this, "sortByCol", col => {
@@ -925,20 +789,20 @@ class JobList extends Component {
925
789
  }
926
790
  });
927
791
  _defineProperty(this, "onRemoveRequest", /*#__PURE__*/function () {
928
- var _ref4 = _asyncToGenerator(function* (request) {
792
+ var _ref3 = _asyncToGenerator(function* (request) {
929
793
  if (window.confirm(values.textAreYouSureYouWantToDelete)) {
930
794
  _this.props.removeJob(request.id);
931
795
  try {
932
796
  yield maintenanceActions.deleteJob(_this.props.auth.site, request.id);
933
- _this.refresh();
797
+ _this.getJobs();
934
798
  } catch (error) {
935
- console.log('onRemoveRequest', error);
936
- alert('Something went wrong with the request. Please try again.');
799
+ console.log("onRemoveRequest", error);
800
+ alert("Something went wrong with the request. Please try again.");
937
801
  }
938
802
  }
939
803
  });
940
804
  return function (_x) {
941
- return _ref4.apply(this, arguments);
805
+ return _ref3.apply(this, arguments);
942
806
  };
943
807
  }());
944
808
  _defineProperty(this, "openFilter", filter => {
@@ -952,22 +816,22 @@ class JobList extends Component {
952
816
  });
953
817
  });
954
818
  _defineProperty(this, "selectTypeFilter", filter => {
955
- this.closeFilter();
956
819
  this.setState({
957
820
  selectedTypeFilter: filter
958
- }, () => this.refresh());
821
+ });
822
+ this.closeFilter();
959
823
  });
960
824
  _defineProperty(this, "selectPriorityFilter", filter => {
961
- this.closeFilter();
962
825
  this.setState({
963
826
  selectedPriorityFilter: filter
964
- }, () => this.refresh());
827
+ });
828
+ this.closeFilter();
965
829
  });
966
830
  _defineProperty(this, "selectStatusFilter", filter => {
967
- this.closeFilter();
968
831
  this.setState({
969
832
  selectedStatusFilter: filter
970
- }, () => this.refresh());
833
+ });
834
+ this.closeFilter();
971
835
  });
972
836
  _defineProperty(this, "timeFilterChanged", selectedTimeFilter => {
973
837
  this.setState({
@@ -987,42 +851,42 @@ class JobList extends Component {
987
851
  if (this.state.selectedTimeFilter.dayCount > 0) {
988
852
  return true;
989
853
  }
990
- return moment(this.state.timeFilterStart).startOf('d').valueOf() < moment(this.state.timeFilterEnd).endOf('d').valueOf();
854
+ return moment(this.state.timeFilterStart).startOf("d").valueOf() < moment(this.state.timeFilterEnd).endOf("d").valueOf();
991
855
  });
992
856
  _defineProperty(this, "saveTimeFilter", () => {
993
857
  if (!this.isValidTimeFilter()) {
994
858
  return;
995
859
  }
996
860
  var startTime = 0;
997
- var endTime = moment().endOf('d').valueOf();
998
- var text = '';
861
+ var endTime = moment().endOf("d").valueOf();
862
+ var text = "";
999
863
  if (this.state.selectedTimeFilter.dayCount > 0) {
1000
- startTime = moment().add(-this.state.selectedTimeFilter.dayCount, 'd').startOf('d').valueOf();
864
+ startTime = moment().add(-this.state.selectedTimeFilter.dayCount, "d").startOf("d").valueOf();
1001
865
  text = this.state.selectedTimeFilter.text;
1002
866
  } else {
1003
- var startDate = moment(this.state.timeFilterStart).startOf('d');
1004
- var endDate = moment(this.state.timeFilterEnd).endOf('d');
867
+ var startDate = moment(this.state.timeFilterStart).startOf("d");
868
+ var endDate = moment(this.state.timeFilterEnd).endOf("d");
1005
869
  startTime = startDate.valueOf();
1006
870
  endTime = endDate.valueOf();
1007
- text = "".concat(startDate.format('DD/MM/YYYY'), " to ").concat(endDate.format('DD/MM/YYYY'));
871
+ text = "".concat(startDate.format("DD/MM/YYYY"), " to ").concat(endDate.format("DD/MM/YYYY"));
1008
872
  }
1009
- this.closeFilter();
1010
873
  this.setState({
1011
874
  selectedTimeFilterStart: startTime,
1012
875
  selectedTimeFilterEnd: endTime,
1013
876
  selectedTimeFilterText: text
1014
- }, () => this.refresh());
877
+ });
878
+ this.closeFilter();
1015
879
  });
1016
880
  _defineProperty(this, "removeTimeFilter", () => {
1017
881
  this.setState({
1018
882
  selectedTimeFilterStart: null,
1019
883
  selectedTimeFilterEnd: null,
1020
884
  selectedTimeFilterText: null
1021
- }, () => this.refresh());
885
+ });
1022
886
  });
1023
887
  _defineProperty(this, "onHandleChange", event => {
1024
888
  var stateChange = {};
1025
- stateChange[event.target.getAttribute('id')] = event.target.value;
889
+ stateChange[event.target.getAttribute("id")] = event.target.value;
1026
890
  this.setState(stateChange);
1027
891
  });
1028
892
  _defineProperty(this, "onSelectAssignee", user => {
@@ -1034,10 +898,9 @@ class JobList extends Component {
1034
898
  this.setState({
1035
899
  selectedUserFilter: null,
1036
900
  selectedUserFilterText: null
1037
- }, () => this.refresh());
901
+ });
1038
902
  });
1039
903
  _defineProperty(this, "saveUserFilter", () => {
1040
- this.closeFilter();
1041
904
  if (!this.state.selectedAssignee) {
1042
905
  this.removeUserFilter();
1043
906
  } else {
@@ -1045,8 +908,9 @@ class JobList extends Component {
1045
908
  selectedUserFilter: this.state.selectedAssignee.id,
1046
909
  selectedUserFilterText: this.state.selectedAssignee.displayName,
1047
910
  selectedAssignee: null
1048
- }, () => this.refresh());
911
+ });
1049
912
  }
913
+ this.closeFilter();
1050
914
  });
1051
915
  _defineProperty(this, "onSelectRequester", user => {
1052
916
  this.setState({
@@ -1078,41 +942,82 @@ class JobList extends Component {
1078
942
  lastSearch: thisSearchTime
1079
943
  });
1080
944
  setTimeout(() => {
1081
- // Debounced: trigger server-side refresh after user stops typing
945
+ // delayed setter to avoid filtering on every keypress
1082
946
  if (this.state.lastSearch === thisSearchTime) {
1083
- this.refresh();
947
+ this.setState({
948
+ searchTerm: this.state.search
949
+ });
1084
950
  }
1085
951
  }, 500);
1086
952
  });
1087
953
  _defineProperty(this, "getSource", () => {
1088
954
  var source = this.props.source;
1089
955
 
1090
- // Client-side filter: Incomplete status (composite filter, not supported server-side)
1091
- if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
956
+ // filter by time
957
+ if (this.state.selectedTimeFilterStart && this.state.selectedTimeFilterEnd) {
958
+ source = _.filter(source, r => {
959
+ return r.createdUnix >= this.state.selectedTimeFilterStart && r.createdUnix <= this.state.selectedTimeFilterEnd;
960
+ });
961
+ }
962
+
963
+ // filter by type
964
+ if (this.state.selectedTypeFilter) {
965
+ source = _.filter(source, r => {
966
+ return r.type === this.state.selectedTypeFilter;
967
+ });
968
+ }
969
+
970
+ // filter by priority
971
+ if (this.state.selectedPriorityFilter) {
972
+ var defaultPriority = getDefaultPriority().name;
973
+ source = _.filter(source, r => {
974
+ return r.priority === this.state.selectedPriorityFilter || this.state.selectedPriorityFilter === defaultPriority && _.isNil(r.priority);
975
+ });
976
+ }
977
+
978
+ // filter by status
979
+ if (this.state.selectedStatusFilter) {
1092
980
  var {
1093
981
  statusTypes
1094
982
  } = this.props;
983
+ var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
1095
984
  source = _.filter(source, r => {
1096
- var status = statusTypes.find(s => s.text === r.status);
1097
- return !status || status.category !== STATUS_COMPLETED;
985
+ var status = statusTypes.find(s => s.text === r.status) || defaultStatus;
986
+ if (this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
987
+ return status.category !== STATUS_COMPLETED;
988
+ }
989
+ return status.text === this.state.selectedStatusFilter;
990
+ });
991
+ }
992
+ if (this.state.selectedUserFilter) {
993
+ source = _.filter(source, r => {
994
+ return r.AssigneeId === this.state.selectedUserFilter;
1098
995
  });
1099
996
  }
1100
-
1101
- // Client-side filter: requester (not supported server-side)
1102
997
  if (this.state.selectedRequesterFilter) {
1103
998
  source = _.filter(source, r => {
1104
999
  return r.userID === this.state.selectedRequesterFilter;
1105
1000
  });
1106
1001
  }
1107
-
1108
- // Note: status, type, priority, assignee, time range, and search filters
1109
- // are all applied server-side via getJobs2 pagination.
1110
-
1002
+ if (!_.isEmpty(this.state.searchTerm)) {
1003
+ source = _.filter(source, r => {
1004
+ if (r.jobId && r.jobId === this.state.searchTerm) {
1005
+ return true;
1006
+ }
1007
+ if (r.room && r.room.toLowerCase().indexOf(this.state.searchTerm.toLowerCase()) > -1) {
1008
+ return true;
1009
+ }
1010
+ if (r.title && r.title.toLowerCase().indexOf(this.state.searchTerm.toLowerCase()) > -1) {
1011
+ return true;
1012
+ }
1013
+ return false;
1014
+ });
1015
+ }
1111
1016
  source = _.sortBy(source, event => {
1112
- if (this.state.sortColumn === 'assigned') {
1113
- return event.Assignee ? event.Assignee.displayName : 'Unassigned';
1017
+ if (this.state.sortColumn === "assigned") {
1018
+ return event.Assignee ? event.Assignee.displayName : "Unassigned";
1114
1019
  }
1115
- if (this.state.sortColumn !== 'createdUnix') return event[this.state.sortColumn];
1020
+ if (this.state.sortColumn !== "createdUnix") return event[this.state.sortColumn];
1116
1021
  return event.createdUnix;
1117
1022
  });
1118
1023
  if (this.state.sortDesc) source.reverse();
@@ -1120,14 +1025,14 @@ class JobList extends Component {
1120
1025
  });
1121
1026
  _defineProperty(this, "getCustomFieldValue", field => {
1122
1027
  switch (field.type) {
1123
- case 'date':
1124
- return field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD-MMM-YYYY') : '';
1125
- case 'time':
1126
- return field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : '';
1127
- case 'yn':
1128
- return field.answer ? 'Yes' : 'No';
1129
- case 'checkbox':
1130
- return field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '';
1028
+ case "date":
1029
+ return field.answer ? moment(field.answer, "YYYY-MM-DD").format("DD-MMM-YYYY") : "";
1030
+ case "time":
1031
+ return field.answer ? moment(field.answer, "HH:mm").format("h:mm a") : "";
1032
+ case "yn":
1033
+ return field.answer ? "Yes" : "No";
1034
+ case "checkbox":
1035
+ return field.answer && Array.isArray(field.answer) ? field.answer.join(", ") : "";
1131
1036
  default:
1132
1037
  return field.answer;
1133
1038
  }
@@ -1141,7 +1046,7 @@ class JobList extends Component {
1141
1046
  if (customFields && Array.isArray(customFields)) {
1142
1047
  customFields.forEach(field => {
1143
1048
  // Exclude un-exportable fields
1144
- if (['image', 'document', 'staticTitle', 'staticText'].includes(field.type)) return;
1049
+ if (["image", "document", "staticTitle", "staticText"].includes(field.type)) return;
1145
1050
  var fieldKey = "".concat(_.camelCase(type), ".").concat(_.camelCase(field.label));
1146
1051
  // Build custom columns
1147
1052
  var exists = customColumns.find(c => c.key === fieldKey);
@@ -1163,10 +1068,10 @@ class JobList extends Component {
1163
1068
  var source = this.getSource().map(r => {
1164
1069
  var history = r.history || [];
1165
1070
  var progressEntry = _.find(history, e => {
1166
- return e.status !== 'Unassigned';
1071
+ return e.status !== "Unassigned";
1167
1072
  });
1168
1073
  var completedEntry = _.find(history, e => {
1169
- return e.status === 'Completed';
1074
+ return e.status === "Completed";
1170
1075
  });
1171
1076
  var progressTime = null;
1172
1077
  var completedTime = null;
@@ -1180,22 +1085,22 @@ class JobList extends Component {
1180
1085
  completedTime = moment.utc(completedEntry.timestamp).format();
1181
1086
  completedDuration = moment.utc(completedEntry.timestamp).unix() - moment.utc(r.createdTime).unix();
1182
1087
  }
1183
- var notes = '';
1088
+ var notes = "";
1184
1089
  (r.Notes || []).forEach((note, index) => {
1185
1090
  if (index > 0) {
1186
- notes += '\n\n';
1091
+ notes += "\n\n";
1187
1092
  }
1188
1093
  if (note.User && !_.isEmpty(note.User.displayName)) {
1189
1094
  notes += "".concat(note.User.displayName, ":\n");
1190
1095
  }
1191
1096
  if (note.Timestamp) {
1192
- notes += "".concat(moment(note.Timestamp).format('DD-MM-YYYY h:mma'), "\n");
1097
+ notes += "".concat(moment(note.Timestamp).format("DD-MM-YYYY h:mma"), "\n");
1193
1098
  }
1194
1099
  notes += note.Note;
1195
1100
  });
1196
1101
  var customFieldValues = this.getCustomFields(r, customColumns);
1197
1102
  var priority = r.priority || defaultPriority;
1198
- return _objectSpread$6(_objectSpread$6(_objectSpread$6({}, r), customFieldValues), {}, {
1103
+ return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, r), customFieldValues), {}, {
1199
1104
  notes,
1200
1105
  progressTime,
1201
1106
  completedTime,
@@ -1206,7 +1111,7 @@ class JobList extends Component {
1206
1111
  });
1207
1112
 
1208
1113
  // Compose revised columns list with custom fields
1209
- var index = this.exportColumns.findIndex(c => c.key === 'notes');
1114
+ var index = this.exportColumns.findIndex(c => c.key === "notes");
1210
1115
  var columns = [...this.exportColumns.slice(0, index), ...customColumns, ...this.exportColumns.slice(index)];
1211
1116
  return {
1212
1117
  columns,
@@ -1228,67 +1133,64 @@ class JobList extends Component {
1228
1133
  });
1229
1134
  });
1230
1135
  this.state = {
1231
- sortColumn: 'createdUnix',
1136
+ showCompleted: false,
1137
+ sortColumn: "createdUnix",
1232
1138
  sortDesc: true,
1233
1139
  selectedTimeFilter: Analytics$2.getAnalyticsFilterOptions()[1],
1234
1140
  assignees: [],
1235
- requesters: [],
1236
- loading: false,
1237
- loadingMore: false,
1238
- lastKey: null,
1239
- hasMore: true
1141
+ requesters: []
1240
1142
  };
1241
1143
  this.exportColumns = [{
1242
- label: 'Select All',
1243
- key: ''
1144
+ label: "Select All",
1145
+ key: ""
1244
1146
  }, {
1245
- label: 'System Id',
1246
- key: 'id'
1147
+ label: "System Id",
1148
+ key: "id"
1247
1149
  }, {
1248
1150
  label: "".concat(values.textEntityName, " No."),
1249
- key: 'jobId'
1151
+ key: "jobId"
1250
1152
  }, {
1251
1153
  label: values.textJobType,
1252
- key: 'type'
1154
+ key: "type"
1253
1155
  }, {
1254
- label: 'Status',
1255
- key: 'status'
1156
+ label: "Status",
1157
+ key: "status"
1256
1158
  }, {
1257
- label: 'Priority',
1258
- key: 'priority'
1159
+ label: "Priority",
1160
+ key: "priority"
1259
1161
  }, {
1260
- label: 'Title',
1261
- key: 'title'
1162
+ label: "Title",
1163
+ key: "title"
1262
1164
  }, {
1263
- label: 'Address',
1264
- key: 'room'
1165
+ label: "Address",
1166
+ key: "room"
1265
1167
  }, {
1266
- label: 'Description',
1267
- key: 'description'
1168
+ label: "Description",
1169
+ key: "description"
1268
1170
  }, {
1269
- label: 'Notes',
1270
- key: 'notes'
1171
+ label: "Notes",
1172
+ key: "notes"
1271
1173
  }, {
1272
- label: 'User Name',
1273
- key: 'userName'
1174
+ label: "User Name",
1175
+ key: "userName"
1274
1176
  }, {
1275
- label: 'User ID',
1276
- key: 'userID'
1177
+ label: "User ID",
1178
+ key: "userID"
1277
1179
  }, {
1278
- label: 'Request Time',
1279
- key: 'createdTime'
1180
+ label: "Request Time",
1181
+ key: "createdTime"
1280
1182
  }, {
1281
- label: 'Progress Time',
1282
- key: 'progressTime'
1183
+ label: "Progress Time",
1184
+ key: "progressTime"
1283
1185
  }, {
1284
- label: 'Completed Time',
1285
- key: 'completedTime'
1186
+ label: "Completed Time",
1187
+ key: "completedTime"
1286
1188
  }, {
1287
- label: 'Time to Progress (in seconds)',
1288
- key: 'progressDuration'
1189
+ label: "Time to Progress (in seconds)",
1190
+ key: "progressDuration"
1289
1191
  }, {
1290
- label: 'Time to Complete (in seconds)',
1291
- key: 'completedDuration'
1192
+ label: "Time to Complete (in seconds)",
1193
+ key: "completedDuration"
1292
1194
  }];
1293
1195
  }
1294
1196
  UNSAFE_componentWillMount() {
@@ -1296,14 +1198,14 @@ class JobList extends Component {
1296
1198
  }
1297
1199
  componentDidMount() {
1298
1200
  this.props.jobStatusesUpdate(this.props.auth.site);
1299
- this.refresh();
1201
+ this.getJobs();
1300
1202
  this.getAssignees();
1301
1203
  }
1302
1204
  renderFilterPopup() {
1303
1205
  if (!this.state.filterOpen) {
1304
1206
  return null;
1305
1207
  }
1306
- if (this.state.filterOpen === 'type') {
1208
+ if (this.state.filterOpen === "type") {
1307
1209
  return /*#__PURE__*/jsx(Components$7.Popup, {
1308
1210
  title: "Select ".concat(values.textJobType),
1309
1211
  maxWidth: 600,
@@ -1321,7 +1223,7 @@ class JobList extends Component {
1321
1223
  })
1322
1224
  });
1323
1225
  }
1324
- if (this.state.filterOpen === 'priority') {
1226
+ if (this.state.filterOpen === "priority") {
1325
1227
  return /*#__PURE__*/jsx(Components$7.Popup, {
1326
1228
  title: "Select Priority",
1327
1229
  maxWidth: 600,
@@ -1339,7 +1241,7 @@ class JobList extends Component {
1339
1241
  })
1340
1242
  });
1341
1243
  }
1342
- if (this.state.filterOpen === 'status') {
1244
+ if (this.state.filterOpen === "status") {
1343
1245
  var {
1344
1246
  statusTypes
1345
1247
  } = this.props;
@@ -1360,7 +1262,7 @@ class JobList extends Component {
1360
1262
  })
1361
1263
  });
1362
1264
  }
1363
- if (this.state.filterOpen === 'time') {
1265
+ if (this.state.filterOpen === "time") {
1364
1266
  return /*#__PURE__*/jsx(Components$7.Popup, {
1365
1267
  title: "Select Time",
1366
1268
  maxWidth: 600,
@@ -1368,13 +1270,13 @@ class JobList extends Component {
1368
1270
  hasPadding: true,
1369
1271
  onClose: this.closeFilter,
1370
1272
  buttons: [{
1371
- type: 'primaryAction',
1273
+ type: "primaryAction",
1372
1274
  onClick: this.saveTimeFilter,
1373
- text: 'Select',
1275
+ text: "Select",
1374
1276
  isActive: this.isValidTimeFilter()
1375
1277
  }],
1376
1278
  children: /*#__PURE__*/jsx("div", {
1377
- style: {
1279
+ iconStyle: {
1378
1280
  minHeight: 150
1379
1281
  },
1380
1282
  children: /*#__PURE__*/jsx(Components$7.AnalyticsFilter, {
@@ -1385,19 +1287,19 @@ class JobList extends Component {
1385
1287
  })
1386
1288
  });
1387
1289
  }
1388
- if (this.state.filterOpen === 'user') {
1290
+ if (this.state.filterOpen === "user") {
1389
1291
  var userContent = null;
1390
1292
  if (this.state.selectedAssignee) {
1391
1293
  userContent = /*#__PURE__*/jsx("div", {
1392
1294
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1393
1295
  user: this.state.selectedAssignee,
1394
- rightContent: /*#__PURE__*/jsx(Components$7.SVGIcon, {
1296
+ rightContent: /*#__PURE__*/jsx(Icon, {
1395
1297
  className: "removeIcon",
1396
- icon: "close",
1298
+ icon: "xmark",
1397
1299
  onClick: () => {
1398
1300
  this.onSelectAssignee();
1399
1301
  },
1400
- colour: Colours$3.COLOUR_DUSK
1302
+ colour: Colours$4.COLOUR_DUSK
1401
1303
  })
1402
1304
  }, this.state.selectedAssignee.id)
1403
1305
  });
@@ -1432,27 +1334,27 @@ class JobList extends Component {
1432
1334
  hasPadding: true,
1433
1335
  onClose: this.closeFilter,
1434
1336
  buttons: [{
1435
- type: 'primaryAction',
1337
+ type: "primaryAction",
1436
1338
  onClick: this.saveUserFilter,
1437
- text: 'Select',
1339
+ text: "Select",
1438
1340
  isActive: true
1439
1341
  }],
1440
1342
  children: userContent
1441
1343
  });
1442
1344
  }
1443
- if (this.state.filterOpen === 'requester') {
1345
+ if (this.state.filterOpen === "requester") {
1444
1346
  var _userContent = null;
1445
1347
  if (this.state.selectedRequester) {
1446
1348
  _userContent = /*#__PURE__*/jsx("div", {
1447
1349
  children: /*#__PURE__*/jsx(Components$7.UserListing, {
1448
1350
  user: this.state.selectedRequester,
1449
- rightContent: /*#__PURE__*/jsx(Components$7.SVGIcon, {
1351
+ rightContent: /*#__PURE__*/jsx(Icon, {
1450
1352
  className: "removeIcon",
1451
- icon: "close",
1353
+ icon: "xmark",
1452
1354
  onClick: () => {
1453
1355
  this.onSelectRequester();
1454
1356
  },
1455
- colour: Colours$3.COLOUR_DUSK
1357
+ colour: Colours$4.COLOUR_DUSK
1456
1358
  })
1457
1359
  }, this.state.selectedRequester.id)
1458
1360
  });
@@ -1487,9 +1389,9 @@ class JobList extends Component {
1487
1389
  hasPadding: true,
1488
1390
  onClose: this.closeFilter,
1489
1391
  buttons: [{
1490
- type: 'primaryAction',
1392
+ type: "primaryAction",
1491
1393
  onClick: this.saveRequesterFilter,
1492
- text: 'Select',
1394
+ text: "Select",
1493
1395
  isActive: true
1494
1396
  }],
1495
1397
  children: _userContent
@@ -1522,7 +1424,7 @@ class JobList extends Component {
1522
1424
  }), /*#__PURE__*/jsx("td", {
1523
1425
  children: ev.type
1524
1426
  }), /*#__PURE__*/jsx("td", {
1525
- children: moment.utc(ev.createdTime).local().format('D MMM YY')
1427
+ children: moment.utc(ev.createdTime).local().format("D MMM YY")
1526
1428
  }), /*#__PURE__*/jsx("td", {
1527
1429
  children: ev.room
1528
1430
  }), /*#__PURE__*/jsx("td", {
@@ -1533,34 +1435,34 @@ class JobList extends Component {
1533
1435
  profilePic: ev.userProfilePic
1534
1436
  },
1535
1437
  textClass: "fontSize-13"
1536
- }) : 'Unknown'
1438
+ }) : "Unknown"
1537
1439
  }), /*#__PURE__*/jsx("td", {
1538
1440
  children: ev.Assignee ? /*#__PURE__*/jsx(Components$7.UserListing, {
1539
1441
  user: ev.Assignee,
1540
1442
  textClass: "fontSize-13"
1541
- }) : 'Unassigned'
1443
+ }) : "Unassigned"
1542
1444
  }), /*#__PURE__*/jsx("td", {
1543
1445
  children: /*#__PURE__*/jsx("div", {
1544
1446
  style: {
1545
- textAlign: 'center',
1447
+ textAlign: "center",
1546
1448
  borderRadius: 4,
1547
1449
  width: 100,
1548
1450
  paddingTop: 2,
1549
1451
  paddingBottom: 2,
1550
- color: '#fff',
1452
+ color: "#fff",
1551
1453
  backgroundColor: status ? status.color : undefined
1552
1454
  },
1553
- children: status ? status.text : ''
1455
+ children: status ? status.text : ""
1554
1456
  })
1555
1457
  }), /*#__PURE__*/jsx("td", {
1556
1458
  children: /*#__PURE__*/jsx("div", {
1557
1459
  style: {
1558
- textAlign: 'center',
1460
+ textAlign: "center",
1559
1461
  borderRadius: 4,
1560
1462
  width: 100,
1561
1463
  paddingTop: 2,
1562
1464
  paddingBottom: 2,
1563
- color: '#fff',
1465
+ color: "#fff",
1564
1466
  backgroundColor: priority.color
1565
1467
  },
1566
1468
  children: priority.name
@@ -1568,30 +1470,30 @@ class JobList extends Component {
1568
1470
  }), /*#__PURE__*/jsx("td", {
1569
1471
  className: "table-options",
1570
1472
  children: /*#__PURE__*/jsxs("div", {
1571
- style: {
1572
- display: 'flex',
1573
- alignItems: 'center'
1473
+ iconStyle: {
1474
+ display: "flex",
1475
+ alignItems: "center"
1574
1476
  },
1575
1477
  children: [/*#__PURE__*/jsx(Link, {
1576
1478
  to: "".concat(values.routeRequestDetails, "/").concat(ev.id),
1577
- children: /*#__PURE__*/jsx(FontAwesome, {
1479
+ children: /*#__PURE__*/jsx(Icon, {
1578
1480
  style: {
1579
1481
  fontSize: 20,
1580
1482
  padding: 5,
1581
- cursor: 'pointer'
1483
+ cursor: "pointer"
1582
1484
  },
1583
- name: "pencil"
1485
+ icon: "pencil"
1584
1486
  })
1585
1487
  }), Session$7.validateAccess(this.props.auth.site, values.permissionMaintenanceTracking, this.props.auth) && /*#__PURE__*/jsx("a", {
1586
1488
  onClick: () => this.onRemoveRequest(ev),
1587
- children: /*#__PURE__*/jsx(FontAwesome, {
1489
+ children: /*#__PURE__*/jsx(Icon, {
1588
1490
  style: {
1589
1491
  fontSize: 20,
1590
1492
  padding: 5,
1591
1493
  marginLeft: 8,
1592
- cursor: 'pointer'
1494
+ cursor: "pointer"
1593
1495
  },
1594
- name: "minus-circle"
1496
+ icon: "circle-minus"
1595
1497
  })
1596
1498
  })]
1597
1499
  })
@@ -1605,26 +1507,26 @@ class JobList extends Component {
1605
1507
  sortDesc
1606
1508
  } = this.state;
1607
1509
  if (col !== sortColumn) return null;
1608
- return /*#__PURE__*/jsx(FontAwesome, {
1510
+ return /*#__PURE__*/jsx(Icon, {
1609
1511
  style: {
1610
1512
  marginLeft: 5
1611
1513
  },
1612
- name: sortDesc ? 'chevron-up' : 'chevron-down'
1514
+ icon: sortDesc ? "fa-".concat("chevron-up") : "fa-".concat("chevron-down")
1613
1515
  });
1614
1516
  }
1615
1517
  sortIsActive(col) {
1616
- if (col !== this.state.sortColumn) return '';
1617
- return ' table--columnActive';
1518
+ if (col !== this.state.sortColumn) return "";
1519
+ return " table--columnActive";
1618
1520
  }
1619
1521
  renderEmpty() {
1620
1522
  var title = this.props.strings["".concat(values.featureKey, "_textTitleRequests")] || values.textTitleRequests;
1621
1523
  return /*#__PURE__*/jsxs("div", {
1622
1524
  style: {
1623
- display: 'flex',
1624
- flexDirection: 'column',
1525
+ display: "flex",
1526
+ flexDirection: "column",
1625
1527
  flex: 1,
1626
- justifyContent: 'center',
1627
- alignItems: 'center',
1528
+ justifyContent: "center",
1529
+ alignItems: "center",
1628
1530
  marginTop: 32
1629
1531
  },
1630
1532
  children: [/*#__PURE__*/jsx("div", {
@@ -1633,7 +1535,7 @@ class JobList extends Component {
1633
1535
  className: "marginTop-32",
1634
1536
  style: {
1635
1537
  maxWidth: 500,
1636
- textAlign: 'center'
1538
+ textAlign: "center"
1637
1539
  },
1638
1540
  children: /*#__PURE__*/jsxs("span", {
1639
1541
  className: "fontRegular fontSize-13",
@@ -1646,149 +1548,112 @@ class JobList extends Component {
1646
1548
  className: "marginTop-8 fontRegular fontSize-13",
1647
1549
  style: {
1648
1550
  maxWidth: 500,
1649
- textAlign: 'center'
1551
+ textAlign: "center"
1650
1552
  },
1651
1553
  children: values.textEmptyExample
1652
1554
  })]
1653
1555
  });
1654
1556
  }
1655
1557
  renderContent() {
1656
- if (this.state.loading) {
1657
- return /*#__PURE__*/jsx("div", {
1658
- style: {
1659
- display: 'flex',
1660
- justifyContent: 'center',
1661
- padding: 40
1662
- },
1663
- children: /*#__PURE__*/jsx(FontAwesome, {
1664
- style: {
1665
- fontSize: 32,
1666
- color: '#ccc'
1667
- },
1668
- name: "spinner fa-pulse fa-fw"
1669
- })
1670
- });
1671
- }
1672
1558
  if (_.isEmpty(this.props.source)) return this.renderEmpty();
1673
- return /*#__PURE__*/jsxs("div", {
1674
- children: [/*#__PURE__*/jsxs(Table, {
1675
- className: "plussTable",
1676
- striped: true,
1677
- bordered: true,
1678
- condensed: true,
1679
- hover: true,
1680
- style: {
1681
- minWidth: '100%'
1682
- },
1683
- children: [/*#__PURE__*/jsx("thead", {
1684
- children: /*#__PURE__*/jsxs("tr", {
1685
- children: [/*#__PURE__*/jsxs("th", {
1686
- className: "".concat(this.sortIsActive('jobId')),
1687
- style: {
1688
- cursor: 'pointer',
1689
- width: 70
1690
- },
1691
- onClick: () => {
1692
- this.sortByCol('jobId');
1693
- },
1694
- children: [values.textEntityName, " No.", this.renderSort('jobId')]
1695
- }), /*#__PURE__*/jsxs("th", {
1696
- className: "".concat(this.sortIsActive('title')),
1697
- style: {
1698
- cursor: 'pointer'
1699
- },
1700
- onClick: () => {
1701
- this.sortByCol('title');
1702
- },
1703
- children: ["Title", this.renderSort('title')]
1704
- }), /*#__PURE__*/jsxs("th", {
1705
- className: "".concat(this.sortIsActive('type')),
1706
- style: {
1707
- cursor: 'pointer',
1708
- width: 100
1709
- },
1710
- onClick: () => {
1711
- this.sortByCol('type');
1712
- },
1713
- children: [values.textJobType, this.renderSort('type')]
1714
- }), /*#__PURE__*/jsxs("th", {
1715
- className: "".concat(this.sortIsActive('createdUnix')),
1716
- style: {
1717
- cursor: 'pointer',
1718
- width: 80
1719
- },
1720
- onClick: () => {
1721
- this.sortByCol('createdUnix');
1722
- },
1723
- children: ["Date", this.renderSort('createdUnix')]
1724
- }), /*#__PURE__*/jsxs("th", {
1725
- className: "".concat(this.sortIsActive('room')),
1726
- style: {
1727
- cursor: 'pointer',
1728
- width: 100
1729
- },
1730
- onClick: () => {
1731
- this.sortByCol('room');
1732
- },
1733
- children: ["Address", this.renderSort('room')]
1734
- }), /*#__PURE__*/jsxs("th", {
1735
- className: "".concat(this.sortIsActive('userName')),
1736
- style: {
1737
- cursor: 'pointer',
1738
- width: 150
1739
- },
1740
- onClick: () => {
1741
- this.sortByCol('userName');
1742
- },
1743
- children: ["Submitted By", this.renderSort('userName')]
1744
- }), /*#__PURE__*/jsxs("th", {
1745
- className: "".concat(this.sortIsActive('assigned')),
1746
- style: {
1747
- cursor: 'pointer',
1748
- width: 150
1749
- },
1750
- onClick: () => {
1751
- this.sortByCol('assigned');
1752
- },
1753
- children: ["Assigned To", this.renderSort('assigned')]
1754
- }), /*#__PURE__*/jsx("th", {
1755
- style: {
1756
- width: 120
1757
- },
1758
- children: "Status"
1759
- }), /*#__PURE__*/jsx("th", {
1760
- style: {
1761
- width: 120
1762
- },
1763
- children: "Priority"
1764
- }), /*#__PURE__*/jsx("th", {
1765
- style: {
1766
- width: 50
1767
- }
1768
- })]
1769
- })
1770
- }), /*#__PURE__*/jsx("tbody", {
1771
- children: this.renderRequests()
1772
- })]
1773
- }), this.state.hasMore && /*#__PURE__*/jsx("div", {
1774
- style: {
1775
- display: 'flex',
1776
- justifyContent: 'center',
1777
- padding: '16px 0'
1778
- },
1779
- children: this.state.loadingMore ? /*#__PURE__*/jsx(FontAwesome, {
1780
- style: {
1781
- fontSize: 24,
1782
- color: '#ccc'
1783
- },
1784
- name: "spinner fa-pulse fa-fw"
1785
- }) : /*#__PURE__*/jsx(Components$7.Button, {
1786
- inline: true,
1787
- buttonType: "tertiary",
1788
- onClick: this.loadMore,
1789
- isActive: true,
1790
- children: "Load More"
1559
+ return /*#__PURE__*/jsxs(Table, {
1560
+ className: "plussTable",
1561
+ striped: true,
1562
+ bordered: true,
1563
+ condensed: true,
1564
+ hover: true,
1565
+ style: {
1566
+ minWidth: "100%"
1567
+ },
1568
+ children: [/*#__PURE__*/jsx("thead", {
1569
+ children: /*#__PURE__*/jsxs("tr", {
1570
+ children: [/*#__PURE__*/jsxs("th", {
1571
+ className: "".concat(this.sortIsActive("jobId")),
1572
+ style: {
1573
+ cursor: "pointer",
1574
+ width: 70
1575
+ },
1576
+ onClick: () => {
1577
+ this.sortByCol("jobId");
1578
+ },
1579
+ children: [values.textEntityName, " No.", this.renderSort("jobId")]
1580
+ }), /*#__PURE__*/jsxs("th", {
1581
+ className: "".concat(this.sortIsActive("title")),
1582
+ style: {
1583
+ cursor: "pointer"
1584
+ },
1585
+ onClick: () => {
1586
+ this.sortByCol("title");
1587
+ },
1588
+ children: ["Title", this.renderSort("title")]
1589
+ }), /*#__PURE__*/jsxs("th", {
1590
+ className: "".concat(this.sortIsActive("type")),
1591
+ style: {
1592
+ cursor: "pointer",
1593
+ width: 100
1594
+ },
1595
+ onClick: () => {
1596
+ this.sortByCol("type");
1597
+ },
1598
+ children: [values.textJobType, this.renderSort("type")]
1599
+ }), /*#__PURE__*/jsxs("th", {
1600
+ className: "".concat(this.sortIsActive("createdUnix")),
1601
+ style: {
1602
+ cursor: "pointer",
1603
+ width: 80
1604
+ },
1605
+ onClick: () => {
1606
+ this.sortByCol("createdUnix");
1607
+ },
1608
+ children: ["Date", this.renderSort("createdUnix")]
1609
+ }), /*#__PURE__*/jsxs("th", {
1610
+ className: "".concat(this.sortIsActive("room")),
1611
+ style: {
1612
+ cursor: "pointer",
1613
+ width: 100
1614
+ },
1615
+ onClick: () => {
1616
+ this.sortByCol("room");
1617
+ },
1618
+ children: ["Address", this.renderSort("room")]
1619
+ }), /*#__PURE__*/jsxs("th", {
1620
+ className: "".concat(this.sortIsActive("userName")),
1621
+ style: {
1622
+ cursor: "pointer",
1623
+ width: 150
1624
+ },
1625
+ onClick: () => {
1626
+ this.sortByCol("userName");
1627
+ },
1628
+ children: ["Submitted By", this.renderSort("userName")]
1629
+ }), /*#__PURE__*/jsxs("th", {
1630
+ className: "".concat(this.sortIsActive("assigned")),
1631
+ style: {
1632
+ cursor: "pointer",
1633
+ width: 150
1634
+ },
1635
+ onClick: () => {
1636
+ this.sortByCol("assigned");
1637
+ },
1638
+ children: ["Assigned To", this.renderSort("assigned")]
1639
+ }), /*#__PURE__*/jsx("th", {
1640
+ iconStyle: {
1641
+ width: 120
1642
+ },
1643
+ children: "Status"
1644
+ }), /*#__PURE__*/jsx("th", {
1645
+ iconStyle: {
1646
+ width: 120
1647
+ },
1648
+ children: "Priority"
1649
+ }), /*#__PURE__*/jsx("th", {
1650
+ iconStyle: {
1651
+ width: 50
1652
+ }
1653
+ })]
1791
1654
  })
1655
+ }), /*#__PURE__*/jsx("tbody", {
1656
+ children: this.renderRequests()
1792
1657
  })]
1793
1658
  });
1794
1659
  }
@@ -1796,42 +1661,42 @@ class JobList extends Component {
1796
1661
  var typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1797
1662
  className: "marginRight-10",
1798
1663
  onClick: () => {
1799
- this.openFilter('type');
1664
+ this.openFilter("type");
1800
1665
  },
1801
1666
  text: values.textJobType
1802
1667
  });
1803
1668
  var statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1804
1669
  className: "marginRight-10",
1805
1670
  onClick: () => {
1806
- this.openFilter('status');
1671
+ this.openFilter("status");
1807
1672
  },
1808
1673
  text: "Status"
1809
1674
  });
1810
1675
  var priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1811
1676
  className: "marginRight-10",
1812
1677
  onClick: () => {
1813
- this.openFilter('priority');
1678
+ this.openFilter("priority");
1814
1679
  },
1815
1680
  text: "Priority"
1816
1681
  });
1817
1682
  var timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1818
1683
  className: "marginRight-10",
1819
1684
  onClick: () => {
1820
- this.openFilter('time');
1685
+ this.openFilter("time");
1821
1686
  },
1822
1687
  text: "Time"
1823
1688
  });
1824
1689
  var userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1825
1690
  className: "marginRight-10",
1826
1691
  onClick: () => {
1827
- this.openFilter('user');
1692
+ this.openFilter("user");
1828
1693
  },
1829
1694
  text: "Assigned To"
1830
1695
  });
1831
1696
  var requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1832
1697
  className: "marginRight-10",
1833
1698
  onClick: () => {
1834
- this.openFilter('requester');
1699
+ this.openFilter("requester");
1835
1700
  },
1836
1701
  text: "Submitted By"
1837
1702
  });
@@ -1839,7 +1704,7 @@ class JobList extends Component {
1839
1704
  typeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1840
1705
  className: "marginRight-10",
1841
1706
  onClick: () => {
1842
- this.openFilter('type');
1707
+ this.openFilter("type");
1843
1708
  },
1844
1709
  rightIcon: "close",
1845
1710
  rightClick: e => {
@@ -1853,7 +1718,7 @@ class JobList extends Component {
1853
1718
  priorityFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1854
1719
  className: "marginRight-10",
1855
1720
  onClick: () => {
1856
- this.openFilter('priority');
1721
+ this.openFilter("priority");
1857
1722
  },
1858
1723
  rightIcon: "close",
1859
1724
  rightClick: e => {
@@ -1867,7 +1732,7 @@ class JobList extends Component {
1867
1732
  statusFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1868
1733
  className: "marginRight-10",
1869
1734
  onClick: () => {
1870
- this.openFilter('status');
1735
+ this.openFilter("status");
1871
1736
  },
1872
1737
  rightIcon: "close",
1873
1738
  rightClick: e => {
@@ -1881,7 +1746,7 @@ class JobList extends Component {
1881
1746
  timeFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1882
1747
  className: "marginRight-10",
1883
1748
  onClick: () => {
1884
- this.openFilter('time');
1749
+ this.openFilter("time");
1885
1750
  },
1886
1751
  rightIcon: "close",
1887
1752
  rightClick: e => {
@@ -1895,7 +1760,7 @@ class JobList extends Component {
1895
1760
  userFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1896
1761
  className: "marginRight-10",
1897
1762
  onClick: () => {
1898
- this.openFilter('user');
1763
+ this.openFilter("user");
1899
1764
  },
1900
1765
  rightIcon: "close",
1901
1766
  rightClick: e => {
@@ -1909,7 +1774,7 @@ class JobList extends Component {
1909
1774
  requesterFilter = /*#__PURE__*/jsx(Components$7.Tag, {
1910
1775
  className: "marginRight-10",
1911
1776
  onClick: () => {
1912
- this.openFilter('requester');
1777
+ this.openFilter("requester");
1913
1778
  },
1914
1779
  rightIcon: "close",
1915
1780
  rightClick: e => {
@@ -1932,7 +1797,7 @@ class JobList extends Component {
1932
1797
  }), /*#__PURE__*/jsx(Components$7.Button, {
1933
1798
  inline: true,
1934
1799
  buttonType: "primaryAction",
1935
- leftIcon: "file-code-o",
1800
+ leftIcon: "file-code",
1936
1801
  onClick: this.onOpenExportCsv,
1937
1802
  isActive: !_.isEmpty(this.getSource()),
1938
1803
  children: "Export CSV"
@@ -1967,8 +1832,8 @@ class JobList extends Component {
1967
1832
  }
1968
1833
  render() {
1969
1834
  return /*#__PURE__*/jsxs("div", {
1970
- style: {
1971
- minWidth: '100%'
1835
+ iconStyle: {
1836
+ minWidth: "100%"
1972
1837
  },
1973
1838
  children: [this.renderFilterPopup(), this.renderCSVPopup(), this.renderFilters(), this.renderContent()]
1974
1839
  });
@@ -1987,7 +1852,6 @@ var mapStateToProps$7 = state => {
1987
1852
  };
1988
1853
  var JobList$1 = connect(mapStateToProps$7, {
1989
1854
  jobsLoaded,
1990
- jobsAdded,
1991
1855
  removeJob,
1992
1856
  jobStatusesUpdate
1993
1857
  })(withRouter(JobList));
@@ -2006,7 +1870,7 @@ class JobTypes extends Component {
2006
1870
  var res = yield maintenanceActions.getJobTypes(_this.props.auth.site);
2007
1871
  if (res.data != null) _this.props.jobTypesLoaded(res.data);
2008
1872
  } catch (error) {
2009
- console.error('getJobTypes', error);
1873
+ console.error("getJobTypes", error);
2010
1874
  } finally {
2011
1875
  _this.setState({
2012
1876
  loading: false
@@ -2039,8 +1903,8 @@ class JobTypes extends Component {
2039
1903
  _this.props.jobTypesLoaded(newJobTypes);
2040
1904
  }
2041
1905
  } catch (error) {
2042
- console.error('onRemoveJobType', error);
2043
- alert('Something went wrong with the request. Please try again.');
1906
+ console.error("onRemoveJobType", error);
1907
+ alert("Something went wrong with the request. Please try again.");
2044
1908
  }
2045
1909
  });
2046
1910
  return function (_x) {
@@ -2049,7 +1913,7 @@ class JobTypes extends Component {
2049
1913
  }());
2050
1914
  this.state = {
2051
1915
  jobList: [],
2052
- sortColumn: 'name',
1916
+ sortColumn: "name",
2053
1917
  sortDesc: false,
2054
1918
  loading: true
2055
1919
  };
@@ -2093,31 +1957,31 @@ class JobTypes extends Component {
2093
1957
  }), /*#__PURE__*/jsx("td", {
2094
1958
  className: "table-options",
2095
1959
  children: /*#__PURE__*/jsxs("div", {
2096
- style: {
2097
- display: 'flex',
2098
- alignItems: 'center'
1960
+ iconStyle: {
1961
+ display: "flex",
1962
+ alignItems: "center"
2099
1963
  },
2100
1964
  children: [Session$6.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && /*#__PURE__*/jsx(Link, {
2101
1965
  to: "".concat(values.routeAddRequestType, "/").concat(ev.id),
2102
- children: /*#__PURE__*/jsx(FontAwesome, {
1966
+ children: /*#__PURE__*/jsx(Icon, {
2103
1967
  style: {
2104
1968
  fontSize: 20,
2105
1969
  padding: 5,
2106
1970
  marginLeft: 12,
2107
- cursor: 'pointer'
1971
+ cursor: "pointer"
2108
1972
  },
2109
- name: "pencil"
1973
+ icon: "pencil"
2110
1974
  })
2111
1975
  }), Session$6.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth) && /*#__PURE__*/jsx("a", {
2112
1976
  onClick: () => this.onRemoveJobType(ev),
2113
- children: /*#__PURE__*/jsx(FontAwesome, {
1977
+ children: /*#__PURE__*/jsx(Icon, {
2114
1978
  style: {
2115
1979
  fontSize: 20,
2116
1980
  padding: 5,
2117
1981
  marginLeft: 8,
2118
- cursor: 'pointer'
1982
+ cursor: "pointer"
2119
1983
  },
2120
- name: "minus-circle"
1984
+ icon: "circle-minus"
2121
1985
  })
2122
1986
  })]
2123
1987
  })
@@ -2135,30 +1999,30 @@ class JobTypes extends Component {
2135
1999
  condensed: true,
2136
2000
  hover: true,
2137
2001
  style: {
2138
- minWidth: '100%'
2002
+ minWidth: "100%"
2139
2003
  },
2140
2004
  children: [/*#__PURE__*/jsx("thead", {
2141
2005
  children: /*#__PURE__*/jsxs("tr", {
2142
2006
  children: [/*#__PURE__*/jsxs("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: [values.textSingularName, " type"]
2148
2012
  }), /*#__PURE__*/jsx("th", {
2149
2013
  style: {
2150
- cursor: 'pointer'
2014
+ cursor: "pointer"
2151
2015
  },
2152
- onClick: () => this.sortByCol('name'),
2016
+ onClick: () => this.sortByCol("name"),
2153
2017
  children: "Type Description"
2154
2018
  }), /*#__PURE__*/jsx("th", {
2155
2019
  style: {
2156
- cursor: 'pointer'
2020
+ cursor: "pointer"
2157
2021
  },
2158
- onClick: () => this.sortByCol('email'),
2022
+ onClick: () => this.sortByCol("email"),
2159
2023
  children: "Email"
2160
2024
  }), /*#__PURE__*/jsx("th", {
2161
- style: {
2025
+ iconStyle: {
2162
2026
  width: 70
2163
2027
  }
2164
2028
  })]
@@ -2171,11 +2035,11 @@ class JobTypes extends Component {
2171
2035
  renderEmpty() {
2172
2036
  return /*#__PURE__*/jsxs("div", {
2173
2037
  style: {
2174
- display: 'flex',
2175
- flexDirection: 'column',
2038
+ display: "flex",
2039
+ flexDirection: "column",
2176
2040
  flex: 1,
2177
- justifyContent: 'center',
2178
- alignItems: 'center',
2041
+ justifyContent: "center",
2042
+ alignItems: "center",
2179
2043
  marginTop: 32
2180
2044
  },
2181
2045
  children: [/*#__PURE__*/jsx("div", {
@@ -2184,7 +2048,7 @@ class JobTypes extends Component {
2184
2048
  className: "marginTop-32",
2185
2049
  style: {
2186
2050
  maxWidth: 500,
2187
- textAlign: 'center'
2051
+ textAlign: "center"
2188
2052
  },
2189
2053
  children: /*#__PURE__*/jsx("span", {
2190
2054
  className: "fontRegular fontSize-13",
@@ -2194,7 +2058,7 @@ class JobTypes extends Component {
2194
2058
  className: "marginTop-8 fontRegular fontSize-13",
2195
2059
  style: {
2196
2060
  maxWidth: 500,
2197
- textAlign: 'center'
2061
+ textAlign: "center"
2198
2062
  },
2199
2063
  children: values.textEmptyJobTypesExample
2200
2064
  })]
@@ -2211,27 +2075,29 @@ class JobTypes extends Component {
2211
2075
  } = this.state;
2212
2076
  if (jobList.length === 0 && loading) {
2213
2077
  return /*#__PURE__*/jsx("div", {
2214
- style: {
2215
- minWidth: '100%'
2078
+ iconStyle: {
2079
+ minWidth: "100%"
2216
2080
  },
2217
2081
  children: /*#__PURE__*/jsx("div", {
2218
2082
  className: "padding-60 paddingVertical-40",
2219
2083
  style: {
2220
- textAlign: 'center'
2084
+ textAlign: "center"
2221
2085
  },
2222
- children: /*#__PURE__*/jsx(FontAwesome, {
2223
- style: {
2086
+ children: /*#__PURE__*/jsx(Icon, {
2087
+ iconStyle: {
2224
2088
  fontSize: 30,
2225
2089
  color: FeatureConfig.env.colourBrandingOff
2226
2090
  },
2227
- name: "spinner fa-pulse fa-fw"
2091
+ icon: "spinner",
2092
+ pulse: true,
2093
+ fixedWidth: true
2228
2094
  })
2229
2095
  })
2230
2096
  });
2231
2097
  }
2232
2098
  return /*#__PURE__*/jsxs("div", {
2233
- style: {
2234
- minWidth: '100%'
2099
+ iconStyle: {
2100
+ minWidth: "100%"
2235
2101
  },
2236
2102
  children: [/*#__PURE__*/jsx("div", {
2237
2103
  className: "marginBottom-32",
@@ -2244,8 +2110,8 @@ class JobTypes extends Component {
2244
2110
  }
2245
2111
  render() {
2246
2112
  return /*#__PURE__*/jsxs("div", {
2247
- style: {
2248
- minWidth: '100%'
2113
+ iconStyle: {
2114
+ minWidth: "100%"
2249
2115
  },
2250
2116
  children: [/*#__PURE__*/jsx("div", {
2251
2117
  children: this.renderJobTypes()
@@ -2269,12 +2135,12 @@ var JobTypes$1 = connect(mapStateToProps$6, {
2269
2135
  jobTypesUpdate
2270
2136
  })(withRouter(JobTypes));
2271
2137
 
2272
- 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; }
2273
- 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; }
2138
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2139
+ 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; }
2274
2140
  var {
2275
2141
  Session: Session$5,
2276
2142
  Components: Components$5,
2277
- Colours: Colours$2
2143
+ Colours: Colours$3
2278
2144
  } = PlussCore;
2279
2145
  class Configuration extends Component {
2280
2146
  constructor(props) {
@@ -2330,7 +2196,7 @@ class Configuration extends Component {
2330
2196
  showWarnings: false,
2331
2197
  showStatusPopup: true,
2332
2198
  selectedStatusIndex: -1,
2333
- statusLabel: '',
2199
+ statusLabel: "",
2334
2200
  statusCategory: STATUS_NOT_ACTIONED,
2335
2201
  statusColour: defaultStatus.color
2336
2202
  });
@@ -2369,7 +2235,7 @@ class Configuration extends Component {
2369
2235
  });
2370
2236
  _defineProperty(this, "onHandleChange", event => {
2371
2237
  var stateChange = {};
2372
- stateChange[event.target.getAttribute('id')] = event.target.value;
2238
+ stateChange[event.target.getAttribute("id")] = event.target.value;
2373
2239
  this.setState(stateChange);
2374
2240
  });
2375
2241
  _defineProperty(this, "onToggleDisableSeen", () => {
@@ -2397,7 +2263,7 @@ class Configuration extends Component {
2397
2263
  success: true
2398
2264
  });
2399
2265
  } catch (error) {
2400
- console.log('onSaveConfig - error', error);
2266
+ console.log("onSaveConfig - error", error);
2401
2267
  _this.setState({
2402
2268
  success: false
2403
2269
  });
@@ -2413,9 +2279,9 @@ class Configuration extends Component {
2413
2279
  submitting: false,
2414
2280
  selectedStatusIndex: -1,
2415
2281
  showStatusPopup: false,
2416
- statusLabel: '',
2282
+ statusLabel: "",
2417
2283
  statusCategory: STATUS_NOT_ACTIONED,
2418
- statusColour: '',
2284
+ statusColour: "",
2419
2285
  fetchingStatusTypes: true,
2420
2286
  statusTypes: this.props.statusTypes,
2421
2287
  fetchingHideSeen: true,
@@ -2426,8 +2292,8 @@ class Configuration extends Component {
2426
2292
  Session$5.checkLoggedIn(this);
2427
2293
  }
2428
2294
  componentDidMount() {
2429
- if (!Session$5.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth, true)) {
2430
- this.props.history.push('/mastermenu');
2295
+ if (!Session$5.validateAccess(this.props.auth.site, "featurePicker", this.props.auth, true)) {
2296
+ this.props.history.push("/mastermenu");
2431
2297
  } else {
2432
2298
  this.props.jobStatusesUpdate(this.props.auth.site, statusTypes => this.setState({
2433
2299
  statusTypes,
@@ -2477,7 +2343,7 @@ class Configuration extends Component {
2477
2343
  style: styles$6.statusTypeContainer,
2478
2344
  children: [/*#__PURE__*/jsx("div", {
2479
2345
  className: "statusLabel",
2480
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusTextContainer), {}, {
2346
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusTextContainer), {}, {
2481
2347
  backgroundColor: status.color
2482
2348
  }),
2483
2349
  children: /*#__PURE__*/jsx("span", {
@@ -2490,39 +2356,39 @@ class Configuration extends Component {
2490
2356
  className: "fontMedium fontSize-16 text-dark",
2491
2357
  children: status.category
2492
2358
  })
2493
- }), /*#__PURE__*/jsx(FontAwesome, {
2494
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2495
- visibility: index === 0 ? 'hidden' : 'visible'
2359
+ }), /*#__PURE__*/jsx(Icon, {
2360
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusIcon), {}, {
2361
+ visibility: index === 0 ? "hidden" : "visible"
2496
2362
  }),
2497
- name: 'arrow-up',
2363
+ name: "arrow-up",
2498
2364
  onClick: () => this.onMoveStatus(index, true)
2499
- }), /*#__PURE__*/jsx(FontAwesome, {
2500
- style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2501
- visibility: index === statusTypes.length - 1 ? 'hidden' : 'visible'
2365
+ }), /*#__PURE__*/jsx(Icon, {
2366
+ style: _objectSpread$6(_objectSpread$6({}, styles$6.statusIcon), {}, {
2367
+ visibility: index === statusTypes.length - 1 ? "hidden" : "visible"
2502
2368
  }),
2503
- name: 'arrow-down',
2369
+ name: "arrow-down",
2504
2370
  onClick: () => this.onMoveStatus(index, false)
2505
- }), /*#__PURE__*/jsx(FontAwesome, {
2506
- style: _objectSpread$5({}, styles$6.statusIcon),
2507
- name: "pencil",
2371
+ }), /*#__PURE__*/jsx(Icon, {
2372
+ style: _objectSpread$6({}, styles$6.statusIcon),
2373
+ icon: "pencil",
2508
2374
  onClick: () => this.onEditStatus(index)
2509
- }), /*#__PURE__*/jsx(FontAwesome, {
2510
- style: _objectSpread$5({}, styles$6.statusIcon),
2511
- name: "minus-circle",
2375
+ }), /*#__PURE__*/jsx(Icon, {
2376
+ style: _objectSpread$6({}, styles$6.statusIcon),
2377
+ icon: "circle-minus",
2512
2378
  onClick: () => this.onDeleteStatus(index)
2513
2379
  })]
2514
2380
  }, "".concat(status.text, "_").concat(index));
2515
2381
  }), /*#__PURE__*/jsxs("div", {
2516
2382
  onClick: this.onAddStatus,
2517
2383
  style: {
2518
- display: 'flex',
2519
- flexDirection: 'row',
2520
- alignItems: 'center',
2384
+ display: "flex",
2385
+ flexDirection: "row",
2386
+ alignItems: "center",
2521
2387
  marginTop: 16
2522
2388
  },
2523
- children: [/*#__PURE__*/jsx(Components$5.P60Icon, {
2389
+ children: [/*#__PURE__*/jsx(Icon, {
2524
2390
  className: "addoption_plus",
2525
- icon: "add",
2391
+ icon: "plus",
2526
2392
  style: {
2527
2393
  fontSize: 12
2528
2394
  }
@@ -2564,8 +2430,8 @@ class Configuration extends Component {
2564
2430
  renderSuccess() {
2565
2431
  if (!this.state.success) return null;
2566
2432
  return /*#__PURE__*/jsx("span", {
2567
- style: _objectSpread$5(_objectSpread$5({}, styles$6.savedText), {}, {
2568
- color: Colours$2.COLOUR_GREEN
2433
+ iconStyle: _objectSpread$6(_objectSpread$6({}, styles$6.savedText), {}, {
2434
+ color: Colours$3.COLOUR_GREEN
2569
2435
  }),
2570
2436
  children: "Saved"
2571
2437
  });
@@ -2587,21 +2453,21 @@ class Configuration extends Component {
2587
2453
  minWidth: 450,
2588
2454
  hasPadding: true,
2589
2455
  buttons: [{
2590
- type: 'primaryAction',
2456
+ type: "primaryAction",
2591
2457
  onClick: this.onSaveStatus,
2592
2458
  isActive: canSave,
2593
2459
  isActive: true,
2594
- text: submitting ? 'Saving...' : 'Save',
2595
- className: 'popupButton'
2460
+ text: submitting ? "Saving..." : "Save",
2461
+ className: "popupButton"
2596
2462
  }, {
2597
- type: 'outlinedAction',
2463
+ type: "outlinedAction",
2598
2464
  onClick: this.onHideStatusPopup,
2599
2465
  isActive: !submitting,
2600
- text: 'Cancel',
2601
- className: 'popupButton'
2466
+ text: "Cancel",
2467
+ className: "popupButton"
2602
2468
  }],
2603
2469
  onClose: this.onHideStatusPopup,
2604
- title: selectedStatusIndex < 0 ? 'New Status' : 'Edit Status',
2470
+ title: selectedStatusIndex < 0 ? "New Status" : "Edit Status",
2605
2471
  children: [/*#__PURE__*/jsx(Components$5.GenericInput, {
2606
2472
  id: "statusLabel",
2607
2473
  type: "text",
@@ -2620,15 +2486,15 @@ class Configuration extends Component {
2620
2486
  className: "marginBottom-16",
2621
2487
  children: [/*#__PURE__*/jsx("div", {
2622
2488
  className: "marginBottom-4",
2623
- children: 'This is used to categorise statuses for filtering and analytics purposes'
2489
+ children: "This is used to categorise statuses for filtering and analytics purposes"
2624
2490
  }), /*#__PURE__*/jsx("div", {
2625
2491
  className: "text-bold",
2626
- children: 'This status is considered'
2492
+ children: "This status is considered"
2627
2493
  })]
2628
2494
  }),
2629
2495
  className: "marginBottom-20",
2630
2496
  rowStyle: {
2631
- flexDirection: 'column'
2497
+ flexDirection: "column"
2632
2498
  },
2633
2499
  buttonStyle: {
2634
2500
  marginBottom: 8
@@ -2654,7 +2520,7 @@ class Configuration extends Component {
2654
2520
  })
2655
2521
  }]
2656
2522
  }), /*#__PURE__*/jsx(Components$5.ColourOptions, {
2657
- options: ['vibrant', 'picker'],
2523
+ options: ["vibrant", "picker"],
2658
2524
  defaultTab: "vibrant",
2659
2525
  value: statusColour,
2660
2526
  onColourSelected: statusColour => this.setState({
@@ -2677,11 +2543,11 @@ class Configuration extends Component {
2677
2543
  }
2678
2544
  render() {
2679
2545
  return /*#__PURE__*/jsxs("div", {
2680
- style: {
2681
- minWidth: '100%'
2546
+ iconStyle: {
2547
+ minWidth: "100%"
2682
2548
  },
2683
2549
  children: [this.renderStatuses(), this.renderOtherOptions(), /*#__PURE__*/jsxs("div", {
2684
- style: {
2550
+ iconStyle: {
2685
2551
  paddingTop: 24,
2686
2552
  paddingBottom: 24
2687
2553
  },
@@ -2694,13 +2560,13 @@ var styles$6 = {
2694
2560
  statusCategoryHeading: {
2695
2561
  marginLeft: 130,
2696
2562
  width: 160,
2697
- textAlign: 'center',
2563
+ textAlign: "center",
2698
2564
  marginBottom: 12
2699
2565
  },
2700
2566
  statusTypeContainer: {
2701
- display: 'flex',
2702
- flexDirection: 'row',
2703
- alignItems: 'center',
2567
+ display: "flex",
2568
+ flexDirection: "row",
2569
+ alignItems: "center",
2704
2570
  marginBottom: 20
2705
2571
  },
2706
2572
  statusTextContainer: {
@@ -2708,19 +2574,19 @@ var styles$6 = {
2708
2574
  },
2709
2575
  statusCategoryContainer: {
2710
2576
  width: 160,
2711
- textAlign: 'center'
2577
+ textAlign: "center"
2712
2578
  },
2713
2579
  statusIcon: {
2714
- cursor: 'pointer',
2580
+ cursor: "pointer",
2715
2581
  fontSize: 20,
2716
2582
  padding: 5,
2717
2583
  marginLeft: 10,
2718
- color: Colours$2.COLOUR_BRANDING_ACTION,
2719
- visibility: 'visible'
2584
+ color: Colours$3.COLOUR_BRANDING_ACTION,
2585
+ visibility: "visible"
2720
2586
  },
2721
2587
  savedText: {
2722
2588
  fontSize: 14,
2723
- lineHeight: '33px',
2589
+ lineHeight: "33px",
2724
2590
  marginLeft: 15
2725
2591
  }
2726
2592
  };
@@ -2748,7 +2614,55 @@ var {
2748
2614
  } = PlussCore;
2749
2615
  class RequestsHub extends Component {
2750
2616
  constructor(props) {
2617
+ var _this;
2751
2618
  super(props);
2619
+ _this = this;
2620
+ _defineProperty(this, "setData", () => {
2621
+ var allList = [];
2622
+ this.state.allList.forEach(ev => {
2623
+ if (ev != null && !ev.Deleted) allList.push(ev);
2624
+ });
2625
+ var upcoming = _.filter(allList, ev => {
2626
+ if (!ev) return false;
2627
+ if (ev.status && ev.status === "Completed") return false;
2628
+ return true;
2629
+ });
2630
+ var completed = _.filter(allList, ev => {
2631
+ if (!ev) return false;
2632
+ if (ev.status && ev.status === "Completed") return true;
2633
+ return false;
2634
+ });
2635
+
2636
+ // console.log('setData', upcoming, completed);
2637
+ this.setState({
2638
+ allList,
2639
+ upcoming,
2640
+ completed
2641
+ });
2642
+ });
2643
+ _defineProperty(this, "getData", () => {
2644
+ var {
2645
+ auth
2646
+ } = this.props;
2647
+ this.setState({
2648
+ loadingAll: true
2649
+ }, /*#__PURE__*/_asyncToGenerator(function* () {
2650
+ try {
2651
+ var res = yield maintenanceActions.getJobsRecursive(auth.site);
2652
+ _this.setState({
2653
+ loadingAll: false
2654
+ });
2655
+ if (!_.isEmpty(res) && res[0].site === auth.site) {
2656
+ _this.props.jobsLoaded(res);
2657
+ }
2658
+ } catch (error) {
2659
+ console.error("getData", error);
2660
+ _this.setState({
2661
+ loadingAll: false
2662
+ });
2663
+ }
2664
+ }));
2665
+ });
2752
2666
  _defineProperty(this, "onAddNew", () => {
2753
2667
  var {
2754
2668
  auth
@@ -2769,74 +2683,91 @@ class RequestsHub extends Component {
2769
2683
  var {
2770
2684
  auth
2771
2685
  } = this.props;
2772
- if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? '' : true;
2773
- return isClass ? ' hub-sideContent-topButton--hide' : false;
2686
+ if (Session$4.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return isClass ? "" : true;
2687
+ return isClass ? " hub-sideContent-topButton--hide" : false;
2774
2688
  });
2775
2689
  _defineProperty(this, "getSideBarSectionColour", id => this.state.selectedSection === id ? {
2776
- backgroundColor: '#fff'
2690
+ backgroundColor: "#fff"
2777
2691
  } : {});
2778
- _defineProperty(this, "renderStats", (stat, loading) => loading ? /*#__PURE__*/jsx(FontAwesome, {
2692
+ _defineProperty(this, "renderStats", (stat, loading) => loading ? /*#__PURE__*/jsx(Icon, {
2779
2693
  style: styles$5.spinner,
2780
- name: "spinner fa-pulse fa-fw"
2694
+ icon: "spinner",
2695
+ pulse: true,
2696
+ fixedWidth: true
2781
2697
  }) : stat);
2782
2698
  this.state = {
2783
- selectedSection: 'all',
2784
- location: '',
2699
+ selectedSection: "all",
2700
+ location: "",
2701
+ loadingAll: false,
2785
2702
  loadingSubmissions: false,
2786
2703
  submissionEntries: [],
2704
+ allList: [],
2705
+ completed: [],
2706
+ upcoming: [],
2787
2707
  now: moment.utc(),
2788
2708
  onlyFuture: true,
2789
- search: ''
2709
+ search: ""
2790
2710
  };
2791
2711
  }
2712
+ UNSAFE_componentWillMount() {
2713
+ this.updateProps(this.props);
2714
+ }
2792
2715
  componentDidMount() {
2793
- // Data fetching is now handled by JobList component with pagination
2716
+ this.getData();
2717
+ }
2718
+ UNSAFE_componentWillReceiveProps(nextProps) {
2719
+ if (!_.isEqual(this.props.jobs, nextProps.jobs)) this.updateProps(nextProps);
2720
+ }
2721
+ updateProps(props) {
2722
+ this.setState({
2723
+ allList: props.jobs
2724
+ }, this.setData);
2794
2725
  }
2795
2726
  renderLeftBar() {
2796
2727
  var sectionItems = [];
2797
2728
  if (this.canAddNew()) {
2798
2729
  sectionItems.push({
2799
- type: 'newButton',
2730
+ type: "newButton",
2800
2731
  text: "New ".concat(values.textSingularName),
2801
2732
  onClick: this.onAddNew
2802
2733
  });
2803
2734
  }
2804
2735
  sectionItems.push({
2805
- type: 'navItem',
2736
+ type: "navItem",
2806
2737
  text: "View ".concat(values.textSingularName, "s"),
2807
- icon: 'eye',
2738
+ icon: "eye",
2808
2739
  isFontAwesome: true,
2809
- selected: this.state.selectedSection === 'all',
2740
+ selected: this.state.selectedSection === "all",
2810
2741
  onClick: () => {
2811
2742
  this.setState({
2812
- selectedSection: 'all'
2743
+ selectedSection: "all"
2813
2744
  });
2814
2745
  }
2815
2746
  });
2816
2747
  if (Session$4.validateAccess(this.props.auth.site, values.permissionMaintenanceTypes, this.props.auth)) {
2817
2748
  sectionItems.push({
2818
- type: 'navItem',
2749
+ type: "navItem",
2819
2750
  text: values.textTitleJobTypes,
2820
2751
  // icon: 'maintenance2',
2821
2752
  // isSVG: true,
2822
- selected: this.state.selectedSection === 'requestTypes',
2753
+ selected: this.state.selectedSection === "requestTypes",
2823
2754
  onClick: () => {
2824
2755
  this.setState({
2825
- selectedSection: 'requestTypes'
2756
+ selectedSection: "requestTypes"
2826
2757
  });
2827
2758
  }
2828
2759
  });
2829
2760
  }
2830
- if (Session$4.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth)) {
2761
+ if (Session$4.validateAccess(this.props.auth.site, "featurePicker", this.props.auth)) {
2831
2762
  sectionItems.push({
2832
- type: 'navItem',
2833
- text: 'Feature Configuration',
2834
- icon: 'settings',
2763
+ type: "navItem",
2764
+ text: "Feature Configuration",
2765
+ icon: "settings",
2835
2766
  isFontAwesome: false,
2836
- selected: this.state.selectedSection === 'config',
2767
+ selected: this.state.selectedSection === "config",
2837
2768
  onClick: () => {
2838
2769
  this.setState({
2839
- selectedSection: 'config'
2770
+ selectedSection: "config"
2840
2771
  });
2841
2772
  }
2842
2773
  });
@@ -2854,14 +2785,16 @@ class RequestsHub extends Component {
2854
2785
  });
2855
2786
  }
2856
2787
  renderRight() {
2857
- if (this.state.selectedSection === 'requestTypes') {
2788
+ if (this.state.selectedSection === "requestTypes") {
2858
2789
  return /*#__PURE__*/jsx(JobTypes$1, {
2859
2790
  onNew: this.onAddRequestType
2860
2791
  });
2861
- } else if (this.state.selectedSection === 'config') {
2792
+ } else if (this.state.selectedSection === "config") {
2862
2793
  return /*#__PURE__*/jsx(Configuration$1, {});
2863
2794
  }
2864
- return /*#__PURE__*/jsx(JobList$1, {});
2795
+ return /*#__PURE__*/jsx(JobList$1, {
2796
+ source: this.state.allList
2797
+ });
2865
2798
  }
2866
2799
  render() {
2867
2800
  return /*#__PURE__*/jsxs("div", {
@@ -2878,21 +2811,21 @@ class RequestsHub extends Component {
2878
2811
  }
2879
2812
  var styles$5 = {
2880
2813
  sideBarTitleSection: {
2881
- lineHeight: '40px',
2814
+ lineHeight: "40px",
2882
2815
  marginTop: 30,
2883
2816
  marginBottom: 30,
2884
2817
  paddingLeft: 24,
2885
2818
  paddingRight: 24
2886
2819
  },
2887
2820
  sideBarSection: {
2888
- weight: '100%',
2821
+ weight: "100%",
2889
2822
  minWidth: 200,
2890
2823
  padding: 32,
2891
2824
  paddingLeft: 24,
2892
- cursor: 'pointer',
2893
- display: 'flex',
2894
- flexDirection: 'column',
2895
- justifyContent: 'center'
2825
+ cursor: "pointer",
2826
+ display: "flex",
2827
+ flexDirection: "column",
2828
+ justifyContent: "center"
2896
2829
  },
2897
2830
  spinner: {
2898
2831
  fontSize: 32,
@@ -2904,19 +2837,22 @@ var mapStateToProps$4 = state => {
2904
2837
  auth
2905
2838
  } = state;
2906
2839
  return {
2840
+ jobs: state[values.reducerKey].jobs,
2907
2841
  auth,
2908
2842
  strings: state.strings && state.strings.config || {}
2909
2843
  };
2910
2844
  };
2911
- var RequestsHub$1 = connect(mapStateToProps$4, {})(withRouter(RequestsHub));
2845
+ var RequestsHub$1 = connect(mapStateToProps$4, {
2846
+ jobsLoaded
2847
+ })(withRouter(RequestsHub));
2912
2848
 
2913
- 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; }
2914
- 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; }
2849
+ function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2850
+ 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; }
2915
2851
  var {
2916
2852
  Apis: Apis$1,
2917
- Helper: Helper$2,
2853
+ Helper: Helper$3,
2918
2854
  Session: Session$3,
2919
- Colours: Colours$1,
2855
+ Colours: Colours$2,
2920
2856
  Components: Components$3
2921
2857
  } = PlussCore;
2922
2858
  var IMAGE_SIZE_NOTE = 72;
@@ -3000,7 +2936,7 @@ class Job extends Component {
3000
2936
  var statusType = statusTypes.find(s => s.text === status);
3001
2937
  if (!statusType) {
3002
2938
  var defaultStatus = statusTypes.find(s => s.category === STATUS_NOT_ACTIONED);
3003
- statusType = _objectSpread$4(_objectSpread$4({}, defaultStatus), {}, {
2939
+ statusType = _objectSpread$5(_objectSpread$5({}, defaultStatus), {}, {
3004
2940
  text: status
3005
2941
  });
3006
2942
  }
@@ -3195,7 +3131,7 @@ class Job extends Component {
3195
3131
  }
3196
3132
  maintenanceActions.deleteNote(this.state.jobId, n.Id);
3197
3133
  var newNotes = _.filter(this.state.job.Notes, note => note.Id !== n.Id);
3198
- var newJob = _objectSpread$4({}, this.state.job);
3134
+ var newJob = _objectSpread$5({}, this.state.job);
3199
3135
  newJob.Notes = newNotes;
3200
3136
  this.setState({
3201
3137
  job: newJob,
@@ -3280,7 +3216,7 @@ class Job extends Component {
3280
3216
  _defineProperty(this, "onSelectPriority", /*#__PURE__*/function () {
3281
3217
  var _ref0 = _asyncToGenerator(function* (priority) {
3282
3218
  _this.setState({
3283
- job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
3219
+ job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3284
3220
  priority
3285
3221
  }),
3286
3222
  priorityChangerOpen: false
@@ -3310,7 +3246,7 @@ class Job extends Component {
3310
3246
  _defineProperty(this, "onSelectStatus", /*#__PURE__*/function () {
3311
3247
  var _ref1 = _asyncToGenerator(function* (status) {
3312
3248
  _this.setState({
3313
- job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
3249
+ job: _objectSpread$5(_objectSpread$5({}, _this.state.job), {}, {
3314
3250
  status: status
3315
3251
  }),
3316
3252
  statusChangerOpen: false
@@ -3333,7 +3269,7 @@ class Job extends Component {
3333
3269
  };
3334
3270
  }());
3335
3271
  this.state = {
3336
- jobId: Helper$2.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3272
+ jobId: Helper$3.safeReadParams(props, "jobId") ? props.match.params.jobId : null,
3337
3273
  job: null,
3338
3274
  showingSelector: false,
3339
3275
  updating: false,
@@ -3525,9 +3461,9 @@ class Job extends Component {
3525
3461
  children: [/*#__PURE__*/jsx("div", {
3526
3462
  className: "commentReply_button".concat(!_.isEmpty(this.state.commentInput) ? " commentReply_button-active" : ""),
3527
3463
  onClick: this.onAddComment,
3528
- children: /*#__PURE__*/jsx(FontAwesome, {
3464
+ children: /*#__PURE__*/jsx(Icon, {
3529
3465
  className: "commentReply_icon",
3530
- name: "paper-plane-o"
3466
+ icon: "paper-plane"
3531
3467
  })
3532
3468
  }), /*#__PURE__*/jsx(Textarea, {
3533
3469
  id: "commentInput",
@@ -3554,7 +3490,7 @@ class Job extends Component {
3554
3490
  children: /*#__PURE__*/jsx("div", {
3555
3491
  className: "imageGrid_image",
3556
3492
  style: {
3557
- backgroundImage: "url('".concat(Helper$2.get1400(image), "')"),
3493
+ backgroundImage: "url('".concat(Helper$3.get1400(image), "')"),
3558
3494
  width: size,
3559
3495
  height: size
3560
3496
  }
@@ -3650,7 +3586,7 @@ class Job extends Component {
3650
3586
  } = this.state.job;
3651
3587
  var hasCustomFields = customFields && customFields.length > 0;
3652
3588
  return /*#__PURE__*/jsxs("div", {
3653
- style: {
3589
+ iconStyle: {
3654
3590
  paddingBottom: 40
3655
3591
  },
3656
3592
  children: [/*#__PURE__*/jsxs("div", {
@@ -3798,9 +3734,9 @@ class Job extends Component {
3798
3734
  className: "maintenanceNote",
3799
3735
  children: [/*#__PURE__*/jsxs("div", {
3800
3736
  className: "maintenanceNote_top",
3801
- children: [this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/jsx(Components$3.SVGIcon, {
3802
- colour: Colours$1.COLOUR_DUSK_LIGHT,
3803
- icon: "more15",
3737
+ children: [this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/jsx(Icon, {
3738
+ colour: Colours$2.COLOUR_DUSK_LIGHT,
3739
+ icon: "ellipsis-vertical",
3804
3740
  className: "maintenanceNote_moreIcon",
3805
3741
  onClick: () => this.onOpenNoteMenu(index)
3806
3742
  }), /*#__PURE__*/jsx("p", {
@@ -3819,7 +3755,7 @@ class Job extends Component {
3819
3755
  })]
3820
3756
  }), /*#__PURE__*/jsx("p", {
3821
3757
  className: "maintenanceNote_text",
3822
- children: Helper$2.toParagraphed(note.Note)
3758
+ children: Helper$3.toParagraphed(note.Note)
3823
3759
  }), note.Attachments.map((a, i) => this.renderAttachment(a, i)), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null]
3824
3760
  })]
3825
3761
  }, index);
@@ -3863,7 +3799,7 @@ class Job extends Component {
3863
3799
  }), /*#__PURE__*/jsx("div", {
3864
3800
  className: "statusLabel statusLabel-large statusLabel-full",
3865
3801
  style: {
3866
- backgroundColor: Colours$1.COLOUR_DUSK
3802
+ backgroundColor: Colours$2.COLOUR_DUSK
3867
3803
  },
3868
3804
  children: /*#__PURE__*/jsxs("span", {
3869
3805
  className: "statusLabel_text",
@@ -3874,7 +3810,7 @@ class Job extends Component {
3874
3810
  }
3875
3811
  renderExternalSyncEntry(e, i) {
3876
3812
  var isSuccess = e.EntryType === "ExternalIDSet";
3877
- var backgroundColor = isSuccess ? Colours$1.COLOUR_GREEN : Colours$1.COLOUR_RED; // Green for success, red for failure
3813
+ var backgroundColor = isSuccess ? Colours$2.COLOUR_GREEN : Colours$2.COLOUR_RED; // Green for success, red for failure
3878
3814
 
3879
3815
  return /*#__PURE__*/jsxs("div", {
3880
3816
  className: "ticketHistoryEntry",
@@ -3937,20 +3873,22 @@ class Job extends Component {
3937
3873
 
3938
3874
  // Show spinner while retrying
3939
3875
  if (retryingSync) {
3940
- return /*#__PURE__*/jsx(FontAwesome, {
3876
+ return /*#__PURE__*/jsx(Icon, {
3941
3877
  style: {
3942
3878
  fontSize: 20,
3943
- color: Colours$1.COLOUR_DUSK_LIGHT,
3879
+ color: Colours$2.COLOUR_DUSK_LIGHT,
3944
3880
  marginLeft: 8
3945
3881
  },
3946
- name: "spinner fa-pulse fa-fw"
3882
+ icon: "spinner",
3883
+ pulse: true,
3884
+ fixedWidth: true
3947
3885
  });
3948
3886
  }
3949
3887
  return /*#__PURE__*/jsx("div", {
3950
3888
  className: "statusLabel pointer",
3951
3889
  onClick: this.onRetrySync,
3952
3890
  style: {
3953
- backgroundColor: Colours$1.COLOUR_RED,
3891
+ backgroundColor: Colours$2.COLOUR_RED,
3954
3892
  marginLeft: 8
3955
3893
  },
3956
3894
  children: /*#__PURE__*/jsx("span", {
@@ -3969,11 +3907,11 @@ class Job extends Component {
3969
3907
  if (retrySyncError) {
3970
3908
  return /*#__PURE__*/jsxs(Components$3.Text, {
3971
3909
  type: "body",
3972
- children: [/*#__PURE__*/jsx(FontAwesome, {
3910
+ children: [/*#__PURE__*/jsx(Icon, {
3973
3911
  className: "userStatusIcon",
3974
- name: "times-circle",
3912
+ icon: "circle-xmark",
3975
3913
  style: {
3976
- color: Colours$1.COLOUR_RED
3914
+ color: Colours$2.COLOUR_RED
3977
3915
  }
3978
3916
  }), " ", retrySyncError]
3979
3917
  });
@@ -3983,11 +3921,11 @@ class Job extends Component {
3983
3921
  if (retrySyncInitiated) {
3984
3922
  return /*#__PURE__*/jsxs(Components$3.Text, {
3985
3923
  type: "body",
3986
- children: [/*#__PURE__*/jsx(FontAwesome, {
3924
+ children: [/*#__PURE__*/jsx(Icon, {
3987
3925
  className: "userStatusIcon",
3988
- name: "check-circle",
3926
+ icon: "circle-check",
3989
3927
  style: {
3990
- color: Colours$1.COLOUR_GREEN
3928
+ color: Colours$2.COLOUR_GREEN
3991
3929
  }
3992
3930
  }), " ", "Sync retry initiated. Check back shortly for results."]
3993
3931
  });
@@ -3997,11 +3935,11 @@ class Job extends Component {
3997
3935
  if (this.hasSyncFailureWithoutSuccess()) {
3998
3936
  return /*#__PURE__*/jsxs(Components$3.Text, {
3999
3937
  type: "body",
4000
- children: [/*#__PURE__*/jsx(FontAwesome, {
3938
+ children: [/*#__PURE__*/jsx(Icon, {
4001
3939
  className: "userStatusIcon",
4002
- name: "times-circle",
3940
+ icon: "circle-xmark",
4003
3941
  style: {
4004
- color: Colours$1.COLOUR_RED
3942
+ color: Colours$2.COLOUR_RED
4005
3943
  }
4006
3944
  }), " ", "External sync failed. Use the retry button to attempt again."]
4007
3945
  });
@@ -4061,11 +3999,11 @@ class Job extends Component {
4061
3999
  } = this.state;
4062
4000
  if (!job || !job.history) return null;
4063
4001
  var source = _.sortBy([...job.history.map(e => {
4064
- return _objectSpread$4(_objectSpread$4({}, e), {}, {
4002
+ return _objectSpread$5(_objectSpread$5({}, e), {}, {
4065
4003
  EntryType: e.EntryType || "status"
4066
4004
  });
4067
4005
  }), ...(job.Notes || []).map(e => {
4068
- return _objectSpread$4(_objectSpread$4({}, e), {}, {
4006
+ return _objectSpread$5(_objectSpread$5({}, e), {}, {
4069
4007
  timestamp: e.Timestamp,
4070
4008
  EntryType: "note"
4071
4009
  });
@@ -4140,9 +4078,11 @@ class Job extends Component {
4140
4078
  hasPadding: true,
4141
4079
  children: /*#__PURE__*/jsx("div", {
4142
4080
  className: "flex flex-center-row",
4143
- children: /*#__PURE__*/jsx(FontAwesome, {
4081
+ children: /*#__PURE__*/jsx(Icon, {
4144
4082
  className: "spinner",
4145
- name: "spinner fa-pulse fa-fw"
4083
+ icon: "spinner",
4084
+ pulse: true,
4085
+ fixedWidth: true
4146
4086
  })
4147
4087
  })
4148
4088
  });
@@ -4188,9 +4128,9 @@ class Job extends Component {
4188
4128
  onClick: () => {
4189
4129
  this.attachmentInput.click();
4190
4130
  },
4191
- children: [/*#__PURE__*/jsx(FontAwesome, {
4131
+ children: [/*#__PURE__*/jsx(Icon, {
4192
4132
  className: "iconTextButton_icon",
4193
- name: "paperclip"
4133
+ icon: "paperclip"
4194
4134
  }), /*#__PURE__*/jsx("p", {
4195
4135
  className: "iconTextButton_text",
4196
4136
  children: "Add Attachment"
@@ -4213,22 +4153,24 @@ class Job extends Component {
4213
4153
  if (this.state.confirmingAssignee) {
4214
4154
  content = /*#__PURE__*/jsx("div", {
4215
4155
  className: "flex flex-center-row",
4216
- children: /*#__PURE__*/jsx(FontAwesome, {
4156
+ children: /*#__PURE__*/jsx(Icon, {
4217
4157
  className: "spinner",
4218
- name: "spinner fa-pulse fa-fw"
4158
+ icon: "spinner",
4159
+ pulse: true,
4160
+ fixedWidth: true
4219
4161
  })
4220
4162
  });
4221
4163
  } else if (this.state.selectedAssignee) {
4222
4164
  content = /*#__PURE__*/jsx("div", {
4223
4165
  children: /*#__PURE__*/jsx(Components$3.UserListing, {
4224
4166
  user: this.state.selectedAssignee,
4225
- rightContent: /*#__PURE__*/jsx(Components$3.SVGIcon, {
4167
+ rightContent: /*#__PURE__*/jsx(Icon, {
4226
4168
  className: "removeIcon",
4227
- icon: "close",
4169
+ icon: "xmark",
4228
4170
  onClick: () => {
4229
4171
  this.onSelectAssignee();
4230
4172
  },
4231
- colour: Colours$1.COLOUR_DUSK
4173
+ colour: Colours$2.COLOUR_DUSK
4232
4174
  })
4233
4175
  }, this.state.selectedAssignee.id)
4234
4176
  });
@@ -4315,14 +4257,14 @@ var Job$1 = connect(mapStateToProps$3, {
4315
4257
  jobStatusesUpdate
4316
4258
  })(withRouter(Job));
4317
4259
 
4318
- 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; }
4319
- 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; }
4260
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4261
+ 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; }
4320
4262
  var {
4321
4263
  Actions,
4322
4264
  Components: Components$2,
4323
- Helper: Helper$1,
4265
+ Helper: Helper$2,
4324
4266
  Session: Session$2,
4325
- Colours,
4267
+ Colours: Colours$1,
4326
4268
  Apis
4327
4269
  } = PlussCore;
4328
4270
  class AddJob extends Component {
@@ -4341,7 +4283,7 @@ class AddJob extends Component {
4341
4283
  type,
4342
4284
  customFields
4343
4285
  } = res.data;
4344
- _this.setState(_objectSpread$3(_objectSpread$3({}, res.data), {}, {
4286
+ _this.setState(_objectSpread$4(_objectSpread$4({}, res.data), {}, {
4345
4287
  prevType: type,
4346
4288
  prevCustomFileds: customFields,
4347
4289
  type,
@@ -4589,7 +4531,7 @@ class AddJob extends Component {
4589
4531
  event.target.value = "";
4590
4532
  });
4591
4533
  _defineProperty(this, "onToggleDatePicker", qId => {
4592
- var showDate = _objectSpread$3({}, this.state.showDate);
4534
+ var showDate = _objectSpread$4({}, this.state.showDate);
4593
4535
  showDate[qId] = !showDate[qId];
4594
4536
  this.setState({
4595
4537
  showDate
@@ -4678,7 +4620,7 @@ class AddJob extends Component {
4678
4620
  if (_.isNil(answer) || _.isEmpty(answer)) return true;
4679
4621
  switch (type) {
4680
4622
  case "email":
4681
- return Helper$1.isEmail(answer);
4623
+ return Helper$2.isEmail(answer);
4682
4624
  case "date":
4683
4625
  return moment(answer, "YYYY-MM-DD", true).isValid();
4684
4626
  case "time":
@@ -4699,7 +4641,7 @@ class AddJob extends Component {
4699
4641
  this.customImageInputs = {};
4700
4642
  this.customDocumentInputs = {};
4701
4643
  this.state = {
4702
- jobId: Helper$1.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
4644
+ jobId: Helper$2.safeReadParams(this.props, "jobId") ? this.props.match.params.jobId : null,
4703
4645
  job: null,
4704
4646
  showingSelector: false,
4705
4647
  updating: false,
@@ -4758,9 +4700,9 @@ class AddJob extends Component {
4758
4700
  } = this.state;
4759
4701
  return types.map(ev => {
4760
4702
  if (ev != null) {
4761
- return /*#__PURE__*/jsx(DropdownItem, {
4703
+ return /*#__PURE__*/jsx(MenuItem, {
4762
4704
  eventKey: ev.typeName,
4763
- ive: type === ev.typeName,
4705
+ active: type === ev.typeName,
4764
4706
  children: ev.typeName
4765
4707
  }, ev.typeName);
4766
4708
  }
@@ -5016,7 +4958,7 @@ class AddJob extends Component {
5016
4958
  className: "inputRequired "
5017
4959
  }) : null, /*#__PURE__*/jsxs("div", {
5018
4960
  className: "visitorSignIn_question",
5019
- style: {
4961
+ iconStyle: {
5020
4962
  flex: 1
5021
4963
  },
5022
4964
  children: [/*#__PURE__*/jsx("div", {
@@ -5066,7 +5008,7 @@ class AddJob extends Component {
5066
5008
  case "staticText":
5067
5009
  return /*#__PURE__*/jsx("p", {
5068
5010
  className: "visitorSignIn_text-staticText",
5069
- children: Helper$1.toParagraphed(field.label, {
5011
+ children: Helper$2.toParagraphed(field.label, {
5070
5012
  marginTop: 10
5071
5013
  })
5072
5014
  }, fieldId);
@@ -5084,9 +5026,9 @@ class AddJob extends Component {
5084
5026
  errorMessage: "Not a valid date",
5085
5027
  alwaysShowLabel: true,
5086
5028
  readOnly: true,
5087
- rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Components$2.SVGIcon, {
5088
- colour: Colours.COLOUR_DUSK_LIGHT,
5089
- icon: "close",
5029
+ rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Icon, {
5030
+ colour: Colours$1.COLOUR_DUSK_LIGHT,
5031
+ icon: "xmark",
5090
5032
  className: "timepicker_clear",
5091
5033
  onClick: () => this.onChangeDateAnswer(fieldId, undefined, false)
5092
5034
  })
@@ -5117,9 +5059,9 @@ class AddJob extends Component {
5117
5059
  width: "100%"
5118
5060
  }
5119
5061
  }),
5120
- rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Components$2.SVGIcon, {
5121
- colour: Colours.COLOUR_DUSK_LIGHT,
5122
- icon: "close",
5062
+ rightContent: !_.isEmpty(field.answer) && /*#__PURE__*/jsx(Icon, {
5063
+ colour: Colours$1.COLOUR_DUSK_LIGHT,
5064
+ icon: "xmark",
5123
5065
  className: "timepicker_clear",
5124
5066
  onClick: () => this.onChangeTimeAnswer(fieldId, undefined)
5125
5067
  })
@@ -5133,7 +5075,7 @@ class AddJob extends Component {
5133
5075
  className: "inputRequired "
5134
5076
  }) : null, /*#__PURE__*/jsxs("div", {
5135
5077
  className: "visitorSignIn_question",
5136
- style: {
5078
+ iconStyle: {
5137
5079
  flex: 1
5138
5080
  },
5139
5081
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5156,7 +5098,7 @@ class AddJob extends Component {
5156
5098
  className: "inputRequired "
5157
5099
  }) : null, /*#__PURE__*/jsxs("div", {
5158
5100
  className: "visitorSignIn_question",
5159
- style: {
5101
+ iconStyle: {
5160
5102
  flex: 1
5161
5103
  },
5162
5104
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5178,9 +5120,9 @@ class AddJob extends Component {
5178
5120
  }), /*#__PURE__*/jsxs("div", {
5179
5121
  className: "iconTextButton marginBottom-16",
5180
5122
  onClick: () => this.customDocumentInputs[fieldId].click(),
5181
- children: [/*#__PURE__*/jsx(FontAwesome, {
5123
+ children: [/*#__PURE__*/jsx(Icon, {
5182
5124
  className: "iconTextButton_icon",
5183
- name: "paperclip"
5125
+ icon: "paperclip"
5184
5126
  }), /*#__PURE__*/jsx("p", {
5185
5127
  className: "iconTextButton_text",
5186
5128
  children: "Add Attachment"
@@ -5208,7 +5150,7 @@ class AddJob extends Component {
5208
5150
  customFields
5209
5151
  } = this.state;
5210
5152
  return /*#__PURE__*/jsx("div", {
5211
- style: {
5153
+ iconStyle: {
5212
5154
  marginBottom: 15
5213
5155
  },
5214
5156
  children: /*#__PURE__*/jsxs("div", {
@@ -5243,7 +5185,7 @@ class AddJob extends Component {
5243
5185
  return this.state.showWarnings && _.isEmpty(this.state.room);
5244
5186
  }
5245
5187
  }), /*#__PURE__*/jsxs("div", {
5246
- style: {
5188
+ iconStyle: {
5247
5189
  marginBottom: 15
5248
5190
  },
5249
5191
  children: [/*#__PURE__*/jsx(Components$2.Text, {
@@ -5343,7 +5285,7 @@ var mapStateToProps$2 = state => {
5343
5285
  return {
5344
5286
  auth,
5345
5287
  strings: state.strings && state.strings.config || {},
5346
- optionOnlyForResidents: Helper$1.getSiteSettingFromState(state, values.optionOnlyForResidents)
5288
+ optionOnlyForResidents: Helper$2.getSiteSettingFromState(state, values.optionOnlyForResidents)
5347
5289
  };
5348
5290
  };
5349
5291
  var AddJob$1 = connect(mapStateToProps$2, {
@@ -5355,14 +5297,14 @@ var AddJob$1 = connect(mapStateToProps$2, {
5355
5297
  var {
5356
5298
  Components: Components$1,
5357
5299
  Session: Session$1,
5358
- Helper
5300
+ Helper: Helper$1
5359
5301
  } = PlussCore;
5360
5302
  var DEFAULT_FIELD = {
5361
- type: 'text',
5362
- label: '',
5303
+ type: "text",
5304
+ label: "",
5363
5305
  mandatory: false,
5364
5306
  isTitle: false,
5365
- values: ['']
5307
+ values: [""]
5366
5308
  };
5367
5309
  class AddJobType extends Component {
5368
5310
  constructor(props) {
@@ -5389,18 +5331,18 @@ class AddJobType extends Component {
5389
5331
  customFields: customFields || [_.cloneDeep(DEFAULT_FIELD)]
5390
5332
  });
5391
5333
  } catch (error) {
5392
- console.error('getJobType', error);
5334
+ console.error("getJobType", error);
5393
5335
  }
5394
5336
  }));
5395
5337
  _defineProperty(this, "getFieldTypeTitle", type => {
5396
5338
  var fieldType = this.fieldTypes.find(f => f.Key === type);
5397
- return fieldType ? fieldType.Title : '';
5339
+ return fieldType ? fieldType.Title : "";
5398
5340
  });
5399
5341
  _defineProperty(this, "validateEmail", () => {
5400
5342
  var {
5401
5343
  jobTypeEmail
5402
5344
  } = this.state;
5403
- return !_.isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
5345
+ return !_.isEmpty(jobTypeEmail) && Helper$1.isEmail(jobTypeEmail);
5404
5346
  });
5405
5347
  _defineProperty(this, "isJobTypeValid", () => {
5406
5348
  var {
@@ -5415,7 +5357,7 @@ class AddJobType extends Component {
5415
5357
  });
5416
5358
  _defineProperty(this, "onHandleChange", event => {
5417
5359
  var stateChange = {};
5418
- stateChange[event.target.getAttribute('id')] = event.target.value;
5360
+ stateChange[event.target.getAttribute("id")] = event.target.value;
5419
5361
  this.setState(stateChange);
5420
5362
  });
5421
5363
  _defineProperty(this, "onFieldTypeChanged", (fieldIndex, key) => {
@@ -5477,7 +5419,7 @@ class AddJobType extends Component {
5477
5419
  });
5478
5420
  _defineProperty(this, "onAddNewOption", fieldIndex => {
5479
5421
  var customFields = [...this.state.customFields];
5480
- customFields[fieldIndex].values.push('');
5422
+ customFields[fieldIndex].values.push("");
5481
5423
  this.setState({
5482
5424
  customFields
5483
5425
  });
@@ -5553,59 +5495,59 @@ class AddJobType extends Component {
5553
5495
  success: true
5554
5496
  });
5555
5497
  } catch (error) {
5556
- console.error('onSave', error);
5498
+ console.error("onSave", error);
5557
5499
  _this.setState({
5558
5500
  submitting: false
5559
5501
  });
5560
- alert('Something went wrong with the request. Please try again.');
5502
+ alert("Something went wrong with the request. Please try again.");
5561
5503
  }
5562
5504
  }));
5563
5505
  });
5564
5506
  this.fieldTypes = [{
5565
- Title: 'Text Input',
5566
- Key: 'text'
5507
+ Title: "Text Input",
5508
+ Key: "text"
5567
5509
  }, {
5568
- Title: 'Email Input',
5569
- Key: 'email'
5510
+ Title: "Email Input",
5511
+ Key: "email"
5570
5512
  }, {
5571
- Title: 'Phone Input',
5572
- Key: 'phone'
5513
+ Title: "Phone Input",
5514
+ Key: "phone"
5573
5515
  }, {
5574
- Title: 'Date Input',
5575
- Key: 'date'
5516
+ Title: "Date Input",
5517
+ Key: "date"
5576
5518
  }, {
5577
- Title: 'Time Input',
5578
- Key: 'time'
5519
+ Title: "Time Input",
5520
+ Key: "time"
5579
5521
  }, {
5580
- Title: 'Image Input',
5581
- Key: 'image'
5522
+ Title: "Image Input",
5523
+ Key: "image"
5582
5524
  },
5583
5525
  // {
5584
5526
  // Title: 'Document Input',
5585
5527
  // Key: 'document',
5586
5528
  // },
5587
5529
  {
5588
- Title: 'Yes/No Question',
5589
- Key: 'yn'
5530
+ Title: "Yes/No Question",
5531
+ Key: "yn"
5590
5532
  }, {
5591
- Title: 'Multiple Choice',
5592
- Key: 'multichoice'
5533
+ Title: "Multiple Choice",
5534
+ Key: "multichoice"
5593
5535
  }, {
5594
- Title: 'Checkboxes',
5595
- Key: 'checkbox'
5536
+ Title: "Checkboxes",
5537
+ Key: "checkbox"
5596
5538
  }, {
5597
- Title: 'Title Text',
5598
- Key: 'staticTitle'
5539
+ Title: "Title Text",
5540
+ Key: "staticTitle"
5599
5541
  }, {
5600
- Title: 'Paragraph Text',
5601
- Key: 'staticText'
5542
+ Title: "Paragraph Text",
5543
+ Key: "staticText"
5602
5544
  }];
5603
5545
  this.state = {
5604
5546
  loading: false,
5605
- jobTypeId: Helper.safeReadParams(this.props, 'jobTypeId') ? this.props.match.params.jobTypeId : null,
5606
- jobTypeName: '',
5607
- jobTypeEmail: '',
5608
- jobTypeDescription: '',
5547
+ jobTypeId: Helper$1.safeReadParams(this.props, "jobTypeId") ? this.props.match.params.jobTypeId : null,
5548
+ jobTypeName: "",
5549
+ jobTypeEmail: "",
5550
+ jobTypeDescription: "",
5609
5551
  hasCustomFields: true ,
5610
5552
  customFields: [_.cloneDeep(DEFAULT_FIELD)],
5611
5553
  jobTypeLevel: 1,
@@ -5641,23 +5583,23 @@ class AddJobType extends Component {
5641
5583
  mandatory,
5642
5584
  isTitle
5643
5585
  } = field;
5644
- if (['staticTitle', 'staticText'].includes(type)) return;
5586
+ if (["staticTitle", "staticText"].includes(type)) return;
5645
5587
  if (_.isEmpty(label)) {
5646
5588
  missingLabel = true;
5647
- } else if (_.isEmpty(type) || (type === 'multichoice' || type === 'checkbox') && (!values || values.length < 2 || !values.every(value => !_.isEmpty(value)))) {
5589
+ } else if (_.isEmpty(type) || (type === "multichoice" || type === "checkbox") && (!values || values.length < 2 || !values.every(value => !_.isEmpty(value)))) {
5648
5590
  warnings.push("'".concat(label, "' is incomplete"));
5649
5591
  }
5650
5592
  if (mandatory) hasMandatoryField = true;
5651
5593
  if (isTitle) titleFieldCount += 1;
5652
5594
  });
5653
5595
  if (missingLabel) {
5654
- warnings.push('All inputs must have a label');
5596
+ warnings.push("All inputs must have a label");
5655
5597
  }
5656
5598
  if (!hasMandatoryField) {
5657
- warnings.push('There must be at least one required input');
5599
+ warnings.push("There must be at least one required input");
5658
5600
  }
5659
5601
  if (titleFieldCount > 1) {
5660
- warnings.push('Only one required input can be selected as title for the request');
5602
+ warnings.push("Only one required input can be selected as title for the request");
5661
5603
  }
5662
5604
  }
5663
5605
  this.setState({
@@ -5691,7 +5633,7 @@ class AddJobType extends Component {
5691
5633
  children: [/*#__PURE__*/jsxs(Components$1.Text, {
5692
5634
  type: "formTitleLarge",
5693
5635
  className: "marginBottom-24",
5694
- children: [!jobTypeId ? 'New' : 'Edit', " ", values.textJobType]
5636
+ children: [!jobTypeId ? "New" : "Edit", " ", values.textJobType]
5695
5637
  }), /*#__PURE__*/jsx(Components$1.GenericInput, {
5696
5638
  id: "jobTypeName",
5697
5639
  type: "text",
@@ -5751,14 +5693,14 @@ class AddJobType extends Component {
5751
5693
  className: "fieldInner",
5752
5694
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5753
5695
  id: "fieldLabel".concat(fieldIndex),
5754
- className: 'textInput',
5755
- placeholder: 'Type your label here (required)',
5696
+ className: "textInput",
5697
+ placeholder: "Type your label here (required)",
5756
5698
  value: field.label,
5757
5699
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5758
5700
  }), /*#__PURE__*/jsx(Components$1.GenericInput, {
5759
5701
  id: "fieldPlaceHolder".concat(fieldIndex),
5760
- className: 'placeHolderInput',
5761
- placeholder: 'Insert placeholder (optional)',
5702
+ className: "placeHolderInput",
5703
+ placeholder: "Insert placeholder (optional)",
5762
5704
  value: field.placeHolder,
5763
5705
  onChange: e => this.onFieldPlaceHolderChanged(fieldIndex, e)
5764
5706
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5769,8 +5711,8 @@ class AddJobType extends Component {
5769
5711
  className: "fieldInner",
5770
5712
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5771
5713
  id: "fieldLabel".concat(fieldIndex),
5772
- className: 'textInput',
5773
- placeholder: 'Type your label here (required)',
5714
+ className: "textInput",
5715
+ placeholder: "Type your label here (required)",
5774
5716
  value: field.label,
5775
5717
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5776
5718
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5781,8 +5723,8 @@ class AddJobType extends Component {
5781
5723
  className: "fieldInner",
5782
5724
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5783
5725
  id: "fieldLabel".concat(fieldIndex),
5784
- className: 'textInput',
5785
- placeholder: 'Type your label here (required)',
5726
+ className: "textInput",
5727
+ placeholder: "Type your label here (required)",
5786
5728
  value: field.label,
5787
5729
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5788
5730
  }), this.renderOptionalCheckBox(field, fieldIndex), this.renderTitleCheckBox(field, fieldIndex)]
@@ -5793,8 +5735,8 @@ class AddJobType extends Component {
5793
5735
  className: "fieldInner",
5794
5736
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5795
5737
  id: "fieldLabel".concat(fieldIndex),
5796
- className: 'textInput',
5797
- placeholder: 'Type your label here (required)',
5738
+ className: "textInput",
5739
+ placeholder: "Type your label here (required)",
5798
5740
  value: field.label,
5799
5741
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5800
5742
  }), this.renderOptionalCheckBox(field, fieldIndex)]
@@ -5805,8 +5747,8 @@ class AddJobType extends Component {
5805
5747
  className: "fieldInner",
5806
5748
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5807
5749
  id: "fieldLabel".concat(fieldIndex),
5808
- className: 'textInput',
5809
- placeholder: 'Type your label here (required)',
5750
+ className: "textInput",
5751
+ placeholder: "Type your label here (required)",
5810
5752
  value: field.label,
5811
5753
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5812
5754
  }), this.renderOptionalCheckBox(field, fieldIndex)]
@@ -5817,8 +5759,8 @@ class AddJobType extends Component {
5817
5759
  className: "fieldInner",
5818
5760
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5819
5761
  id: "fieldLabel".concat(fieldIndex),
5820
- className: 'textInput',
5821
- placeholder: 'Type your label here (required)',
5762
+ className: "textInput",
5763
+ placeholder: "Type your label here (required)",
5822
5764
  value: field.label,
5823
5765
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5824
5766
  }), /*#__PURE__*/jsxs(Table, {
@@ -5834,7 +5776,7 @@ class AddJobType extends Component {
5834
5776
  })]
5835
5777
  })
5836
5778
  }), /*#__PURE__*/jsx("tbody", {
5837
- children: ['Yes', 'No'].map((value, optionIndex) => {
5779
+ children: ["Yes", "No"].map((value, optionIndex) => {
5838
5780
  return /*#__PURE__*/jsxs("tr", {
5839
5781
  className: "option",
5840
5782
  children: [/*#__PURE__*/jsx("td", {
@@ -5864,8 +5806,8 @@ class AddJobType extends Component {
5864
5806
  className: "fieldInner",
5865
5807
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5866
5808
  id: "fieldLabel".concat(fieldIndex),
5867
- className: 'textInput',
5868
- placeholder: 'Type your label here (required)',
5809
+ className: "textInput",
5810
+ placeholder: "Type your label here (required)",
5869
5811
  value: field.label,
5870
5812
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5871
5813
  }), /*#__PURE__*/jsxs(Table, {
@@ -5895,15 +5837,15 @@ class AddJobType extends Component {
5895
5837
  }), /*#__PURE__*/jsx("td", {
5896
5838
  children: /*#__PURE__*/jsx(Components$1.GenericInput, {
5897
5839
  id: "fieldOption".concat(optionIndex),
5898
- placeholder: 'Enter option',
5840
+ placeholder: "Enter option",
5899
5841
  value: value,
5900
5842
  onChange: e => this.onFieldOptionChanged(fieldIndex, optionIndex, e)
5901
5843
  })
5902
5844
  }), /*#__PURE__*/jsx("td", {
5903
5845
  children: customFields[fieldIndex].values.length > 1 ? /*#__PURE__*/jsx("div", {
5904
5846
  onClick: () => this.onRemoveOption(fieldIndex, optionIndex),
5905
- children: /*#__PURE__*/jsx(FontAwesome, {
5906
- name: "minus-circle",
5847
+ children: /*#__PURE__*/jsx(Icon, {
5848
+ icon: "circle-minus",
5907
5849
  className: "cornerCancelButton_icon"
5908
5850
  })
5909
5851
  }) : null
@@ -5914,9 +5856,9 @@ class AddJobType extends Component {
5914
5856
  }), /*#__PURE__*/jsxs("div", {
5915
5857
  className: "clearfix addoption optionAdd marginBottom-10",
5916
5858
  onClick: () => this.onAddNewOption(fieldIndex),
5917
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
5859
+ children: [/*#__PURE__*/jsx(Icon, {
5918
5860
  className: "addoption_plus",
5919
- icon: "add-circle"
5861
+ icon: "circle-plus"
5920
5862
  }), /*#__PURE__*/jsx("div", {
5921
5863
  className: "fillSpace",
5922
5864
  children: /*#__PURE__*/jsx("p", {
@@ -5935,8 +5877,8 @@ class AddJobType extends Component {
5935
5877
  className: "fieldInner",
5936
5878
  children: [/*#__PURE__*/jsx(Components$1.GenericInput, {
5937
5879
  id: "fieldLabel".concat(fieldIndex),
5938
- className: 'textInput',
5939
- placeholder: 'Type your label here (required)',
5880
+ className: "textInput",
5881
+ placeholder: "Type your label here (required)",
5940
5882
  value: field.label,
5941
5883
  onChange: e => this.onFieldLabelChanged(fieldIndex, e)
5942
5884
  }), /*#__PURE__*/jsxs(Table, {
@@ -5966,15 +5908,15 @@ class AddJobType extends Component {
5966
5908
  }), /*#__PURE__*/jsx("td", {
5967
5909
  children: /*#__PURE__*/jsx(Components$1.GenericInput, {
5968
5910
  id: "fieldOption".concat(optionIndex),
5969
- placeholder: 'Enter option',
5911
+ placeholder: "Enter option",
5970
5912
  value: value,
5971
5913
  onChange: e => this.onFieldOptionChanged(fieldIndex, optionIndex, e)
5972
5914
  })
5973
5915
  }), /*#__PURE__*/jsx("td", {
5974
5916
  children: customFields[fieldIndex].values.length > 1 ? /*#__PURE__*/jsx("div", {
5975
5917
  onClick: () => this.onRemoveOption(fieldIndex, optionIndex),
5976
- children: /*#__PURE__*/jsx(FontAwesome, {
5977
- name: "minus-circle",
5918
+ children: /*#__PURE__*/jsx(Icon, {
5919
+ icon: "circle-minus",
5978
5920
  className: "cornerCancelButton_icon"
5979
5921
  })
5980
5922
  }) : null
@@ -5985,9 +5927,9 @@ class AddJobType extends Component {
5985
5927
  }), /*#__PURE__*/jsxs("div", {
5986
5928
  className: "clearfix addoption optionAdd marginBottom-10",
5987
5929
  onClick: () => this.onAddNewOption(fieldIndex),
5988
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
5930
+ children: [/*#__PURE__*/jsx(Icon, {
5989
5931
  className: "addoption_plus",
5990
- icon: "add-circle"
5932
+ icon: "circle-plus"
5991
5933
  }), /*#__PURE__*/jsx("div", {
5992
5934
  className: "fillSpace",
5993
5935
  children: /*#__PURE__*/jsx("p", {
@@ -6028,27 +5970,27 @@ class AddJobType extends Component {
6028
5970
  } = this.state;
6029
5971
  var renderFieldContent = () => {
6030
5972
  switch (field.type) {
6031
- case 'text':
6032
- case 'email':
6033
- case 'phone':
5973
+ case "text":
5974
+ case "email":
5975
+ case "phone":
6034
5976
  return this.renderFieldText(field, fieldIndex);
6035
- case 'date':
5977
+ case "date":
6036
5978
  return this.renderFieldDate(field, fieldIndex);
6037
- case 'time':
5979
+ case "time":
6038
5980
  return this.renderFieldTime(field, fieldIndex);
6039
- case 'image':
5981
+ case "image":
6040
5982
  return this.renderFieldImage(field, fieldIndex);
6041
- case 'document':
5983
+ case "document":
6042
5984
  return this.renderFieldDocument(field, fieldIndex);
6043
- case 'yn':
5985
+ case "yn":
6044
5986
  return this.renderFieldYesNo(field, fieldIndex);
6045
- case 'multichoice':
5987
+ case "multichoice":
6046
5988
  return this.renderFieldMultiple(field, fieldIndex);
6047
- case 'checkbox':
5989
+ case "checkbox":
6048
5990
  return this.renderFieldCheckbox(field, fieldIndex);
6049
- case 'staticTitle':
5991
+ case "staticTitle":
6050
5992
  return this.renderFieldStaticTitle(field, fieldIndex);
6051
- case 'staticText':
5993
+ case "staticText":
6052
5994
  return this.renderFieldStaticText(field, fieldIndex);
6053
5995
  default:
6054
5996
  return null;
@@ -6094,15 +6036,15 @@ class AddJobType extends Component {
6094
6036
  children: [fieldIndex > 0 ? /*#__PURE__*/jsx("div", {
6095
6037
  className: "circle",
6096
6038
  onClick: () => this.onMoveFieldPrev(fieldIndex),
6097
- children: /*#__PURE__*/jsx(FontAwesome, {
6098
- name: "angle-up",
6039
+ children: /*#__PURE__*/jsx(Icon, {
6040
+ icon: "angle-up",
6099
6041
  className: "icon"
6100
6042
  })
6101
6043
  }) : null, fieldIndex < customFields.length - 1 ? /*#__PURE__*/jsx("div", {
6102
6044
  className: "circle",
6103
6045
  onClick: () => this.onMoveFieldNext(fieldIndex),
6104
- children: /*#__PURE__*/jsx(FontAwesome, {
6105
- name: "angle-down",
6046
+ children: /*#__PURE__*/jsx(Icon, {
6047
+ icon: "angle-down",
6106
6048
  className: "icon"
6107
6049
  })
6108
6050
  }) : null]
@@ -6122,7 +6064,7 @@ class AddJobType extends Component {
6122
6064
  type: "bodyLarge",
6123
6065
  className: "marginBottom-24 paddingLeft-40",
6124
6066
  style: {
6125
- color: Colours$3.COLOUR_LIGHTGREY
6067
+ color: Colours$4.COLOUR_LIGHTGREY
6126
6068
  },
6127
6069
  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."
6128
6070
  }), /*#__PURE__*/jsxs("div", {
@@ -6130,9 +6072,9 @@ class AddJobType extends Component {
6130
6072
  children: [customFields.map((field, fieldIndex) => this.renderField(field, fieldIndex)), /*#__PURE__*/jsxs("div", {
6131
6073
  className: "clearfix addoption addField",
6132
6074
  onClick: () => this.onAddNewField(),
6133
- children: [/*#__PURE__*/jsx(Components$1.P60Icon, {
6075
+ children: [/*#__PURE__*/jsx(Icon, {
6134
6076
  className: "addoption_plus",
6135
- icon: "add-circle"
6077
+ icon: "circle-plus"
6136
6078
  }), /*#__PURE__*/jsx("div", {
6137
6079
  className: "fillSpace",
6138
6080
  children: /*#__PURE__*/jsx("p", {
@@ -6153,10 +6095,10 @@ class AddJobType extends Component {
6153
6095
  return /*#__PURE__*/jsxs("div", {
6154
6096
  className: "padding-60 paddingVertical-8 text-bodyLarge",
6155
6097
  style: {
6156
- color: Colours$3.COLOUR_RED
6098
+ color: Colours$4.COLOUR_RED
6157
6099
  },
6158
6100
  children: ["To save the form", /*#__PURE__*/jsx("ul", {
6159
- style: {
6101
+ iconStyle: {
6160
6102
  padding: 0,
6161
6103
  paddingLeft: 16
6162
6104
  },
@@ -6173,11 +6115,11 @@ class AddJobType extends Component {
6173
6115
  } = this.state;
6174
6116
  if (!success) return null;
6175
6117
  return /*#__PURE__*/jsx(Components$1.SuccessPopup, {
6176
- text: "".concat("".concat(values.textJobType), " has been ", !jobTypeId ? 'added' : 'edited'),
6118
+ text: "".concat("".concat(values.textJobType), " has been ", !jobTypeId ? "added" : "edited"),
6177
6119
  buttons: [{
6178
- type: 'outlined',
6120
+ type: "outlined",
6179
6121
  onClick: this.onBack,
6180
- text: 'Go to home'
6122
+ text: "Go to home"
6181
6123
  }]
6182
6124
  });
6183
6125
  }
@@ -6240,10 +6182,14 @@ var AddJobType$1 = connect(mapStateToProps$1, {
6240
6182
  jobTypesUpdate
6241
6183
  })(withRouter(AddJobType));
6242
6184
 
6185
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6186
+ 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; }
6243
6187
  var {
6244
6188
  Analytics: Analytics$1,
6245
6189
  Session,
6246
- Components
6190
+ Components,
6191
+ Helper,
6192
+ Colours
6247
6193
  } = PlussCore;
6248
6194
  var getInitialState = () => ({
6249
6195
  requests: 0,
@@ -6263,10 +6209,21 @@ var AnalyticsHub = _ref => {
6263
6209
  auth,
6264
6210
  prevText,
6265
6211
  dayCount,
6266
- strings
6212
+ strings,
6213
+ userType,
6214
+ userCategory,
6215
+ selectedSites
6267
6216
  } = _ref;
6268
6217
  var [analyticsData, setAnalyticsData] = useState(getInitialState());
6269
6218
  var [isExportOpen, setIsExportOpen] = useState(false);
6219
+ var [failedSites, setFailedSites] = useState([]);
6220
+ var [comparisonData, setComparisonData] = useState({
6221
+ requests: [],
6222
+ completedRequests: [],
6223
+ comments: [],
6224
+ isLoading: true
6225
+ });
6226
+ var comparisonMode = selectedSites && selectedSites.length > 1;
6270
6227
  var hasAccess = Session.validateAccess(auth.site, values.permissionMaintenanceTracking, auth);
6271
6228
  if (!hasAccess) {
6272
6229
  return null;
@@ -6278,55 +6235,140 @@ var AnalyticsHub = _ref => {
6278
6235
  return strings.sideNav[key];
6279
6236
  })();
6280
6237
  var exportColumns = [{
6281
- label: 'Select All',
6282
- key: ''
6283
- }, {
6284
- label: 'Start Date',
6285
- key: 'startDate'
6238
+ label: "Select All",
6239
+ key: ""
6240
+ }, ...(comparisonMode ? [{
6241
+ label: "Site",
6242
+ key: "site"
6243
+ }] : []), {
6244
+ label: "Start Date",
6245
+ key: "startDate"
6286
6246
  }, {
6287
- label: 'End Date',
6288
- key: 'endDate'
6247
+ label: "End Date",
6248
+ key: "endDate"
6289
6249
  }, {
6290
6250
  label: "".concat(values.textSingularName, "s"),
6291
- key: 'requests'
6251
+ key: "requests"
6292
6252
  }, {
6293
6253
  label: "Completed ".concat(values.textSingularName, "s"),
6294
- key: 'completedRequests'
6254
+ key: "completedRequests"
6295
6255
  }, {
6296
- label: 'Comments',
6297
- key: 'comments'
6256
+ label: "Comments",
6257
+ key: "comments"
6298
6258
  }];
6299
6259
  useEffect(() => {
6300
6260
  getData();
6301
- }, [startTime, endTime]);
6261
+ }, [startTime, endTime, userType, userCategory, selectedSites]);
6302
6262
  var getData = /*#__PURE__*/function () {
6303
6263
  var _ref2 = _asyncToGenerator(function* () {
6304
- setAnalyticsData(getInitialState());
6305
- // Load analytics data here using startTime and endTime
6306
- var timeDifference = endTime - startTime;
6307
- 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)]);
6308
- var data = {
6309
- requests: Analytics$1.countActivities(currentStatsResponse.data, 'Request', 'total'),
6310
- prevRequests: Analytics$1.countActivities(prevStatsResponse.data, 'Request', 'total'),
6311
- completedRequests: Analytics$1.countActivities(currentStatsResponse.data, 'RequestCompleted', 'unique'),
6312
- prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, 'RequestCompleted', 'unique'),
6313
- comments: Analytics$1.countActivities(currentStatsResponse.data, 'Comment', 'total'),
6314
- prevComments: Analytics$1.countActivities(prevStatsResponse.data, 'Comment', 'total'),
6315
- isLoading: false
6316
- };
6317
- setAnalyticsData(data);
6264
+ try {
6265
+ setFailedSites([]);
6266
+ if (comparisonMode) {
6267
+ setComparisonData({
6268
+ requests: [],
6269
+ completedRequests: [],
6270
+ comments: [],
6271
+ isLoading: true
6272
+ });
6273
+ var multiSiteResultsObj = yield Analytics$1.fetchMultiSiteData(selectedSites, /*#__PURE__*/function () {
6274
+ var _ref3 = _asyncToGenerator(function* (site) {
6275
+ var {
6276
+ data
6277
+ } = yield analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6278
+ userType,
6279
+ userCategory
6280
+ });
6281
+ return data;
6282
+ });
6283
+ return function (_x) {
6284
+ return _ref3.apply(this, arguments);
6285
+ };
6286
+ }());
6287
+ var roles = auth.user.Roles;
6288
+ var failed = Object.entries(multiSiteResultsObj).filter(_ref4 => {
6289
+ var [, data] = _ref4;
6290
+ return data === null;
6291
+ }).map(_ref5 => {
6292
+ var [site] = _ref5;
6293
+ return Helper.getSiteNameFromRoles(site, roles);
6294
+ });
6295
+ setFailedSites(failed);
6296
+ var multiSiteResults = Object.entries(multiSiteResultsObj).filter(_ref6 => {
6297
+ var [, data] = _ref6;
6298
+ return data !== null;
6299
+ }).map(_ref7 => {
6300
+ var [site, data] = _ref7;
6301
+ return {
6302
+ site,
6303
+ data
6304
+ };
6305
+ });
6306
+ var buildComparison = (activityKey, countType) => multiSiteResults.map(result => ({
6307
+ name: Helper.getSiteNameFromRoles(result.site, roles),
6308
+ value: Analytics$1.countActivities(result.data, activityKey, countType)
6309
+ }));
6310
+ setComparisonData({
6311
+ requests: buildComparison("Request", "total"),
6312
+ completedRequests: buildComparison("RequestCompleted", "unique"),
6313
+ comments: buildComparison("Comment", "total"),
6314
+ isLoading: false
6315
+ });
6316
+ } else {
6317
+ setAnalyticsData(getInitialState());
6318
+ var site = selectedSites && selectedSites.length === 1 ? selectedSites[0] : auth.site;
6319
+ var timeDifference = endTime - startTime;
6320
+ var [currentStatsResponse, prevStatsResponse] = yield Promise.all([analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime, endTime, true, {
6321
+ userType,
6322
+ userCategory
6323
+ }), analyticsActions.getAggregateEntityStats(site, values.analyticsKey, startTime - timeDifference, startTime, true, {
6324
+ userType,
6325
+ userCategory
6326
+ })]);
6327
+ var data = {
6328
+ requests: Analytics$1.countActivities(currentStatsResponse.data, "Request", "total"),
6329
+ prevRequests: Analytics$1.countActivities(prevStatsResponse.data, "Request", "total"),
6330
+ completedRequests: Analytics$1.countActivities(currentStatsResponse.data, "RequestCompleted", "unique"),
6331
+ prevCompletedRequests: Analytics$1.countActivities(prevStatsResponse.data, "RequestCompleted", "unique"),
6332
+ comments: Analytics$1.countActivities(currentStatsResponse.data, "Comment", "total"),
6333
+ prevComments: Analytics$1.countActivities(prevStatsResponse.data, "Comment", "total"),
6334
+ isLoading: false
6335
+ };
6336
+ setAnalyticsData(data);
6337
+ }
6338
+ } catch (err) {
6339
+ if (comparisonMode) {
6340
+ setComparisonData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6341
+ isLoading: false
6342
+ }));
6343
+ } else {
6344
+ setAnalyticsData(prev => _objectSpread$3(_objectSpread$3({}, prev), {}, {
6345
+ isLoading: false
6346
+ }));
6347
+ }
6348
+ }
6318
6349
  });
6319
6350
  return function getData() {
6320
6351
  return _ref2.apply(this, arguments);
6321
6352
  };
6322
6353
  }();
6323
6354
  var isReadyToOpenCSV = () => {
6324
- return !analyticsData.isLoading;
6355
+ return comparisonMode ? !comparisonData.isLoading : !analyticsData.isLoading;
6325
6356
  };
6326
6357
  var getExportSource = () => {
6358
+ if (comparisonMode) {
6359
+ var sites = comparisonData.requests || [];
6360
+ return sites.map((site, i) => ({
6361
+ site: site.name,
6362
+ startDate: moment(startTime + 1).format("D-MM-YYYY"),
6363
+ endDate: moment(endTime).format("D-MM-YYYY"),
6364
+ requests: site.value,
6365
+ completedRequests: comparisonData.completedRequests[i] && comparisonData.completedRequests[i].value || 0,
6366
+ comments: comparisonData.comments[i] && comparisonData.comments[i].value || 0
6367
+ }));
6368
+ }
6327
6369
  return [{
6328
- startDate: moment(startTime + 1).format('D-MM-YYYY'),
6329
- endDate: moment(endTime).format('D-MM-YYYY'),
6370
+ startDate: moment(startTime + 1).format("D-MM-YYYY"),
6371
+ endDate: moment(endTime).format("D-MM-YYYY"),
6330
6372
  requests: analyticsData.requests,
6331
6373
  completedRequests: analyticsData.completedRequests,
6332
6374
  comments: analyticsData.comments
@@ -6337,13 +6379,14 @@ var AnalyticsHub = _ref => {
6337
6379
  return null;
6338
6380
  }
6339
6381
  var source = getExportSource();
6382
+ var filterSuffix = [userType, userCategory].filter(Boolean).map(f => f.toLowerCase().replace(/\s+/g, "-")).join("_");
6340
6383
  return /*#__PURE__*/jsx(Components.ExportCsvPopup, {
6341
6384
  onClose: () => {
6342
6385
  setIsExportOpen(false);
6343
6386
  },
6344
6387
  columns: exportColumns,
6345
6388
  source: source,
6346
- filename: "".concat(values.analyticsKey, "analytics_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
6389
+ filename: "".concat(values.analyticsKey, "analytics").concat(comparisonMode ? "_comparison" : "").concat(filterSuffix ? "_".concat(filterSuffix) : "", "_").concat(source[0].startDate, "_").concat(source[0].endDate, ".csv")
6347
6390
  });
6348
6391
  };
6349
6392
  return /*#__PURE__*/jsxs("div", {
@@ -6361,36 +6404,76 @@ var AnalyticsHub = _ref => {
6361
6404
  setIsExportOpen(true);
6362
6405
  },
6363
6406
  isActive: isReadyToOpenCSV(),
6364
- leftIcon: "file-code-o",
6407
+ leftIcon: "file-code",
6365
6408
  children: "Export CSV"
6366
6409
  })]
6367
- }), /*#__PURE__*/jsxs("div", {
6410
+ }), failedSites.length > 0 && /*#__PURE__*/jsxs(Components.Text, {
6411
+ type: "help",
6412
+ style: {
6413
+ color: Colours.COLOUR_RED,
6414
+ marginTop: 8
6415
+ },
6416
+ children: ["Data unavailable for: ", failedSites.join(", ")]
6417
+ }), /*#__PURE__*/jsx("div", {
6368
6418
  className: "analyticsSection dashboardSection_content",
6369
- children: [/*#__PURE__*/jsx(Components.StatBox, {
6370
- title: "".concat(featureTitle, " Requests"),
6371
- icon: faWrench,
6372
- value: analyticsData.requests,
6373
- previousValue: analyticsData.prevRequests,
6374
- prevText: prevText,
6375
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount),
6376
- isLoading: analyticsData.isLoading
6377
- }), /*#__PURE__*/jsx(Components.StatBox, {
6378
- title: "Completed ".concat(featureTitle, " Requests"),
6379
- icon: faCircleCheck,
6380
- value: analyticsData.completedRequests,
6381
- previousValue: analyticsData.prevCompletedRequests,
6382
- prevText: prevText,
6383
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount),
6384
- isLoading: analyticsData.isLoading
6385
- }), /*#__PURE__*/jsx(Components.StatBox, {
6386
- title: "".concat(featureTitle, " Comments"),
6387
- icon: faComment,
6388
- value: analyticsData.comments,
6389
- previousValue: analyticsData.prevComments,
6390
- prevText: prevText,
6391
- viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount),
6392
- isLoading: analyticsData.isLoading
6393
- })]
6419
+ children: (() => {
6420
+ var chartSuffix = [selectedSites && selectedSites.length > 0 ? "&sites=".concat(selectedSites.join(",")) : "", userType ? "&userType=".concat(encodeURIComponent(userType)) : "", userCategory ? "&userCategory=".concat(encodeURIComponent(userCategory)) : ""].join("");
6421
+ if (comparisonMode) {
6422
+ return /*#__PURE__*/jsxs("div", {
6423
+ style: {
6424
+ display: "flex",
6425
+ flexDirection: "column",
6426
+ gap: 16
6427
+ },
6428
+ children: [/*#__PURE__*/jsx(Components.ComparisonStatBox, {
6429
+ title: "".concat(featureTitle, " Requests"),
6430
+ data: comparisonData.requests,
6431
+ prevText: prevText,
6432
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6433
+ isLoading: comparisonData.isLoading
6434
+ }), /*#__PURE__*/jsx(Components.ComparisonStatBox, {
6435
+ title: "Completed ".concat(featureTitle, " Requests"),
6436
+ data: comparisonData.completedRequests,
6437
+ prevText: prevText,
6438
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
6439
+ isLoading: comparisonData.isLoading
6440
+ }), /*#__PURE__*/jsx(Components.ComparisonStatBox, {
6441
+ title: "".concat(featureTitle, " Comments"),
6442
+ data: comparisonData.comments,
6443
+ prevText: prevText,
6444
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6445
+ isLoading: comparisonData.isLoading
6446
+ })]
6447
+ });
6448
+ }
6449
+ return /*#__PURE__*/jsxs(Fragment, {
6450
+ children: [/*#__PURE__*/jsx(Components.StatBox, {
6451
+ title: "".concat(featureTitle, " Requests"),
6452
+ icon: "wrench",
6453
+ value: analyticsData.requests,
6454
+ previousValue: analyticsData.prevRequests,
6455
+ prevText: prevText,
6456
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Request&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6457
+ isLoading: analyticsData.isLoading
6458
+ }), /*#__PURE__*/jsx(Components.StatBox, {
6459
+ title: "Completed ".concat(featureTitle, " Requests"),
6460
+ icon: "circle-check",
6461
+ value: analyticsData.completedRequests,
6462
+ previousValue: analyticsData.prevCompletedRequests,
6463
+ prevText: prevText,
6464
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=RequestCompleted&countType=unique&dayCount=").concat(dayCount).concat(chartSuffix),
6465
+ isLoading: analyticsData.isLoading
6466
+ }), /*#__PURE__*/jsx(Components.StatBox, {
6467
+ title: "".concat(featureTitle, " Comments"),
6468
+ icon: "comment",
6469
+ value: analyticsData.comments,
6470
+ previousValue: analyticsData.prevComments,
6471
+ prevText: prevText,
6472
+ viewGraphLink: "/chart?entity=".concat(values.analyticsKey, "&startTime=").concat(startTime, "&endTime=").concat(endTime, "&key=Comment&countType=total&dayCount=").concat(dayCount).concat(chartSuffix),
6473
+ isLoading: analyticsData.isLoading
6474
+ })]
6475
+ });
6476
+ })()
6394
6477
  })]
6395
6478
  });
6396
6479
  };
@@ -6423,19 +6506,15 @@ var MaintenanceReducer = (function () {
6423
6506
  loading: true
6424
6507
  });
6425
6508
  case JOBS_LOADED:
6509
+ var result = _.unionWith(action.payload, state.jobs, (v1, v2) => {
6510
+ return v1 != null && v2 != null && v1.id === v2.id;
6511
+ });
6426
6512
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6427
- jobs: action.payload.map(job => _objectSpread$2({
6513
+ jobs: result.map(job => _objectSpread$2({
6428
6514
  title: job.title || job.description
6429
6515
  }, job)),
6430
6516
  loading: false
6431
6517
  });
6432
- case JOBS_ADDED:
6433
- var added = _.unionWith(action.payload.map(job => _objectSpread$2({
6434
- title: job.title || job.description
6435
- }, job)), state.jobs, (v1, v2) => v1 != null && v2 != null && v1.id === v2.id);
6436
- return _objectSpread$2(_objectSpread$2({}, state), {}, {
6437
- jobs: added
6438
- });
6439
6518
  case JOBS_REMOVED:
6440
6519
  var index = _.findIndex(state.jobs, event => {
6441
6520
  return event != null && event.id === action.payload;
@@ -6456,7 +6535,7 @@ var MaintenanceReducer = (function () {
6456
6535
  jobtypes
6457
6536
  });
6458
6537
  case JOBS_STATUSES_LOADED:
6459
- var jobstatuses = _.orderBy(action.payload, 'order', 'asc');
6538
+ var jobstatuses = _.orderBy(action.payload, "order", "asc");
6460
6539
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
6461
6540
  jobstatuses
6462
6541
  });
@@ -6489,7 +6568,7 @@ class ActivityText extends Component {
6489
6568
  className: clickableClasses,
6490
6569
  children: _.truncate(data.Data.title || data.Data.description, {
6491
6570
  length: 30,
6492
- separator: '...'
6571
+ separator: "..."
6493
6572
  })
6494
6573
  })]
6495
6574
  });
@@ -6504,7 +6583,7 @@ class ActivityText extends Component {
6504
6583
  className: clickableClasses,
6505
6584
  children: _.truncate(data.Data.title || data.Data.description, {
6506
6585
  length: 30,
6507
- separator: '...'
6586
+ separator: "..."
6508
6587
  })
6509
6588
  })]
6510
6589
  });
@@ -6519,7 +6598,7 @@ class ActivityText extends Component {
6519
6598
  className: clickableClasses,
6520
6599
  children: _.truncate(data.Data.title || data.Data.description, {
6521
6600
  length: 30,
6522
- separator: '...'
6601
+ separator: "..."
6523
6602
  })
6524
6603
  })]
6525
6604
  });
@@ -6533,7 +6612,7 @@ class ActivityText extends Component {
6533
6612
  className: highlightedClasses,
6534
6613
  children: _.truncate(data.Data.title || data.Data.description, {
6535
6614
  length: 30,
6536
- separator: '...'
6615
+ separator: "..."
6537
6616
  })
6538
6617
  })]
6539
6618
  });
@@ -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
 
@@ -6626,10 +6705,10 @@ class PreviewWidget extends Component {
6626
6705
  }
6627
6706
  var styles$1 = {
6628
6707
  container: {
6629
- position: 'relative'
6708
+ position: "relative"
6630
6709
  },
6631
6710
  image: {
6632
- width: '100%'
6711
+ width: "100%"
6633
6712
  }
6634
6713
  };
6635
6714
 
@@ -6667,10 +6746,10 @@ class PreviewFull extends Component {
6667
6746
  }
6668
6747
  var styles = {
6669
6748
  container: {
6670
- position: 'relative'
6749
+ position: "relative"
6671
6750
  },
6672
6751
  image: {
6673
- width: '100%'
6752
+ width: "100%"
6674
6753
  }
6675
6754
  };
6676
6755