@plusscommunities/pluss-maintenance-web 1.1.31-beta.3 → 1.1.31

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
@@ -58,6 +58,7 @@ var values = {
58
58
  svgPathGridIcon: 'M22.7072 2.33998C20.5868 2.30886 18.2156 3.43862 16.824 4.83022C15.1138 6.54042 15.1486 8.34584 15.7894 10.5065L13.2058 13.0901L7.7566 7.64089C7.75294 7.60976 7.75477 7.5768 7.74927 7.54567L7.48926 6.30605C7.43799 6.06435 7.28968 5.84645 7.08277 5.71279L3.77589 3.56313C3.40601 3.32509 2.91163 3.37636 2.60035 3.68764L1.81116 4.47682C1.50171 4.7881 1.44861 5.28066 1.68848 5.6487L3.80152 8.91713C3.93336 9.12221 4.13843 9.26686 4.3783 9.32179L5.66004 9.61659C5.69483 9.62392 5.72962 9.62209 5.76441 9.62575L11.2155 15.0786L8.03309 18.2647C6.23316 18.0907 4.52112 18.8396 3.417 20.2971C2.0254 22.1373 2.05836 24.7814 3.49756 26.5886C4.41858 27.7459 5.78821 28.4563 7.25123 28.5405C7.34827 28.546 7.44532 28.5479 7.54236 28.5479C8.9065 28.5479 10.2212 28.0059 11.1898 27.0372C12.2866 25.9404 12.8195 24.4445 12.6711 22.9027L14.7311 20.8446C14.8391 21.2035 15.0259 21.5386 15.2987 21.8114L21.5939 28.1102C22.0516 28.5662 22.6522 28.7932 23.2528 28.7932C23.8534 28.7932 24.454 28.5662 24.9099 28.1102L26.2356 26.7827C27.1493 25.869 27.1493 24.3822 26.2356 23.4685L19.9368 17.1697C19.6658 16.8987 19.3307 16.7138 18.9718 16.6039L20.4275 15.1464C22.5881 15.7854 24.3954 15.822 26.1056 14.1118C27.814 12.4035 29.1323 9.21559 28.3834 6.83522C28.3358 6.67958 28.2076 6.55873 28.0483 6.52028C27.889 6.48183 27.7206 6.52944 27.6052 6.64479L24.681 9.56899C24.5638 9.68801 24.3899 9.73561 24.2288 9.68984L23.7161 9.55251C22.5863 9.25038 21.6964 8.36049 21.3943 7.23256L21.257 6.71987C21.213 6.55873 21.2606 6.38478 21.3796 6.2676L24.3093 3.33608C24.4247 3.22072 24.4705 3.05409 24.4338 2.89479C24.3936 2.73549 24.2764 2.60732 24.1189 2.55788C23.6721 2.41506 23.1961 2.34731 22.7072 2.33998ZM22.6669 3.28115C22.7877 3.28298 22.9067 3.28664 23.0239 3.29579L20.7168 5.60292C20.3616 5.95815 20.2242 6.47817 20.3543 6.96157L20.4916 7.47609C20.8798 8.92629 22.0223 10.0689 23.4744 10.4589L23.9871 10.5962C24.4705 10.7262 24.9905 10.5871 25.3439 10.2318L27.6437 7.93202C27.7883 9.80702 26.7318 12.1599 25.4446 13.4472C23.9834 14.9083 22.5021 14.8168 20.4367 14.1686C20.27 14.1173 20.0888 14.1613 19.9661 14.284L11.849 22.401C11.7446 22.5054 11.6952 22.6519 11.7172 22.7984C11.9039 24.1277 11.47 25.4314 10.527 26.3744C9.67737 27.224 8.5055 27.6708 7.30433 27.6049C6.08851 27.5353 4.9972 26.9677 4.22999 26.0045C3.05445 24.5287 3.02698 22.3662 4.16407 20.8648C4.98438 19.7826 6.20936 19.1765 7.52588 19.1765C7.7273 19.1765 7.93238 19.1912 8.13746 19.2186C8.28211 19.2388 8.43043 19.1912 8.53296 19.0868L16.65 10.9716C16.7745 10.8471 16.8203 10.6658 16.7672 10.4973C16.119 8.43373 16.0275 6.95424 17.4887 5.49306C18.7008 4.2809 20.8541 3.27931 22.6669 3.28115ZM3.26319 4.35048L6.57191 6.49831L6.83191 7.73793L5.86695 8.70107L4.58704 8.4081L2.474 5.13967L3.26319 4.35048ZM7.34095 8.55275L12.543 13.7529L11.8801 14.4158L6.67994 9.21559L7.0077 8.88967L7.34095 8.55275ZM18.4811 8.66994C18.3621 8.66994 18.243 8.71572 18.1497 8.80727C17.9666 8.99037 17.9666 9.287 18.1497 9.47011L21.4657 12.7843C21.5573 12.8759 21.6763 12.9216 21.7971 12.9216C21.9161 12.9216 22.037 12.8759 22.1267 12.7843C22.3117 12.6012 22.3117 12.3046 22.1267 12.1215L18.8143 8.80727C18.721 8.71572 18.6019 8.66994 18.4811 8.66994ZM17.1554 12.647C17.0364 12.647 16.9155 12.6928 16.824 12.7843C16.6409 12.9674 16.6409 13.2641 16.824 13.4472L17.4887 14.11C17.5802 14.2016 17.6992 14.2473 17.8201 14.2473C17.9409 14.2473 18.0599 14.2016 18.1515 14.11C18.3346 13.9269 18.3346 13.6303 18.1515 13.4472L17.4887 12.7843C17.3953 12.6928 17.2763 12.647 17.1554 12.647ZM15.4983 14.3041C15.3793 14.3041 15.2603 14.3499 15.1687 14.4433C14.9838 14.6264 14.9838 14.9212 15.1687 15.1043L15.8297 15.7689C15.9213 15.8587 16.0421 15.9063 16.163 15.9063C16.282 15.9063 16.4028 15.8587 16.4944 15.7689C16.6775 15.584 16.6775 15.2892 16.4944 15.1043L15.8297 14.4433C15.7382 14.3499 15.6191 14.3041 15.4983 14.3041ZM13.843 15.9612C13.7222 15.9612 13.6032 16.007 13.5116 16.0985C13.3267 16.2816 13.3267 16.5783 13.5116 16.7632L14.1726 17.4242C14.2642 17.5158 14.385 17.5634 14.504 17.5634C14.6249 17.5634 14.7457 17.5158 14.8373 17.4242C15.0204 17.2429 15.0204 16.9463 14.8373 16.7632L14.1726 16.0985C14.0811 16.007 13.962 15.9612 13.843 15.9612ZM18.4426 17.4444C18.7539 17.4755 19.0487 17.6073 19.2758 17.8344L25.5728 24.1314C26.1221 24.6807 26.1221 25.5706 25.5728 26.1199L24.2452 27.4456C23.6978 27.9949 22.806 27.9949 22.2586 27.4456L15.9597 21.1467C15.6594 20.8465 15.5258 20.4216 15.5734 20.0023L18.1277 17.4462C18.2339 17.4352 18.3383 17.4334 18.4426 17.4444ZM12.1859 17.6201C12.0651 17.6201 11.9461 17.6641 11.8527 17.7556C11.6696 17.9406 11.6696 18.2354 11.8527 18.4203L12.5173 19.0813C12.6071 19.1729 12.7279 19.2186 12.8469 19.2186C12.9678 19.2186 13.0886 19.1729 13.1784 19.0813C13.3633 18.8982 13.3633 18.6034 13.1784 18.4203L12.5173 17.7556C12.424 17.6641 12.3049 17.6201 12.1859 17.6201ZM10.527 19.2772C10.408 19.2772 10.2889 19.323 10.1956 19.4146C10.0125 19.5977 10.0125 19.8925 10.1956 20.0756L10.8584 20.7403C10.95 20.83 11.069 20.8757 11.1898 20.8757C11.3107 20.8757 11.4297 20.83 11.5212 20.7403C11.7044 20.5553 11.7044 20.2605 11.5212 20.0756L10.8584 19.4146C10.7669 19.323 10.646 19.2772 10.527 19.2772ZM19.2758 19.3523C19.1549 19.3523 19.0359 19.3981 18.9425 19.4896C18.7594 19.6746 18.7594 19.9694 18.9425 20.1543L23.5842 24.7942C23.6758 24.8858 23.7948 24.9315 23.9157 24.9315C24.0365 24.9315 24.1555 24.8858 24.2471 24.7942C24.4302 24.6111 24.4302 24.3145 24.2471 24.1314L19.6072 19.4896C19.5138 19.3981 19.3948 19.3523 19.2758 19.3523ZM17.9501 20.678C17.8292 20.678 17.7102 20.7238 17.6168 20.8153C17.4337 21.0003 17.4337 21.2951 17.6168 21.48L22.2586 26.1199C22.3483 26.2114 22.4691 26.2572 22.5881 26.2572C22.709 26.2572 22.8298 26.2114 22.9196 26.1199C23.1045 25.9368 23.1045 25.6402 22.9196 25.457L18.2815 20.8153C18.1881 20.7238 18.0691 20.678 17.9501 20.678ZM8.11182 20.8373C8.07154 20.8373 8.03126 20.8428 7.99097 20.8538L5.89808 21.4141C5.73694 21.458 5.6106 21.5844 5.56666 21.7455L5.00818 23.8366C4.96424 23.9977 5.01002 24.1698 5.1272 24.2888L6.65796 25.8196C6.74769 25.9093 6.86671 25.9569 6.98939 25.9569C7.0315 25.9569 7.07178 25.9514 7.11207 25.9423L9.20313 25.3801C9.36426 25.338 9.49061 25.2117 9.53455 25.0487L10.0949 22.9595C10.1388 22.7965 10.0912 22.6244 9.974 22.5054L8.44324 20.9746C8.35352 20.8867 8.2345 20.8391 8.11182 20.8373ZM7.97083 21.8279L9.1189 22.976L8.69959 24.5452L7.13038 24.9663L5.98231 23.8183L6.40162 22.249L7.97083 21.8279Z',
59
59
  svgPathGridIconViewBox: '0 0 30 30',
60
60
  menuOrder: 10,
61
+ optionOnlyForResidents: 'onlyForResidentsMaintenance',
61
62
  textEmptyDescription: 'allows your users to submit Requests (such as maintenance requests) that all appear in this job board.',
62
63
  textEmptyExample: 'Example might be; Fix my light bulb, hand rail is broken, or please send flowers to Mum.',
63
64
  textEmptyJobTypes: 'Please add the many categories of request types that exist in your village which work alongside the Maintenance area.',
@@ -100,7 +101,19 @@ var FeatureConfig = {
100
101
  singularName: values.textSingularName,
101
102
  description: 'Submit maintenance requests and track the progress.',
102
103
  emptyText: values.textYourRequestHere,
103
- widgetOptions: [],
104
+ widgetOptions: [{
105
+ key: values.featureKey,
106
+ widget: true,
107
+ main: true,
108
+ hideOnTabNumbers: [],
109
+ optionKey: values.optionOnlyForResidents,
110
+ type: 'toggle',
111
+ inverseOption: false,
112
+ title: 'Limit Admins to Only Submit on Behalf of Primary Users',
113
+ description: 'This will limit admins to only make a submission on behalf of a primary users in the site. Otherwise they can also submit on behalf of other admins/staff users.',
114
+ defaultNew: false,
115
+ default: false
116
+ }],
104
117
  menu: {
105
118
  order: values.menuOrder,
106
119
  text: values.textMenuTitle,
@@ -469,6 +482,15 @@ var maintenanceActions = {
469
482
  id: jobId
470
483
  })
471
484
  });
