@plusscommunities/pluss-maintenance-web-a 1.1.23 → 1.1.24

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.esm.js CHANGED
@@ -14,7 +14,7 @@ import _ from 'lodash';
14
14
  import moment from 'moment';
15
15
  import FontAwesome from 'react-fontawesome';
16
16
  import * as PlussCore from '@plusscommunities/pluss-core-web';
17
- import { Colours as Colours$2 } from '@plusscommunities/pluss-core-web';
17
+ import { Colours as Colours$3 } from '@plusscommunities/pluss-core-web';
18
18
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
19
19
  import { Table, MenuItem, DropdownButton } from 'react-bootstrap';
20
20
  import { Link } from 'react-router-dom';
@@ -32,6 +32,8 @@ var values = {
32
32
  actionJobsLoaded: 'JOBS_LOADEDA',
33
33
  actionJobsRemoved: 'JOBS_REMOVEDA',
34
34
  actionJobsTypesLoaded: 'JOBS_TYPES_LOADEDA',
35
+ actionJobsStatusesLoaded: 'JOBS_STATUSES_LOADEDA',
36
+ actionJobsHideSeen: 'JOBS_HIDE_UNSEENA',
35
37
  actionJobsLoading: 'JOBS_LOADINGA',
36
38
  permissionMaintenanceTracking: 'maintenanceTrackingA',
37
39
  permissionMaintenanceTypes: 'maintenanceTypesA',
@@ -75,7 +77,9 @@ var values = {
75
77
  optionKeyMoreSectionMaintenance: 'maintenanceRequestA',
76
78
  hiddenKeyMoreSectionMaintenance: 'maintenanceRequestA',
77
79
  forceCustomFields: false,
78
- textEntityName: 'Job'
80
+ textEntityName: 'Job',
81
+ stringConfigJobStatus: 'maintenanceJobStatusA',
82
+ stringConfigHideSeen: 'maintenanceDisableSeenA'
79
83
  };
80
84
 
81
85
  // import * as PlussCore from '../../pluss-core/src';
@@ -190,19 +194,21 @@ var FeatureConfig = {
190
194
  };
191
195
 
192
196
  var JOBS_LOADED = values.actionJobsLoaded;
197
+ var JOBS_LOADING = values.actionJobsLoading;
193
198
  var JOBS_REMOVED = values.actionJobsRemoved;
194
199
  var JOBS_TYPES_LOADED = values.actionJobsTypesLoaded;
195
- var JOBS_LOADING = values.actionJobsLoading;
200
+ var JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
201
+ var JOBS_HIDE_SEEN = values.actionJobsHideSeen;
196
202
 
197
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
203
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
198
204
 
199
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
205
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
200
206
  var Helper$5 = PlussCore.Helper,
201
- Session$8 = PlussCore.Session;
207
+ Session$9 = PlussCore.Session;
202
208
  var maintenanceActions = {
203
209
  getJobType: function getJobType(site, typeId) {
204
210
  var url = Helper$5.getUrl(values.serviceKey, 'getjobtype');
205
- return Session$8.authedFunction({
211
+ return Session$9.authedFunction({
206
212
  method: 'POST',
207
213
  url: url,
208
214
  data: {
@@ -213,7 +219,7 @@ var maintenanceActions = {
213
219
  },
214
220
  getJobTypes: function getJobTypes(site, id) {
215
221
  var url = Helper$5.getUrl(values.serviceKey, 'getjobtypes');
216
- return Session$8.authedFunction({
222
+ return Session$9.authedFunction({
217
223
  method: 'POST',
218
224
  url: url,
219
225
  data: {
@@ -223,7 +229,7 @@ var maintenanceActions = {
223
229
  },
224
230
  getJob: function getJob(site, id) {
225
231
  var url = Helper$5.getUrl(values.serviceKey, 'getJob');
226
- return Session$8.authedFunction({
232
+ return Session$9.authedFunction({
227
233
  method: 'POST',
228
234
  url: url,
229
235
  data: {
@@ -234,7 +240,7 @@ var maintenanceActions = {
234
240
  },
235
241
  getJobByJobId: function getJobByJobId(site, jobId) {
236
242
  var url = Helper$5.getUrl(values.serviceKey, 'getJob');
237
- return Session$8.authedFunction({
243
+ return Session$9.authedFunction({
238
244
  method: 'POST',
239
245
  url: url,
240
246
  data: {
@@ -246,7 +252,7 @@ var maintenanceActions = {
246
252
  getJobs: function getJobs(site) {
247
253
  var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
248
254
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
249
- return Session$8.authedFunction({
255
+ return Session$9.authedFunction({
250
256
  method: 'POST',
251
257
  url: Helper$5.getUrl(values.serviceKey, 'getJobs'),
252
258
  data: {
@@ -273,7 +279,7 @@ var maintenanceActions = {
273
279
  query.lastKey = JSON.stringify(lastKey);
274
280
  }
275
281
 
276
- return Session$8.authedFunction({
282
+ return Session$9.authedFunction({
277
283
  method: 'GET',
278
284
  url: Helper$5.getUrl(values.serviceKey, 'get/requests', query)
279
285
  });
@@ -293,14 +299,14 @@ var maintenanceActions = {
293
299
  });
294
300
  },
295
301
  createJob: function createJob(job) {
296
- return Session$8.authedFunction({
302
+ return Session$9.authedFunction({
297
303
  method: 'POST',
298
304
  url: Helper$5.getUrl(values.serviceKey, 'sendMaintenance'),
299
- data: _objectSpread$6({}, job)
305
+ data: _objectSpread$7({}, job)
300
306
  });
301
307
  },
302
308
  editJob: function editJob(job, site) {
303
- return Session$8.authedFunction({
309
+ return Session$9.authedFunction({
304
310
  method: 'POST',
305
311
  url: Helper$5.getUrl(values.serviceKey, 'editJob'),
306
312
  data: {
@@ -310,7 +316,7 @@ var maintenanceActions = {
310
316
  });
311
317
  },
312
318
  deleteJob: function deleteJob(site, id) {
313
- return Session$8.authedFunction({
319
+ return Session$9.authedFunction({
314
320
  method: 'POST',
315
321
  url: Helper$5.getUrl(values.serviceKey, 'requests/remove'),
316
322
  data: {
@@ -320,7 +326,7 @@ var maintenanceActions = {
320
326
  });
321
327
  },
322
328
  editJobStatus: function editJobStatus(id, status) {
323
- return Session$8.authedFunction({
329
+ return Session$9.authedFunction({
324
330
  method: 'POST',
325
331
  url: Helper$5.getUrl(values.serviceKey, 'editJobStatus'),
326
332
  data: {
@@ -329,8 +335,18 @@ var maintenanceActions = {
329
335
  }
330
336
  });
331
337
  },
338
+ editJobPriority: function editJobPriority(id, priority) {
339
+ return Session$9.authedFunction({
340
+ method: 'POST',
341
+ url: Helper$5.getUrl(values.serviceKey, 'update/priority'),
342
+ data: {
343
+ id: id,
344
+ priority: priority
345
+ }
346
+ });
347
+ },
332
348
  assignJob: function assignJob(jobId, userId) {
333
- return Session$8.authedFunction({
349
+ return Session$9.authedFunction({
334
350
  method: 'POST',
335
351
  url: Helper$5.getUrl(values.serviceKey, 'update/assign'),
336
352
  data: {
@@ -340,40 +356,42 @@ var maintenanceActions = {
340
356
  });
341
357
  },
342
358
  getAssignees: function getAssignees(site) {
343
- return Session$8.authedFunction({
359
+ return Session$9.authedFunction({
344
360
  method: 'GET',
345
361
  url: Helper$5.getUrl(values.serviceKey, 'get/assignees', {
346
362
  site: site
347
363
  })
348
364
  });
349
365
  },
350
- addNote: function addNote(jobId, note, attachments) {
351
- return Session$8.authedFunction({
366
+ addNote: function addNote(jobId, note, attachments, images) {
367
+ return Session$9.authedFunction({
352
368
  method: 'POST',
353
369
  url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
354
370
  data: {
355
371
  id: jobId,
356
372
  note: note,
357
373
  attachments: attachments,
374
+ images: images,
358
375
  action: 'AddNote'
359
376
  }
360
377
  });
361
378
  },
362
- editNote: function editNote(jobId, noteId, note, attachments) {
363
- return Session$8.authedFunction({
379
+ editNote: function editNote(jobId, noteId, note, attachments, images) {
380
+ return Session$9.authedFunction({
364
381
  method: 'POST',
365
382
  url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
366
383
  data: {
367
384
  id: jobId,
368
385
  note: note,
369
386
  attachments: attachments,
387
+ images: images,
370
388
  noteId: noteId,
371
389
  action: 'EditNote'
372
390
  }
373
391
  });
374
392
  },
375
393
  deleteNote: function deleteNote(jobId, noteId) {
376
- return Session$8.authedFunction({
394
+ return Session$9.authedFunction({
377
395
  method: 'POST',
378
396
  url: Helper$5.getUrl(values.serviceKey, 'requests/note'),
379
397
  data: {
@@ -393,7 +411,7 @@ var maintenanceActions = {
393
411
  hasCustomFields: hasCustomFields,
394
412
  customFields: customFields || []
395
413
  };
396
- return Session$8.authedFunction({
414
+ return Session$9.authedFunction({
397
415
  method: 'POST',
398
416
  url: Helper$5.getUrl(values.serviceKey, 'createJobType'),
399
417
  data: data
@@ -411,14 +429,14 @@ var maintenanceActions = {
411
429
  customFields: customFields || []
412
430
  };
413
431
  if (hasCustomFields && customFields) data.customFields = customFields;
414
- return Session$8.authedFunction({
432
+ return Session$9.authedFunction({
415
433
  method: 'POST',
416
434
  url: Helper$5.getUrl(values.serviceKey, 'editJobType'),
417
435
  data: data
418
436
  });
419
437
  },
420
438
  deleteJobType: function deleteJobType(site, id) {
421
- return Session$8.authedFunction({
439
+ return Session$9.authedFunction({
422
440
  method: 'POST',
423
441
  url: Helper$5.getUrl(values.serviceKey, 'deleteJobType'),
424
442
  data: {
@@ -430,7 +448,7 @@ var maintenanceActions = {
430
448
  };
431
449
 
432
450
  var Helper$4 = PlussCore.Helper,
433
- Session$7 = PlussCore.Session;
451
+ Session$8 = PlussCore.Session;
434
452
  var reactionActions = {
435
453
  addComment: function addComment(entityId, entityType, entityName, site, comment, image, parentId) {
436
454
  var data = {
@@ -446,7 +464,7 @@ var reactionActions = {
446
464
  data.image = image;
447
465
  }
448
466
 
449
- return Session$7.authedFunction({
467
+ return Session$8.authedFunction({
450
468
  method: 'POST',
451
469
  url: Helper$4.getUrl('reactions', 'comments/add'),
452
470
  data: data
@@ -471,7 +489,7 @@ var reactionActions = {
471
489
  query.minTime = minTime;
472
490
  }
473
491
 
474
- return Session$7.authedFunction({
492
+ return Session$8.authedFunction({
475
493
  method: 'GET',
476
494
  url: Helper$4.getUrl('reactions', 'comments/get', query)
477
495
  });
@@ -481,6 +499,28 @@ var reactionActions = {
481
499
  var Apis$1 = PlussCore.Apis;
482
500
  var analyticsActions = Apis$1.analyticsActions;
483
501
  var userActions = Apis$1.userActions;
502
+ var stringActions = Apis$1.stringActions;
503
+
504
+ var jobStatusOptions = [
505
+ {
506
+ text: "Open",
507
+ order: 0,
508
+ color: "#d5dde4",
509
+ category: "Not Actioned"
510
+ },
511
+ {
512
+ text: "In Progress",
513
+ order: 1,
514
+ color: "#82d6e5",
515
+ category: "In Progress"
516
+ },
517
+ {
518
+ text: "Completed",
519
+ order: 2,
520
+ color: "#58dba4",
521
+ category: "Completed"
522
+ }
523
+ ];
484
524
 
485
525
  var Helper$3 = PlussCore.Helper;
486
526
  var jobsUpdate = function jobsUpdate(site, isdashboard) {
@@ -532,6 +572,54 @@ var jobTypesLoaded = function jobTypesLoaded(events) {
532
572
  type: JOBS_TYPES_LOADED,
533
573
  payload: events
534
574
  };
575
+ };
576
+ var jobStatusesUpdate = function jobStatusesUpdate(site) {
577
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
578
+ return function (dispatch) {
579
+ stringActions.getString(site, values.stringConfigJobStatus).then(function (res) {
580
+ dispatch({
581
+ type: JOBS_STATUSES_LOADED,
582
+ payload: res.data
583
+ });
584
+ if (callback) callback(res.data);
585
+ }).catch(function (_error) {
586
+ dispatch({
587
+ type: JOBS_STATUSES_LOADED,
588
+ payload: jobStatusOptions
589
+ });
590
+ if (callback) callback(jobStatusOptions);
591
+ });
592
+ };
593
+ };
594
+ var jobStatusesLoaded = function jobStatusesLoaded(statuses) {
595
+ return {
596
+ type: JOBS_STATUSES_LOADED,
597
+ payload: statuses
598
+ };
599
+ };
600
+ var jobHideSeenUpdate = function jobHideSeenUpdate(site) {
601
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
602
+ return function (dispatch) {
603
+ stringActions.getString(site, values.stringConfigHideSeen).then(function (res) {
604
+ dispatch({
605
+ type: JOBS_HIDE_SEEN,
606
+ payload: res.data
607
+ });
608
+ if (callback) callback(res.data);
609
+ }).catch(function (_error) {
610
+ dispatch({
611
+ type: JOBS_HIDE_SEEN,
612
+ payload: false
613
+ });
614
+ if (callback) callback(false);
615
+ });
616
+ };
617
+ };
618
+ var jobHideSeenLoaded = function jobHideSeenLoaded(hide) {
619
+ return {
620
+ type: JOBS_HIDE_SEEN,
621
+ payload: hide
622
+ };
535
623
  }; // export const removeJobType = (id) => {
536
624
  // return {
537
625
  // type: JOBS_TYPES_REMOVED,
@@ -562,41 +650,56 @@ var jobTypesLoaded = function jobTypesLoaded(events) {
562
650
  // };
563
651
  // };
564
652
 
565
- var Unassigned = {
566
- text: "Open",
567
- order: 0,
568
- color: "#d5dde4"
569
- };
570
- var Completed = {
571
- text: "Completed",
572
- order: 2,
573
- color: "#58dba4"
653
+ var jobPriorityOptions = [
654
+ {
655
+ name: "Low",
656
+ color: "green",
657
+ "default": true
658
+ },
659
+ {
660
+ name: "Medium",
661
+ color: "orange"
662
+ },
663
+ {
664
+ name: "High",
665
+ color: "red"
666
+ }
667
+ ];
668
+
669
+ var STATUS_IMCOMPLETE = 'All Incomplete';
670
+ var STATUS_NOT_ACTIONED = 'Not Actioned';
671
+ var STATUS_IN_PROGRESS = 'In Progress';
672
+ var STATUS_COMPLETED = 'Completed';
673
+
674
+ var getDefaultPriority = function getDefaultPriority() {
675
+ return jobPriorityOptions.find(function (p) {
676
+ return p.default;
677
+ });
574
678
  };
575
- var StatusTypes = {
576
- Unassigned: Unassigned,
577
- "In Progress": {
578
- text: "In Progress",
579
- order: 1,
580
- color: "#82d6e5"
581
- },
582
- Completed: Completed
679
+
680
+ var getJobPriority = function getJobPriority(priority) {
681
+ var priorityOption = null;
682
+ if (priority) priorityOption = jobPriorityOptions.find(function (p) {
683
+ return p.name === priority;
684
+ });
685
+ return priorityOption || getDefaultPriority();
583
686
  };
584
687
 
585
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
688
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
586
689
 
587
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
690
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
588
691
 
589
- function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
692
+ function _createSuper$c(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
590
693
 
591
- function _isNativeReflectConstruct$b() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
592
- var Session$6 = PlussCore.Session,
593
- Components$6 = PlussCore.Components,
694
+ function _isNativeReflectConstruct$c() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
695
+ var Session$7 = PlussCore.Session,
696
+ Components$7 = PlussCore.Components,
594
697
  Analytics$2 = PlussCore.Analytics;
595
698
 
596
699
  var JobList = /*#__PURE__*/function (_Component) {
597
700
  _inherits(JobList, _Component);
598
701
 
599
- var _super = _createSuper$b(JobList);
702
+ var _super = _createSuper$c(JobList);
600
703
 
601
704
  function JobList(props) {
602
705
  var _this;
@@ -605,6 +708,20 @@ var JobList = /*#__PURE__*/function (_Component) {
605
708
 
606
709
  _this = _super.call(this, props);
607
710
 
711
+ _defineProperty(_assertThisInitialized(_this), "setRequesters", function (jobs) {
712
+ var requesters = _.orderBy(_.uniqBy(jobs.map(function (j) {
713
+ return {
714
+ id: j.userID,
715
+ displayName: j.userName,
716
+ profilePic: j.userProfilePic
717
+ };
718
+ }), 'id'), 'displayName', 'asc');
719
+
720
+ _this.setState({
721
+ requesters: requesters
722
+ });
723
+ });
724
+
608
725
  _defineProperty(_assertThisInitialized(_this), "getJobs", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
609
726
  var auth, res;
610
727
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -620,6 +737,8 @@ var JobList = /*#__PURE__*/function (_Component) {
620
737
  res = _context.sent;
621
738
 
622
739
  if (!_.isEmpty(res) && res[0].site === auth.site) {
740
+ _this.setRequesters(res);
741
+
623
742
  _this.props.jobsLoaded(res);
624
743
  }
625
744
 
@@ -751,6 +870,14 @@ var JobList = /*#__PURE__*/function (_Component) {
751
870
  _this.closeFilter();
752
871
  });
753
872
 
873
+ _defineProperty(_assertThisInitialized(_this), "selectPriorityFilter", function (filter) {
874
+ _this.setState({
875
+ selectedPriorityFilter: filter
876
+ });
877
+
878
+ _this.closeFilter();
879
+ });
880
+
754
881
  _defineProperty(_assertThisInitialized(_this), "selectStatusFilter", function (filter) {
755
882
  _this.setState({
756
883
  selectedStatusFilter: filter
@@ -855,6 +982,33 @@ var JobList = /*#__PURE__*/function (_Component) {
855
982
  _this.closeFilter();
856
983
  });
857
984
 
985
+ _defineProperty(_assertThisInitialized(_this), "onSelectRequester", function (user) {
986
+ _this.setState({
987
+ selectedRequester: user
988
+ });
989
+ });
990
+
991
+ _defineProperty(_assertThisInitialized(_this), "removeRequesterFilter", function () {
992
+ _this.setState({
993
+ selectedRequesterFilter: null,
994
+ selectedRequesterFilterText: null
995
+ });
996
+ });
997
+
998
+ _defineProperty(_assertThisInitialized(_this), "saveRequesterFilter", function () {
999
+ if (!_this.state.selectedRequester) {
1000
+ _this.removeRequesterFilter();
1001
+ } else {
1002
+ _this.setState({
1003
+ selectedRequesterFilter: _this.state.selectedRequester.id,
1004
+ selectedRequesterFilterText: _this.state.selectedRequester.displayName,
1005
+ selectedRequester: null
1006
+ });
1007
+ }
1008
+
1009
+ _this.closeFilter();
1010
+ });
1011
+
858
1012
  _defineProperty(_assertThisInitialized(_this), "onHandleSearchChange", function (event) {
859
1013
  var thisSearchTime = moment().valueOf();
860
1014
 
@@ -887,18 +1041,32 @@ var JobList = /*#__PURE__*/function (_Component) {
887
1041
  source = _.filter(source, function (r) {
888
1042
  return r.type === _this.state.selectedTypeFilter;
889
1043
  });
1044
+ } // filter by priority
1045
+
1046
+
1047
+ if (_this.state.selectedPriorityFilter) {
1048
+ var defaultPriority = getDefaultPriority().name;
1049
+ source = _.filter(source, function (r) {
1050
+ return r.priority === _this.state.selectedPriorityFilter || _this.state.selectedPriorityFilter === defaultPriority && _.isNil(r.priority);
1051
+ });
890
1052
  } // filter by status
891
1053
 
892
1054
 
893
1055
  if (_this.state.selectedStatusFilter) {
1056
+ var statusTypes = _this.props.statusTypes;
1057
+ var defaultStatus = statusTypes.find(function (s) {
1058
+ return s.category === STATUS_NOT_ACTIONED;
1059
+ });
894
1060
  source = _.filter(source, function (r) {
895
- var status = r.status && StatusTypes[r.status] ? r.status : 'Unassigned';
1061
+ var status = statusTypes.find(function (s) {
1062
+ return s.text === r.status;
1063
+ }) || defaultStatus;
896
1064
 
897
- if (_this.state.selectedStatusFilter === 'incomplete') {
898
- return status !== 'Completed';
1065
+ if (_this.state.selectedStatusFilter === STATUS_IMCOMPLETE) {
1066
+ return status.category !== STATUS_COMPLETED;
899
1067
  }
900
1068
 
901
- return status === _this.state.selectedStatusFilter;
1069
+ return status.text === _this.state.selectedStatusFilter;
902
1070
  });
903
1071
  }
904
1072
 
@@ -908,6 +1076,12 @@ var JobList = /*#__PURE__*/function (_Component) {
908
1076
  });
909
1077
  }
910
1078
 
1079
+ if (_this.state.selectedRequesterFilter) {
1080
+ source = _.filter(source, function (r) {
1081
+ return r.userID === _this.state.selectedRequesterFilter;
1082
+ });
1083
+ }
1084
+
911
1085
  if (!_.isEmpty(_this.state.searchTerm)) {
912
1086
  source = _.filter(source, function (r) {
913
1087
  if (r.jobId && r.jobId === _this.state.searchTerm) {
@@ -989,6 +1163,7 @@ var JobList = /*#__PURE__*/function (_Component) {
989
1163
 
990
1164
  _defineProperty(_assertThisInitialized(_this), "getExportSource", function () {
991
1165
  var customColumns = [];
1166
+ var defaultPriority = getDefaultPriority().name;
992
1167
 
993
1168
  var source = _this.getSource().map(function (r) {
994
1169
  var history = r.history || [];
@@ -1035,12 +1210,14 @@ var JobList = /*#__PURE__*/function (_Component) {
1035
1210
 
1036
1211
  var customFieldValues = _this.getCustomFields(r, customColumns);
1037
1212
 
1038
- return _objectSpread$5(_objectSpread$5(_objectSpread$5({}, r), customFieldValues), {}, {
1213
+ var priority = r.priority || defaultPriority;
1214
+ return _objectSpread$6(_objectSpread$6(_objectSpread$6({}, r), customFieldValues), {}, {
1039
1215
  notes: notes,
1040
1216
  progressTime: progressTime,
1041
1217
  completedTime: completedTime,
1042
1218
  progressDuration: progressDuration,
1043
- completedDuration: completedDuration
1219
+ completedDuration: completedDuration,
1220
+ priority: priority
1044
1221
  });
1045
1222
  }); // Compose revised columns list with custom fields
1046
1223
 
@@ -1079,7 +1256,8 @@ var JobList = /*#__PURE__*/function (_Component) {
1079
1256
  sortColumn: 'createdUnix',
1080
1257
  sortDesc: true,
1081
1258
  selectedTimeFilter: Analytics$2.getAnalyticsFilterOptions()[1],
1082
- assignees: []
1259
+ assignees: [],
1260
+ requesters: []
1083
1261
  };
1084
1262
  _this.exportColumns = [{
1085
1263
  label: 'Select All',
@@ -1096,6 +1274,9 @@ var JobList = /*#__PURE__*/function (_Component) {
1096
1274
  }, {
1097
1275
  label: 'Status',
1098
1276
  key: 'status'
1277
+ }, {
1278
+ label: 'Priority',
1279
+ key: 'priority'
1099
1280
  }, {
1100
1281
  label: 'Title',
1101
1282
  key: 'title'
@@ -1136,11 +1317,12 @@ var JobList = /*#__PURE__*/function (_Component) {
1136
1317
  _createClass(JobList, [{
1137
1318
  key: "UNSAFE_componentWillMount",
1138
1319
  value: function UNSAFE_componentWillMount() {
1139
- Session$6.checkLoggedIn(this);
1320
+ Session$7.checkLoggedIn(this);
1140
1321
  }
1141
1322
  }, {
1142
1323
  key: "componentDidMount",
1143
1324
  value: function componentDidMount() {
1325
+ this.props.jobStatusesUpdate(this.props.auth.site);
1144
1326
  this.getJobs();
1145
1327
  this.getAssignees();
1146
1328
  }
@@ -1154,7 +1336,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1154
1336
  }
1155
1337
 
1156
1338
  if (this.state.filterOpen === 'type') {
1157
- return /*#__PURE__*/React.createElement(Components$6.Popup, {
1339
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1158
1340
  title: "Select ".concat(values.textJobType),
1159
1341
  maxWidth: 600,
1160
1342
  minWidth: 400,
@@ -1165,7 +1347,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1165
1347
  })), function (t) {
1166
1348
  return t.toLowerCase();
1167
1349
  }).map(function (type) {
1168
- return /*#__PURE__*/React.createElement(Components$6.Tag, {
1350
+ return /*#__PURE__*/React.createElement(Components$7.Tag, {
1169
1351
  key: type,
1170
1352
  onClick: function onClick() {
1171
1353
  _this2.selectTypeFilter(type);
@@ -1176,28 +1358,49 @@ var JobList = /*#__PURE__*/function (_Component) {
1176
1358
  }));
1177
1359
  }
1178
1360
 
1361
+ if (this.state.filterOpen === 'priority') {
1362
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1363
+ title: "Select Priority",
1364
+ maxWidth: 600,
1365
+ minWidth: 400,
1366
+ hasPadding: true,
1367
+ onClose: this.closeFilter
1368
+ }, jobPriorityOptions.map(function (p) {
1369
+ return /*#__PURE__*/React.createElement(Components$7.Tag, {
1370
+ key: p.name,
1371
+ onClick: function onClick() {
1372
+ _this2.selectPriorityFilter(p.name);
1373
+ },
1374
+ text: p.name,
1375
+ className: "marginRight-10"
1376
+ });
1377
+ }));
1378
+ }
1379
+
1179
1380
  if (this.state.filterOpen === 'status') {
1180
- return /*#__PURE__*/React.createElement(Components$6.Popup, {
1381
+ var statusTypes = this.props.statusTypes;
1382
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1181
1383
  title: "Select Status",
1182
1384
  maxWidth: 600,
1183
1385
  minWidth: 400,
1184
1386
  hasPadding: true,
1185
1387
  onClose: this.closeFilter
1186
- }, ['incomplete'].concat(_toConsumableArray(Object.keys(StatusTypes))).map(function (sKey) {
1187
- var text = sKey === 'incomplete' ? 'All Incomplete' : StatusTypes[sKey].text;
1188
- return /*#__PURE__*/React.createElement(Components$6.Tag, {
1189
- key: sKey,
1388
+ }, [STATUS_IMCOMPLETE].concat(_toConsumableArray(statusTypes.map(function (s) {
1389
+ return s.text;
1390
+ }))).map(function (status) {
1391
+ return /*#__PURE__*/React.createElement(Components$7.Tag, {
1392
+ key: status,
1190
1393
  onClick: function onClick() {
1191
- _this2.selectStatusFilter(sKey);
1394
+ _this2.selectStatusFilter(status);
1192
1395
  },
1193
- text: text,
1194
- className: "marginRight-10"
1396
+ text: status,
1397
+ className: "marginRight-10 marginBottom-10"
1195
1398
  });
1196
1399
  }));
1197
1400
  }
1198
1401
 
1199
1402
  if (this.state.filterOpen === 'time') {
1200
- return /*#__PURE__*/React.createElement(Components$6.Popup, {
1403
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1201
1404
  title: "Select Time",
1202
1405
  maxWidth: 600,
1203
1406
  minWidth: 400,
@@ -1213,7 +1416,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1213
1416
  style: {
1214
1417
  minHeight: 150
1215
1418
  }
1216
- }, /*#__PURE__*/React.createElement(Components$6.AnalyticsFilter, {
1419
+ }, /*#__PURE__*/React.createElement(Components$7.AnalyticsFilter, {
1217
1420
  defaultFilter: this.state.selectedTimeFilter,
1218
1421
  filterChanged: this.timeFilterChanged,
1219
1422
  filterDateRangeChanged: this.timeFilterDateRangeChanged
@@ -1224,20 +1427,20 @@ var JobList = /*#__PURE__*/function (_Component) {
1224
1427
  var userContent = null;
1225
1428
 
1226
1429
  if (this.state.selectedAssignee) {
1227
- userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$6.UserListing, {
1430
+ userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$7.UserListing, {
1228
1431
  key: this.state.selectedAssignee.id,
1229
1432
  user: this.state.selectedAssignee,
1230
- rightContent: /*#__PURE__*/React.createElement(Components$6.SVGIcon, {
1433
+ rightContent: /*#__PURE__*/React.createElement(Components$7.SVGIcon, {
1231
1434
  className: "removeIcon",
1232
1435
  icon: "close",
1233
1436
  onClick: function onClick() {
1234
1437
  _this2.onSelectAssignee();
1235
1438
  },
1236
- colour: Colours$2.COLOUR_DUSK
1439
+ colour: Colours$3.COLOUR_DUSK
1237
1440
  })
1238
1441
  }));
1239
1442
  } else {
1240
- userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$6.GenericInput, {
1443
+ userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$7.GenericInput, {
1241
1444
  id: "userSearch",
1242
1445
  type: "text" // label="Search"
1243
1446
  ,
@@ -1253,7 +1456,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1253
1456
  if (_.isEmpty(_this2.state.userSearch)) return true;
1254
1457
  return u.displayName.toUpperCase().indexOf(_this2.state.userSearch.toUpperCase()) > -1;
1255
1458
  }).map(function (user) {
1256
- return /*#__PURE__*/React.createElement(Components$6.UserListing, {
1459
+ return /*#__PURE__*/React.createElement(Components$7.UserListing, {
1257
1460
  key: user.id,
1258
1461
  user: user,
1259
1462
  onClick: function onClick() {
@@ -1263,7 +1466,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1263
1466
  }));
1264
1467
  }
1265
1468
 
1266
- return /*#__PURE__*/React.createElement(Components$6.Popup, {
1469
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1267
1470
  title: "Select User",
1268
1471
  maxWidth: 600,
1269
1472
  minWidth: 400,
@@ -1278,6 +1481,64 @@ var JobList = /*#__PURE__*/function (_Component) {
1278
1481
  }, userContent);
1279
1482
  }
1280
1483
 
1484
+ if (this.state.filterOpen === 'requester') {
1485
+ var _userContent = null;
1486
+
1487
+ if (this.state.selectedRequester) {
1488
+ _userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$7.UserListing, {
1489
+ key: this.state.selectedRequester.id,
1490
+ user: this.state.selectedRequester,
1491
+ rightContent: /*#__PURE__*/React.createElement(Components$7.SVGIcon, {
1492
+ className: "removeIcon",
1493
+ icon: "close",
1494
+ onClick: function onClick() {
1495
+ _this2.onSelectRequester();
1496
+ },
1497
+ colour: Colours$3.COLOUR_DUSK
1498
+ })
1499
+ }));
1500
+ } else {
1501
+ _userContent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Components$7.GenericInput, {
1502
+ id: "requesterSearch",
1503
+ type: "text" // label="Search"
1504
+ ,
1505
+ placeholder: "Search name",
1506
+ value: this.state.requesterSearch,
1507
+ onChange: function onChange(e) {
1508
+ return _this2.onHandleChange(e);
1509
+ },
1510
+ alwaysShowLabel: true
1511
+ }), _.sortBy(this.state.requesters, function (u) {
1512
+ return u.displayName.toUpperCase();
1513
+ }).filter(function (u) {
1514
+ if (_.isEmpty(_this2.state.requesterSearch)) return true;
1515
+ return u.displayName.toUpperCase().indexOf(_this2.state.requesterSearch.toUpperCase()) > -1;
1516
+ }).map(function (user) {
1517
+ return /*#__PURE__*/React.createElement(Components$7.UserListing, {
1518
+ key: user.id,
1519
+ user: user,
1520
+ onClick: function onClick() {
1521
+ _this2.onSelectRequester(user);
1522
+ }
1523
+ });
1524
+ }));
1525
+ }
1526
+
1527
+ return /*#__PURE__*/React.createElement(Components$7.Popup, {
1528
+ title: "Select User",
1529
+ maxWidth: 600,
1530
+ minWidth: 400,
1531
+ hasPadding: true,
1532
+ onClose: this.closeFilter,
1533
+ buttons: [{
1534
+ type: 'primaryAction',
1535
+ onClick: this.saveRequesterFilter,
1536
+ text: 'Select',
1537
+ isActive: true
1538
+ }]
1539
+ }, _userContent);
1540
+ }
1541
+
1281
1542
  return null;
1282
1543
  }
1283
1544
  }, {
@@ -1285,19 +1546,33 @@ var JobList = /*#__PURE__*/function (_Component) {
1285
1546
  value: function renderRequests() {
1286
1547
  var _this3 = this;
1287
1548
 
1549
+ var statusTypes = this.props.statusTypes;
1550
+ var defaultStatus = statusTypes.find(function (s) {
1551
+ return s.category === STATUS_NOT_ACTIONED;
1552
+ });
1288
1553
  return this.getSource().map(function (ev, index) {
1289
1554
  if (!ev) {
1290
1555
  return null;
1291
1556
  }
1292
1557
 
1293
- var status = ev.status && StatusTypes[ev.status] ? StatusTypes[ev.status] : StatusTypes['Unassigned'];
1558
+ var status = ev.status && statusTypes.find(function (s) {
1559
+ return s.text === ev.status;
1560
+ }) || defaultStatus;
1561
+ var priority = getJobPriority(ev.priority);
1294
1562
  return /*#__PURE__*/React.createElement("tr", {
1295
1563
  key: index
1296
1564
  }, /*#__PURE__*/React.createElement("td", null, ev.jobId), /*#__PURE__*/React.createElement("td", {
1297
1565
  className: "table-TitleColumn"
1298
1566
  }, /*#__PURE__*/React.createElement(Link, {
1299
1567
  to: "".concat(values.routeRequestDetails, "/").concat(ev.id)
1300
- }, /*#__PURE__*/React.createElement("span", null, ev.title))), /*#__PURE__*/React.createElement("td", null, ev.type), /*#__PURE__*/React.createElement("td", null, moment.utc(ev.createdTime).local().format('D MMM YY')), /*#__PURE__*/React.createElement("td", null, ev.room), /*#__PURE__*/React.createElement("td", null, ev.Assignee ? /*#__PURE__*/React.createElement(Components$6.UserListing, {
1568
+ }, /*#__PURE__*/React.createElement("span", null, ev.title))), /*#__PURE__*/React.createElement("td", null, ev.type), /*#__PURE__*/React.createElement("td", null, moment.utc(ev.createdTime).local().format('D MMM YY')), /*#__PURE__*/React.createElement("td", null, ev.room), /*#__PURE__*/React.createElement("td", null, ev.userName ? /*#__PURE__*/React.createElement(Components$7.UserListing, {
1569
+ user: {
1570
+ id: ev.userID,
1571
+ displayName: ev.userName,
1572
+ profilePic: ev.userProfilePic
1573
+ },
1574
+ textClass: "fontSize-13"
1575
+ }) : 'Unknown'), /*#__PURE__*/React.createElement("td", null, ev.Assignee ? /*#__PURE__*/React.createElement(Components$7.UserListing, {
1301
1576
  user: ev.Assignee,
1302
1577
  textClass: "fontSize-13"
1303
1578
  }) : 'Unassigned'), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
@@ -1308,9 +1583,19 @@ var JobList = /*#__PURE__*/function (_Component) {
1308
1583
  paddingTop: 2,
1309
1584
  paddingBottom: 2,
1310
1585
  color: '#fff',
1311
- backgroundColor: status.color
1586
+ backgroundColor: status ? status.color : undefined
1312
1587
  }
1313
- }, status.text)), /*#__PURE__*/React.createElement("td", {
1588
+ }, status ? status.text : '')), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
1589
+ style: {
1590
+ textAlign: 'center',
1591
+ borderRadius: 4,
1592
+ width: 100,
1593
+ paddingTop: 2,
1594
+ paddingBottom: 2,
1595
+ color: '#fff',
1596
+ backgroundColor: priority.color
1597
+ }
1598
+ }, priority.name)), /*#__PURE__*/React.createElement("td", {
1314
1599
  className: "table-options"
1315
1600
  }, /*#__PURE__*/React.createElement("div", {
1316
1601
  style: {
@@ -1326,7 +1611,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1326
1611
  cursor: 'pointer'
1327
1612
  },
1328
1613
  name: "pencil"
1329
- })), Session$6.validateAccess(_this3.props.auth.site, values.permissionMaintenanceTracking, _this3.props.auth) && /*#__PURE__*/React.createElement("a", {
1614
+ })), Session$7.validateAccess(_this3.props.auth.site, values.permissionMaintenanceTracking, _this3.props.auth) && /*#__PURE__*/React.createElement("a", {
1330
1615
  onClick: function onClick() {
1331
1616
  return _this3.onRemoveRequest(ev);
1332
1617
  }
@@ -1454,6 +1739,15 @@ var JobList = /*#__PURE__*/function (_Component) {
1454
1739
  _this4.sortByCol('room');
1455
1740
  }
1456
1741
  }, "Address", this.renderSort('room')), /*#__PURE__*/React.createElement("th", {
1742
+ className: "".concat(this.sortIsActive('userName')),
1743
+ style: {
1744
+ cursor: 'pointer',
1745
+ width: 150
1746
+ },
1747
+ onClick: function onClick() {
1748
+ _this4.sortByCol('userName');
1749
+ }
1750
+ }, "Submitted By", this.renderSort('userName')), /*#__PURE__*/React.createElement("th", {
1457
1751
  className: "".concat(this.sortIsActive('assigned')),
1458
1752
  style: {
1459
1753
  cursor: 'pointer',
@@ -1467,6 +1761,10 @@ var JobList = /*#__PURE__*/function (_Component) {
1467
1761
  width: 120
1468
1762
  }
1469
1763
  }, "Status"), /*#__PURE__*/React.createElement("th", {
1764
+ style: {
1765
+ width: 120
1766
+ }
1767
+ }, "Priority"), /*#__PURE__*/React.createElement("th", {
1470
1768
  style: {
1471
1769
  width: 50
1472
1770
  }
@@ -1477,37 +1775,51 @@ var JobList = /*#__PURE__*/function (_Component) {
1477
1775
  value: function renderFilters() {
1478
1776
  var _this5 = this;
1479
1777
 
1480
- var typeFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1778
+ var typeFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1481
1779
  className: "marginRight-10",
1482
1780
  onClick: function onClick() {
1483
1781
  _this5.openFilter('type');
1484
1782
  },
1485
1783
  text: values.textJobType
1486
1784
  });
1487
- var statusFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1785
+ var statusFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1488
1786
  className: "marginRight-10",
1489
1787
  onClick: function onClick() {
1490
1788
  _this5.openFilter('status');
1491
1789
  },
1492
1790
  text: "Status"
1493
1791
  });
1494
- var timeFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1792
+ var priorityFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1793
+ className: "marginRight-10",
1794
+ onClick: function onClick() {
1795
+ _this5.openFilter('priority');
1796
+ },
1797
+ text: "Priority"
1798
+ });
1799
+ var timeFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1495
1800
  className: "marginRight-10",
1496
1801
  onClick: function onClick() {
1497
1802
  _this5.openFilter('time');
1498
1803
  },
1499
1804
  text: "Time"
1500
1805
  });
1501
- var userFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1806
+ var userFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1502
1807
  className: "marginRight-10",
1503
1808
  onClick: function onClick() {
1504
1809
  _this5.openFilter('user');
1505
1810
  },
1506
1811
  text: "Assigned To"
1507
1812
  });
1813
+ var requesterFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1814
+ className: "marginRight-10",
1815
+ onClick: function onClick() {
1816
+ _this5.openFilter('requester');
1817
+ },
1818
+ text: "Submitted By"
1819
+ });
1508
1820
 
1509
1821
  if (this.state.selectedTypeFilter) {
1510
- typeFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1822
+ typeFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1511
1823
  className: "marginRight-10",
1512
1824
  onClick: function onClick() {
1513
1825
  _this5.openFilter('type');
@@ -1522,8 +1834,24 @@ var JobList = /*#__PURE__*/function (_Component) {
1522
1834
  });
1523
1835
  }
1524
1836
 
1837
+ if (this.state.selectedPriorityFilter) {
1838
+ priorityFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1839
+ className: "marginRight-10",
1840
+ onClick: function onClick() {
1841
+ _this5.openFilter('priority');
1842
+ },
1843
+ rightIcon: "close",
1844
+ rightClick: function rightClick(e) {
1845
+ e.stopPropagation();
1846
+
1847
+ _this5.selectPriorityFilter();
1848
+ },
1849
+ text: this.state.selectedPriorityFilter
1850
+ });
1851
+ }
1852
+
1525
1853
  if (this.state.selectedStatusFilter) {
1526
- statusFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1854
+ statusFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1527
1855
  className: "marginRight-10",
1528
1856
  onClick: function onClick() {
1529
1857
  _this5.openFilter('status');
@@ -1534,12 +1862,12 @@ var JobList = /*#__PURE__*/function (_Component) {
1534
1862
 
1535
1863
  _this5.selectStatusFilter();
1536
1864
  },
1537
- text: this.state.selectedStatusFilter === 'incomplete' ? 'All Incomplete' : StatusTypes[this.state.selectedStatusFilter].text
1865
+ text: this.state.selectedStatusFilter
1538
1866
  });
1539
1867
  }
1540
1868
 
1541
1869
  if (this.state.selectedTimeFilterText) {
1542
- timeFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1870
+ timeFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1543
1871
  className: "marginRight-10",
1544
1872
  onClick: function onClick() {
1545
1873
  _this5.openFilter('time');
@@ -1555,7 +1883,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1555
1883
  }
1556
1884
 
1557
1885
  if (this.state.selectedUserFilter) {
1558
- userFilter = /*#__PURE__*/React.createElement(Components$6.Tag, {
1886
+ userFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1559
1887
  className: "marginRight-10",
1560
1888
  onClick: function onClick() {
1561
1889
  _this5.openFilter('user');
@@ -1570,20 +1898,36 @@ var JobList = /*#__PURE__*/function (_Component) {
1570
1898
  });
1571
1899
  }
1572
1900
 
1901
+ if (this.state.selectedRequesterFilter) {
1902
+ requesterFilter = /*#__PURE__*/React.createElement(Components$7.Tag, {
1903
+ className: "marginRight-10",
1904
+ onClick: function onClick() {
1905
+ _this5.openFilter('requester');
1906
+ },
1907
+ rightIcon: "close",
1908
+ rightClick: function rightClick(e) {
1909
+ e.stopPropagation();
1910
+
1911
+ _this5.removeRequesterFilter();
1912
+ },
1913
+ text: this.state.selectedRequesterFilterText
1914
+ });
1915
+ }
1916
+
1573
1917
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1574
1918
  className: "marginTop-20 flex flex-between flex-center"
1575
1919
  }, /*#__PURE__*/React.createElement("div", {
1576
1920
  className: "flex flex-center"
1577
- }, /*#__PURE__*/React.createElement(Components$6.Text, {
1921
+ }, /*#__PURE__*/React.createElement(Components$7.Text, {
1578
1922
  type: "h5",
1579
1923
  className: "marginRight-20"
1580
- }, "Filter by"), typeFilter, statusFilter, timeFilter, userFilter), /*#__PURE__*/React.createElement(Components$6.Button, {
1924
+ }, "Filter by"), typeFilter, statusFilter, priorityFilter, timeFilter, userFilter, requesterFilter), /*#__PURE__*/React.createElement(Components$7.Button, {
1581
1925
  inline: true,
1582
1926
  buttonType: "primaryAction",
1583
1927
  leftIcon: "file-code-o",
1584
1928
  onClick: this.onOpenExportCsv,
1585
1929
  isActive: !_.isEmpty(this.getSource())
1586
- }, "Export CSV")), /*#__PURE__*/React.createElement(Components$6.GenericInput, {
1930
+ }, "Export CSV")), /*#__PURE__*/React.createElement(Components$7.GenericInput, {
1587
1931
  id: "search",
1588
1932
  type: "text",
1589
1933
  placeholder: "Search by ".concat(values.textEntityName, " ID, Address or Title"),
@@ -1608,7 +1952,7 @@ var JobList = /*#__PURE__*/function (_Component) {
1608
1952
  columns = _this$getExportSource.columns,
1609
1953
  source = _this$getExportSource.source;
1610
1954
 
1611
- return /*#__PURE__*/React.createElement(Components$6.ExportCsvPopup, {
1955
+ return /*#__PURE__*/React.createElement(Components$7.ExportCsvPopup, {
1612
1956
  onClose: this.onCloseExportCsv,
1613
1957
  columns: columns,
1614
1958
  source: source,
@@ -1629,30 +1973,32 @@ var JobList = /*#__PURE__*/function (_Component) {
1629
1973
  return JobList;
1630
1974
  }(Component);
1631
1975
 
1632
- var mapStateToProps$6 = function mapStateToProps(state) {
1976
+ var mapStateToProps$7 = function mapStateToProps(state) {
1633
1977
  var auth = state.auth;
1634
1978
  return {
1635
1979
  jobs: state[values.reducerKey].jobs,
1636
1980
  auth: auth,
1637
- strings: state.strings && state.strings.config || {}
1981
+ strings: state.strings && state.strings.config || {},
1982
+ statusTypes: state[values.reducerKey].jobstatuses
1638
1983
  };
1639
1984
  };
1640
1985
 
1641
- var JobList$1 = connect(mapStateToProps$6, {
1986
+ var JobList$1 = connect(mapStateToProps$7, {
1642
1987
  jobsLoaded: jobsLoaded,
1643
- removeJob: removeJob
1988
+ removeJob: removeJob,
1989
+ jobStatusesUpdate: jobStatusesUpdate
1644
1990
  })(withRouter(JobList));
1645
1991
 
1646
- function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1992
+ function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1647
1993
 
1648
- function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1649
- var Session$5 = PlussCore.Session,
1650
- Components$5 = PlussCore.Components;
1994
+ function _isNativeReflectConstruct$b() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1995
+ var Session$6 = PlussCore.Session,
1996
+ Components$6 = PlussCore.Components;
1651
1997
 
1652
1998
  var JobTypes = /*#__PURE__*/function (_Component) {
1653
1999
  _inherits(JobTypes, _Component);
1654
2000
 
1655
- var _super = _createSuper$a(JobTypes);
2001
+ var _super = _createSuper$b(JobTypes);
1656
2002
 
1657
2003
  function JobTypes(props) {
1658
2004
  var _this;
@@ -1778,7 +2124,7 @@ var JobTypes = /*#__PURE__*/function (_Component) {
1778
2124
  key: "componentWillMount",
1779
2125
  value: function componentWillMount() {
1780
2126
  this.updateProps(this.props);
1781
- Session$5.checkLoggedIn(this, this.props.auth);
2127
+ Session$6.checkLoggedIn(this, this.props.auth);
1782
2128
  }
1783
2129
  }, {
1784
2130
  key: "componentDidMount",
@@ -1825,7 +2171,7 @@ var JobTypes = /*#__PURE__*/function (_Component) {
1825
2171
  display: 'flex',
1826
2172
  alignItems: 'center'
1827
2173
  }
1828
- }, Session$5.validateAccess(_this2.props.auth.site, values.permissionMaintenanceTypes, _this2.props.auth) && /*#__PURE__*/React.createElement(Link, {
2174
+ }, Session$6.validateAccess(_this2.props.auth.site, values.permissionMaintenanceTypes, _this2.props.auth) && /*#__PURE__*/React.createElement(Link, {
1829
2175
  to: "".concat(values.routeAddRequestType, "/").concat(ev.id)
1830
2176
  }, /*#__PURE__*/React.createElement(FontAwesome, {
1831
2177
  style: {
@@ -1835,7 +2181,7 @@ var JobTypes = /*#__PURE__*/function (_Component) {
1835
2181
  cursor: 'pointer'
1836
2182
  },
1837
2183
  name: "pencil"
1838
- })), Session$5.validateAccess(_this2.props.auth.site, values.permissionMaintenanceTypes, _this2.props.auth) && /*#__PURE__*/React.createElement("a", {
2184
+ })), Session$6.validateAccess(_this2.props.auth.site, values.permissionMaintenanceTypes, _this2.props.auth) && /*#__PURE__*/React.createElement("a", {
1839
2185
  onClick: function onClick() {
1840
2186
  return _this2.onRemoveJobType(ev);
1841
2187
  }
@@ -1922,50 +2268,581 @@ var JobTypes = /*#__PURE__*/function (_Component) {
1922
2268
  maxWidth: 500,
1923
2269
  textAlign: 'center'
1924
2270
  }
1925
- }, values.textEmptyJobTypesExample));
2271
+ }, values.textEmptyJobTypesExample));
2272
+ }
2273
+ }, {
2274
+ key: "renderContent",
2275
+ value: function renderContent() {
2276
+ if (_.isEmpty(this.state.jobList)) return this.renderEmpty();
2277
+ return this.renderView();
2278
+ }
2279
+ }, {
2280
+ key: "renderJobTypes",
2281
+ value: function renderJobTypes() {
2282
+ var _this$state = this.state,
2283
+ jobList = _this$state.jobList,
2284
+ loading = _this$state.loading;
2285
+
2286
+ if (jobList.length === 0 && loading) {
2287
+ return /*#__PURE__*/React.createElement("div", {
2288
+ style: {
2289
+ minWidth: '100%'
2290
+ }
2291
+ }, /*#__PURE__*/React.createElement("div", {
2292
+ className: "padding-60 paddingVertical-40",
2293
+ style: {
2294
+ textAlign: 'center'
2295
+ }
2296
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
2297
+ style: {
2298
+ fontSize: 30,
2299
+ color: FeatureConfig.env.colourBrandingOff
2300
+ },
2301
+ name: "spinner fa-pulse fa-fw"
2302
+ })));
2303
+ }
2304
+
2305
+ return /*#__PURE__*/React.createElement("div", {
2306
+ style: {
2307
+ minWidth: '100%'
2308
+ }
2309
+ }, /*#__PURE__*/React.createElement("div", {
2310
+ className: "marginBottom-32"
2311
+ }, /*#__PURE__*/React.createElement(Components$6.AddButton, {
2312
+ onClick: this.props.onNew,
2313
+ text: values.textNewTypeButton
2314
+ })), this.renderContent());
2315
+ }
2316
+ }, {
2317
+ key: "render",
2318
+ value: function render() {
2319
+ return /*#__PURE__*/React.createElement("div", {
2320
+ style: {
2321
+ minWidth: '100%'
2322
+ }
2323
+ }, /*#__PURE__*/React.createElement("div", null, this.renderJobTypes()), /*#__PURE__*/React.createElement("div", {
2324
+ className: "hub_tidioPadding"
2325
+ }));
2326
+ }
2327
+ }]);
2328
+
2329
+ return JobTypes;
2330
+ }(Component);
2331
+
2332
+ var mapStateToProps$6 = function mapStateToProps(state) {
2333
+ var auth = state.auth;
2334
+ return {
2335
+ jobtypes: state[values.reducerKey].jobtypes,
2336
+ auth: auth
2337
+ };
2338
+ };
2339
+
2340
+ var JobTypes$1 = connect(mapStateToProps$6, {
2341
+ jobTypesLoaded: jobTypesLoaded,
2342
+ jobTypesUpdate: jobTypesUpdate
2343
+ })(withRouter(JobTypes));
2344
+
2345
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2346
+
2347
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2348
+
2349
+ function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2350
+
2351
+ function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2352
+ var Session$5 = PlussCore.Session,
2353
+ Components$5 = PlussCore.Components,
2354
+ Colours$2 = PlussCore.Colours;
2355
+
2356
+ var Configuration = /*#__PURE__*/function (_Component) {
2357
+ _inherits(Configuration, _Component);
2358
+
2359
+ var _super = _createSuper$a(Configuration);
2360
+
2361
+ function Configuration(props) {
2362
+ var _this;
2363
+
2364
+ _classCallCheck(this, Configuration);
2365
+
2366
+ _this = _super.call(this, props);
2367
+
2368
+ _defineProperty(_assertThisInitialized(_this), "isStatusValid", function (statusLabel, statusCategory, statusColour) {
2369
+ if (_.isEmpty(statusLabel)) return false;
2370
+ if (_.isEmpty(statusCategory)) return false;
2371
+ if (_.isEmpty(statusColour)) return false;
2372
+ return true;
2373
+ });
2374
+
2375
+ _defineProperty(_assertThisInitialized(_this), "onMoveStatus", function (index) {
2376
+ var up = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2377
+ if (_this.state.fetchingStatusTypes) return;
2378
+
2379
+ var statusTypes = _.cloneDeep(_this.state.statusTypes);
2380
+
2381
+ if (up && index > 0) {
2382
+ // Moving up
2383
+ var _ref = [statusTypes[index], statusTypes[index - 1]];
2384
+ statusTypes[index - 1] = _ref[0];
2385
+ statusTypes[index] = _ref[1];
2386
+ } else if (index < statusTypes.length - 1) {
2387
+ // Moving down
2388
+ var _ref2 = [statusTypes[index + 1], statusTypes[index]];
2389
+ statusTypes[index] = _ref2[0];
2390
+ statusTypes[index + 1] = _ref2[1];
2391
+ } // Reset order
2392
+
2393
+
2394
+ statusTypes.forEach(function (status, index) {
2395
+ return status.order = index;
2396
+ });
2397
+
2398
+ _this.setState({
2399
+ statusTypes: statusTypes
2400
+ });
2401
+ });
2402
+
2403
+ _defineProperty(_assertThisInitialized(_this), "onEditStatus", function (index) {
2404
+ if (_this.state.fetchingStatusTypes) return;
2405
+ var status = _this.state.statusTypes[index];
2406
+
2407
+ _this.setState({
2408
+ showWarnings: false,
2409
+ showStatusPopup: true,
2410
+ selectedStatusIndex: index,
2411
+ statusLabel: status.text,
2412
+ statusCategory: status.category,
2413
+ statusColour: status.color
2414
+ });
2415
+ });
2416
+
2417
+ _defineProperty(_assertThisInitialized(_this), "onDeleteStatus", function (index) {
2418
+ if (_this.state.fetchingStatusTypes) return;
2419
+
2420
+ var statusTypes = _.cloneDeep(_this.state.statusTypes);
2421
+
2422
+ statusTypes.splice(index, 1);
2423
+
2424
+ _this.setState({
2425
+ statusTypes: statusTypes
2426
+ });
2427
+ });
2428
+
2429
+ _defineProperty(_assertThisInitialized(_this), "onAddStatus", function () {
2430
+ var defaultStatus = _this.props.statusTypes.find(function (s) {
2431
+ return s.category === STATUS_NOT_ACTIONED;
2432
+ });
2433
+
2434
+ _this.setState({
2435
+ showWarnings: false,
2436
+ showStatusPopup: true,
2437
+ selectedStatusIndex: -1,
2438
+ statusLabel: '',
2439
+ statusCategory: STATUS_NOT_ACTIONED,
2440
+ statusColour: defaultStatus.color
2441
+ });
2442
+ });
2443
+
2444
+ _defineProperty(_assertThisInitialized(_this), "onSaveStatus", function () {
2445
+ var _this$state = _this.state,
2446
+ selectedStatusIndex = _this$state.selectedStatusIndex,
2447
+ statusLabel = _this$state.statusLabel,
2448
+ statusCategory = _this$state.statusCategory,
2449
+ statusColour = _this$state.statusColour;
2450
+
2451
+ var statusTypes = _.cloneDeep(_this.state.statusTypes);
2452
+
2453
+ if (selectedStatusIndex < 0) {
2454
+ statusTypes.push({
2455
+ text: statusLabel,
2456
+ order: statusTypes.length,
2457
+ color: statusColour,
2458
+ category: statusCategory
2459
+ });
2460
+ } else {
2461
+ var status = statusTypes[selectedStatusIndex];
2462
+ status.text = statusLabel;
2463
+ status.color = statusColour;
2464
+ status.category = statusCategory;
2465
+ }
2466
+
2467
+ _this.setState({
2468
+ statusTypes: statusTypes,
2469
+ showStatusPopup: false
2470
+ });
2471
+ });
2472
+
2473
+ _defineProperty(_assertThisInitialized(_this), "onHideStatusPopup", function () {
2474
+ if (_this.state.submitting) return;
2475
+
2476
+ _this.setState({
2477
+ showStatusPopup: false
2478
+ });
2479
+ });
2480
+
2481
+ _defineProperty(_assertThisInitialized(_this), "onHandleChange", function (event) {
2482
+ var stateChange = {};
2483
+ stateChange[event.target.getAttribute('id')] = event.target.value;
2484
+
2485
+ _this.setState(stateChange);
2486
+ });
2487
+
2488
+ _defineProperty(_assertThisInitialized(_this), "onToggleDisableSeen", function () {
2489
+ if (_this.state.fetchingHideSeen) return;
2490
+
2491
+ _this.setState({
2492
+ hideSeen: !_this.state.hideSeen
2493
+ });
2494
+ });
2495
+
2496
+ _defineProperty(_assertThisInitialized(_this), "onSaveConfig", function () {
2497
+ if (!_this.validateForm()) return;
2498
+
2499
+ _this.setState({
2500
+ success: false,
2501
+ submitting: true
2502
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
2503
+ var _this$state2, statusTypes, hideSeen;
2504
+
2505
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
2506
+ while (1) {
2507
+ switch (_context.prev = _context.next) {
2508
+ case 0:
2509
+ _context.prev = 0;
2510
+ _this$state2 = _this.state, statusTypes = _this$state2.statusTypes, hideSeen = _this$state2.hideSeen;
2511
+ _context.next = 4;
2512
+ return stringActions.setString(_this.props.auth.site, values.stringConfigJobStatus, statusTypes);
2513
+
2514
+ case 4:
2515
+ _context.next = 6;
2516
+ return stringActions.setString(_this.props.auth.site, values.stringConfigHideSeen, hideSeen);
2517
+
2518
+ case 6:
2519
+ _this.props.jobStatusesLoaded(statusTypes);
2520
+
2521
+ _this.props.jobHideSeenLoaded(hideSeen);
2522
+
2523
+ _this.setState({
2524
+ success: true
2525
+ });
2526
+
2527
+ _context.next = 15;
2528
+ break;
2529
+
2530
+ case 11:
2531
+ _context.prev = 11;
2532
+ _context.t0 = _context["catch"](0);
2533
+ console.log('onSaveConfig - error', _context.t0);
2534
+
2535
+ _this.setState({
2536
+ success: false
2537
+ });
2538
+
2539
+ case 15:
2540
+ _context.prev = 15;
2541
+
2542
+ _this.setState({
2543
+ submitting: false
2544
+ });
2545
+
2546
+ return _context.finish(15);
2547
+
2548
+ case 18:
2549
+ case "end":
2550
+ return _context.stop();
2551
+ }
2552
+ }
2553
+ }, _callee, null, [[0, 11, 15, 18]]);
2554
+ })));
2555
+ });
2556
+
2557
+ _this.state = {
2558
+ success: false,
2559
+ submitting: false,
2560
+ selectedStatusIndex: -1,
2561
+ showStatusPopup: false,
2562
+ statusLabel: '',
2563
+ statusCategory: STATUS_NOT_ACTIONED,
2564
+ statusColour: '',
2565
+ fetchingStatusTypes: true,
2566
+ statusTypes: _this.props.statusTypes,
2567
+ fetchingHideSeen: true,
2568
+ hideSeen: _this.props.hideSeen
2569
+ };
2570
+ return _this;
2571
+ }
2572
+
2573
+ _createClass(Configuration, [{
2574
+ key: "UNSAFE_componentWillMount",
2575
+ value: function UNSAFE_componentWillMount() {
2576
+ Session$5.checkLoggedIn(this);
2577
+ }
2578
+ }, {
2579
+ key: "componentDidMount",
2580
+ value: function componentDidMount() {
2581
+ var _this2 = this;
2582
+
2583
+ if (!Session$5.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth, true)) {
2584
+ this.props.history.push('/mastermenu');
2585
+ } else {
2586
+ this.props.jobStatusesUpdate(this.props.auth.site, function (statusTypes) {
2587
+ return _this2.setState({
2588
+ statusTypes: statusTypes,
2589
+ fetchingStatusTypes: false
2590
+ });
2591
+ });
2592
+ this.props.jobHideSeenUpdate(this.props.auth.site, function (hideSeen) {
2593
+ return _this2.setState({
2594
+ hideSeen: hideSeen,
2595
+ fetchingHideSeen: false
2596
+ });
2597
+ });
2598
+ }
2599
+ }
2600
+ }, {
2601
+ key: "validateForm",
2602
+ value: function validateForm() {
2603
+ var _this3 = this;
2604
+
2605
+ var _this$state3 = this.state,
2606
+ submitting = _this$state3.submitting,
2607
+ statusTypes = _this$state3.statusTypes;
2608
+ if (submitting) return false; // Validate statuses
2609
+
2610
+ var statusesValid = statusTypes.map(function (status) {
2611
+ var text = status.text,
2612
+ category = status.category,
2613
+ color = status.color;
2614
+ return _this3.isStatusValid(text, category, color);
2615
+ });
2616
+ if (!statusesValid.every(function (valid) {
2617
+ return valid;
2618
+ })) return false;
2619
+ return true;
2620
+ }
2621
+ }, {
2622
+ key: "renderStatuses",
2623
+ value: function renderStatuses() {
2624
+ var _this4 = this;
2625
+
2626
+ var statusTypes = this.state.statusTypes;
2627
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
2628
+ className: "fontMedium fontSize-36 text-dark"
2629
+ }, "Statuses"), /*#__PURE__*/React.createElement("div", {
2630
+ style: styles$6.statusCategoryHeading
2631
+ }, /*#__PURE__*/React.createElement("span", {
2632
+ className: "fontMedium fontSize-16 text-bold"
2633
+ }, "Status Category")), statusTypes.map(function (status, index) {
2634
+ return /*#__PURE__*/React.createElement("div", {
2635
+ key: "".concat(status.text, "_").concat(index),
2636
+ style: styles$6.statusTypeContainer
2637
+ }, /*#__PURE__*/React.createElement("div", {
2638
+ key: status.text,
2639
+ className: "statusLabel",
2640
+ style: _objectSpread$5(_objectSpread$5({}, styles$6.statusTextContainer), {}, {
2641
+ backgroundColor: status.color
2642
+ })
2643
+ }, /*#__PURE__*/React.createElement("span", {
2644
+ className: "statusLabel_text"
2645
+ }, status.text)), /*#__PURE__*/React.createElement("div", {
2646
+ style: styles$6.statusCategoryContainer
2647
+ }, /*#__PURE__*/React.createElement("span", {
2648
+ className: "fontMedium fontSize-16 text-dark"
2649
+ }, status.category)), /*#__PURE__*/React.createElement(FontAwesome, {
2650
+ style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2651
+ visibility: index === 0 ? 'hidden' : 'visible'
2652
+ }),
2653
+ name: 'arrow-up',
2654
+ onClick: function onClick() {
2655
+ return _this4.onMoveStatus(index, true);
2656
+ }
2657
+ }), /*#__PURE__*/React.createElement(FontAwesome, {
2658
+ style: _objectSpread$5(_objectSpread$5({}, styles$6.statusIcon), {}, {
2659
+ visibility: index === statusTypes.length - 1 ? 'hidden' : 'visible'
2660
+ }),
2661
+ name: 'arrow-down',
2662
+ onClick: function onClick() {
2663
+ return _this4.onMoveStatus(index, false);
2664
+ }
2665
+ }), /*#__PURE__*/React.createElement(FontAwesome, {
2666
+ style: _objectSpread$5({}, styles$6.statusIcon),
2667
+ name: "pencil",
2668
+ onClick: function onClick() {
2669
+ return _this4.onEditStatus(index);
2670
+ }
2671
+ }), /*#__PURE__*/React.createElement(FontAwesome, {
2672
+ style: _objectSpread$5({}, styles$6.statusIcon),
2673
+ name: "minus-circle",
2674
+ onClick: function onClick() {
2675
+ return _this4.onDeleteStatus(index);
2676
+ }
2677
+ }));
2678
+ }), /*#__PURE__*/React.createElement("div", {
2679
+ onClick: this.onAddStatus,
2680
+ style: {
2681
+ display: 'flex',
2682
+ flexDirection: 'row',
2683
+ alignItems: 'center',
2684
+ marginTop: 16
2685
+ }
2686
+ }, /*#__PURE__*/React.createElement(Components$5.P60Icon, {
2687
+ className: "addoption_plus",
2688
+ icon: "add",
2689
+ style: {
2690
+ fontSize: 12
2691
+ }
2692
+ }), /*#__PURE__*/React.createElement("p", {
2693
+ className: "addoption_text"
2694
+ }, "Add another status")));
1926
2695
  }
1927
2696
  }, {
1928
- key: "renderContent",
1929
- value: function renderContent() {
1930
- if (_.isEmpty(this.state.jobList)) return this.renderEmpty();
1931
- return this.renderView();
2697
+ key: "renderOtherOptions",
2698
+ value: function renderOtherOptions() {
2699
+ return /*#__PURE__*/React.createElement("div", {
2700
+ className: "marginTop-55"
2701
+ }, /*#__PURE__*/React.createElement("p", {
2702
+ className: "fontMedium fontSize-36 text-dark"
2703
+ }, "Other options"), /*#__PURE__*/React.createElement(Components$5.CheckBox, {
2704
+ label: "Disable whether a request has been \"Seen\" and prevent that from being surfaced to the App user",
2705
+ isActive: this.state.hideSeen,
2706
+ onChange: this.onToggleDisableSeen
2707
+ }));
1932
2708
  }
1933
2709
  }, {
1934
- key: "renderJobTypes",
1935
- value: function renderJobTypes() {
1936
- var _this$state = this.state,
1937
- jobList = _this$state.jobList,
1938
- loading = _this$state.loading;
2710
+ key: "renderSubmit",
2711
+ value: function renderSubmit() {
2712
+ if (this.state.submitting) {
2713
+ return /*#__PURE__*/React.createElement(Components$5.Button, {
2714
+ buttonType: "secondary"
2715
+ }, "Saving...");
2716
+ }
1939
2717
 
1940
- if (jobList.length === 0 && loading) {
1941
- return /*#__PURE__*/React.createElement("div", {
1942
- style: {
1943
- minWidth: '100%'
1944
- }
2718
+ return /*#__PURE__*/React.createElement(Components$5.Button, {
2719
+ inline: true,
2720
+ buttonType: "primary",
2721
+ onClick: this.onSaveConfig,
2722
+ isActive: this.validateForm()
2723
+ }, "Save");
2724
+ }
2725
+ }, {
2726
+ key: "renderSuccess",
2727
+ value: function renderSuccess() {
2728
+ if (!this.state.success) return null;
2729
+ return /*#__PURE__*/React.createElement("span", {
2730
+ style: _objectSpread$5(_objectSpread$5({}, styles$6.savedText), {}, {
2731
+ color: Colours$2.COLOUR_GREEN
2732
+ })
2733
+ }, "Saved");
2734
+ }
2735
+ }, {
2736
+ key: "renderNewStatusPopup",
2737
+ value: function renderNewStatusPopup() {
2738
+ var _ref4,
2739
+ _this5 = this;
2740
+
2741
+ var _this$state4 = this.state,
2742
+ submitting = _this$state4.submitting,
2743
+ showStatusPopup = _this$state4.showStatusPopup,
2744
+ showWarnings = _this$state4.showWarnings,
2745
+ selectedStatusIndex = _this$state4.selectedStatusIndex,
2746
+ statusLabel = _this$state4.statusLabel,
2747
+ statusCategory = _this$state4.statusCategory,
2748
+ statusColour = _this$state4.statusColour;
2749
+ if (!showStatusPopup) return null;
2750
+ var canSave = !submitting && this.isStatusValid(statusLabel, statusCategory, statusColour);
2751
+ return /*#__PURE__*/React.createElement(Components$5.Popup, {
2752
+ maxWidth: 800,
2753
+ minWidth: 450,
2754
+ hasPadding: true,
2755
+ buttons: [(_ref4 = {
2756
+ type: 'primaryAction',
2757
+ onClick: this.onSaveStatus,
2758
+ isActive: canSave
2759
+ }, _defineProperty(_ref4, "isActive", true), _defineProperty(_ref4, "text", submitting ? 'Saving...' : 'Save'), _defineProperty(_ref4, "className", 'popupButton'), _ref4), {
2760
+ type: 'outlinedAction',
2761
+ onClick: this.onHideStatusPopup,
2762
+ isActive: !submitting,
2763
+ text: 'Cancel',
2764
+ className: 'popupButton'
2765
+ }],
2766
+ onClose: this.onHideStatusPopup,
2767
+ title: selectedStatusIndex < 0 ? 'New Status' : 'Edit Status'
2768
+ }, /*#__PURE__*/React.createElement(Components$5.GenericInput, {
2769
+ id: "statusLabel",
2770
+ type: "text",
2771
+ label: "Label",
2772
+ placeholder: "Status label",
2773
+ value: statusLabel,
2774
+ onChange: this.onHandleChange,
2775
+ isRequired: true,
2776
+ isValid: function isValid() {
2777
+ return !_.isEmpty(statusLabel);
2778
+ },
2779
+ showError: function showError() {
2780
+ return showWarnings && _.isEmpty(statusLabel);
2781
+ },
2782
+ alwaysShowLabel: true,
2783
+ className: "marginBottom-20"
2784
+ }), /*#__PURE__*/React.createElement(Components$5.RadioButton, {
2785
+ label: "Status Category",
2786
+ subLabel: /*#__PURE__*/React.createElement("div", {
2787
+ className: "marginBottom-16"
1945
2788
  }, /*#__PURE__*/React.createElement("div", {
1946
- className: "padding-60 paddingVertical-40",
1947
- style: {
1948
- textAlign: 'center'
2789
+ className: "marginBottom-4"
2790
+ }, 'This is used to categorise statuses for filtering and analytics purposes'), /*#__PURE__*/React.createElement("div", {
2791
+ className: "text-bold"
2792
+ }, 'This status is considered')),
2793
+ className: "marginBottom-20",
2794
+ rowStyle: {
2795
+ flexDirection: 'column'
2796
+ },
2797
+ buttonStyle: {
2798
+ marginBottom: 8
2799
+ },
2800
+ isActive: statusCategory || null,
2801
+ options: [{
2802
+ Label: STATUS_NOT_ACTIONED,
2803
+ Value: STATUS_NOT_ACTIONED,
2804
+ onChange: function onChange() {
2805
+ return _this5.setState({
2806
+ statusCategory: STATUS_NOT_ACTIONED
2807
+ });
1949
2808
  }
1950
- }, /*#__PURE__*/React.createElement(FontAwesome, {
1951
- style: {
1952
- fontSize: 30,
1953
- color: FeatureConfig.env.colourBrandingOff
1954
- },
1955
- name: "spinner fa-pulse fa-fw"
1956
- })));
1957
- }
1958
-
1959
- return /*#__PURE__*/React.createElement("div", {
1960
- style: {
1961
- minWidth: '100%'
2809
+ }, {
2810
+ Label: STATUS_IN_PROGRESS,
2811
+ Value: STATUS_IN_PROGRESS,
2812
+ onChange: function onChange() {
2813
+ return _this5.setState({
2814
+ statusCategory: STATUS_IN_PROGRESS
2815
+ });
2816
+ }
2817
+ }, {
2818
+ Label: STATUS_COMPLETED,
2819
+ Value: STATUS_COMPLETED,
2820
+ onChange: function onChange() {
2821
+ return _this5.setState({
2822
+ statusCategory: STATUS_COMPLETED
2823
+ });
2824
+ }
2825
+ }]
2826
+ }), /*#__PURE__*/React.createElement(Components$5.ColourOptions, {
2827
+ options: ['vibrant', 'picker'],
2828
+ defaultTab: "vibrant",
2829
+ value: statusColour,
2830
+ onColourSelected: function onColourSelected(statusColour) {
2831
+ return _this5.setState({
2832
+ statusColour: statusColour
2833
+ });
1962
2834
  }
2835
+ }), /*#__PURE__*/React.createElement("div", {
2836
+ className: "marginTop-24"
1963
2837
  }, /*#__PURE__*/React.createElement("div", {
1964
- className: "marginBottom-32"
1965
- }, /*#__PURE__*/React.createElement(Components$5.AddButton, {
1966
- onClick: this.props.onNew,
1967
- text: values.textNewTypeButton
1968
- })), this.renderContent());
2838
+ className: "fieldLabel marginBottom-4"
2839
+ }, "Preview"), /*#__PURE__*/React.createElement(Components$5.Tag, {
2840
+ text: this.state.statusLabel,
2841
+ style: {
2842
+ backgroundColor: statusColour,
2843
+ borderColor: statusColour
2844
+ }
2845
+ })));
1969
2846
  }
1970
2847
  }, {
1971
2848
  key: "render",
@@ -1974,27 +2851,68 @@ var JobTypes = /*#__PURE__*/function (_Component) {
1974
2851
  style: {
1975
2852
  minWidth: '100%'
1976
2853
  }
1977
- }, /*#__PURE__*/React.createElement("div", null, this.renderJobTypes()), /*#__PURE__*/React.createElement("div", {
1978
- className: "hub_tidioPadding"
1979
- }));
2854
+ }, this.renderStatuses(), this.renderOtherOptions(), /*#__PURE__*/React.createElement("div", {
2855
+ style: {
2856
+ paddingTop: 24,
2857
+ paddingBottom: 24
2858
+ }
2859
+ }, this.renderSubmit(), this.renderSuccess()), this.renderNewStatusPopup());
1980
2860
  }
1981
2861
  }]);
1982
2862
 
1983
- return JobTypes;
2863
+ return Configuration;
1984
2864
  }(Component);
1985
2865
 
2866
+ var styles$6 = {
2867
+ statusCategoryHeading: {
2868
+ marginLeft: 130,
2869
+ width: 160,
2870
+ textAlign: 'center',
2871
+ marginBottom: 12
2872
+ },
2873
+ statusTypeContainer: {
2874
+ display: 'flex',
2875
+ flexDirection: 'row',
2876
+ alignItems: 'center',
2877
+ marginBottom: 20
2878
+ },
2879
+ statusTextContainer: {
2880
+ width: 130
2881
+ },
2882
+ statusCategoryContainer: {
2883
+ width: 160,
2884
+ textAlign: 'center'
2885
+ },
2886
+ statusIcon: {
2887
+ cursor: 'pointer',
2888
+ fontSize: 20,
2889
+ padding: 5,
2890
+ marginLeft: 10,
2891
+ color: Colours$2.COLOUR_BRANDING_ACTION,
2892
+ visibility: 'visible'
2893
+ },
2894
+ savedText: {
2895
+ fontSize: 14,
2896
+ lineHeight: '33px',
2897
+ marginLeft: 15
2898
+ }
2899
+ };
2900
+
1986
2901
  var mapStateToProps$5 = function mapStateToProps(state) {
1987
2902
  var auth = state.auth;
1988
2903
  return {
1989
- jobtypes: state[values.reducerKey].jobtypes,
1990
- auth: auth
2904
+ auth: auth,
2905
+ statusTypes: state[values.reducerKey].jobstatuses,
2906
+ hideSeen: state[values.reducerKey].hideSeen
1991
2907
  };
1992
2908
  };
1993
2909
 
1994
- var JobTypes$1 = connect(mapStateToProps$5, {
1995
- jobTypesLoaded: jobTypesLoaded,
1996
- jobTypesUpdate: jobTypesUpdate
1997
- })(withRouter(JobTypes));
2910
+ var Configuration$1 = connect(mapStateToProps$5, {
2911
+ jobStatusesUpdate: jobStatusesUpdate,
2912
+ jobStatusesLoaded: jobStatusesLoaded,
2913
+ jobHideSeenUpdate: jobHideSeenUpdate,
2914
+ jobHideSeenLoaded: jobHideSeenLoaded
2915
+ })(withRouter(Configuration));
1998
2916
 
1999
2917
  function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2000
2918
 
@@ -2204,6 +3122,21 @@ var RequestsHub = /*#__PURE__*/function (_Component) {
2204
3122
  });
2205
3123
  }
2206
3124
 
3125
+ if (Session$4.validateAccess(this.props.auth.site, 'featurePicker', this.props.auth)) {
3126
+ sectionItems.push({
3127
+ type: 'navItem',
3128
+ text: 'Feature Configuration',
3129
+ icon: 'settings',
3130
+ isFontAwesome: false,
3131
+ selected: this.state.selectedSection === 'config',
3132
+ onClick: function onClick() {
3133
+ _this2.setState({
3134
+ selectedSection: 'config'
3135
+ });
3136
+ }
3137
+ });
3138
+ }
3139
+
2207
3140
  var helpGuide = null;
2208
3141
  return /*#__PURE__*/React.createElement(Components$4.HubSidebar, {
2209
3142
  sections: [{
@@ -2220,6 +3153,8 @@ var RequestsHub = /*#__PURE__*/function (_Component) {
2220
3153
  return /*#__PURE__*/React.createElement(JobTypes$1, {
2221
3154
  onNew: this.onAddRequestType
2222
3155
  });
3156
+ } else if (this.state.selectedSection === 'config') {
3157
+ return /*#__PURE__*/React.createElement(Configuration$1, null);
2223
3158
  }
2224
3159
 
2225
3160
  return /*#__PURE__*/React.createElement(JobList$1, {
@@ -2291,6 +3226,7 @@ var Apis = PlussCore.Apis,
2291
3226
  Session$3 = PlussCore.Session,
2292
3227
  Colours$1 = PlussCore.Colours,
2293
3228
  Components$3 = PlussCore.Components;
3229
+ var IMAGE_SIZE_NOTE = 72;
2294
3230
 
2295
3231
  var Job = /*#__PURE__*/function (_Component) {
2296
3232
  _inherits(Job, _Component);
@@ -2375,13 +3311,20 @@ var Job = /*#__PURE__*/function (_Component) {
2375
3311
  })));
2376
3312
 
2377
3313
  _defineProperty(_assertThisInitialized(_this), "getStatusType", function (status) {
2378
- var statusType = StatusTypes[status] || Object.values(StatusTypes).find(function (s) {
3314
+ var statusTypes = _this.props.statusTypes;
3315
+ var statusType = statusTypes.find(function (s) {
2379
3316
  return s.text === status;
2380
3317
  });
2381
- if (!statusType) statusType = {
2382
- text: status,
2383
- color: '#aaa'
2384
- };
3318
+
3319
+ if (!statusType) {
3320
+ var defaultStatus = statusTypes.find(function (s) {
3321
+ return s.category === STATUS_NOT_ACTIONED;
3322
+ });
3323
+ statusType = _objectSpread$4(_objectSpread$4({}, defaultStatus), {}, {
3324
+ text: status
3325
+ });
3326
+ }
3327
+
2385
3328
  return statusType;
2386
3329
  });
2387
3330
 
@@ -2424,11 +3367,12 @@ var Job = /*#__PURE__*/function (_Component) {
2424
3367
  _defineProperty(_assertThisInitialized(_this), "isReadyToSaveNote", function () {
2425
3368
  var _this$state = _this.state,
2426
3369
  noteAttachments = _this$state.noteAttachments,
2427
- noteInput = _this$state.noteInput;
3370
+ noteInput = _this$state.noteInput,
3371
+ noteImages = _this$state.noteImages;
2428
3372
  if (_.some(noteAttachments, function (n) {
2429
3373
  return n.Uploading;
2430
3374
  })) return false;
2431
- return !_.isEmpty(noteInput) || !_.isEmpty(noteAttachments);
3375
+ return !_.isEmpty(noteInput) || !_.isEmpty(noteAttachments) || !_.isEmpty(noteImages);
2432
3376
  });
2433
3377
 
2434
3378
  _defineProperty(_assertThisInitialized(_this), "onOpenAddNote", function () {
@@ -2447,6 +3391,7 @@ var Job = /*#__PURE__*/function (_Component) {
2447
3391
  if (!!_this.state.editingNote) {
2448
3392
  newState.noteInput = '';
2449
3393
  newState.noteAttachments = [];
3394
+ newState.noteImages = [];
2450
3395
  }
2451
3396
 
2452
3397
  _this.setState(newState);
@@ -2634,12 +3579,12 @@ var Job = /*#__PURE__*/function (_Component) {
2634
3579
  Title: a.Title,
2635
3580
  Source: a.Source
2636
3581
  };
2637
- })) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
3582
+ }), _this.state.noteImages) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
2638
3583
  return {
2639
3584
  Title: a.Title,
2640
3585
  Source: a.Source
2641
3586
  };
2642
- }));
3587
+ }), _this.state.noteImages);
2643
3588
 
2644
3589
  case 6:
2645
3590
  res = _context5.sent;
@@ -2650,6 +3595,7 @@ var Job = /*#__PURE__*/function (_Component) {
2650
3595
  addNoteOpen: false,
2651
3596
  noteInput: '',
2652
3597
  noteAttachments: [],
3598
+ noteImages: [],
2653
3599
  editingNote: null
2654
3600
  }, function () {
2655
3601
  _this.props.jobsLoaded([_this.state.job]);
@@ -2699,11 +3645,12 @@ var Job = /*#__PURE__*/function (_Component) {
2699
3645
  _defineProperty(_assertThisInitialized(_this), "onOpenEditNote", function (n) {
2700
3646
  _this.setState({
2701
3647
  noteAttachments: n.Attachments || [],
3648
+ noteImages: n.Images || [],
2702
3649
  noteInput: n.Note || '',
2703
3650
  addNoteOpen: true,
2704
3651
  editingNote: n.Id,
2705
3652
  noteMenuOpen: null
2706
- });
3653
+ }, _this.checkSetImage);
2707
3654
  });
2708
3655
 
2709
3656
  _defineProperty(_assertThisInitialized(_this), "markSeen", function () {
@@ -2809,53 +3756,54 @@ var Job = /*#__PURE__*/function (_Component) {
2809
3756
  _this.setState(stateChange);
2810
3757
  });
2811
3758
 
2812
- _defineProperty(_assertThisInitialized(_this), "onToggleStatusChanger", function () {
3759
+ _defineProperty(_assertThisInitialized(_this), "onTogglePriorityChanger", function () {
2813
3760
  _this.setState({
2814
- statusChangerOpen: !_this.state.statusChangerOpen
3761
+ priorityChangerOpen: !_this.state.priorityChangerOpen
2815
3762
  });
2816
3763
  });
2817
3764
 
2818
- _defineProperty(_assertThisInitialized(_this), "onSelectStatus", /*#__PURE__*/function () {
2819
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(status) {
2820
- var res;
3765
+ _defineProperty(_assertThisInitialized(_this), "onSelectPriority", /*#__PURE__*/function () {
3766
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(priority) {
3767
+ var res, job;
2821
3768
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
2822
3769
  while (1) {
2823
3770
  switch (_context8.prev = _context8.next) {
2824
3771
  case 0:
2825
3772
  _this.setState({
2826
3773
  job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
2827
- status: status
3774
+ priority: priority
2828
3775
  }),
2829
- statusChangerOpen: false
3776
+ priorityChangerOpen: false
2830
3777
  });
2831
3778
 
2832
3779
  _context8.prev = 1;
2833
3780
  _context8.next = 4;
2834
- return maintenanceActions.editJobStatus(_this.state.job.id, status);
3781
+ return maintenanceActions.editJobPriority(_this.state.job.id, priority);
2835
3782
 
2836
3783
  case 4:
2837
3784
  res = _context8.sent;
3785
+ job = res.data.job;
3786
+
3787
+ _this.props.jobsLoaded([job]);
2838
3788
 
2839
3789
  _this.setState({
2840
- job: res.data.job
2841
- }, function () {
2842
- _this.props.jobsLoaded([_this.state.job]);
3790
+ job: job
2843
3791
  });
2844
3792
 
2845
- _context8.next = 11;
3793
+ _context8.next = 13;
2846
3794
  break;
2847
3795
 
2848
- case 8:
2849
- _context8.prev = 8;
3796
+ case 10:
3797
+ _context8.prev = 10;
2850
3798
  _context8.t0 = _context8["catch"](1);
2851
- console.error('onSelectStatus', _context8.t0);
3799
+ console.error('onSelectPriority', _context8.t0);
2852
3800
 
2853
- case 11:
3801
+ case 13:
2854
3802
  case "end":
2855
3803
  return _context8.stop();
2856
3804
  }
2857
3805
  }
2858
- }, _callee8, null, [[1, 8]]);
3806
+ }, _callee8, null, [[1, 10]]);
2859
3807
  }));
2860
3808
 
2861
3809
  return function (_x2) {
@@ -2863,6 +3811,61 @@ var Job = /*#__PURE__*/function (_Component) {
2863
3811
  };
2864
3812
  }());
2865
3813
 
3814
+ _defineProperty(_assertThisInitialized(_this), "onToggleStatusChanger", function () {
3815
+ _this.setState({
3816
+ statusChangerOpen: !_this.state.statusChangerOpen
3817
+ });
3818
+ });
3819
+
3820
+ _defineProperty(_assertThisInitialized(_this), "onSelectStatus", /*#__PURE__*/function () {
3821
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(status) {
3822
+ var res, job;
3823
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
3824
+ while (1) {
3825
+ switch (_context9.prev = _context9.next) {
3826
+ case 0:
3827
+ _this.setState({
3828
+ job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
3829
+ status: status
3830
+ }),
3831
+ statusChangerOpen: false
3832
+ });
3833
+
3834
+ _context9.prev = 1;
3835
+ _context9.next = 4;
3836
+ return maintenanceActions.editJobStatus(_this.state.job.id, status);
3837
+
3838
+ case 4:
3839
+ res = _context9.sent;
3840
+ job = res.data.job;
3841
+
3842
+ _this.props.jobsLoaded([job]);
3843
+
3844
+ _this.setState({
3845
+ job: job
3846
+ });
3847
+
3848
+ _context9.next = 13;
3849
+ break;
3850
+
3851
+ case 10:
3852
+ _context9.prev = 10;
3853
+ _context9.t0 = _context9["catch"](1);
3854
+ console.error('onSelectStatus', _context9.t0);
3855
+
3856
+ case 13:
3857
+ case "end":
3858
+ return _context9.stop();
3859
+ }
3860
+ }
3861
+ }, _callee9, null, [[1, 10]]);
3862
+ }));
3863
+
3864
+ return function (_x3) {
3865
+ return _ref9.apply(this, arguments);
3866
+ };
3867
+ }());
3868
+
2866
3869
  _this.state = {
2867
3870
  jobId: Helper$2.safeReadParams(props, 'jobId') ? props.match.params.jobId : null,
2868
3871
  job: null,
@@ -2871,10 +3874,12 @@ var Job = /*#__PURE__*/function (_Component) {
2871
3874
  comments: [],
2872
3875
  commentInput: '',
2873
3876
  loadingComments: false,
3877
+ priorityChangerOpen: false,
2874
3878
  statusChangerOpen: false,
2875
3879
  addNoteOpen: false,
2876
3880
  noteAttachments: [],
2877
3881
  noteInput: '',
3882
+ noteImages: [],
2878
3883
  assignees: []
2879
3884
  };
2880
3885
  return _this;
@@ -2888,12 +3893,64 @@ var Job = /*#__PURE__*/function (_Component) {
2888
3893
  }, {
2889
3894
  key: "componentDidMount",
2890
3895
  value: function componentDidMount() {
3896
+ this.props.jobStatusesUpdate(this.props.auth.site);
3897
+
2891
3898
  if (this.state.jobId) {
2892
3899
  this.getJob();
2893
3900
  this.getComments();
2894
3901
  this.getAssignees();
2895
3902
  }
2896
3903
  }
3904
+ }, {
3905
+ key: "checkSetImage",
3906
+ value: function checkSetImage() {
3907
+ if (this.imageInput && !_.isEmpty(this.state.noteImages)) {
3908
+ this.imageInput.getWrappedInstance().setValue(this.state.noteImages);
3909
+ } else {
3910
+ setTimeout(this.checkSetImage, 100);
3911
+ }
3912
+ }
3913
+ }, {
3914
+ key: "renderPriorityChanger",
3915
+ value: function renderPriorityChanger() {
3916
+ var _this2 = this;
3917
+
3918
+ if (!this.state.priorityChangerOpen) return null;
3919
+ return /*#__PURE__*/React.createElement("div", {
3920
+ className: "statusChanger statusChanger-priority"
3921
+ }, jobPriorityOptions.map(function (p) {
3922
+ return /*#__PURE__*/React.createElement("div", {
3923
+ key: p.name,
3924
+ className: "statusLabel",
3925
+ onClick: function onClick() {
3926
+ return _this2.onSelectPriority(p.name);
3927
+ },
3928
+ style: {
3929
+ backgroundColor: p.color
3930
+ }
3931
+ }, /*#__PURE__*/React.createElement("span", {
3932
+ className: "statusLabel_text"
3933
+ }, p.name));
3934
+ }));
3935
+ }
3936
+ }, {
3937
+ key: "renderPriorityLabel",
3938
+ value: function renderPriorityLabel() {
3939
+ var auth = this.props.auth;
3940
+ if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
3941
+ var job = this.state.job;
3942
+ if (!job) return null;
3943
+ var selectedPriority = getJobPriority(job.priority);
3944
+ return /*#__PURE__*/React.createElement("div", {
3945
+ className: "statusLabel marginTop-5 pointer",
3946
+ onClick: this.onTogglePriorityChanger,
3947
+ style: {
3948
+ backgroundColor: selectedPriority.color
3949
+ }
3950
+ }, /*#__PURE__*/React.createElement("span", {
3951
+ className: "statusLabel_text"
3952
+ }, job.priority || selectedPriority.name), this.renderPriorityChanger());
3953
+ }
2897
3954
  }, {
2898
3955
  key: "renderStatusLabel",
2899
3956
  value: function renderStatusLabel() {
@@ -2957,24 +4014,25 @@ var Job = /*#__PURE__*/function (_Component) {
2957
4014
  }, {
2958
4015
  key: "renderStatusChanger",
2959
4016
  value: function renderStatusChanger() {
2960
- var _this2 = this;
4017
+ var _this3 = this;
2961
4018
 
2962
4019
  if (!this.state.statusChangerOpen) return null;
4020
+ var statusTypes = this.props.statusTypes;
2963
4021
  return /*#__PURE__*/React.createElement("div", {
2964
4022
  className: "statusChanger statusChanger-maintenance"
2965
- }, Object.keys(StatusTypes).map(function (statusKey) {
4023
+ }, statusTypes.map(function (status) {
2966
4024
  return /*#__PURE__*/React.createElement("div", {
2967
- key: statusKey,
4025
+ key: status.text,
2968
4026
  className: "statusLabel",
2969
4027
  onClick: function onClick() {
2970
- return _this2.onSelectStatus(statusKey);
4028
+ return _this3.onSelectStatus(status.text);
2971
4029
  },
2972
4030
  style: {
2973
- backgroundColor: StatusTypes[statusKey].color
4031
+ backgroundColor: status.color
2974
4032
  }
2975
4033
  }, /*#__PURE__*/React.createElement("span", {
2976
4034
  className: "statusLabel_text"
2977
- }, StatusTypes[statusKey].text));
4035
+ }, status.text));
2978
4036
  }));
2979
4037
  }
2980
4038
  }, {
@@ -2988,7 +4046,7 @@ var Job = /*#__PURE__*/function (_Component) {
2988
4046
  }, {
2989
4047
  key: "renderCommentSection",
2990
4048
  value: function renderCommentSection() {
2991
- var _this3 = this;
4049
+ var _this4 = this;
2992
4050
 
2993
4051
  if (this.state.loadingComments) return null;
2994
4052
  return /*#__PURE__*/React.createElement("div", {
@@ -3001,7 +4059,7 @@ var Job = /*#__PURE__*/function (_Component) {
3001
4059
  }, "Comments"), /*#__PURE__*/React.createElement("div", {
3002
4060
  className: "commentSection"
3003
4061
  }, this.state.comments.map(function (c) {
3004
- return _this3.renderComment(c);
4062
+ return _this4.renderComment(c);
3005
4063
  })), /*#__PURE__*/React.createElement("div", {
3006
4064
  className: "commentReply"
3007
4065
  }, /*#__PURE__*/React.createElement("div", {
@@ -3017,13 +4075,14 @@ var Job = /*#__PURE__*/function (_Component) {
3017
4075
  className: "commentReply_input",
3018
4076
  value: this.state.commentInput,
3019
4077
  onChange: function onChange(e) {
3020
- return _this3.onHandleChange(e);
4078
+ return _this4.onHandleChange(e);
3021
4079
  }
3022
4080
  }))));
3023
4081
  }
3024
4082
  }, {
3025
4083
  key: "renderImageGrid",
3026
4084
  value: function renderImageGrid(images) {
4085
+ var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3027
4086
  var imagesToUse = images && images.length > 0 ? images : [];
3028
4087
  return /*#__PURE__*/React.createElement("div", {
3029
4088
  className: "imageGrid"
@@ -3036,7 +4095,9 @@ var Job = /*#__PURE__*/function (_Component) {
3036
4095
  }, /*#__PURE__*/React.createElement("div", {
3037
4096
  className: "imageGrid_image",
3038
4097
  style: {
3039
- backgroundImage: "url('".concat(Helper$2.get1400(image), "')")
4098
+ backgroundImage: "url('".concat(Helper$2.get1400(image), "')"),
4099
+ width: size,
4100
+ height: size
3040
4101
  }
3041
4102
  }));
3042
4103
  }));
@@ -3056,7 +4117,7 @@ var Job = /*#__PURE__*/function (_Component) {
3056
4117
  }, {
3057
4118
  key: "renderCustomFields",
3058
4119
  value: function renderCustomFields() {
3059
- var _this4 = this;
4120
+ var _this5 = this;
3060
4121
 
3061
4122
  var job = this.state.job;
3062
4123
  var customFields = job.customFields;
@@ -3086,7 +4147,7 @@ var Job = /*#__PURE__*/function (_Component) {
3086
4147
  }, field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '');
3087
4148
 
3088
4149
  case 'image':
3089
- return _this4.renderImageGrid(field.answer);
4150
+ return _this5.renderImageGrid(field.answer);
3090
4151
 
3091
4152
  default:
3092
4153
  return /*#__PURE__*/React.createElement("div", {
@@ -3207,12 +4268,12 @@ var Job = /*#__PURE__*/function (_Component) {
3207
4268
  }
3208
4269
  }, /*#__PURE__*/React.createElement("span", {
3209
4270
  className: "statusLabel_text"
3210
- }, e ? "Marked as ".concat(statusType.text) : "".concat(values.textEntityName, " opened"))));
4271
+ }, e ? "".concat(entryToUse.user.displayName, " marked as ").concat(statusType.text) : "".concat(values.textEntityName, " opened"))));
3211
4272
  }
3212
4273
  }, {
3213
4274
  key: "renderNote",
3214
4275
  value: function renderNote(note, index) {
3215
- var _this5 = this;
4276
+ var _this6 = this;
3216
4277
 
3217
4278
  return /*#__PURE__*/React.createElement("div", {
3218
4279
  className: "ticketHistoryEntry",
@@ -3235,7 +4296,7 @@ var Job = /*#__PURE__*/function (_Component) {
3235
4296
  icon: "more15",
3236
4297
  className: "maintenanceNote_moreIcon",
3237
4298
  onClick: function onClick() {
3238
- return _this5.onOpenNoteMenu(index);
4299
+ return _this6.onOpenNoteMenu(index);
3239
4300
  }
3240
4301
  }), /*#__PURE__*/React.createElement("p", {
3241
4302
  className: "maintenanceNote_name"
@@ -3244,20 +4305,20 @@ var Job = /*#__PURE__*/function (_Component) {
3244
4305
  key: 'edit',
3245
4306
  text: 'Edit',
3246
4307
  onPress: function onPress() {
3247
- return _this5.onOpenEditNote(note);
4308
+ return _this6.onOpenEditNote(note);
3248
4309
  }
3249
4310
  }, {
3250
4311
  key: 'delete',
3251
4312
  text: 'Delete',
3252
4313
  onPress: function onPress() {
3253
- return _this5.onDeleteNote(note);
4314
+ return _this6.onDeleteNote(note);
3254
4315
  }
3255
4316
  }]
3256
4317
  })), /*#__PURE__*/React.createElement("p", {
3257
4318
  className: "maintenanceNote_text"
3258
4319
  }, Helper$2.toParagraphed(note.Note)), note.Attachments.map(function (a, i) {
3259
- return _this5.renderAttachment(a, i);
3260
- })));
4320
+ return _this6.renderAttachment(a, i);
4321
+ }), note.Images && note.Images.length > 0 ? this.renderImageGrid(note.Images, IMAGE_SIZE_NOTE) : null));
3261
4322
  }
3262
4323
  }, {
3263
4324
  key: "renderAssignment",
@@ -3298,10 +4359,24 @@ var Job = /*#__PURE__*/function (_Component) {
3298
4359
  className: "statusLabel_text"
3299
4360
  }, e.user.displayName, " assigned the ", values.textSingularName, " to ", e.assignedUser ? e.assignedUser.displayName : 'Unassigned')));
3300
4361
  }
4362
+ }, {
4363
+ key: "renderPriority",
4364
+ value: function renderPriority() {
4365
+ var auth = this.props.auth;
4366
+ if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null;
4367
+ return /*#__PURE__*/React.createElement("div", {
4368
+ className: "padding-32 paddingVertical-40 bottomDivideBorder relative"
4369
+ }, /*#__PURE__*/React.createElement("div", {
4370
+ className: "newTopBar clearfix flex flex-reverse"
4371
+ }, this.renderPriorityLabel(), /*#__PURE__*/React.createElement(Components$3.Text, {
4372
+ type: "formTitleSmall",
4373
+ className: "flex-1"
4374
+ }, "Priority")));
4375
+ }
3301
4376
  }, {
3302
4377
  key: "renderOverview",
3303
4378
  value: function renderOverview() {
3304
- var _this6 = this;
4379
+ var _this7 = this;
3305
4380
 
3306
4381
  var job = this.state.job;
3307
4382
  if (!job || !job.history) return null;
@@ -3327,13 +4402,13 @@ var Job = /*#__PURE__*/function (_Component) {
3327
4402
  }, "Status History")), this.renderHistoryEntry(null, -1), _.map(source, function (e, i) {
3328
4403
  switch (e.EntryType) {
3329
4404
  case 'status':
3330
- return _this6.renderHistoryEntry(e, i);
4405
+ return _this7.renderHistoryEntry(e, i);
3331
4406
 
3332
4407
  case 'note':
3333
- return _this6.renderNote(e, i);
4408
+ return _this7.renderNote(e, i);
3334
4409
 
3335
4410
  case 'assignment':
3336
- return _this6.renderAssignmentEntry(e, i);
4411
+ return _this7.renderAssignmentEntry(e, i);
3337
4412
  }
3338
4413
  }));
3339
4414
  }
@@ -3379,7 +4454,7 @@ var Job = /*#__PURE__*/function (_Component) {
3379
4454
  }, {
3380
4455
  key: "renderAddNotePopup",
3381
4456
  value: function renderAddNotePopup() {
3382
- var _this7 = this;
4457
+ var _this8 = this;
3383
4458
 
3384
4459
  if (!this.state.addNoteOpen) return null;
3385
4460
 
@@ -3419,7 +4494,7 @@ var Job = /*#__PURE__*/function (_Component) {
3419
4494
  value: this.state.noteInput,
3420
4495
  placeholder: "Enter note",
3421
4496
  onChange: function onChange(e) {
3422
- return _this7.onHandleChange(e);
4497
+ return _this8.onHandleChange(e);
3423
4498
  },
3424
4499
  inputStyle: {
3425
4500
  width: 400
@@ -3427,34 +4502,44 @@ var Job = /*#__PURE__*/function (_Component) {
3427
4502
  }), /*#__PURE__*/React.createElement(Components$3.Text, {
3428
4503
  type: "h5"
3429
4504
  }, "Attachments"), this.state.noteAttachments.map(function (a, i) {
3430
- return _this7.renderAttachment(a, i, _this7.onRemoveAttachment);
4505
+ return _this8.renderAttachment(a, i, _this8.onRemoveAttachment);
3431
4506
  }), /*#__PURE__*/React.createElement("input", {
3432
4507
  ref: function ref(input) {
3433
- return _this7.attachmentInput = input;
4508
+ return _this8.attachmentInput = input;
3434
4509
  },
3435
4510
  id: "attachmentInput",
3436
4511
  type: "file",
3437
4512
  className: "fileInput",
3438
4513
  onChange: function onChange(e) {
3439
- return _this7.onHandlePDFFileChange(e);
4514
+ return _this8.onHandlePDFFileChange(e);
3440
4515
  },
3441
4516
  accept: "application/pdf"
3442
4517
  }), /*#__PURE__*/React.createElement("div", {
3443
- className: "iconTextButton",
4518
+ className: "iconTextButton marginBottom-16",
3444
4519
  onClick: function onClick() {
3445
- _this7.attachmentInput.click();
4520
+ _this8.attachmentInput.click();
3446
4521
  }
3447
4522
  }, /*#__PURE__*/React.createElement(FontAwesome, {
3448
4523
  className: "iconTextButton_icon",
3449
4524
  name: "paperclip"
3450
4525
  }), /*#__PURE__*/React.createElement("p", {
3451
4526
  className: "iconTextButton_text"
3452
- }, "Add Attachment")));
4527
+ }, "Add Attachment")), /*#__PURE__*/React.createElement(Components$3.ImageInput, {
4528
+ ref: function ref(_ref10) {
4529
+ _this8.imageInput = _ref10;
4530
+ },
4531
+ multiple: true,
4532
+ refreshCallback: function refreshCallback(images) {
4533
+ _this8.setState({
4534
+ noteImages: images
4535
+ });
4536
+ }
4537
+ }));
3453
4538
  }
3454
4539
  }, {
3455
4540
  key: "renderUsers",
3456
4541
  value: function renderUsers() {
3457
- var _this8 = this;
4542
+ var _this9 = this;
3458
4543
 
3459
4544
  var content = null;
3460
4545
 
@@ -3473,7 +4558,7 @@ var Job = /*#__PURE__*/function (_Component) {
3473
4558
  className: "removeIcon",
3474
4559
  icon: "close",
3475
4560
  onClick: function onClick() {
3476
- _this8.onSelectAssignee();
4561
+ _this9.onSelectAssignee();
3477
4562
  },
3478
4563
  colour: Colours$1.COLOUR_DUSK
3479
4564
  })
@@ -3486,20 +4571,20 @@ var Job = /*#__PURE__*/function (_Component) {
3486
4571
  placeholder: "Search name",
3487
4572
  value: this.state.userSearch,
3488
4573
  onChange: function onChange(e) {
3489
- return _this8.onHandleChange(e);
4574
+ return _this9.onHandleChange(e);
3490
4575
  },
3491
4576
  alwaysShowLabel: true
3492
4577
  }), _.sortBy(this.state.assignees, function (u) {
3493
4578
  return u.displayName.toUpperCase();
3494
4579
  }).filter(function (u) {
3495
- if (_.isEmpty(_this8.state.userSearch)) return true;
3496
- return u.displayName.toUpperCase().indexOf(_this8.state.userSearch.toUpperCase()) > -1;
4580
+ if (_.isEmpty(_this9.state.userSearch)) return true;
4581
+ return u.displayName.toUpperCase().indexOf(_this9.state.userSearch.toUpperCase()) > -1;
3497
4582
  }).map(function (user) {
3498
4583
  return /*#__PURE__*/React.createElement(Components$3.UserListing, {
3499
4584
  key: user.id,
3500
4585
  user: user,
3501
4586
  onClick: function onClick() {
3502
- _this8.onSelectAssignee(user);
4587
+ _this9.onSelectAssignee(user);
3503
4588
  }
3504
4589
  });
3505
4590
  }));
@@ -3540,7 +4625,7 @@ var Job = /*#__PURE__*/function (_Component) {
3540
4625
  className: "pageSectionWrapper--fixedPopupSize"
3541
4626
  }, this.renderInner()), /*#__PURE__*/React.createElement(Components$3.OverlayPageSection, {
3542
4627
  className: "pageSectionWrapper--newPopupSide pageSectionWrapper--newPopupSide-fixedWidth"
3543
- }, this.renderAssignment(), this.renderOverview())), /*#__PURE__*/React.createElement(Components$3.OverlayPageBottomButtons, null, this.renderButtons()));
4628
+ }, this.renderAssignment(), this.renderPriority(), this.renderOverview())), /*#__PURE__*/React.createElement(Components$3.OverlayPageBottomButtons, null, this.renderButtons()));
3544
4629
  }
3545
4630
  }]);
3546
4631
 
@@ -3550,12 +4635,14 @@ var Job = /*#__PURE__*/function (_Component) {
3550
4635
  var mapStateToProps$3 = function mapStateToProps(state) {
3551
4636
  var auth = state.auth;
3552
4637
  return {
3553
- auth: auth
4638
+ auth: auth,
4639
+ statusTypes: state[values.reducerKey].jobstatuses
3554
4640
  };
3555
4641
  };
3556
4642
 
3557
4643
  var Job$1 = connect(mapStateToProps$3, {
3558
- jobsLoaded: jobsLoaded
4644
+ jobsLoaded: jobsLoaded,
4645
+ jobStatusesUpdate: jobStatusesUpdate
3559
4646
  })(withRouter(Job));
3560
4647
 
3561
4648
  function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -5624,7 +6711,7 @@ var AddJobType = /*#__PURE__*/function (_Component) {
5624
6711
  type: "bodyLarge",
5625
6712
  className: "marginBottom-24 paddingLeft-40",
5626
6713
  style: {
5627
- color: Colours$2.COLOUR_LIGHTGREY
6714
+ color: Colours$3.COLOUR_LIGHTGREY
5628
6715
  }
5629
6716
  }, "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."), /*#__PURE__*/React.createElement("div", {
5630
6717
  className: "fields"
@@ -5654,7 +6741,7 @@ var AddJobType = /*#__PURE__*/function (_Component) {
5654
6741
  return /*#__PURE__*/React.createElement("div", {
5655
6742
  className: "padding-60 paddingVertical-8 text-bodyLarge",
5656
6743
  style: {
5657
- color: Colours$2.COLOUR_RED
6744
+ color: Colours$3.COLOUR_RED
5658
6745
  }
5659
6746
  }, "To save the form", /*#__PURE__*/React.createElement("ul", {
5660
6747
  style: {
@@ -5940,8 +7027,9 @@ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) {
5940
7027
  var INITIAL_STATE = {
5941
7028
  jobs: [],
5942
7029
  jobtypes: [],
5943
- loading: false // tickets: [],
5944
-
7030
+ jobstatuses: jobStatusOptions,
7031
+ loading: false,
7032
+ hideSeen: false
5945
7033
  };
5946
7034
  var MaintenanceReducer = (function () {
5947
7035
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;
@@ -5984,33 +7072,25 @@ var MaintenanceReducer = (function () {
5984
7072
  return state;
5985
7073
 
5986
7074
  case JOBS_TYPES_LOADED:
5987
- var resultSub = _.unionWith(action.payload, state.jobtypes, function (v1, v2) {
7075
+ var jobtypes = _.unionWith(action.payload, state.jobtypes, function (v1, v2) {
5988
7076
  return v1 != null && v2 != null && v1.id === v2.id;
5989
7077
  });
5990
7078
 
5991
7079
  return _objectSpread$2(_objectSpread$2({}, state), {}, {
5992
- jobtypes: resultSub
7080
+ jobtypes: jobtypes
7081
+ });
7082
+
7083
+ case JOBS_STATUSES_LOADED:
7084
+ var jobstatuses = _.orderBy(action.payload, 'order', 'asc');
7085
+
7086
+ return _objectSpread$2(_objectSpread$2({}, state), {}, {
7087
+ jobstatuses: jobstatuses
7088
+ });
7089
+
7090
+ case JOBS_HIDE_SEEN:
7091
+ return _objectSpread$2(_objectSpread$2({}, state), {}, {
7092
+ hideSeen: action.payload
5993
7093
  });
5994
- // case JOBS_TYPES_REMOVED:
5995
- // const indexSub = _.findIndex(state.jobtypes, (event) => {
5996
- // return event != null && event.id === action.payload;
5997
- // });
5998
- // if (indexSub > -1) {
5999
- // const newEventsSub = [...state.jobtypes];
6000
- // newEventsSub.splice(indexSub, 1);
6001
- // return { ...state, jobtypes: newEventsSub };
6002
- // }
6003
- // return state;
6004
- // case TICKETS_LOADED:
6005
- // const ticketResult = _.unionWith(action.payload, state.tickets, (v1, v2) => {
6006
- // return v1 != null && v2 != null && v1.Id === v2.Id;
6007
- // });
6008
- // return {
6009
- // ...state,
6010
- // tickets: ticketResult,
6011
- // };
6012
- // case JOBS_PURGE:
6013
- // return INITIAL_STATE;
6014
7094
 
6015
7095
  default:
6016
7096
  return state;