@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.umd.js CHANGED
@@ -80,6 +80,7 @@
80
80
  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',
81
81
  svgPathGridIconViewBox: '0 0 30 30',
82
82
  menuOrder: 10,
83
+ optionOnlyForResidents: 'onlyForResidentsMaintenance',
83
84
  textEmptyDescription: 'allows your users to submit Requests (such as maintenance requests) that all appear in this job board.',
84
85
  textEmptyExample: 'Example might be; Fix my light bulb, hand rail is broken, or please send flowers to Mum.',
85
86
  textEmptyJobTypes: 'Please add the many categories of request types that exist in your village which work alongside the Maintenance area.',
@@ -122,7 +123,19 @@
122
123
  singularName: values.textSingularName,
123
124
  description: 'Submit maintenance requests and track the progress.',
124
125
  emptyText: values.textYourRequestHere,
125
- widgetOptions: [],
126
+ widgetOptions: [{
127
+ key: values.featureKey,
128
+ widget: true,
129
+ main: true,
130
+ hideOnTabNumbers: [],
131
+ optionKey: values.optionOnlyForResidents,
132
+ type: 'toggle',
133
+ inverseOption: false,
134
+ title: 'Limit Admins to Only Submit on Behalf of Primary Users',
135
+ 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.',
136
+ defaultNew: false,
137
+ default: false
138
+ }],
126
139
  menu: {
127
140
  order: values.menuOrder,
128
141
  text: values.textMenuTitle,
@@ -491,6 +504,15 @@
491
504
  id: jobId
492
505
  })
493
506
  });
507
+ },
508
+ retrySync: function retrySync(jobId) {
509
+ return Session$9.authedFunction({
510
+ method: 'POST',
511
+ url: Helper$5.getUrl(values.serviceKey, 'update/retrysync'),
512
+ data: {
513
+ id: jobId
514
+ }
515
+ });
494
516
  }
495
517
  };
496
518
 
@@ -3408,6 +3430,63 @@
3408
3430
  }, _callee3, null, [[0, 8]]);
3409
3431
  })));
3410
3432
 
3433
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onRetrySync", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
3434
+ var job, errorMessage;
3435
+ return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
3436
+ while (1) {
3437
+ switch (_context4.prev = _context4.next) {
3438
+ case 0:
3439
+ job = _this.state.job;
3440
+
3441
+ if (!(!job || _this.state.retryingSync)) {
3442
+ _context4.next = 3;
3443
+ break;
3444
+ }
3445
+
3446
+ return _context4.abrupt("return");
3447
+
3448
+ case 3:
3449
+ _this.setState({
3450
+ retryingSync: true,
3451
+ retrySyncError: null
3452
+ });
3453
+
3454
+ _context4.prev = 4;
3455
+ _context4.next = 7;
3456
+ return maintenanceActions.retrySync(job.id);
3457
+
3458
+ case 7:
3459
+ _context4.next = 9;
3460
+ return _this.getJob();
3461
+
3462
+ case 9:
3463
+ _this.setState({
3464
+ retryingSync: false,
3465
+ retrySyncInitiated: true
3466
+ });
3467
+
3468
+ _context4.next = 17;
3469
+ break;
3470
+
3471
+ case 12:
3472
+ _context4.prev = 12;
3473
+ _context4.t0 = _context4["catch"](4);
3474
+ console.error('onRetrySync', _context4.t0);
3475
+ errorMessage = _context4.t0 && _context4.t0.response && _context4.t0.response.data && _context4.t0.response.data.error || 'Failed to retry sync. Please try again.';
3476
+
3477
+ _this.setState({
3478
+ retryingSync: false,
3479
+ retrySyncError: errorMessage
3480
+ });
3481
+
3482
+ case 17:
3483
+ case "end":
3484
+ return _context4.stop();
3485
+ }
3486
+ }
3487
+ }, _callee4, null, [[4, 12]]);
3488
+ })));
3489
+
3411
3490
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getStatusType", function (status) {
3412
3491
  var statusTypes = _this.props.statusTypes;