485
+ },
486
+ retrySync: function retrySync(jobId) {
487
+ return Session$9.authedFunction({
488
+ method: 'POST',
489
+ url: Helper$5.getUrl(values.serviceKey, 'update/retrysync'),
490
+ data: {
491
+ id: jobId
492
+ }
493
+ });
472
494
  }
473
495
  };
474
496
 
@@ -3386,6 +3408,63 @@ var Job = /*#__PURE__*/function (_Component) {
3386
3408
  }, _callee3, null, [[0, 8]]);
3387
3409
  })));
3388
3410
 
3411
+ _defineProperty(_assertThisInitialized(_this), "onRetrySync", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
3412
+ var job, errorMessage;
3413
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
3414
+ while (1) {
3415
+ switch (_context4.prev = _context4.next) {
3416
+ case 0:
3417
+ job = _this.state.job;
3418
+
3419
+ if (!(!job || _this.state.retryingSync)) {
3420
+ _context4.next = 3;
3421
+ break;
3422
+ }
3423
+
3424
+ return _context4.abrupt("return");
3425
+
3426
+ case 3:
3427
+ _this.setState({
3428
+ retryingSync: true,
3429
+ retrySyncError: null
3430
+ });
3431
+
3432
+ _context4.prev = 4;
3433
+ _context4.next = 7;
3434
+ return maintenanceActions.retrySync(job.id);
3435
+
3436
+ case 7:
3437
+ _context4.next = 9;
3438
+ return _this.getJob();
3439
+
3440
+ case 9:
3441
+ _this.setState({
3442
+ retryingSync: false,
3443
+ retrySyncInitiated: true
3444
+ });
3445
+
3446
+ _context4.next = 17;
3447
+ break;
3448
+
3449
+ case 12:
3450
+ _context4.prev = 12;
3451
+ _context4.t0 = _context4["catch"](4);
3452
+ console.error('onRetrySync', _context4.t0);
3453
+ errorMessage = _context4.t0 && _context4.t0.response && _context4.t0.response.data && _context4.t0.response.data.error || 'Failed to retry sync. Please try again.';
3454
+
3455
+ _this.setState({
3456
+ retryingSync: false,
3457
+ retrySyncError: errorMessage
3458
+ });
3459
+
3460
+ case 17:
3461
+ case "end":
3462
+ return _context4.stop();
3463
+ }
3464
+ }
3465
+ }, _callee4, null, [[4, 12]]);
3466
+ })));
3467
+
3389
3468
  _defineProperty(_assertThisInitialized(_this), "getStatusType", function (status) {
3390
3469
  var statusTypes = _this.props.statusTypes;
3391
3470
  var statusType = statusTypes.find(function (s) {
@@ -3551,35 +3630,35 @@ var Job = /*#__PURE__*/function (_Component) {
3551
3630
  });
3552
3631
  });
3553
3632
 
3554
- _defineProperty(_assertThisInitialized(_this), "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
3555
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
3633
+ _defineProperty(_assertThisInitialized(_this), "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
3634
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
3556
3635
  while (1) {
3557
- switch (_context4.prev = _context4.next) {
3636
+ switch (_context5.prev = _context5.next) {
3558
3637
  case 0:
3559
3638
  _this.setState({
3560
3639
  confirmingAssignee: true
3561
3640
  });
3562
3641
 
3563
- _context4.prev = 1;
3642
+ _context5.prev = 1;
3564
3643
 
3565
3644
  if (!_this.state.selectedAssignee) {
3566
- _context4.next = 5;
3645
+ _context5.next = 5;
3567
3646
  break;
3568
3647
  }
3569
3648
 
3570
- _context4.next = 5;
3649
+ _context5.next = 5;
3571
3650
  return _this.onAssignUser(_this.state.selectedAssignee.id);
3572
3651
 
3573
3652
  case 5:
3574
3653
  _this.onCloseSelectAssignee();
3575
3654
 
3576
- _context4.next = 11;
3655
+ _context5.next = 11;
3577
3656
  break;
3578
3657
 
3579
3658
  case 8:
3580
- _context4.prev = 8;
3581
- _context4.t0 = _context4["catch"](1);
3582
- console.error('onConfirmAssignee', _context4.t0);
3659
+ _context5.prev = 8;
3660
+ _context5.t0 = _context5["catch"](1);
3661
+ console.error('onConfirmAssignee', _context5.t0);
3583
3662
 
3584
3663
  case 11:
3585
3664
  _this.setState({
@@ -3588,68 +3667,68 @@ var Job = /*#__PURE__*/function (_Component) {
3588
3667
 
3589
3668
  case 12:
3590
3669
  case "end":
3591
- return _context4.stop();
3670
+ return _context5.stop();
3592
3671
  }
3593
3672
  }
3594
- }, _callee4, null, [[1, 8]]);
3673
+ }, _callee5, null, [[1, 8]]);
3595
3674
  })));