3413
3492
  var statusType = statusTypes.find(function (s) {
@@ -3573,35 +3652,35 @@
3573
3652
  });
3574
3653
  });
3575
3654
 
3576
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
3577
- return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
3655
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAssignee", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5() {
3656
+ return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
3578
3657
  while (1) {
3579
- switch (_context4.prev = _context4.next) {
3658
+ switch (_context5.prev = _context5.next) {
3580
3659
  case 0:
3581
3660
  _this.setState({
3582
3661
  confirmingAssignee: true
3583
3662
  });
3584
3663
 
3585
- _context4.prev = 1;
3664
+ _context5.prev = 1;
3586
3665
 
3587
3666
  if (!_this.state.selectedAssignee) {
3588
- _context4.next = 5;
3667
+ _context5.next = 5;
3589
3668
  break;
3590
3669
  }
3591
3670
 
3592
- _context4.next = 5;
3671
+ _context5.next = 5;
3593
3672
  return _this.onAssignUser(_this.state.selectedAssignee.id);
3594
3673
 
3595
3674
  case 5:
3596
3675
  _this.onCloseSelectAssignee();
3597
3676
 
3598
- _context4.next = 11;
3677
+ _context5.next = 11;
3599
3678
  break;
3600
3679
 
3601
3680
  case 8:
3602
- _context4.prev = 8;
3603
- _context4.t0 = _context4["catch"](1);
3604
- console.error('onConfirmAssignee', _context4.t0);
3681
+ _context5.prev = 8;
3682
+ _context5.t0 = _context5["catch"](1);
3683
+ console.error('onConfirmAssignee', _context5.t0);
3605
3684
 
3606
3685
  case 11:
3607
3686
  _this.setState({
@@ -3610,68 +3689,68 @@
3610
3689
 
3611
3690
  case 12:
3612
3691
  case "end":
3613
- return _context4.stop();
3692
+ return _context5.stop();
3614
3693
  }
3615
3694
  }
3616
- }, _callee4, null, [[1, 8]]);
3695
+ }, _callee5, null, [[1, 8]]);
3617
3696
  })));
3618
3697
 
3619
3698
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAssignUser", /*#__PURE__*/function () {
3620
- var _ref5 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(userId) {
3621
- return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
3699
+ var _ref6 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6(userId) {
3700
+ return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
3622
3701
  while (1) {
3623
- switch (_context5.prev = _context5.next) {
3702
+ switch (_context6.prev = _context6.next) {
3624
3703
  case 0:
3625
- _context5.prev = 0;
3626
- _context5.next = 3;
3704
+ _context6.prev = 0;
3705
+ _context6.next = 3;
3627
3706
  return maintenanceActions.assignJob(_this.state.jobId, userId);
3628
3707
 
3629
3708
  case 3:
3630
3709
 
3631
3710
  _this.getJob();
3632
3711
 
3633
- _context5.next = 10;
3712
+ _context6.next = 10;
3634
3713
  break;
3635
3714
 
3636
3715
  case 7:
3637
- _context5.prev = 7;
3638
- _context5.t0 = _context5["catch"](0);
3639
- console.error('onAssignUser', _context5.t0);
3716
+ _context6.prev = 7;
3717
+ _context6.t0 = _context6["catch"](0);
3718
+ console.error('onAssignUser', _context6.t0);
3640
3719
 
3641
3720
  case 10:
3642
3721
  case "end":
3643
- return _context5.stop();
3722
+ return _context6.stop();
3644
3723
  }
3645
3724
  }
3646
- }, _callee5, null, [[0, 7]]);
3725
+ }, _callee6, null, [[0, 7]]);
3647
3726
  }));
3648
3727
 
3649
3728
  return function (_x) {
3650
- return _ref5.apply(this, arguments);
3729
+ return _ref6.apply(this, arguments);
3651
3730
  };
3652
3731
  }());
3653
3732
 
3654
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6() {
3733
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
3655
3734
  var res;
3656
- return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
3735
+ return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
3657
3736
  while (1) {
3658
- switch (_context6.prev = _context6.next) {
3737
+ switch (_context7.prev = _context7.next) {
3659
3738
  case 0:
3660
3739
  if (_this.isReadyToSaveNote()) {
3661
- _context6.next = 2;
3740
+ _context7.next = 2;
3662
3741
  break;
3663
3742
  }
3664
3743
 
3665
- return _context6.abrupt("return");
3744
+ return _context7.abrupt("return");
3666
3745
 
3667
3746
  case 2:
3668
- _context6.prev = 2;
3747
+ _context7.prev = 2;
3669
3748
 
3670
3749
  _this.setState({
3671
3750
  submittingNote: true
3672
3751
  });
3673
3752
 
3674
- _context6.next = 6;
3753
+ _context7.next = 6;
3675
3754
  return _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
3676
3755
  return {
3677
3756
  Title: a.Title,
@@ -3685,7 +3764,7 @@
3685
3764
  }), _this.state.noteImages);
3686
3765
 
3687
3766
  case 6:
3688
- res = _context6.sent;
3767
+ res = _context7.sent;
3689
3768
 
3690
3769
  _this.setState({
3691
3770
  job: res.data.job,
@@ -3699,20 +3778,20 @@
3699
3778
  _this.props.jobsLoaded([_this.state.job]);
3700
3779
  });
3701
3780
 
3702
- _context6.next = 13;
3781
+ _context7.next = 13;
3703
3782
  break;
3704
3783
 
3705
3784
  case 10:
3706
- _context6.prev = 10;
3707
- _context6.t0 = _context6["catch"](2);
3708
- console.error('onConfirmAddNote', _context6.t0);
3785
+ _context7.prev = 10;
3786
+ _context7.t0 = _context7["catch"](2);
3787
+ console.error('onConfirmAddNote', _context7.t0);
3709
3788
 
3710
3789
  case 13:
3711
3790
  case "end":
3712
- return _context6.stop();
3791
+ return _context7.stop();
3713
3792
  }
3714
3793
  }
3715
- }, _callee6, null, [[2, 10]]);
3794
+ }, _callee7, null, [[2, 10]]);
3716
3795
  })));
3717
3796
 
3718
3797
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onDeleteNote", function (n) {
@@ -3760,42 +3839,42 @@
3760
3839
 
3761
3840
  _this.setState({
3762
3841
  updating: true
3763
- }, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7() {
3842
+ }, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
3764
3843
  var update;
3765
- return _regeneratorRuntime__default['default'].wrap(function _callee7$(_context7) {
3844
+ return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
3766
3845
  while (1) {
3767
- switch (_context7.prev = _context7.next) {
3846
+ switch (_context8.prev = _context8.next) {
3768
3847
  case 0:
3769
- _context7.prev = 0;
3848
+ _context8.prev = 0;
3770
3849
  update = {
3771
3850
  id: job.id,
3772
3851
  seen: true,
3773
3852
  status: job.status || 'Unassigned'
3774
3853
  };
3775
- _context7.next = 4;
3854
+ _context8.next = 4;
3776
3855
  return maintenanceActions.editJob(update, auth.site);
3777
3856
 
3778
3857
  case 4:
3779
- _context7.next = 11;
3858
+ _context8.next = 11;
3780
3859
  break;
3781
3860
 
3782
3861
  case 6:
3783
- _context7.prev = 6;
3784
- _context7.t0 = _context7["catch"](0);
3862
+ _context8.prev = 6;
3863
+ _context8.t0 = _context8["catch"](0);
3785
3864
 
3786
3865
  _this.setState({
3787
3866
  updating: false
3788
3867
  });
3789
3868
 
3790
- console.log('markSeen error', _context7.t0);
3869
+ console.log('markSeen error', _context8.t0);
3791
3870
  alert('Something went wrong with the request. Please try again.');
3792
3871
 
3793
3872
  case 11:
3794
3873
  case "end":
3795
- return _context7.stop();
3874
+ return _context8.stop();
3796
3875
  }
3797
3876
  }
3798
- }, _callee7, null, [[0, 6]]);
3877
+ }, _callee8, null, [[0, 6]]);
3799
3878
  })));