3596
3675
 
3597
3676
  _defineProperty(_assertThisInitialized(_this), "onAssignUser", /*#__PURE__*/function () {
3598
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(userId) {
3599
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
3677
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(userId) {
3678
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
3600
3679
  while (1) {
3601
- switch (_context5.prev = _context5.next) {
3680
+ switch (_context6.prev = _context6.next) {
3602
3681
  case 0:
3603
- _context5.prev = 0;
3604
- _context5.next = 3;
3682
+ _context6.prev = 0;
3683
+ _context6.next = 3;
3605
3684
  return maintenanceActions.assignJob(_this.state.jobId, userId);
3606
3685
 
3607
3686
  case 3:
3608
3687
 
3609
3688
  _this.getJob();
3610
3689
 
3611
- _context5.next = 10;
3690
+ _context6.next = 10;
3612
3691
  break;
3613
3692
 
3614
3693
  case 7:
3615
- _context5.prev = 7;
3616
- _context5.t0 = _context5["catch"](0);
3617
- console.error('onAssignUser', _context5.t0);
3694
+ _context6.prev = 7;
3695
+ _context6.t0 = _context6["catch"](0);
3696
+ console.error('onAssignUser', _context6.t0);
3618
3697
 
3619
3698
  case 10:
3620
3699
  case "end":
3621
- return _context5.stop();
3700
+ return _context6.stop();
3622
3701
  }
3623
3702
  }
3624
- }, _callee5, null, [[0, 7]]);
3703
+ }, _callee6, null, [[0, 7]]);
3625
3704
  }));
3626
3705
 
3627
3706
  return function (_x) {
3628
- return _ref5.apply(this, arguments);
3707
+ return _ref6.apply(this, arguments);
3629
3708
  };
3630
3709
  }());
3631
3710
 
3632
- _defineProperty(_assertThisInitialized(_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
3711
+ _defineProperty(_assertThisInitialized(_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
3633
3712
  var res;
3634
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
3713
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
3635
3714
  while (1) {
3636
- switch (_context6.prev = _context6.next) {
3715
+ switch (_context7.prev = _context7.next) {
3637
3716
  case 0:
3638
3717
  if (_this.isReadyToSaveNote()) {
3639
- _context6.next = 2;
3718
+ _context7.next = 2;
3640
3719
  break;
3641
3720
  }
3642
3721
 
3643
- return _context6.abrupt("return");
3722
+ return _context7.abrupt("return");
3644
3723
 
3645
3724
  case 2:
3646
- _context6.prev = 2;
3725
+ _context7.prev = 2;
3647
3726
 
3648
3727
  _this.setState({
3649
3728
  submittingNote: true
3650
3729
  });
3651
3730
 
3652
- _context6.next = 6;
3731
+ _context7.next = 6;
3653
3732
  return _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
3654
3733
  return {
3655
3734
  Title: a.Title,
@@ -3663,7 +3742,7 @@ var Job = /*#__PURE__*/function (_Component) {
3663
3742
  }), _this.state.noteImages);
3664
3743
 
3665
3744
  case 6:
3666
- res = _context6.sent;
3745
+ res = _context7.sent;
3667
3746
 
3668
3747
  _this.setState({
3669
3748
  job: res.data.job,
@@ -3677,20 +3756,20 @@ var Job = /*#__PURE__*/function (_Component) {
3677
3756
  _this.props.jobsLoaded([_this.state.job]);
3678
3757
  });
3679
3758
 
3680
- _context6.next = 13;
3759
+ _context7.next = 13;
3681
3760
  break;
3682
3761
 
3683
3762
  case 10:
3684
- _context6.prev = 10;
3685
- _context6.t0 = _context6["catch"](2);
3686
- console.error('onConfirmAddNote', _context6.t0);
3763
+ _context7.prev = 10;
3764
+ _context7.t0 = _context7["catch"](2);
3765
+ console.error('onConfirmAddNote', _context7.t0);
3687
3766
 
3688
3767
  case 13:
3689
3768
  case "end":
3690
- return _context6.stop();
3769
+ return _context7.stop();
3691
3770
  }
3692
3771
  }
3693
- }, _callee6, null, [[2, 10]]);
3772
+ }, _callee7, null, [[2, 10]]);
3694
3773
  })));