3800
3879
  });
3801
3880
 
@@ -3807,44 +3886,44 @@
3807
3886
  });
3808
3887
  });
3809
3888
 
3810
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAddComment", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8() {
3889
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAddComment", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee9() {
3811
3890
  var _this$state2, commentInput, jobId, job, comments, res;
3812
3891
 
3813
- return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
3892
+ return _regeneratorRuntime__default['default'].wrap(function _callee9$(_context9) {
3814
3893
  while (1) {
3815
- switch (_context8.prev = _context8.next) {
3894
+ switch (_context9.prev = _context9.next) {
3816
3895
  case 0:
3817
3896
  _this$state2 = _this.state, commentInput = _this$state2.commentInput, jobId = _this$state2.jobId, job = _this$state2.job, comments = _this$state2.comments;
3818
- _context8.prev = 1;
3897
+ _context9.prev = 1;
3819
3898
 
3820
3899
  _this.setState({
3821
3900
  commentInput: ''
3822
3901
  });
3823
3902
 
3824
- _context8.next = 5;
3903
+ _context9.next = 5;
3825
3904
  return reactionActions.addComment(jobId, values.commentKey, job.title, job.site, commentInput);
3826
3905
 
3827
3906
  case 5:
3828
- res = _context8.sent;
3907
+ res = _context9.sent;
3829
3908
 
3830
3909
  _this.setState({
3831
3910
  comments: [].concat(_toConsumableArray__default['default'](comments), [res.data])
3832
3911
  });
3833
3912
 
3834
- _context8.next = 12;
3913
+ _context9.next = 12;
3835
3914
  break;
3836
3915
 
3837
3916
  case 9:
3838
- _context8.prev = 9;
3839
- _context8.t0 = _context8["catch"](1);
3840
- console.error('onAddComment', _context8.t0);
3917
+ _context9.prev = 9;
3918
+ _context9.t0 = _context9["catch"](1);
3919
+ console.error('onAddComment', _context9.t0);
3841
3920
 
3842
3921
  case 12:
3843
3922
  case "end":
3844
- return _context8.stop();
3923
+ return _context9.stop();
3845
3924
  }
3846
3925
  }
3847
- }, _callee8, null, [[1, 9]]);
3926
+ }, _callee9, null, [[1, 9]]);
3848
3927
  })));
3849
3928
 
3850
3929
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
@@ -3861,11 +3940,11 @@
3861
3940
  });
3862
3941
 
3863
3942
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectPriority", /*#__PURE__*/function () {
3864
- var _ref9 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee9(priority) {
3943
+ var _ref10 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee10(priority) {
3865
3944
  var res, job;
3866
- return _regeneratorRuntime__default['default'].wrap(function _callee9$(_context9) {
3945
+ return _regeneratorRuntime__default['default'].wrap(function _callee10$(_context10) {
3867
3946
  while (1) {
3868
- switch (_context9.prev = _context9.next) {
3947
+ switch (_context10.prev = _context10.next) {
3869
3948
  case 0:
3870
3949
  _this.setState({
3871
3950
  job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
@@ -3874,12 +3953,12 @@
3874
3953
  priorityChangerOpen: false
3875
3954
  });
3876
3955
 
3877
- _context9.prev = 1;
3878
- _context9.next = 4;
3956
+ _context10.prev = 1;
3957
+ _context10.next = 4;
3879
3958
  return maintenanceActions.editJobPriority(_this.state.job.id, priority);
3880
3959
 
3881
3960
  case 4:
3882
- res = _context9.sent;
3961
+ res = _context10.sent;
3883
3962
  job = res.data.job;
3884
3963
 
3885
3964
  _this.props.jobsLoaded([job]);
@@ -3888,24 +3967,24 @@
3888
3967
  job: job
3889
3968
  });
3890
3969
 
3891
- _context9.next = 13;
3970
+ _context10.next = 13;
3892
3971
  break;
3893
3972
 
3894
3973
  case 10:
3895
- _context9.prev = 10;
3896
- _context9.t0 = _context9["catch"](1);
3897
- console.error('onSelectPriority', _context9.t0);
3974
+ _context10.prev = 10;
3975
+ _context10.t0 = _context10["catch"](1);
3976
+ console.error('onSelectPriority', _context10.t0);
3898
3977
 
3899
3978
  case 13:
3900
3979
  case "end":
3901
- return _context9.stop();
3980
+ return _context10.stop();
3902
3981
  }
3903
3982
  }
3904
- }, _callee9, null, [[1, 10]]);
3983
+ }, _callee10, null, [[1, 10]]);
3905
3984
  }));