3695
3774
 
3696
3775
  _defineProperty(_assertThisInitialized(_this), "onDeleteNote", function (n) {
@@ -3738,42 +3817,42 @@ var Job = /*#__PURE__*/function (_Component) {
3738
3817
 
3739
3818
  _this.setState({
3740
3819
  updating: true
3741
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
3820
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
3742
3821
  var update;
3743
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
3822
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
3744
3823
  while (1) {
3745
- switch (_context7.prev = _context7.next) {
3824
+ switch (_context8.prev = _context8.next) {
3746
3825
  case 0:
3747
- _context7.prev = 0;
3826
+ _context8.prev = 0;
3748
3827
  update = {
3749
3828
  id: job.id,
3750
3829
  seen: true,
3751
3830
  status: job.status || 'Unassigned'
3752
3831
  };
3753
- _context7.next = 4;
3832
+ _context8.next = 4;
3754
3833
  return maintenanceActions.editJob(update, auth.site);
3755
3834
 
3756
3835
  case 4:
3757
- _context7.next = 11;
3836
+ _context8.next = 11;
3758
3837
  break;
3759
3838
 
3760
3839
  case 6:
3761
- _context7.prev = 6;
3762
- _context7.t0 = _context7["catch"](0);
3840
+ _context8.prev = 6;
3841
+ _context8.t0 = _context8["catch"](0);
3763
3842
 
3764
3843
  _this.setState({
3765
3844
  updating: false
3766
3845
  });
3767
3846
 
3768
- console.log('markSeen error', _context7.t0);
3847
+ console.log('markSeen error', _context8.t0);
3769
3848
  alert('Something went wrong with the request. Please try again.');
3770
3849
 
3771
3850
  case 11:
3772
3851
  case "end":
3773
- return _context7.stop();
3852
+ return _context8.stop();
3774
3853
  }
3775
3854
  }
3776
- }, _callee7, null, [[0, 6]]);
3855
+ }, _callee8, null, [[0, 6]]);
3777
3856
  })));
3778
3857
  });
3779
3858
 
@@ -3785,44 +3864,44 @@ var Job = /*#__PURE__*/function (_Component) {
3785
3864
  });
3786
3865
  });
3787
3866
 
3788
- _defineProperty(_assertThisInitialized(_this), "onAddComment", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
3867
+ _defineProperty(_assertThisInitialized(_this), "onAddComment", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
3789
3868
  var _this$state2, commentInput, jobId, job, comments, res;
3790
3869
 
3791
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
3870
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
3792
3871
  while (1) {
3793
- switch (_context8.prev = _context8.next) {
3872
+ switch (_context9.prev = _context9.next) {
3794
3873
  case 0:
3795
3874
  _this$state2 = _this.state, commentInput = _this$state2.commentInput, jobId = _this$state2.jobId, job = _this$state2.job, comments = _this$state2.comments;
3796
- _context8.prev = 1;
3875
+ _context9.prev = 1;
3797
3876
 
3798
3877
  _this.setState({
3799
3878
  commentInput: ''
3800
3879
  });
3801
3880
 
3802
- _context8.next = 5;
3881
+ _context9.next = 5;
3803
3882
  return reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3804
3883
 
3805
3884
  case 5:
3806
- res = _context8.sent;
3885
+ res = _context9.sent;
3807
3886
 
3808
3887
  _this.setState({
3809
3888
  comments: [].concat(_toConsumableArray(comments), [res.data])
3810
3889
  });
3811
3890
 
3812
- _context8.next = 12;
3891
+ _context9.next = 12;
3813
3892
  break;
3814
3893
 
3815
3894
  case 9:
3816
- _context8.prev = 9;
3817
- _context8.t0 = _context8["catch"](1);
3818
- console.error('onAddComment', _context8.t0);
3895
+ _context9.prev = 9;
3896
+ _context9.t0 = _context9["catch"](1);
3897
+ console.error('onAddComment', _context9.t0);
3819
3898
 
3820
3899
  case 12:
3821
3900
  case "end":
3822
- return _context8.stop();
3901
+ return _context9.stop();
3823
3902
  }
3824
3903
  }
3825
- }, _callee8, null, [[1, 9]]);
3904
+ }, _callee9, null, [[1, 9]]);
3826
3905
  })));
3827
3906
 
3828
3907
  _defineProperty(_assertThisInitialized(_this), "onHandleChange", function (event) {
@@ -3839,11 +3918,11 @@ var Job = /*#__PURE__*/function (_Component) {
3839
3918
  });
3840
3919
 
3841
3920
  _defineProperty(_assertThisInitialized(_this), "onSelectPriority", /*#__PURE__*/function () {
3842
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(priority) {
3921
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(priority) {
3843
3922
  var res, job;
3844
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
3923
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
3845
3924
  while (1) {
3846
- switch (_context9.prev = _context9.next) {
3925
+ switch (_context10.prev = _context10.next) {
3847
3926
  case 0:
3848
3927
  _this.setState({
3849
3928
  job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
@@ -3852,12 +3931,12 @@ var Job = /*#__PURE__*/function (_Component) {
3852
3931
  priorityChangerOpen: false
3853
3932
  });
3854
3933
 
3855
- _context9.prev = 1;
3856
- _context9.next = 4;
3934
+ _context10.prev = 1;
3935
+ _context10.next = 4;
3857
3936
  return maintenanceActions.editJobPriority(_this.state.job.id, priority);
3858
3937
 
3859
3938
  case 4:
3860
- res = _context9.sent;
3939
+ res = _context10.sent;
3861
3940
  job = res.data.job;
3862
3941
 
3863
3942
  _this.props.jobsLoaded([job]);
@@ -3866,24 +3945,24 @@ var Job = /*#__PURE__*/function (_Component) {
3866
3945
  job: job
3867
3946
  });
3868
3947
 
3869
- _context9.next = 13;
3948
+ _context10.next = 13;
3870
3949
  break;
3871
3950
 
3872
3951
  case 10:
3873
- _context9.prev = 10;
3874
- _context9.t0 = _context9["catch"](1);
3875
- console.error('onSelectPriority', _context9.t0);
3952
+ _context10.prev = 10;
3953
+ _context10.t0 = _context10["catch"](1);
3954
+ console.error('onSelectPriority', _context10.t0);
3876
3955
 
3877
3956
  case 13:
3878
3957
  case "end":
3879
- return _context9.stop();
3958
+ return _context10.stop();
3880
3959
  }
3881
3960
  }
3882
- }, _callee9, null, [[1, 10]]);
3961
+ }, _callee10, null, [[1, 10]]);
3883
3962
  }));
3884
3963
 
3885
3964
  return function (_x2) {
3886
- return _ref9.apply(this, arguments);
3965
+ return _ref10.apply(this, arguments);
3887
3966
  };
3888
3967
  }());
3889
3968
 
@@ -3894,11 +3973,11 @@ var Job = /*#__PURE__*/function (_Component) {
3894
3973
  });
3895
3974
 
3896
3975
  _defineProperty(_assertThisInitialized(_this), "onSelectStatus", /*#__PURE__*/function () {
3897
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(status) {
3976
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(status) {
3898
3977
  var res, job;
3899
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
3978
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
3900
3979
  while (1) {
3901
- switch (_context10.prev = _context10.next) {
3980
+ switch (_context11.prev = _context11.next) {
3902
3981
  case 0:
3903
3982
  _this.setState({
3904
3983
  job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
@@ -3907,12 +3986,12 @@ var Job = /*#__PURE__*/function (_Component) {
3907
3986
  statusChangerOpen: false
3908
3987
  });
3909
3988
 
3910
- _context10.prev = 1;
3911
- _context10.next = 4;
3989
+ _context11.prev = 1;
3990
+ _context11.next = 4;
3912
3991
  return maintenanceActions.editJobStatus(_this.state.job.id, status);
3913
3992
 
3914
3993
  case 4:
3915
- res = _context10.sent;
3994
+ res = _context11.sent;
3916
3995
  job = res.data.job;
3917
3996
 
3918
3997
  _this.props.jobsLoaded([job]);
@@ -3921,24 +4000,24 @@ var Job = /*#__PURE__*/function (_Component) {
3921
4000
  job: job
3922
4001
  });
3923
4002
 
3924
- _context10.next = 13;
4003
+ _context11.next = 13;
3925
4004
  break;
3926
4005
 
3927
4006
  case 10:
3928
- _context10.prev = 10;
3929
- _context10.t0 = _context10["catch"](1);
3930
- console.error('onSelectStatus', _context10.t0);
4007
+ _context11.prev = 10;
4008
+ _context11.t0 = _context11["catch"](1);
4009
+ console.error('onSelectStatus', _context11.t0);
3931
4010
 
3932
4011
  case 13:
3933
4012
  case "end":
3934
- return _context10.stop();
4013
+ return _context11.stop();
3935
4014
  }
3936
4015
  }
3937
- }, _callee10, null, [[1, 10]]);
4016
+ }, _callee11, null, [[1, 10]]);
3938
4017
  }));