3906
3985
 
3907
3986
  return function (_x2) {
3908
- return _ref9.apply(this, arguments);
3987
+ return _ref10.apply(this, arguments);
3909
3988
  };
3910
3989
  }());
3911
3990
 
@@ -3916,11 +3995,11 @@
3916
3995
  });
3917
3996
 
3918
3997
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectStatus", /*#__PURE__*/function () {
3919
- var _ref10 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee10(status) {
3998
+ var _ref11 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee11(status) {
3920
3999
  var res, job;
3921
- return _regeneratorRuntime__default['default'].wrap(function _callee10$(_context10) {
4000
+ return _regeneratorRuntime__default['default'].wrap(function _callee11$(_context11) {
3922
4001
  while (1) {
3923
- switch (_context10.prev = _context10.next) {
4002
+ switch (_context11.prev = _context11.next) {
3924
4003
  case 0:
3925
4004
  _this.setState({
3926
4005
  job: _objectSpread$4(_objectSpread$4({}, _this.state.job), {}, {
@@ -3929,12 +4008,12 @@
3929
4008
  statusChangerOpen: false
3930
4009
  });
3931
4010
 
3932
- _context10.prev = 1;
3933
- _context10.next = 4;
4011
+ _context11.prev = 1;
4012
+ _context11.next = 4;
3934
4013
  return maintenanceActions.editJobStatus(_this.state.job.id, status);
3935
4014
 
3936
4015
  case 4:
3937
- res = _context10.sent;
4016
+ res = _context11.sent;
3938
4017
  job = res.data.job;
3939
4018
 
3940
4019
  _this.props.jobsLoaded([job]);
@@ -3943,24 +4022,24 @@
3943
4022
  job: job
3944
4023
  });
3945
4024
 
3946
- _context10.next = 13;
4025
+ _context11.next = 13;
3947
4026
  break;
3948
4027
 
3949
4028
  case 10:
3950
- _context10.prev = 10;
3951
- _context10.t0 = _context10["catch"](1);
3952
- console.error('onSelectStatus', _context10.t0);
4029
+ _context11.prev = 10;
4030
+ _context11.t0 = _context11["catch"](1);
4031
+ console.error('onSelectStatus', _context11.t0);
3953
4032
 
3954
4033
  case 13:
3955
4034
  case "end":
3956
- return _context10.stop();
4035
+ return _context11.stop();
3957
4036
  }
3958
4037
  }
3959
- }, _callee10, null, [[1, 10]]);
4038
+ }, _callee11, null, [[1, 10]]);
3960
4039
  }));
3961
4040
 
3962
4041
  return function (_x3) {
3963
- return _ref10.apply(this, arguments);
4042
+ return _ref11.apply(this, arguments);
3964
4043
  };
3965
4044
  }());
3966
4045
 
@@ -3980,7 +4059,10 @@
3980
4059
  noteImages: [],
3981
4060
  assignees: [],
3982
4061
  externalSync: null,
3983
- loadingExternalSync: false
4062
+ loadingExternalSync: false,
4063
+ retryingSync: false,
4064
+ retrySyncError: null,
4065
+ retrySyncInitiated: false
3984
4066
  };
3985
4067
  return _this;
3986
4068
  }
@@ -4512,24 +4594,122 @@
4512
4594
  className: "flex-1"
4513
4595
  }, "Priority")));
4514
4596
  }