3939
4018
 
3940
4019
  return function (_x3) {
3941
- return _ref10.apply(this, arguments);
4020
+ return _ref11.apply(this, arguments);
3942
4021
  };
3943
4022
  }());
3944
4023
 
@@ -3958,7 +4037,10 @@ var Job = /*#__PURE__*/function (_Component) {
3958
4037
  noteImages: [],
3959
4038
  assignees: [],
3960
4039
  externalSync: null,
3961
- loadingExternalSync: false
4040
+ loadingExternalSync: false,
4041
+ retryingSync: false,
4042
+ retrySyncError: null,
4043
+ retrySyncInitiated: false
3962
4044
  };
3963
4045
  return _this;
3964
4046
  }
@@ -4490,24 +4572,122 @@ var Job = /*#__PURE__*/function (_Component) {
4490
4572
  className: "flex-1"
4491
4573
  }, "Priority")));
4492
4574
  }
4575
+ }, {
4576
+ key: "hasSyncFailureWithoutSuccess",
4577
+ value: function hasSyncFailureWithoutSuccess() {
4578
+ var job = this.state.job;
4579
+ if (!job || !job.history) return false;
4580
+ var history = job.history || [];
4581
+ var hasSuccess = history.some(function (entry) {
4582
+ return entry.EntryType === 'ExternalIDSet';
4583
+ });
4584
+ var hasFailure = history.some(function (entry) {
4585
+ return entry.EntryType === 'ExternalIDSetFailed';
4586
+ });
4587
+ return hasFailure && !hasSuccess;
4588
+ }
4589
+ }, {
4590
+ key: "renderRetrySyncButton",
4591
+ value: function renderRetrySyncButton() {
4592
+ var auth = this.props.auth;
4593
+ var _this$state3 = this.state,
4594
+ retryingSync = _this$state3.retryingSync,
4595
+ retrySyncInitiated = _this$state3.retrySyncInitiated; // Only show for users with maintenance tracking permission
4596
+
4597
+ if (!Session$3.validateAccess(auth.site, values.permissionMaintenanceTracking, auth)) return null; // Only show if there's a failure without success and retry hasn't been initiated
4598
+
4599
+ if (!this.hasSyncFailureWithoutSuccess() || retrySyncInitiated) return null; // Show spinner while retrying
4600
+
4601
+ if (retryingSync) {
4602
+ return /*#__PURE__*/React.createElement(FontAwesome, {
4603
+ style: {
4604
+ fontSize: 20,
4605
+ color: Colours$1.COLOUR_DUSK_LIGHT,
4606
+ marginLeft: 8
4607
+ },
4608
+ name: "spinner fa-pulse fa-fw"
4609
+ });
4610
+ }
4611
+
4612
+ return /*#__PURE__*/React.createElement("div", {
4613
+ className: "statusLabel pointer",
4614
+ onClick: this.onRetrySync,
4615
+ style: {
4616
+ backgroundColor: Colours$1.COLOUR_RED,
4617
+ marginLeft: 8
4618
+ }
4619
+ }, /*#__PURE__*/React.createElement("span", {
4620
+ className: "statusLabel_text"
4621
+ }, "Retry Sync"));
4622
+ }
4623
+ }, {
4624
+ key: "renderExternalSyncStatus",
4625
+ value: function renderExternalSyncStatus() {
4626
+ var _this$state4 = this.state,
4627
+ retrySyncError = _this$state4.retrySyncError,
4628
+ retrySyncInitiated = _this$state4.retrySyncInitiated; // Show error message if retry failed
4629
+
4630
+ if (retrySyncError) {
4631
+ return /*#__PURE__*/React.createElement(Components$3.Text, {
4632
+ type: "body"
4633
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
4634
+ className: "userStatusIcon",
4635
+ name: "times-circle",
4636
+ style: {
4637
+ color: Colours$1.COLOUR_RED
4638
+ }
4639
+ }), " ", retrySyncError);
4640
+ } // Show success message if retry was initiated
4641
+
4642
+
4643
+ if (retrySyncInitiated) {
4644
+ return /*#__PURE__*/React.createElement(Components$3.Text, {
4645
+ type: "body"
4646
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
4647
+ className: "userStatusIcon",
4648
+ name: "check-circle",
4649
+ style: {
4650
+ color: Colours$1.COLOUR_GREEN
4651
+ }
4652
+ }), " Sync retry initiated. Check back shortly for results.");
4653
+ } // Show failure message with instruction
4654
+
4655
+
4656
+ if (this.hasSyncFailureWithoutSuccess()) {
4657
+ return /*#__PURE__*/React.createElement(Components$3.Text, {
4658
+ type: "body"
4659
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
4660
+ className: "userStatusIcon",
4661
+ name: "times-circle",
4662
+ style: {
4663
+ color: Colours$1.COLOUR_RED
4664
+ }
4665
+ }), " External sync failed. Use the retry button to attempt again.");
4666
+ }
4667
+
4668
+ return null;
4669
+ }
4493
4670
  }, {
4494
4671
  key: "renderExternalSync",
4495
4672
  value: function renderExternalSync() {
4496
- var _this$state3 = this.state,
4497
- externalSync = _this$state3.externalSync,
4498
- loadingExternalSync = _this$state3.loadingExternalSync; // Only show if external sync data exists
4673
+ var _this$state5 = this.state,
4674
+ externalSync = _this$state5.externalSync,
4675
+ loadingExternalSync = _this$state5.loadingExternalSync; // Check if we should show this section at all
4676
+
4677
+ var hasExternalSyncData = externalSync && !loadingExternalSync;
4678
+ var hasSyncFailure = this.hasSyncFailureWithoutSuccess(); // Show section if we have sync data OR if there's a failure that can be retried
4499
4679
 
4500
- if (!externalSync || loadingExternalSync) return null;
4680
+ if (!hasExternalSyncData && !hasSyncFailure) return null;
4501
4681
  return /*#__PURE__*/React.createElement("div", {
4502
4682
  className: "padding-32 paddingVertical-40 bottomDivideBorder relative"
4503
4683
  }, /*#__PURE__*/React.createElement("div", {
4504
4684
  className: "newTopBar clearfix flex flex-reverse"
4505
- }, /*#__PURE__*/React.createElement(Components$3.Text, {
4685
+ }, this.renderRetrySyncButton(), /*#__PURE__*/React.createElement(Components$3.Text, {
4506
4686
  type: "formTitleSmall",
4507
4687
  className: "flex-1"
4508
4688
  }, "External Sync")), /*#__PURE__*/React.createElement("div", {
4509
4689
  className: "marginTop-16"
4510
- }, externalSync.systemType && /*#__PURE__*/React.createElement(Components$3.Text, {
4690
+ }, hasExternalSyncData ? /*#__PURE__*/React.createElement(React.Fragment, null, externalSync.systemType && /*#__PURE__*/React.createElement(Components$3.Text, {
4511
4691
  type: "body",
4512
4692
  className: "marginBottom-8"
4513
4693
  }, /*#__PURE__*/React.createElement("strong", null, "System:"), " ", externalSync.systemType), externalSync.externalId && /*#__PURE__*/React.createElement(Components$3.Text, {
@@ -4516,7 +4696,7 @@ var Job = /*#__PURE__*/function (_Component) {
4516
4696
  }, /*#__PURE__*/React.createElement("strong", null, "External ID:"), " ", externalSync.externalId), externalSync.syncedAt && /*#__PURE__*/React.createElement(Components$3.Text, {
4517
4697
  type: "body",
4518
4698
  className: "marginBottom-8"
4519
- }, /*#__PURE__*/React.createElement("strong", null, "Synced:"), " ", moment.utc(externalSync.syncedAt).local().format('D MMM YYYY h:mma'))));
4699
+ }, /*#__PURE__*/React.createElement("strong", null, "Synced:"), " ", moment.utc(externalSync.syncedAt).local().format('D MMM YYYY h:mma'))) : this.renderExternalSyncStatus()));
4520
4700
  }