4597
+ }, {
4598
+ key: "hasSyncFailureWithoutSuccess",
4599
+ value: function hasSyncFailureWithoutSuccess() {
4600
+ var job = this.state.job;
4601
+ if (!job || !job.history) return false;
4602
+ var history = job.history || [];
4603
+ var hasSuccess = history.some(function (entry) {
4604
+ return entry.EntryType === 'ExternalIDSet';
4605
+ });
4606
+ var hasFailure = history.some(function (entry) {
4607
+ return entry.EntryType === 'ExternalIDSetFailed';
4608
+ });
4609
+ return hasFailure && !hasSuccess;
4610
+ }
4611
+ }, {
4612
+ key: "renderRetrySyncButton",
4613
+ value: function renderRetrySyncButton() {
4614
+ var auth = this.props.auth;
4615
+ var _this$state3 = this.state,
4616
+ retryingSync = _this$state3.retryingSync,
4617
+ retrySyncInitiated = _this$state3.retrySyncInitiated; // Only show for users with maintenance tracking permission
4618
+
4619
+ 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
4620
+
4621
+ if (!this.hasSyncFailureWithoutSuccess() || retrySyncInitiated) return null; // Show spinner while retrying
4622
+
4623
+ if (retryingSync) {
4624
+ return /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
4625
+ style: {
4626
+ fontSize: 20,
4627
+ color: Colours$1.COLOUR_DUSK_LIGHT,
4628
+ marginLeft: 8
4629
+ },
4630
+ name: "spinner fa-pulse fa-fw"
4631
+ });
4632
+ }
4633
+
4634
+ return /*#__PURE__*/React__default['default'].createElement("div", {
4635
+ className: "statusLabel pointer",
4636
+ onClick: this.onRetrySync,
4637
+ style: {
4638
+ backgroundColor: Colours$1.COLOUR_RED,
4639
+ marginLeft: 8
4640
+ }
4641
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
4642
+ className: "statusLabel_text"
4643
+ }, "Retry Sync"));
4644
+ }
4645
+ }, {
4646
+ key: "renderExternalSyncStatus",
4647
+ value: function renderExternalSyncStatus() {
4648
+ var _this$state4 = this.state,
4649
+ retrySyncError = _this$state4.retrySyncError,
4650
+ retrySyncInitiated = _this$state4.retrySyncInitiated; // Show error message if retry failed
4651
+
4652
+ if (retrySyncError) {
4653
+ return /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4654
+ type: "body"
4655
+ }, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
4656
+ className: "userStatusIcon",
4657
+ name: "times-circle",
4658
+ style: {
4659
+ color: Colours$1.COLOUR_RED
4660
+ }
4661
+ }), " ", retrySyncError);
4662
+ } // Show success message if retry was initiated
4663
+
4664
+
4665
+ if (retrySyncInitiated) {
4666
+ return /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4667
+ type: "body"
4668
+ }, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
4669
+ className: "userStatusIcon",
4670
+ name: "check-circle",
4671
+ style: {
4672
+ color: Colours$1.COLOUR_GREEN
4673
+ }
4674
+ }), " Sync retry initiated. Check back shortly for results.");
4675
+ } // Show failure message with instruction
4676
+
4677
+
4678
+ if (this.hasSyncFailureWithoutSuccess()) {
4679
+ return /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4680
+ type: "body"
4681
+ }, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
4682
+ className: "userStatusIcon",
4683
+ name: "times-circle",
4684
+ style: {
4685
+ color: Colours$1.COLOUR_RED
4686
+ }
4687
+ }), " External sync failed. Use the retry button to attempt again.");
4688
+ }
4689
+
4690
+ return null;
4691
+ }
4515
4692
  }, {
4516
4693
  key: "renderExternalSync",
4517
4694
  value: function renderExternalSync() {
4518
- var _this$state3 = this.state,
4519
- externalSync = _this$state3.externalSync,
4520
- loadingExternalSync = _this$state3.loadingExternalSync; // Only show if external sync data exists
4695
+ var _this$state5 = this.state,
4696
+ externalSync = _this$state5.externalSync,
4697
+ loadingExternalSync = _this$state5.loadingExternalSync; // Check if we should show this section at all
4698
+
4699
+ var hasExternalSyncData = externalSync && !loadingExternalSync;
4700
+ var hasSyncFailure = this.hasSyncFailureWithoutSuccess(); // Show section if we have sync data OR if there's a failure that can be retried
4521
4701
 
4522
- if (!externalSync || loadingExternalSync) return null;
4702
+ if (!hasExternalSyncData && !hasSyncFailure) return null;
4523
4703
  return /*#__PURE__*/React__default['default'].createElement("div", {
4524
4704
  className: "padding-32 paddingVertical-40 bottomDivideBorder relative"
4525
4705
  }, /*#__PURE__*/React__default['default'].createElement("div", {
4526
4706
  className: "newTopBar clearfix flex flex-reverse"
4527
- }, /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4707
+ }, this.renderRetrySyncButton(), /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4528
4708
  type: "formTitleSmall",
4529
4709
  className: "flex-1"
4530
4710
  }, "External Sync")), /*#__PURE__*/React__default['default'].createElement("div", {
4531
4711
  className: "marginTop-16"
4532
- }, externalSync.systemType && /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4712
+ }, hasExternalSyncData ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, externalSync.systemType && /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4533
4713
  type: "body",
4534
4714
  className: "marginBottom-8"
4535
4715
  }, /*#__PURE__*/React__default['default'].createElement("strong", null, "System:"), " ", externalSync.systemType), externalSync.externalId && /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
@@ -4538,7 +4718,7 @@
4538
4718
  }, /*#__PURE__*/React__default['default'].createElement("strong", null, "External ID:"), " ", externalSync.externalId), externalSync.syncedAt && /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
4539
4719
  type: "body",
4540
4720
  className: "marginBottom-8"
4541
- }, /*#__PURE__*/React__default['default'].createElement("strong", null, "Synced:"), " ", moment__default['default'].utc(externalSync.syncedAt).local().format('D MMM YYYY h:mma'))));
4721
+ }, /*#__PURE__*/React__default['default'].createElement("strong", null, "Synced:"), " ", moment__default['default'].utc(externalSync.syncedAt).local().format('D MMM YYYY h:mma'))) : this.renderExternalSyncStatus()));
4542
4722
  }
4543
4723
  }, {
4544
4724
  key: "renderOverview",
@@ -4696,8 +4876,8 @@
4696
4876
  }), /*#__PURE__*/React__default['default'].createElement("p", {
4697
4877
  className: "iconTextButton_text"
4698
4878
  }, "Add Attachment")), /*#__PURE__*/React__default['default'].createElement(Components$3.ImageInput, {
4699
- ref: function ref(_ref11) {
4700
- _this8.imageInput = _ref11;
4879
+ ref: function ref(_ref12) {
4880
+ _this8.imageInput = _ref12;
4701
4881
  },
4702
4882
  multiple: true,
4703
4883
  refreshCallback: function refreshCallback(images) {
@@ -4955,6 +5135,12 @@
4955
5135
  if (res.data != null && !___default['default'].isEmpty(res.data.results.Items)) {
4956
5136
  items = res.data.results.Items;
4957
5137
 
5138
+ if (_this.props.optionOnlyForResidents) {
5139
+ items = ___default['default'].filter(items, function (u) {
5140
+ return u.category === 'resident';
5141
+ });
5142
+ }
5143
+
4958
5144
  _this.setState({
4959
5145
  users: ___default['default'].sortBy(items, function (u) {
4960
5146
  return (u.displayName || '').toLowerCase();
@@ -6071,7 +6257,8 @@
6071
6257
  var auth = state.auth;
6072
6258
  return {
6073
6259
  auth: auth,
6074
- strings: state.strings && state.strings.config || {}
6260
+ strings: state.strings && state.strings.config || {},
6261
+ optionOnlyForResidents: Helper$1.getSiteSettingFromState(state, values.optionOnlyForResidents)
6075
6262
  };
6076
6263
  };
6077
6264