4521
4701
  }, {
4522
4702
  key: "renderOverview",
@@ -4674,8 +4854,8 @@ var Job = /*#__PURE__*/function (_Component) {
4674
4854
  }), /*#__PURE__*/React.createElement("p", {
4675
4855
  className: "iconTextButton_text"
4676
4856
  }, "Add Attachment")), /*#__PURE__*/React.createElement(Components$3.ImageInput, {
4677
- ref: function ref(_ref11) {
4678
- _this8.imageInput = _ref11;
4857
+ ref: function ref(_ref12) {
4858
+ _this8.imageInput = _ref12;
4679
4859
  },
4680
4860
  multiple: true,
4681
4861
  refreshCallback: function refreshCallback(images) {
@@ -4933,6 +5113,12 @@ var AddJob = /*#__PURE__*/function (_Component) {
4933
5113
  if (res.data != null && !_.isEmpty(res.data.results.Items)) {
4934
5114
  items = res.data.results.Items;
4935
5115
 
5116
+ if (_this.props.optionOnlyForResidents) {
5117
+ items = _.filter(items, function (u) {
5118
+ return u.category === 'resident';
5119
+ });
5120
+ }
5121
+
4936
5122
  _this.setState({
4937
5123
  users: _.sortBy(items, function (u) {
4938
5124
  return (u.displayName || '').toLowerCase();
@@ -6049,7 +6235,8 @@ var mapStateToProps$2 = function mapStateToProps(state) {
6049
6235
  var auth = state.auth;
6050
6236
  return {
6051
6237
  auth: auth,
6052
- strings: state.strings && state.strings.config || {}
6238
+ strings: state.strings && state.strings.config || {},
6239
+ optionOnlyForResidents: Helper$1.getSiteSettingFromState(state, values.optionOnlyForResidents)
6053
6240
  };
6054
6241
  };
6055
6242