@plusscommunities/pluss-maintenance-web 1.0.23 → 1.0.27-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1851 -1876
- package/dist/index.esm.js +1851 -1876
- package/dist/index.umd.js +1854 -1879
- package/package.json +6 -5
- package/src/apis/reactionActions.js +2 -1
- package/src/components/JobList.js +2 -21
- package/src/{screens → components}/JobTypes.js +5 -11
- package/src/index.js +1 -2
- package/src/screens/RequestsHub.js +51 -41
package/dist/index.cjs.js
CHANGED
|
@@ -13,13 +13,13 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
13
13
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var reactRedux = require('react-redux');
|
|
16
|
+
var reactRouter = require('react-router');
|
|
16
17
|
var _ = require('lodash');
|
|
17
18
|
var moment = require('moment');
|
|
18
19
|
var FontAwesome = require('react-fontawesome');
|
|
19
20
|
var PlussCore = require('@plusscommunities/pluss-core-web');
|
|
20
21
|
var Cookies = require('js-cookie');
|
|
21
22
|
var reactBootstrap = require('react-bootstrap');
|
|
22
|
-
var reactRouter = require('react-router');
|
|
23
23
|
var reactRouterDom = require('react-router-dom');
|
|
24
24
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
25
25
|
var Textarea = require('react-textarea-autosize');
|
|
@@ -321,13 +321,14 @@ var maintenanceActions = {
|
|
|
321
321
|
var Helper$3 = PlussCore__namespace.Helper,
|
|
322
322
|
Session$5 = PlussCore__namespace.Session;
|
|
323
323
|
var reactionActions = {
|
|
324
|
-
addComment: function addComment(entityId, entityType, entityName, site, comment, image) {
|
|
324
|
+
addComment: function addComment(entityId, entityType, entityName, site, comment, image, parentId) {
|
|
325
325
|
var data = {
|
|
326
326
|
entityId: entityId,
|
|
327
327
|
entityType: entityType,
|
|
328
328
|
entityName: entityName,
|
|
329
329
|
site: site,
|
|
330
|
-
comment: comment
|
|
330
|
+
comment: comment,
|
|
331
|
+
parentId: parentId
|
|
331
332
|
};
|
|
332
333
|
|
|
333
334
|
if (!___default['default'].isEmpty(image)) {
|
|
@@ -468,8 +469,7 @@ var StatusTypes = {
|
|
|
468
469
|
function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
469
470
|
|
|
470
471
|
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; } }
|
|
471
|
-
var Session$4 = PlussCore__namespace.Session
|
|
472
|
-
Components$4 = PlussCore__namespace.Components;
|
|
472
|
+
var Session$4 = PlussCore__namespace.Session;
|
|
473
473
|
|
|
474
474
|
var JobList = /*#__PURE__*/function (_Component) {
|
|
475
475
|
_inherits__default['default'](JobList, _Component);
|
|
@@ -577,10 +577,6 @@ var JobList = /*#__PURE__*/function (_Component) {
|
|
|
577
577
|
};
|
|
578
578
|
}());
|
|
579
579
|
|
|
580
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenJobTypes", function () {
|
|
581
|
-
_this.props.history.push('/requestTypes');
|
|
582
|
-
});
|
|
583
|
-
|
|
584
580
|
_this.state = {
|
|
585
581
|
showCompleted: false,
|
|
586
582
|
sortColumn: 'createdUnix',
|
|
@@ -720,27 +716,6 @@ var JobList = /*#__PURE__*/function (_Component) {
|
|
|
720
716
|
}
|
|
721
717
|
}, "Example might be; Fix my light bulb, hand rail is broken, or please send flowers to Mum."));
|
|
722
718
|
}
|
|
723
|
-
}, {
|
|
724
|
-
key: "renderButtons",
|
|
725
|
-
value: function renderButtons() {
|
|
726
|
-
if (!Session$4.validateAccess(this.props.auth.site, 'maintenanceTypes', this.props.auth)) return null;
|
|
727
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
728
|
-
className: "flex-reverse"
|
|
729
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$4.Button, {
|
|
730
|
-
inline: true,
|
|
731
|
-
buttonType: "primaryAction",
|
|
732
|
-
onClick: this.onOpenJobTypes,
|
|
733
|
-
isActive: true
|
|
734
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
735
|
-
className: "flex flex-row flex-center"
|
|
736
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$4.SVGIcon, {
|
|
737
|
-
colour: '#fff',
|
|
738
|
-
icon: "maintenance2",
|
|
739
|
-
height: "17px"
|
|
740
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
741
|
-
className: "marginLeft-10"
|
|
742
|
-
}, "Request Types"))));
|
|
743
|
-
}
|
|
744
719
|
}, {
|
|
745
720
|
key: "renderContent",
|
|
746
721
|
value: function renderContent() {
|
|
@@ -812,7 +787,9 @@ var JobList = /*#__PURE__*/function (_Component) {
|
|
|
812
787
|
style: {
|
|
813
788
|
minWidth: '100%'
|
|
814
789
|
}
|
|
815
|
-
}, this.
|
|
790
|
+
}, this.renderContent(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
791
|
+
className: "hub_tidioPadding"
|
|
792
|
+
}));
|
|
816
793
|
}
|
|
817
794
|
}]);
|
|
818
795
|
|
|
@@ -836,1308 +813,1235 @@ var JobList$1 = reactRedux.connect(mapStateToProps$4, {
|
|
|
836
813
|
function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
837
814
|
|
|
838
815
|
function _isNativeReflectConstruct$9() { 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; } }
|
|
839
|
-
var
|
|
840
|
-
|
|
816
|
+
var Session$3 = PlussCore__namespace.Session,
|
|
817
|
+
Components$3 = PlussCore__namespace.Components,
|
|
818
|
+
Helper$2 = PlussCore__namespace.Helper;
|
|
841
819
|
|
|
842
|
-
var
|
|
843
|
-
_inherits__default['default'](
|
|
820
|
+
var JobTypes = /*#__PURE__*/function (_Component) {
|
|
821
|
+
_inherits__default['default'](JobTypes, _Component);
|
|
844
822
|
|
|
845
|
-
var _super = _createSuper$9(
|
|
823
|
+
var _super = _createSuper$9(JobTypes);
|
|
846
824
|
|
|
847
|
-
function
|
|
825
|
+
function JobTypes(props) {
|
|
848
826
|
var _this;
|
|
849
827
|
|
|
850
|
-
_classCallCheck__default['default'](this,
|
|
828
|
+
_classCallCheck__default['default'](this, JobTypes);
|
|
851
829
|
|
|
852
830
|
_this = _super.call(this, props);
|
|
853
831
|
|
|
854
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
855
|
-
var
|
|
832
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJobTypes", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
833
|
+
var res;
|
|
834
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
835
|
+
while (1) {
|
|
836
|
+
switch (_context.prev = _context.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
_context.prev = 0;
|
|
839
|
+
_context.next = 3;
|
|
840
|
+
return maintenanceActions.getJobTypes(_this.props.auth.site);
|
|
856
841
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
842
|
+
case 3:
|
|
843
|
+
res = _context.sent;
|
|
844
|
+
if (res.data != null) _this.props.jobTypesLoaded(res.data);
|
|
845
|
+
_context.next = 10;
|
|
846
|
+
break;
|
|
860
847
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
});
|
|
848
|
+
case 7:
|
|
849
|
+
_context.prev = 7;
|
|
850
|
+
_context.t0 = _context["catch"](0);
|
|
851
|
+
console.error('getJobTypes', _context.t0);
|
|
866
852
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
if (ev.status && ev.status === 'Completed') return true;
|
|
870
|
-
return false;
|
|
871
|
-
}); // console.log('setData', upcoming, completed);
|
|
853
|
+
case 10:
|
|
854
|
+
_context.prev = 10;
|
|
872
855
|
|
|
856
|
+
_this.setState({
|
|
857
|
+
loading: false
|
|
858
|
+
});
|
|
873
859
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
860
|
+
return _context.finish(10);
|
|
861
|
+
|
|
862
|
+
case 13:
|
|
863
|
+
case "end":
|
|
864
|
+
return _context.stop();
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}, _callee, null, [[0, 7, 10, 13]]);
|
|
868
|
+
})));
|
|
869
|
+
|
|
870
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "sortByCol", function (col) {
|
|
871
|
+
if (_this.state.sortColumn === col) {
|
|
872
|
+
_this.setState({
|
|
873
|
+
sortDesc: !_this.state.sortDesc
|
|
874
|
+
});
|
|
875
|
+
} else {
|
|
876
|
+
_this.setState({
|
|
877
|
+
sortColumn: col,
|
|
878
|
+
sortDesc: false
|
|
879
|
+
});
|
|
880
|
+
}
|
|
879
881
|
});
|
|
880
882
|
|
|
881
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
882
|
-
var
|
|
883
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "validateEmail", function () {
|
|
884
|
+
var jobTypeEmail = _this.state.jobTypeEmail;
|
|
885
|
+
return !___default['default'].isEmpty(jobTypeEmail) && Helper$2.isEmail(jobTypeEmail);
|
|
886
|
+
});
|
|
883
887
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
888
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "isJobTypeValid", function () {
|
|
889
|
+
var _this$state = _this.state,
|
|
890
|
+
jobTypeName = _this$state.jobTypeName,
|
|
891
|
+
jobTypeDescription = _this$state.jobTypeDescription;
|
|
892
|
+
if (___default['default'].isEmpty(jobTypeName)) return false;
|
|
893
|
+
if (!_this.validateEmail()) return false;
|
|
894
|
+
if (___default['default'].isEmpty(jobTypeDescription)) return false;
|
|
895
|
+
return true;
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onRemoveJobType", /*#__PURE__*/function () {
|
|
899
|
+
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(ev) {
|
|
900
|
+
var index, newJobTypes;
|
|
901
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
889
902
|
while (1) {
|
|
890
|
-
switch (
|
|
903
|
+
switch (_context2.prev = _context2.next) {
|
|
891
904
|
case 0:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
905
|
+
if (window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) {
|
|
906
|
+
_context2.next = 2;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
895
909
|
|
|
896
|
-
|
|
897
|
-
res = _context.sent;
|
|
910
|
+
return _context2.abrupt("return");
|
|
898
911
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
912
|
+
case 2:
|
|
913
|
+
_context2.prev = 2;
|
|
914
|
+
_context2.next = 5;
|
|
915
|
+
return maintenanceActions.deleteJobType(_this.props.auth.site, ev.id);
|
|
916
|
+
|
|
917
|
+
case 5:
|
|
918
|
+
index = ___default['default'].findIndex(_this.state.jobList, function (job) {
|
|
919
|
+
return job != null && job.id === ev.id;
|
|
902
920
|
});
|
|
903
921
|
|
|
904
|
-
if (
|
|
905
|
-
_this.
|
|
922
|
+
if (index > -1) {
|
|
923
|
+
newJobTypes = _toConsumableArray__default['default'](_this.state.jobList);
|
|
924
|
+
newJobTypes[index].Deleted = true;
|
|
925
|
+
|
|
926
|
+
_this.props.jobTypesLoaded(newJobTypes);
|
|
906
927
|
}
|
|
907
928
|
|
|
908
|
-
|
|
929
|
+
_context2.next = 13;
|
|
909
930
|
break;
|
|
910
931
|
|
|
911
|
-
case
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
console.error('
|
|
915
|
-
|
|
916
|
-
_this.setState({
|
|
917
|
-
loadingAll: false
|
|
918
|
-
});
|
|
932
|
+
case 9:
|
|
933
|
+
_context2.prev = 9;
|
|
934
|
+
_context2.t0 = _context2["catch"](2);
|
|
935
|
+
console.error('onRemoveJobType', _context2.t0);
|
|
936
|
+
alert('Something went wrong with the request. Please try again.');
|
|
919
937
|
|
|
920
|
-
case
|
|
938
|
+
case 13:
|
|
921
939
|
case "end":
|
|
922
|
-
return
|
|
940
|
+
return _context2.stop();
|
|
923
941
|
}
|
|
924
942
|
}
|
|
925
|
-
},
|
|
926
|
-
}))
|
|
927
|
-
});
|
|
943
|
+
}, _callee2, null, [[2, 9]]);
|
|
944
|
+
}));
|
|
928
945
|
|
|
929
|
-
|
|
930
|
-
|
|
946
|
+
return function (_x) {
|
|
947
|
+
return _ref2.apply(this, arguments);
|
|
948
|
+
};
|
|
949
|
+
}());
|
|
931
950
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
});
|
|
951
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onShowJobType", function () {
|
|
952
|
+
var job = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
936
953
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
954
|
+
_this.setState({
|
|
955
|
+
showJobType: true,
|
|
956
|
+
jobTypeId: job ? job.id : null,
|
|
957
|
+
jobTypeName: job ? job.typeName : '',
|
|
958
|
+
jobTypeEmail: job ? job.email : '',
|
|
959
|
+
jobTypeDescription: job ? job.description : '',
|
|
960
|
+
jobTypeLevel: job ? job.level : 1
|
|
961
|
+
});
|
|
941
962
|
});
|
|
942
963
|
|
|
943
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
944
|
-
|
|
945
|
-
backgroundColor: '#fff'
|
|
946
|
-
} : {};
|
|
947
|
-
});
|
|
964
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHideJobType", function () {
|
|
965
|
+
if (_this.state.submitting) return;
|
|
948
966
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
967
|
+
_this.setState({
|
|
968
|
+
showWarnings: false,
|
|
969
|
+
showJobType: false,
|
|
970
|
+
jobTypeId: null,
|
|
971
|
+
jobTypeName: '',
|
|
972
|
+
jobTypeEmail: '',
|
|
973
|
+
jobTypeDescription: '',
|
|
974
|
+
jobTypeLevel: 1
|
|
975
|
+
});
|
|
954
976
|
});
|
|
955
977
|
|
|
956
|
-
_this
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
loadingAll: false,
|
|
960
|
-
loadingSubmissions: false,
|
|
961
|
-
submissionEntries: [],
|
|
962
|
-
allList: [],
|
|
963
|
-
completed: [],
|
|
964
|
-
upcoming: [],
|
|
965
|
-
now: moment__default['default'].utc(),
|
|
966
|
-
onlyFuture: true,
|
|
967
|
-
search: ''
|
|
968
|
-
};
|
|
969
|
-
return _this;
|
|
970
|
-
}
|
|
978
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
979
|
+
var stateChange = {};
|
|
980
|
+
stateChange[event.target.getAttribute('id')] = event.target.value;
|
|
971
981
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
value: function UNSAFE_componentWillMount() {
|
|
975
|
-
this.updateProps(this.props);
|
|
976
|
-
}
|
|
977
|
-
}, {
|
|
978
|
-
key: "componentDidMount",
|
|
979
|
-
value: function componentDidMount() {
|
|
980
|
-
this.getData();
|
|
981
|
-
}
|
|
982
|
-
}, {
|
|
983
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
984
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
985
|
-
if (!___default['default'].isEqual(this.props.jobs, nextProps.jobs)) this.updateProps(nextProps);
|
|
986
|
-
}
|
|
987
|
-
}, {
|
|
988
|
-
key: "updateProps",
|
|
989
|
-
value: function updateProps(props) {
|
|
990
|
-
this.setState({
|
|
991
|
-
allList: props.jobs
|
|
992
|
-
}, this.setData);
|
|
993
|
-
}
|
|
994
|
-
}, {
|
|
995
|
-
key: "renderLeftBar",
|
|
996
|
-
value: function renderLeftBar() {
|
|
997
|
-
var _this2 = this;
|
|
982
|
+
_this.setState(stateChange);
|
|
983
|
+
});
|
|
998
984
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
className: "fontMedium fontSize-32 text-dark",
|
|
1010
|
-
style: styles$4.sideBarTitleSection
|
|
1011
|
-
}, "Maintenance requests"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1012
|
-
onClick: function onClick() {
|
|
1013
|
-
_this2.setState({
|
|
1014
|
-
selectedSection: 'completed'
|
|
1015
|
-
});
|
|
1016
|
-
},
|
|
1017
|
-
className: "sideBarSection",
|
|
1018
|
-
style: this.getSideBarSectionColour('completed')
|
|
1019
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1020
|
-
className: "fontMedium fontSize-36 text-dark",
|
|
1021
|
-
style: {
|
|
1022
|
-
lineHeight: '50px'
|
|
1023
|
-
}
|
|
1024
|
-
}, this.renderStats(this.state.completed.length, this.state.loadingAll)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1025
|
-
className: "fontRegular fontSize-16 text-light lineHeight-22"
|
|
1026
|
-
}, "Complete")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1027
|
-
onClick: function onClick() {
|
|
1028
|
-
_this2.setState({
|
|
1029
|
-
selectedSection: 'upcoming'
|
|
1030
|
-
});
|
|
1031
|
-
},
|
|
1032
|
-
className: "sideBarSection",
|
|
1033
|
-
style: this.getSideBarSectionColour('upcoming')
|
|
1034
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1035
|
-
className: "fontMedium fontSize-36 text-dark",
|
|
1036
|
-
style: {
|
|
1037
|
-
lineHeight: '50px'
|
|
1038
|
-
}
|
|
1039
|
-
}, this.renderStats(this.state.upcoming.length, this.state.loadingAll)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1040
|
-
className: "fontRegular fontSize-16 text-light lineHeight-22"
|
|
1041
|
-
}, "Incomplete"))));
|
|
1042
|
-
}
|
|
1043
|
-
}, {
|
|
1044
|
-
key: "renderRight",
|
|
1045
|
-
value: function renderRight() {
|
|
1046
|
-
return /*#__PURE__*/React__default['default'].createElement(JobList$1, {
|
|
1047
|
-
source: this.state.selectedSection === 'completed' ? this.state.completed : this.state.upcoming
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
}, {
|
|
1051
|
-
key: "render",
|
|
1052
|
-
value: function render() {
|
|
1053
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1054
|
-
className: "hub-wrapperContainer"
|
|
1055
|
-
}, this.renderLeftBar(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1056
|
-
className: "hub-headerContentWrapper"
|
|
1057
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$3.Header, null, this.canAddNew() && /*#__PURE__*/React__default['default'].createElement(Components$3.AddButton, {
|
|
1058
|
-
onClick: this.onAddNew,
|
|
1059
|
-
text: "NEW REQUEST"
|
|
1060
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1061
|
-
className: "hub-contentWrapper"
|
|
1062
|
-
}, this.renderRight())));
|
|
1063
|
-
}
|
|
1064
|
-
}]);
|
|
1065
|
-
|
|
1066
|
-
return RequestsHub;
|
|
1067
|
-
}(React.Component);
|
|
1068
|
-
|
|
1069
|
-
var styles$4 = {
|
|
1070
|
-
sideBarTitleSection: {
|
|
1071
|
-
lineHeight: '40px',
|
|
1072
|
-
marginTop: 30,
|
|
1073
|
-
marginBottom: 30,
|
|
1074
|
-
paddingLeft: 24,
|
|
1075
|
-
paddingRight: 24
|
|
1076
|
-
},
|
|
1077
|
-
sideBarSection: {
|
|
1078
|
-
weight: '100%',
|
|
1079
|
-
minWidth: 200,
|
|
1080
|
-
padding: 32,
|
|
1081
|
-
paddingLeft: 24,
|
|
1082
|
-
cursor: 'pointer',
|
|
1083
|
-
display: 'flex',
|
|
1084
|
-
flexDirection: 'column',
|
|
1085
|
-
justifyContent: 'center'
|
|
1086
|
-
},
|
|
1087
|
-
spinner: {
|
|
1088
|
-
fontSize: 32,
|
|
1089
|
-
color: FeatureConfig.env.colourBrandingOff
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
var mapStateToProps$3 = function mapStateToProps(state) {
|
|
1094
|
-
var jobs = state.maintenance.jobs;
|
|
1095
|
-
var auth = state.auth;
|
|
1096
|
-
return {
|
|
1097
|
-
jobs: jobs,
|
|
1098
|
-
auth: auth
|
|
1099
|
-
};
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
var RequestsHub$1 = reactRedux.connect(mapStateToProps$3, {
|
|
1103
|
-
jobsLoaded: jobsLoaded
|
|
1104
|
-
})(RequestsHub);
|
|
1105
|
-
|
|
1106
|
-
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; }
|
|
1107
|
-
|
|
1108
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1109
|
-
|
|
1110
|
-
function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
985
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSave", function () {
|
|
986
|
+
var site = _this.props.auth.site;
|
|
987
|
+
var _this$state2 = _this.state,
|
|
988
|
+
submitting = _this$state2.submitting,
|
|
989
|
+
jobTypeId = _this$state2.jobTypeId,
|
|
990
|
+
jobTypeName = _this$state2.jobTypeName,
|
|
991
|
+
jobTypeEmail = _this$state2.jobTypeEmail,
|
|
992
|
+
jobTypeDescription = _this$state2.jobTypeDescription,
|
|
993
|
+
jobTypeLevel = _this$state2.jobTypeLevel;
|
|
994
|
+
if (submitting) return;
|
|
1111
995
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
Colours = PlussCore__namespace.Colours,
|
|
1117
|
-
Components$2 = PlussCore__namespace.Components;
|
|
996
|
+
if (!_this.isJobTypeValid()) {
|
|
997
|
+
_this.setState({
|
|
998
|
+
showWarnings: true
|
|
999
|
+
});
|
|
1118
1000
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1121
1003
|
|
|
1122
|
-
|
|
1004
|
+
_this.setState({
|
|
1005
|
+
submitting: true
|
|
1006
|
+
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
1007
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1008
|
+
while (1) {
|
|
1009
|
+
switch (_context3.prev = _context3.next) {
|
|
1010
|
+
case 0:
|
|
1011
|
+
_context3.prev = 0;
|
|
1123
1012
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1013
|
+
if (!jobTypeId) {
|
|
1014
|
+
_context3.next = 6;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1126
1017
|
|
|
1127
|
-
|
|
1018
|
+
_context3.next = 4;
|
|
1019
|
+
return maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
1128
1020
|
|
|
1129
|
-
|
|
1021
|
+
case 4:
|
|
1022
|
+
_context3.next = 8;
|
|
1023
|
+
break;
|
|
1130
1024
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
while (1) {
|
|
1135
|
-
switch (_context.prev = _context.next) {
|
|
1136
|
-
case 0:
|
|
1137
|
-
_context.prev = 0;
|
|
1138
|
-
_context.next = 3;
|
|
1139
|
-
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
1025
|
+
case 6:
|
|
1026
|
+
_context3.next = 8;
|
|
1027
|
+
return maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
1140
1028
|
|
|
1141
|
-
|
|
1142
|
-
|
|
1029
|
+
case 8:
|
|
1030
|
+
_this.props.jobTypesUpdate(site);
|
|
1143
1031
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1032
|
+
_this.setState({
|
|
1033
|
+
submitting: false
|
|
1034
|
+
}, _this.onHideJobType);
|
|
1147
1035
|
|
|
1148
|
-
|
|
1036
|
+
_context3.next = 17;
|
|
1037
|
+
break;
|
|
1149
1038
|
|
|
1150
|
-
|
|
1039
|
+
case 12:
|
|
1040
|
+
_context3.prev = 12;
|
|
1041
|
+
_context3.t0 = _context3["catch"](0);
|
|
1042
|
+
console.error('onSave', _context3.t0);
|
|
1151
1043
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1044
|
+
_this.setState({
|
|
1045
|
+
submitting: false
|
|
1046
|
+
});
|
|
1154
1047
|
|
|
1155
|
-
|
|
1156
|
-
_context.prev = 9;
|
|
1157
|
-
_context.t0 = _context["catch"](0);
|
|
1158
|
-
console.error('getJob', _context.t0);
|
|
1048
|
+
alert('Something went wrong with the request. Please try again.');
|
|
1159
1049
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1050
|
+
case 17:
|
|
1051
|
+
case "end":
|
|
1052
|
+
return _context3.stop();
|
|
1053
|
+
}
|
|
1163
1054
|
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
})
|
|
1167
|
-
|
|
1168
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setJob", function (job) {
|
|
1169
|
-
job.typeIcon = job.type === 'General' ? 'wrench' : 'tree';
|
|
1170
|
-
job.typeColour = job.type === 'General' ? '#666' : 'green';
|
|
1171
|
-
|
|
1172
|
-
if (___default['default'].isEmpty(job.lastActivity)) {
|
|
1173
|
-
job.lastActivity = '-- --';
|
|
1174
|
-
job.noActivity = true;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
if (___default['default'].isEmpty(job.status)) {
|
|
1178
|
-
job.status = 'Unassigned';
|
|
1179
|
-
job.notStatus = true;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
if (___default['default'].isEmpty(job.audience)) {
|
|
1183
|
-
job.audience = [{
|
|
1184
|
-
displayName: 'Unassigned',
|
|
1185
|
-
isEmpty: true
|
|
1186
|
-
}];
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
var needToMarkSeen = false;
|
|
1055
|
+
}, _callee3, null, [[0, 12]]);
|
|
1056
|
+
})));
|
|
1057
|
+
});
|
|
1190
1058
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1059
|
+
_this.state = {
|
|
1060
|
+
jobList: [],
|
|
1061
|
+
showCompleted: false,
|
|
1062
|
+
sortColumn: 'name',
|
|
1063
|
+
sortDesc: false,
|
|
1064
|
+
loading: true,
|
|
1065
|
+
showJobType: false,
|
|
1066
|
+
jobTypeId: null,
|
|
1067
|
+
jobTypeName: '',
|
|
1068
|
+
jobTypeEmail: '',
|
|
1069
|
+
jobTypeDescription: '',
|
|
1070
|
+
jobTypeLevel: 1,
|
|
1071
|
+
showWarnings: false,
|
|
1072
|
+
submitting: false
|
|
1073
|
+
};
|
|
1074
|
+
return _this;
|
|
1075
|
+
}
|
|
1195
1076
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1077
|
+
_createClass__default['default'](JobTypes, [{
|
|
1078
|
+
key: "componentWillMount",
|
|
1079
|
+
value: function componentWillMount() {
|
|
1080
|
+
this.updateProps(this.props);
|
|
1081
|
+
Session$3.checkLoggedIn(this, this.props.auth);
|
|
1082
|
+
}
|
|
1083
|
+
}, {
|
|
1084
|
+
key: "componentDidMount",
|
|
1085
|
+
value: function componentDidMount() {
|
|
1086
|
+
this.getJobTypes();
|
|
1087
|
+
}
|
|
1088
|
+
}, {
|
|
1089
|
+
key: "componentWillReceiveProps",
|
|
1090
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
1091
|
+
this.updateProps(nextProps);
|
|
1092
|
+
}
|
|
1093
|
+
}, {
|
|
1094
|
+
key: "updateProps",
|
|
1095
|
+
value: function updateProps(props) {
|
|
1096
|
+
this.setState({
|
|
1097
|
+
jobList: props.jobtypes
|
|
1200
1098
|
});
|
|
1099
|
+
}
|
|
1100
|
+
}, {
|
|
1101
|
+
key: "renderList",
|
|
1102
|
+
value: function renderList() {
|
|
1103
|
+
var _this2 = this;
|
|
1201
1104
|
|
|
1202
|
-
|
|
1203
|
-
});
|
|
1204
|
-
|
|
1205
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "editJob", function () {});
|
|
1105
|
+
var source = ___default['default'].sortBy(this.state.jobList, this.state.sortColumn);
|
|
1206
1106
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
return n.Uploading;
|
|
1213
|
-
})) return false;
|
|
1214
|
-
return !___default['default'].isEmpty(noteInput) || !___default['default'].isEmpty(noteAttachments);
|
|
1215
|
-
});
|
|
1216
|
-
|
|
1217
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenAddNote", function () {
|
|
1218
|
-
_this.setState({
|
|
1219
|
-
addNoteOpen: true,
|
|
1220
|
-
editingNote: null
|
|
1221
|
-
});
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1224
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onCloseAddNote", function () {
|
|
1225
|
-
var newState = {
|
|
1226
|
-
addNoteOpen: false,
|
|
1227
|
-
editingNote: null
|
|
1228
|
-
};
|
|
1229
|
-
|
|
1230
|
-
if (!!_this.state.editingNote) {
|
|
1231
|
-
newState.noteInput = '';
|
|
1232
|
-
newState.noteAttachments = [];
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
_this.setState(newState);
|
|
1236
|
-
});
|
|
1237
|
-
|
|
1238
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenNoteMenu", function (index) {
|
|
1239
|
-
if (_this.state.noteMenuOpen === index) {
|
|
1240
|
-
_this.setState({
|
|
1241
|
-
noteMenuOpen: null
|
|
1242
|
-
});
|
|
1243
|
-
} else {
|
|
1244
|
-
_this.setState({
|
|
1245
|
-
noteMenuOpen: index
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
|
-
});
|
|
1249
|
-
|
|
1250
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandlePDFFileChange", function (event) {
|
|
1251
|
-
var file = event.target.files[0];
|
|
1252
|
-
if (!file || _this.state.uploadingNoteAttachment) return;
|
|
1253
|
-
|
|
1254
|
-
var noteAttachments = _toConsumableArray__default['default'](_this.state.noteAttachments);
|
|
1255
|
-
|
|
1256
|
-
var newAttachment = {
|
|
1257
|
-
Uploading: true,
|
|
1258
|
-
Title: file.name
|
|
1259
|
-
};
|
|
1260
|
-
noteAttachments.push(newAttachment);
|
|
1261
|
-
|
|
1262
|
-
_this.setState({
|
|
1263
|
-
noteAttachments: noteAttachments
|
|
1107
|
+
if (this.state.sortDesc) source.reverse();
|
|
1108
|
+
source = ___default['default'].filter(source, function (ev) {
|
|
1109
|
+
if (!ev) return false;
|
|
1110
|
+
if (ev.Deleted) return false;
|
|
1111
|
+
return true;
|
|
1264
1112
|
});
|
|
1113
|
+
return source.map(function (ev, index) {
|
|
1114
|
+
if (ev != null) {
|
|
1115
|
+
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
1116
|
+
key: index
|
|
1117
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
1118
|
+
className: "table-TitleColumn"
|
|
1119
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1120
|
+
onClick: function onClick() {
|
|
1121
|
+
return _this2.onShowJobType(ev);
|
|
1122
|
+
}
|
|
1123
|
+
}, ev.typeName)), /*#__PURE__*/React__default['default'].createElement("td", null, ev.description), /*#__PURE__*/React__default['default'].createElement("td", null, ev.email), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
1124
|
+
className: "table-options"
|
|
1125
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1126
|
+
style: {
|
|
1127
|
+
display: 'flex',
|
|
1128
|
+
alignItems: 'center'
|
|
1129
|
+
}
|
|
1130
|
+
}, Session$3.validateAccess(_this2.props.auth.site, 'maintenanceTypes', _this2.props.auth) && /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1131
|
+
onClick: function onClick() {
|
|
1132
|
+
return _this2.onShowJobType(ev);
|
|
1133
|
+
}
|
|
1134
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1135
|
+
style: {
|
|
1136
|
+
fontSize: 20,
|
|
1137
|
+
padding: 5,
|
|
1138
|
+
marginLeft: 12,
|
|
1139
|
+
cursor: 'pointer'
|
|
1140
|
+
},
|
|
1141
|
+
name: "pencil"
|
|
1142
|
+
})), Session$3.validateAccess(_this2.props.auth.site, 'maintenanceTypes', _this2.props.auth) && /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1143
|
+
onClick: function onClick() {
|
|
1144
|
+
return _this2.onRemoveJobType(ev);
|
|
1145
|
+
}
|
|
1146
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1147
|
+
style: {
|
|
1148
|
+
fontSize: 20,
|
|
1149
|
+
padding: 5,
|
|
1150
|
+
marginLeft: 8,
|
|
1151
|
+
cursor: 'pointer'
|
|
1152
|
+
},
|
|
1153
|
+
name: "minus-circle"
|
|
1154
|
+
})))));
|
|
1155
|
+
}
|
|
1265
1156
|
|
|
1266
|
-
|
|
1267
|
-
newAttachment.Source = fileRes;
|
|
1268
|
-
newAttachment.Uploading = false;
|
|
1269
|
-
|
|
1270
|
-
_this.setState({
|
|
1271
|
-
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1272
|
-
});
|
|
1273
|
-
}).catch(function (uploadErrorRes) {
|
|
1274
|
-
console.log(uploadErrorRes);
|
|
1275
|
-
newAttachment.Uploading = false;
|
|
1276
|
-
|
|
1277
|
-
_this.setState({
|
|
1278
|
-
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1279
|
-
});
|
|
1157
|
+
return null;
|
|
1280
1158
|
});
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
var
|
|
1159
|
+
}
|
|
1160
|
+
}, {
|
|
1161
|
+
key: "renderView",
|
|
1162
|
+
value: function renderView() {
|
|
1163
|
+
var _this3 = this;
|
|
1286
1164
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1165
|
+
return /*#__PURE__*/React__default['default'].createElement(reactBootstrap.Table, {
|
|
1166
|
+
className: "plussTable",
|
|
1167
|
+
striped: true,
|
|
1168
|
+
bordered: true,
|
|
1169
|
+
condensed: true,
|
|
1170
|
+
hover: true,
|
|
1171
|
+
style: {
|
|
1172
|
+
minWidth: '100%'
|
|
1173
|
+
}
|
|
1174
|
+
}, /*#__PURE__*/React__default['default'].createElement("thead", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
1175
|
+
style: {
|
|
1176
|
+
cursor: 'pointer'
|
|
1177
|
+
},
|
|
1178
|
+
onClick: function onClick() {
|
|
1179
|
+
return _this3.sortByCol('name');
|
|
1180
|
+
}
|
|
1181
|
+
}, "Request type"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
1182
|
+
style: {
|
|
1183
|
+
cursor: 'pointer'
|
|
1184
|
+
},
|
|
1185
|
+
onClick: function onClick() {
|
|
1186
|
+
return _this3.sortByCol('name');
|
|
1187
|
+
}
|
|
1188
|
+
}, "Type Description"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
1189
|
+
style: {
|
|
1190
|
+
cursor: 'pointer'
|
|
1191
|
+
},
|
|
1192
|
+
onClick: function onClick() {
|
|
1193
|
+
return _this3.sortByCol('email');
|
|
1194
|
+
}
|
|
1195
|
+
}, "Email"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
1196
|
+
style: {
|
|
1197
|
+
width: 70
|
|
1198
|
+
}
|
|
1199
|
+
}))), /*#__PURE__*/React__default['default'].createElement("tbody", null, this.renderList()));
|
|
1200
|
+
}
|
|
1201
|
+
}, {
|
|
1202
|
+
key: "renderEmpty",
|
|
1203
|
+
value: function renderEmpty() {
|
|
1204
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1205
|
+
style: {
|
|
1206
|
+
display: 'flex',
|
|
1207
|
+
flexDirection: 'column',
|
|
1208
|
+
flex: 1,
|
|
1209
|
+
justifyContent: 'center',
|
|
1210
|
+
alignItems: 'center',
|
|
1211
|
+
marginTop: 32
|
|
1212
|
+
}
|
|
1213
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1214
|
+
className: "emptyState"
|
|
1215
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1216
|
+
className: "marginTop-32",
|
|
1217
|
+
style: {
|
|
1218
|
+
maxWidth: 500,
|
|
1219
|
+
textAlign: 'center'
|
|
1220
|
+
}
|
|
1221
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1222
|
+
className: "fontRegular fontSize-13"
|
|
1223
|
+
}, "Please add the many categories of request types that exist in your village which work alongside the Maintenance area.")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1224
|
+
className: "marginTop-8 fontRegular fontSize-13",
|
|
1225
|
+
style: {
|
|
1226
|
+
maxWidth: 500,
|
|
1227
|
+
textAlign: 'center'
|
|
1228
|
+
}
|
|
1229
|
+
}, "Examples might be; OH&S, Electrical, General. Remember to add a description too."));
|
|
1230
|
+
}
|
|
1231
|
+
}, {
|
|
1232
|
+
key: "renderContent",
|
|
1233
|
+
value: function renderContent() {
|
|
1234
|
+
if (___default['default'].isEmpty(this.state.jobList)) return this.renderEmpty();
|
|
1235
|
+
return this.renderView();
|
|
1236
|
+
}
|
|
1237
|
+
}, {
|
|
1238
|
+
key: "renderJobTypes",
|
|
1239
|
+
value: function renderJobTypes() {
|
|
1240
|
+
var _this4 = this;
|
|
1289
1241
|
|
|
1290
|
-
|
|
1242
|
+
var _this$state3 = this.state,
|
|
1243
|
+
jobList = _this$state3.jobList,
|
|
1244
|
+
loading = _this$state3.loading;
|
|
1291
1245
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1246
|
+
if (jobList.length === 0 && loading) {
|
|
1247
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1248
|
+
style: {
|
|
1249
|
+
minWidth: '100%'
|
|
1250
|
+
}
|
|
1251
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1252
|
+
className: "padding-60 paddingVertical-40",
|
|
1253
|
+
style: {
|
|
1254
|
+
textAlign: 'center'
|
|
1255
|
+
}
|
|
1256
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1257
|
+
style: {
|
|
1258
|
+
fontSize: 30,
|
|
1259
|
+
color: FeatureConfig.env.colourBrandingOff
|
|
1260
|
+
},
|
|
1261
|
+
name: "spinner fa-pulse fa-fw"
|
|
1262
|
+
})));
|
|
1295
1263
|
}
|
|
1296
|
-
});
|
|
1297
|
-
|
|
1298
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
1299
|
-
var res;
|
|
1300
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1301
|
-
while (1) {
|
|
1302
|
-
switch (_context2.prev = _context2.next) {
|
|
1303
|
-
case 0:
|
|
1304
|
-
if (_this.isReadyToSaveNote()) {
|
|
1305
|
-
_context2.next = 2;
|
|
1306
|
-
break;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
return _context2.abrupt("return");
|
|
1310
1264
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1265
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1266
|
+
style: {
|
|
1267
|
+
minWidth: '100%'
|
|
1268
|
+
}
|
|
1269
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1270
|
+
className: "marginBottom-32"
|
|
1271
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$3.AddButton, {
|
|
1272
|
+
onClick: function onClick() {
|
|
1273
|
+
return _this4.onShowJobType();
|
|
1274
|
+
},
|
|
1275
|
+
text: "NEW REQUEST TYPE"
|
|
1276
|
+
})), this.renderContent());
|
|
1277
|
+
}
|
|
1278
|
+
}, {
|
|
1279
|
+
key: "renderNewUserTypePopup",
|
|
1280
|
+
value: function renderNewUserTypePopup() {
|
|
1281
|
+
var _this5 = this;
|
|
1313
1282
|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1283
|
+
var _this$state4 = this.state,
|
|
1284
|
+
submitting = _this$state4.submitting,
|
|
1285
|
+
showJobType = _this$state4.showJobType,
|
|
1286
|
+
jobTypeId = _this$state4.jobTypeId,
|
|
1287
|
+
showWarnings = _this$state4.showWarnings,
|
|
1288
|
+
jobTypeName = _this$state4.jobTypeName,
|
|
1289
|
+
jobTypeEmail = _this$state4.jobTypeEmail,
|
|
1290
|
+
jobTypeDescription = _this$state4.jobTypeDescription;
|
|
1291
|
+
if (!showJobType) return null;
|
|
1292
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$3.Popup, {
|
|
1293
|
+
maxWidth: 800,
|
|
1294
|
+
hasPadding: true,
|
|
1295
|
+
buttons: [{
|
|
1296
|
+
type: 'primaryAction',
|
|
1297
|
+
onClick: this.onSave,
|
|
1298
|
+
isActive: !submitting && this.isJobTypeValid(),
|
|
1299
|
+
text: submitting ? 'Saving...' : 'Save',
|
|
1300
|
+
className: 'popupButton'
|
|
1301
|
+
}, {
|
|
1302
|
+
type: 'outlinedAction',
|
|
1303
|
+
onClick: this.onHideJobType,
|
|
1304
|
+
isActive: !submitting,
|
|
1305
|
+
text: 'Cancel',
|
|
1306
|
+
className: 'popupButton'
|
|
1307
|
+
}],
|
|
1308
|
+
onClose: this.onHideJobType,
|
|
1309
|
+
title: jobTypeId ? 'Edit Request Type' : 'Create New Request Type'
|
|
1310
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$3.GenericInput, {
|
|
1311
|
+
id: "jobTypeName",
|
|
1312
|
+
type: "text",
|
|
1313
|
+
label: "Request type title",
|
|
1314
|
+
placeholder: "Request type title",
|
|
1315
|
+
value: jobTypeName,
|
|
1316
|
+
onChange: this.onHandleChange,
|
|
1317
|
+
isRequired: true,
|
|
1318
|
+
isValid: function isValid() {
|
|
1319
|
+
return !___default['default'].isEmpty(jobTypeName);
|
|
1320
|
+
},
|
|
1321
|
+
showError: function showError() {
|
|
1322
|
+
return showWarnings && ___default['default'].isEmpty(jobTypeName);
|
|
1323
|
+
},
|
|
1324
|
+
alwaysShowLabel: true
|
|
1325
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components$3.GenericInput, {
|
|
1326
|
+
id: "jobTypeEmail",
|
|
1327
|
+
type: "text",
|
|
1328
|
+
label: "Email",
|
|
1329
|
+
placeholder: "Request email",
|
|
1330
|
+
help: "This is the email address that'll receive service requests of this type",
|
|
1331
|
+
value: jobTypeEmail,
|
|
1332
|
+
onChange: this.onHandleChange,
|
|
1333
|
+
isRequired: true,
|
|
1334
|
+
isValid: this.validateEmail,
|
|
1335
|
+
showError: function showError() {
|
|
1336
|
+
return showWarnings && !_this5.validateEmail();
|
|
1337
|
+
},
|
|
1338
|
+
alwaysShowLabel: true
|
|
1339
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components$3.GenericInput, {
|
|
1340
|
+
id: "jobTypeDescription",
|
|
1341
|
+
type: "text",
|
|
1342
|
+
label: "Description",
|
|
1343
|
+
placeholder: "Add a description. ",
|
|
1344
|
+
help: "This description will be visible to the people to help them select the correct request type.",
|
|
1345
|
+
value: jobTypeDescription,
|
|
1346
|
+
onChange: this.onHandleChange,
|
|
1347
|
+
isRequired: true,
|
|
1348
|
+
isValid: function isValid() {
|
|
1349
|
+
return !___default['default'].isEmpty(jobTypeDescription);
|
|
1350
|
+
},
|
|
1351
|
+
showError: function showError() {
|
|
1352
|
+
return showWarnings && ___default['default'].isEmpty(jobTypeDescription);
|
|
1353
|
+
},
|
|
1354
|
+
alwaysShowLabel: true
|
|
1355
|
+
}));
|
|
1356
|
+
}
|
|
1357
|
+
}, {
|
|
1358
|
+
key: "render",
|
|
1359
|
+
value: function render() {
|
|
1360
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1361
|
+
style: {
|
|
1362
|
+
minWidth: '100%'
|
|
1363
|
+
}
|
|
1364
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", null, this.renderJobTypes()), this.renderNewUserTypePopup(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1365
|
+
className: "hub_tidioPadding"
|
|
1366
|
+
}));
|
|
1367
|
+
}
|
|
1368
|
+
}]);
|
|
1317
1369
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
return {
|
|
1321
|
-
Title: a.Title,
|
|
1322
|
-
Source: a.Source
|
|
1323
|
-
};
|
|
1324
|
-
})) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
|
|
1325
|
-
return {
|
|
1326
|
-
Title: a.Title,
|
|
1327
|
-
Source: a.Source
|
|
1328
|
-
};
|
|
1329
|
-
}));
|
|
1370
|
+
return JobTypes;
|
|
1371
|
+
}(React.Component);
|
|
1330
1372
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1373
|
+
var mapStateToProps$3 = function mapStateToProps(state) {
|
|
1374
|
+
var jobtypes = state.maintenance.jobtypes;
|
|
1375
|
+
var auth = state.auth;
|
|
1376
|
+
return {
|
|
1377
|
+
jobtypes: jobtypes,
|
|
1378
|
+
auth: auth
|
|
1379
|
+
};
|
|
1380
|
+
};
|
|
1333
1381
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
noteInput: '',
|
|
1339
|
-
noteAttachments: [],
|
|
1340
|
-
editingNote: null
|
|
1341
|
-
}, function () {
|
|
1342
|
-
_this.props.jobsLoaded([_this.state.job]);
|
|
1343
|
-
});
|
|
1382
|
+
var JobTypes$1 = reactRedux.connect(mapStateToProps$3, {
|
|
1383
|
+
jobTypesLoaded: jobTypesLoaded,
|
|
1384
|
+
jobTypesUpdate: jobTypesUpdate
|
|
1385
|
+
})(reactRouter.withRouter(JobTypes));
|
|
1344
1386
|
|
|
1345
|
-
|
|
1346
|
-
break;
|
|
1387
|
+
function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
1347
1388
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
console.error('onConfirmAddNote', _context2.t0);
|
|
1389
|
+
function _isNativeReflectConstruct$8() { 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; } }
|
|
1390
|
+
var Components$2 = PlussCore__namespace.Components,
|
|
1391
|
+
Session$2 = PlussCore__namespace.Session;
|
|
1352
1392
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
return _context2.stop();
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
}, _callee2, null, [[2, 10]]);
|
|
1359
|
-
})));
|
|
1393
|
+
var RequestsHub = /*#__PURE__*/function (_Component) {
|
|
1394
|
+
_inherits__default['default'](RequestsHub, _Component);
|
|
1360
1395
|
|
|
1361
|
-
|
|
1362
|
-
if (!window.confirm('Are you sure you want to delete that note?')) {
|
|
1363
|
-
_this.setState({
|
|
1364
|
-
noteMenuOpen: null
|
|
1365
|
-
});
|
|
1396
|
+
var _super = _createSuper$8(RequestsHub);
|
|
1366
1397
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1398
|
+
function RequestsHub(props) {
|
|
1399
|
+
var _this;
|
|
1369
1400
|
|
|
1370
|
-
|
|
1401
|
+
_classCallCheck__default['default'](this, RequestsHub);
|
|
1371
1402
|
|
|
1372
|
-
|
|
1373
|
-
return note.Id !== n.Id;
|
|
1374
|
-
});
|
|
1403
|
+
_this = _super.call(this, props);
|
|
1375
1404
|
|
|
1376
|
-
|
|
1405
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setData", function () {
|
|
1406
|
+
var allList = [];
|
|
1377
1407
|
|
|
1378
|
-
|
|
1408
|
+
_this.state.allList.forEach(function (ev) {
|
|
1409
|
+
if (ev != null && !ev.Deleted) allList.push(ev);
|
|
1410
|
+
});
|
|
1379
1411
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1412
|
+
var upcoming = ___default['default'].filter(allList, function (ev) {
|
|
1413
|
+
if (!ev) return false;
|
|
1414
|
+
if (ev.status && ev.status === 'Completed') return false;
|
|
1415
|
+
return true;
|
|
1383
1416
|
});
|
|
1384
|
-
});
|
|
1385
1417
|
|
|
1386
|
-
|
|
1418
|
+
var completed = ___default['default'].filter(allList, function (ev) {
|
|
1419
|
+
if (!ev) return false;
|
|
1420
|
+
if (ev.status && ev.status === 'Completed') return true;
|
|
1421
|
+
return false;
|
|
1422
|
+
}); // console.log('setData', upcoming, completed);
|
|
1423
|
+
|
|
1424
|
+
|
|
1387
1425
|
_this.setState({
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
editingNote: n.Id,
|
|
1392
|
-
noteMenuOpen: null
|
|
1426
|
+
allList: allList,
|
|
1427
|
+
upcoming: upcoming,
|
|
1428
|
+
completed: completed
|
|
1393
1429
|
});
|
|
1394
1430
|
});
|
|
1395
1431
|
|
|
1396
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
1397
|
-
var
|
|
1398
|
-
var auth = _this.props.auth; // Must have maintenance permission and not the requester
|
|
1399
|
-
|
|
1400
|
-
if (!Session$2.validateAccess(auth.site, 'maintenanceTracking', auth)) return;
|
|
1401
|
-
if (auth.user.Id === job.userID) return;
|
|
1432
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getData", function () {
|
|
1433
|
+
var auth = _this.props.auth;
|
|
1402
1434
|
|
|
1403
1435
|
_this.setState({
|
|
1404
|
-
|
|
1405
|
-
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
1406
|
-
var
|
|
1407
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
1436
|
+
loadingAll: true
|
|
1437
|
+
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
1438
|
+
var res;
|
|
1439
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1408
1440
|
while (1) {
|
|
1409
|
-
switch (
|
|
1441
|
+
switch (_context.prev = _context.next) {
|
|
1410
1442
|
case 0:
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
seen: true,
|
|
1415
|
-
status: job.status || 'Unassigned'
|
|
1416
|
-
};
|
|
1417
|
-
_context3.next = 4;
|
|
1418
|
-
return maintenanceActions.editJob(update, auth.site);
|
|
1443
|
+
_context.prev = 0;
|
|
1444
|
+
_context.next = 3;
|
|
1445
|
+
return maintenanceActions.getJobs(auth.site);
|
|
1419
1446
|
|
|
1420
|
-
case
|
|
1421
|
-
|
|
1447
|
+
case 3:
|
|
1448
|
+
res = _context.sent;
|
|
1449
|
+
|
|
1450
|
+
// console.log('getData', res.data);
|
|
1451
|
+
_this.setState({
|
|
1452
|
+
loadingAll: false
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
if (res.data != null && !___default['default'].isEmpty(res.data) && res.data[0].site === auth.site) {
|
|
1456
|
+
_this.props.jobsLoaded(res.data);
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
_context.next = 12;
|
|
1422
1460
|
break;
|
|
1423
1461
|
|
|
1424
|
-
case
|
|
1425
|
-
|
|
1426
|
-
|
|
1462
|
+
case 8:
|
|
1463
|
+
_context.prev = 8;
|
|
1464
|
+
_context.t0 = _context["catch"](0);
|
|
1465
|
+
console.error('getData', _context.t0);
|
|
1427
1466
|
|
|
1428
1467
|
_this.setState({
|
|
1429
|
-
|
|
1468
|
+
loadingAll: false
|
|
1430
1469
|
});
|
|
1431
1470
|
|
|
1432
|
-
|
|
1433
|
-
alert('Something went wrong with the request. Please try again.');
|
|
1434
|
-
|
|
1435
|
-
case 11:
|
|
1471
|
+
case 12:
|
|
1436
1472
|
case "end":
|
|
1437
|
-
return
|
|
1473
|
+
return _context.stop();
|
|
1438
1474
|
}
|
|
1439
1475
|
}
|
|
1440
|
-
},
|
|
1476
|
+
}, _callee, null, [[0, 8]]);
|
|
1441
1477
|
})));
|
|
1442
1478
|
});
|
|
1443
1479
|
|
|
1444
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1480
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAddNew", function () {
|
|
1481
|
+
var auth = _this.props.auth;
|
|
1482
|
+
|
|
1483
|
+
if (Session$2.validateAccess(auth.site, 'maintenanceTracking', auth)) {
|
|
1484
|
+
_this.props.history.push("/requestsHub/job");
|
|
1485
|
+
}
|
|
1450
1486
|
});
|
|
1451
1487
|
|
|
1452
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
1453
|
-
var
|
|
1454
|
-
|
|
1455
|
-
return
|
|
1456
|
-
while (1) {
|
|
1457
|
-
switch (_context4.prev = _context4.next) {
|
|
1458
|
-
case 0:
|
|
1459
|
-
_this$state2 = _this.state, commentInput = _this$state2.commentInput, jobId = _this$state2.jobId, job = _this$state2.job, comments = _this$state2.comments;
|
|
1460
|
-
_context4.prev = 1;
|
|
1461
|
-
|
|
1462
|
-
_this.setState({
|
|
1463
|
-
commentInput: ''
|
|
1464
|
-
});
|
|
1465
|
-
|
|
1466
|
-
_context4.next = 5;
|
|
1467
|
-
return reactionActions.addComment(jobId, 'maintenancerequest', job.title, job.site, commentInput);
|
|
1468
|
-
|
|
1469
|
-
case 5:
|
|
1470
|
-
res = _context4.sent;
|
|
1471
|
-
|
|
1472
|
-
_this.setState({
|
|
1473
|
-
comments: [].concat(_toConsumableArray__default['default'](comments), [res.data])
|
|
1474
|
-
});
|
|
1475
|
-
|
|
1476
|
-
_context4.next = 12;
|
|
1477
|
-
break;
|
|
1478
|
-
|
|
1479
|
-
case 9:
|
|
1480
|
-
_context4.prev = 9;
|
|
1481
|
-
_context4.t0 = _context4["catch"](1);
|
|
1482
|
-
console.error('onAddComment', _context4.t0);
|
|
1483
|
-
|
|
1484
|
-
case 12:
|
|
1485
|
-
case "end":
|
|
1486
|
-
return _context4.stop();
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
}, _callee4, null, [[1, 9]]);
|
|
1490
|
-
})));
|
|
1491
|
-
|
|
1492
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
1493
|
-
var stateChange = {};
|
|
1494
|
-
stateChange[event.target.getAttribute('id')] = event.target.value;
|
|
1495
|
-
|
|
1496
|
-
_this.setState(stateChange);
|
|
1488
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "canAddNew", function (isClass) {
|
|
1489
|
+
var auth = _this.props.auth;
|
|
1490
|
+
if (Session$2.validateAccess(auth.site, 'maintenanceTracking', auth)) return isClass ? '' : true;
|
|
1491
|
+
return isClass ? ' hub-sideContent-topButton--hide' : false;
|
|
1497
1492
|
});
|
|
1498
1493
|
|
|
1499
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
1500
|
-
_this.
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1494
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getSideBarSectionColour", function (id) {
|
|
1495
|
+
return _this.state.selectedSection === id ? {
|
|
1496
|
+
backgroundColor: '#fff'
|
|
1497
|
+
} : {};
|
|
1503
1498
|
});
|
|
1504
1499
|
|
|
1505
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
case 0:
|
|
1512
|
-
_this.setState({
|
|
1513
|
-
job: _objectSpread$3(_objectSpread$3({}, _this.state.job), {}, {
|
|
1514
|
-
status: status
|
|
1515
|
-
}),
|
|
1516
|
-
statusChangerOpen: false
|
|
1517
|
-
});
|
|
1518
|
-
|
|
1519
|
-
_context5.prev = 1;
|
|
1520
|
-
_context5.next = 4;
|
|
1521
|
-
return maintenanceActions.editJobStatus(_this.state.job.id, status);
|
|
1522
|
-
|
|
1523
|
-
case 4:
|
|
1524
|
-
res = _context5.sent;
|
|
1525
|
-
|
|
1526
|
-
_this.setState({
|
|
1527
|
-
job: res.data.job
|
|
1528
|
-
}, function () {
|
|
1529
|
-
_this.props.jobsLoaded([_this.state.job]);
|
|
1530
|
-
});
|
|
1531
|
-
|
|
1532
|
-
_context5.next = 11;
|
|
1533
|
-
break;
|
|
1534
|
-
|
|
1535
|
-
case 8:
|
|
1536
|
-
_context5.prev = 8;
|
|
1537
|
-
_context5.t0 = _context5["catch"](1);
|
|
1538
|
-
console.error('onSelectStatus', _context5.t0);
|
|
1539
|
-
|
|
1540
|
-
case 11:
|
|
1541
|
-
case "end":
|
|
1542
|
-
return _context5.stop();
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
}, _callee5, null, [[1, 8]]);
|
|
1546
|
-
}));
|
|
1547
|
-
|
|
1548
|
-
return function (_x) {
|
|
1549
|
-
return _ref5.apply(this, arguments);
|
|
1550
|
-
};
|
|
1551
|
-
}());
|
|
1500
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "renderStats", function (stat, loading) {
|
|
1501
|
+
return loading ? /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1502
|
+
style: styles$4.spinner,
|
|
1503
|
+
name: "spinner fa-pulse fa-fw"
|
|
1504
|
+
}) : stat;
|
|
1505
|
+
});
|
|
1552
1506
|
|
|
1553
1507
|
_this.state = {
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1508
|
+
selectedSection: 'all',
|
|
1509
|
+
location: '',
|
|
1510
|
+
loadingAll: false,
|
|
1511
|
+
loadingSubmissions: false,
|
|
1512
|
+
submissionEntries: [],
|
|
1513
|
+
allList: [],
|
|
1514
|
+
completed: [],
|
|
1515
|
+
upcoming: [],
|
|
1516
|
+
now: moment__default['default'].utc(),
|
|
1517
|
+
onlyFuture: true,
|
|
1518
|
+
search: ''
|
|
1565
1519
|
};
|
|
1566
1520
|
return _this;
|
|
1567
1521
|
}
|
|
1568
1522
|
|
|
1569
|
-
_createClass__default['default'](
|
|
1570
|
-
key: "
|
|
1571
|
-
value: function
|
|
1572
|
-
|
|
1523
|
+
_createClass__default['default'](RequestsHub, [{
|
|
1524
|
+
key: "UNSAFE_componentWillMount",
|
|
1525
|
+
value: function UNSAFE_componentWillMount() {
|
|
1526
|
+
this.updateProps(this.props);
|
|
1573
1527
|
}
|
|
1574
1528
|
}, {
|
|
1575
1529
|
key: "componentDidMount",
|
|
1576
1530
|
value: function componentDidMount() {
|
|
1577
|
-
|
|
1578
|
-
this.getJob();
|
|
1579
|
-
this.getComments();
|
|
1580
|
-
}
|
|
1531
|
+
this.getData();
|
|
1581
1532
|
}
|
|
1582
1533
|
}, {
|
|
1583
|
-
key: "
|
|
1584
|
-
value: function
|
|
1585
|
-
if (!this.
|
|
1586
|
-
var auth = this.props.auth;
|
|
1587
|
-
|
|
1588
|
-
if (Session$2.validateAccess(auth.site, 'maintenanceTracking', auth)) {
|
|
1589
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1590
|
-
className: "statusLabel pointer",
|
|
1591
|
-
onClick: this.onToggleStatusChanger,
|
|
1592
|
-
style: {
|
|
1593
|
-
backgroundColor: StatusTypes[this.state.job.status].color
|
|
1594
|
-
}
|
|
1595
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1596
|
-
className: "statusLabel_text"
|
|
1597
|
-
}, StatusTypes[this.state.job.status].text), this.renderStatusChanger());
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1601
|
-
className: "statusLabel",
|
|
1602
|
-
style: {
|
|
1603
|
-
backgroundColor: StatusTypes[this.state.job.status].color
|
|
1604
|
-
}
|
|
1605
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1606
|
-
className: "statusLabel_text"
|
|
1607
|
-
}, StatusTypes[this.state.job.status].text));
|
|
1534
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
1535
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
1536
|
+
if (!___default['default'].isEqual(this.props.jobs, nextProps.jobs)) this.updateProps(nextProps);
|
|
1608
1537
|
}
|
|
1609
1538
|
}, {
|
|
1610
|
-
key: "
|
|
1611
|
-
value: function
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
className: "statusLabel pointer",
|
|
1616
|
-
onClick: this.onOpenAddNote,
|
|
1617
|
-
style: {
|
|
1618
|
-
backgroundColor: FeatureConfig.env.colourBrandingMain,
|
|
1619
|
-
marginLeft: 8
|
|
1620
|
-
}
|
|
1621
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1622
|
-
className: "statusLabel_text"
|
|
1623
|
-
}, "Add Note"));
|
|
1539
|
+
key: "updateProps",
|
|
1540
|
+
value: function updateProps(props) {
|
|
1541
|
+
this.setState({
|
|
1542
|
+
allList: props.jobs
|
|
1543
|
+
}, this.setData);
|
|
1624
1544
|
}
|
|
1625
1545
|
}, {
|
|
1626
|
-
key: "
|
|
1627
|
-
value: function
|
|
1546
|
+
key: "renderLeftBar",
|
|
1547
|
+
value: function renderLeftBar() {
|
|
1628
1548
|
var _this2 = this;
|
|
1629
1549
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1550
|
+
var sectionItems = [];
|
|
1551
|
+
|
|
1552
|
+
if (this.canAddNew()) {
|
|
1553
|
+
sectionItems.push({
|
|
1554
|
+
type: 'newButton',
|
|
1555
|
+
text: 'New Request',
|
|
1556
|
+
onClick: this.onAddNew
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
sectionItems.push({
|
|
1561
|
+
type: 'navItem',
|
|
1562
|
+
text: 'View Requests',
|
|
1563
|
+
icon: 'eye',
|
|
1564
|
+
isFontAwesome: true,
|
|
1565
|
+
selected: this.state.selectedSection === 'all',
|
|
1566
|
+
onClick: function onClick() {
|
|
1567
|
+
_this2.setState({
|
|
1568
|
+
selectedSection: 'all'
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
if (Session$2.validateAccess(this.props.auth.site, 'maintenanceTypes', this.props.auth)) {
|
|
1574
|
+
sectionItems.push({
|
|
1575
|
+
type: 'navItem',
|
|
1576
|
+
text: 'Request Types',
|
|
1577
|
+
// icon: 'maintenance2',
|
|
1578
|
+
// isSVG: true,
|
|
1579
|
+
selected: this.state.selectedSection === 'requestTypes',
|
|
1637
1580
|
onClick: function onClick() {
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
backgroundColor: StatusTypes[statusKey].color
|
|
1581
|
+
_this2.setState({
|
|
1582
|
+
selectedSection: 'requestTypes'
|
|
1583
|
+
});
|
|
1642
1584
|
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$2.HubSidebar, {
|
|
1589
|
+
sections: [{
|
|
1590
|
+
title: 'Requests',
|
|
1591
|
+
items: sectionItems
|
|
1592
|
+
}]
|
|
1593
|
+
});
|
|
1647
1594
|
}
|
|
1648
1595
|
}, {
|
|
1649
|
-
key: "
|
|
1650
|
-
value: function
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.ProfilePic, {
|
|
1659
|
-
className: "comment_profilePic",
|
|
1660
|
-
size: 25,
|
|
1661
|
-
image: c.User.profilePic
|
|
1662
|
-
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
1663
|
-
className: "comment_name"
|
|
1664
|
-
}, c.User.displayName), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
1665
|
-
className: "comment_time"
|
|
1666
|
-
}, moment__default['default'].utc(c.Timestamp).local().format('D MMM YYYY • h:mma'))));
|
|
1596
|
+
key: "renderRight",
|
|
1597
|
+
value: function renderRight() {
|
|
1598
|
+
if (this.state.selectedSection === 'requestTypes') {
|
|
1599
|
+
return /*#__PURE__*/React__default['default'].createElement(JobTypes$1, null);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
return /*#__PURE__*/React__default['default'].createElement(JobList$1, {
|
|
1603
|
+
source: this.state.allList
|
|
1604
|
+
});
|
|
1667
1605
|
}
|
|
1668
1606
|
}, {
|
|
1669
|
-
key: "
|
|
1670
|
-
value: function
|
|
1671
|
-
var _this3 = this;
|
|
1672
|
-
|
|
1673
|
-
if (this.state.loadingComments) return null;
|
|
1607
|
+
key: "render",
|
|
1608
|
+
value: function render() {
|
|
1674
1609
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1675
|
-
className: "
|
|
1676
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1677
|
-
className: "
|
|
1678
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
}, "Comments"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1682
|
-
className: "commentSection"
|
|
1683
|
-
}, this.state.comments.map(function (c) {
|
|
1684
|
-
return _this3.renderComment(c);
|
|
1685
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1686
|
-
className: "commentReply"
|
|
1687
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1688
|
-
className: "commentReply_button".concat(!___default['default'].isEmpty(this.state.commentInput) ? ' commentReply_button-active' : ''),
|
|
1689
|
-
onClick: this.onAddComment
|
|
1690
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1691
|
-
className: "commentReply_icon",
|
|
1692
|
-
name: "paper-plane-o"
|
|
1693
|
-
})), /*#__PURE__*/React__default['default'].createElement(Textarea__default['default'], {
|
|
1694
|
-
id: "commentInput",
|
|
1695
|
-
placeholder: "Reply here...",
|
|
1696
|
-
type: "text",
|
|
1697
|
-
className: "commentReply_input",
|
|
1698
|
-
value: this.state.commentInput,
|
|
1699
|
-
onChange: function onChange(e) {
|
|
1700
|
-
return _this3.onHandleChange(e);
|
|
1701
|
-
}
|
|
1702
|
-
}))));
|
|
1703
|
-
}
|
|
1704
|
-
}, {
|
|
1705
|
-
key: "renderInner",
|
|
1706
|
-
value: function renderInner() {
|
|
1707
|
-
if (this.state.job == null) return null;
|
|
1708
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1709
|
-
style: {
|
|
1710
|
-
paddingBottom: 40
|
|
1711
|
-
}
|
|
1712
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1713
|
-
className: "padding-60 paddingVertical-40 bottomDivideBorder relative"
|
|
1714
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
1715
|
-
type: "formTitleLarge",
|
|
1716
|
-
className: "marginBottom-24"
|
|
1717
|
-
}, this.state.job.title || 'Request'), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1718
|
-
className: "marginTop-16"
|
|
1719
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1720
|
-
className: 'fieldLabel'
|
|
1721
|
-
}, "Request date"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1722
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1723
|
-
}, moment__default['default'].utc(this.state.job.createdTime).local().format('D MMM YY'))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1724
|
-
className: "marginTop-16"
|
|
1725
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1726
|
-
className: 'fieldLabel'
|
|
1727
|
-
}, "Type"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1728
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1729
|
-
}, this.state.job.type)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1730
|
-
className: "marginTop-16"
|
|
1731
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1732
|
-
className: 'fieldLabel'
|
|
1733
|
-
}, "Location"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1734
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1735
|
-
}, this.state.job.room)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1736
|
-
className: "marginTop-16"
|
|
1737
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1738
|
-
className: 'fieldLabel'
|
|
1739
|
-
}, "Description ", this.state.job.image ? '- (image supplied)' : ''), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1740
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1741
|
-
}, this.state.job.description))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1742
|
-
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
1743
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
1744
|
-
type: "formTitleSmall",
|
|
1745
|
-
className: "marginBottom-16"
|
|
1746
|
-
}, "Contact Details"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1747
|
-
className: "marginTop-16"
|
|
1748
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1749
|
-
className: 'fieldLabel'
|
|
1750
|
-
}, "Name"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1751
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1752
|
-
}, this.state.job.userName)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1753
|
-
className: "marginTop-16"
|
|
1754
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1755
|
-
className: 'fieldLabel'
|
|
1756
|
-
}, "Contact number"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1757
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1758
|
-
}, ___default['default'].isEmpty(this.state.job.phone) ? 'No phone provided' : this.state.job.phone)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1759
|
-
className: "marginTop-16"
|
|
1760
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1761
|
-
className: 'fieldLabel'
|
|
1762
|
-
}, "Should person be home?"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1763
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1764
|
-
}, this.state.job.isHome ? 'Yes' : 'No')), this.state.job.isHome && this.state.job.homeText && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1765
|
-
className: "marginTop-16"
|
|
1766
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1767
|
-
className: 'fieldLabel'
|
|
1768
|
-
}, "When"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1769
|
-
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
1770
|
-
}, this.state.job.homeText))), (this.state.job.image || this.state.job.images) && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1771
|
-
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
1772
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
1773
|
-
type: "formTitleSmall",
|
|
1774
|
-
className: "marginBottom-16"
|
|
1775
|
-
}, "Image"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1776
|
-
style: {
|
|
1777
|
-
marginTop: 16,
|
|
1778
|
-
height: 180,
|
|
1779
|
-
width: 260,
|
|
1780
|
-
borderRadius: 4,
|
|
1781
|
-
border: '1px solid #aaa',
|
|
1782
|
-
backgroundColor: '#ddd',
|
|
1783
|
-
backgroundImage: "url(".concat(this.state.job.thumbnail, ")"),
|
|
1784
|
-
backgroundPosition: 'center'
|
|
1785
|
-
}
|
|
1786
|
-
})), this.renderCommentSection());
|
|
1610
|
+
className: "hub-wrapperContainer"
|
|
1611
|
+
}, this.renderLeftBar(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1612
|
+
className: "hub-headerContentWrapper"
|
|
1613
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Header, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1614
|
+
className: "hub-contentWrapper"
|
|
1615
|
+
}, this.renderRight())));
|
|
1787
1616
|
}
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1617
|
+
}]);
|
|
1618
|
+
|
|
1619
|
+
return RequestsHub;
|
|
1620
|
+
}(React.Component);
|
|
1621
|
+
|
|
1622
|
+
var styles$4 = {
|
|
1623
|
+
sideBarTitleSection: {
|
|
1624
|
+
lineHeight: '40px',
|
|
1625
|
+
marginTop: 30,
|
|
1626
|
+
marginBottom: 30,
|
|
1627
|
+
paddingLeft: 24,
|
|
1628
|
+
paddingRight: 24
|
|
1629
|
+
},
|
|
1630
|
+
sideBarSection: {
|
|
1631
|
+
weight: '100%',
|
|
1632
|
+
minWidth: 200,
|
|
1633
|
+
padding: 32,
|
|
1634
|
+
paddingLeft: 24,
|
|
1635
|
+
cursor: 'pointer',
|
|
1636
|
+
display: 'flex',
|
|
1637
|
+
flexDirection: 'column',
|
|
1638
|
+
justifyContent: 'center'
|
|
1639
|
+
},
|
|
1640
|
+
spinner: {
|
|
1641
|
+
fontSize: 32,
|
|
1642
|
+
color: FeatureConfig.env.colourBrandingOff
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
var mapStateToProps$2 = function mapStateToProps(state) {
|
|
1647
|
+
var jobs = state.maintenance.jobs;
|
|
1648
|
+
var auth = state.auth;
|
|
1649
|
+
return {
|
|
1650
|
+
jobs: jobs,
|
|
1651
|
+
auth: auth
|
|
1652
|
+
};
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
var RequestsHub$1 = reactRedux.connect(mapStateToProps$2, {
|
|
1656
|
+
jobsLoaded: jobsLoaded
|
|
1657
|
+
})(reactRouter.withRouter(RequestsHub));
|
|
1658
|
+
|
|
1659
|
+
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; }
|
|
1660
|
+
|
|
1661
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1662
|
+
|
|
1663
|
+
function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
1664
|
+
|
|
1665
|
+
function _isNativeReflectConstruct$7() { 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; } }
|
|
1666
|
+
var Apis = PlussCore__namespace.Apis,
|
|
1667
|
+
Helper$1 = PlussCore__namespace.Helper,
|
|
1668
|
+
Session$1 = PlussCore__namespace.Session,
|
|
1669
|
+
Colours = PlussCore__namespace.Colours,
|
|
1670
|
+
Components$1 = PlussCore__namespace.Components;
|
|
1671
|
+
|
|
1672
|
+
var Job = /*#__PURE__*/function (_Component) {
|
|
1673
|
+
_inherits__default['default'](Job, _Component);
|
|
1674
|
+
|
|
1675
|
+
var _super = _createSuper$7(Job);
|
|
1676
|
+
|
|
1677
|
+
function Job(props) {
|
|
1678
|
+
var _this;
|
|
1679
|
+
|
|
1680
|
+
_classCallCheck__default['default'](this, Job);
|
|
1681
|
+
|
|
1682
|
+
_this = _super.call(this, props);
|
|
1683
|
+
|
|
1684
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJob", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
1685
|
+
var res;
|
|
1686
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1687
|
+
while (1) {
|
|
1688
|
+
switch (_context.prev = _context.next) {
|
|
1689
|
+
case 0:
|
|
1690
|
+
_context.prev = 0;
|
|
1691
|
+
_context.next = 3;
|
|
1692
|
+
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
1693
|
+
|
|
1694
|
+
case 3:
|
|
1695
|
+
res = _context.sent;
|
|
1696
|
+
|
|
1697
|
+
_this.setState({
|
|
1698
|
+
updating: false
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
res.data.location = res.data.site;
|
|
1702
|
+
|
|
1703
|
+
_this.setJob(res.data);
|
|
1704
|
+
|
|
1705
|
+
_context.next = 12;
|
|
1706
|
+
break;
|
|
1707
|
+
|
|
1708
|
+
case 9:
|
|
1709
|
+
_context.prev = 9;
|
|
1710
|
+
_context.t0 = _context["catch"](0);
|
|
1711
|
+
console.error('getJob', _context.t0);
|
|
1712
|
+
|
|
1713
|
+
case 12:
|
|
1714
|
+
case "end":
|
|
1715
|
+
return _context.stop();
|
|
1716
|
+
}
|
|
1799
1717
|
}
|
|
1718
|
+
}, _callee, null, [[0, 9]]);
|
|
1719
|
+
})));
|
|
1720
|
+
|
|
1721
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setJob", function (job) {
|
|
1722
|
+
job.typeIcon = job.type === 'General' ? 'wrench' : 'tree';
|
|
1723
|
+
job.typeColour = job.type === 'General' ? '#666' : 'green';
|
|
1724
|
+
|
|
1725
|
+
if (___default['default'].isEmpty(job.lastActivity)) {
|
|
1726
|
+
job.lastActivity = '-- --';
|
|
1727
|
+
job.noActivity = true;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
if (___default['default'].isEmpty(job.status)) {
|
|
1731
|
+
job.status = 'Unassigned';
|
|
1732
|
+
job.notStatus = true;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
if (___default['default'].isEmpty(job.audience)) {
|
|
1736
|
+
job.audience = [{
|
|
1737
|
+
displayName: 'Unassigned',
|
|
1738
|
+
isEmpty: true
|
|
1739
|
+
}];
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
var needToMarkSeen = false;
|
|
1743
|
+
|
|
1744
|
+
if (!job.seen) {
|
|
1745
|
+
job.seen = true;
|
|
1746
|
+
needToMarkSeen = true;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
_this.setState({
|
|
1750
|
+
job: job
|
|
1751
|
+
}, function () {
|
|
1752
|
+
if (needToMarkSeen) _this.markSeen();
|
|
1753
|
+
});
|
|
1754
|
+
|
|
1755
|
+
_this.props.jobsLoaded([job]);
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "editJob", function () {});
|
|
1759
|
+
|
|
1760
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "isReadyToSaveNote", function () {
|
|
1761
|
+
var _this$state = _this.state,
|
|
1762
|
+
noteAttachments = _this$state.noteAttachments,
|
|
1763
|
+
noteInput = _this$state.noteInput;
|
|
1764
|
+
if (___default['default'].some(noteAttachments, function (n) {
|
|
1765
|
+
return n.Uploading;
|
|
1766
|
+
})) return false;
|
|
1767
|
+
return !___default['default'].isEmpty(noteInput) || !___default['default'].isEmpty(noteAttachments);
|
|
1768
|
+
});
|
|
1769
|
+
|
|
1770
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenAddNote", function () {
|
|
1771
|
+
_this.setState({
|
|
1772
|
+
addNoteOpen: true,
|
|
1773
|
+
editingNote: null
|
|
1774
|
+
});
|
|
1775
|
+
});
|
|
1776
|
+
|
|
1777
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onCloseAddNote", function () {
|
|
1778
|
+
var newState = {
|
|
1779
|
+
addNoteOpen: false,
|
|
1780
|
+
editingNote: null
|
|
1800
1781
|
};
|
|
1801
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1802
|
-
className: "ticketHistoryEntry",
|
|
1803
|
-
key: i
|
|
1804
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
1805
|
-
className: "ticketHistoryEntry_timestamp"
|
|
1806
|
-
}, moment__default['default'].utc(entryToUse.timestamp).local().format('D MMM YYYY h:mma')), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1807
|
-
className: "statusLabel statusLabel-large statusLabel-full",
|
|
1808
|
-
style: {
|
|
1809
|
-
backgroundColor: StatusTypes[entryToUse.status].color
|
|
1810
|
-
}
|
|
1811
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1812
|
-
className: "statusLabel_text"
|
|
1813
|
-
}, e ? "Marked as ".concat(StatusTypes[entryToUse.status].text) : 'Job opened')));
|
|
1814
|
-
}
|
|
1815
|
-
}, {
|
|
1816
|
-
key: "renderNote",
|
|
1817
|
-
value: function renderNote(note, index) {
|
|
1818
|
-
var _this4 = this;
|
|
1819
1782
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
}))
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1783
|
+
if (!!_this.state.editingNote) {
|
|
1784
|
+
newState.noteInput = '';
|
|
1785
|
+
newState.noteAttachments = [];
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
_this.setState(newState);
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenNoteMenu", function (index) {
|
|
1792
|
+
if (_this.state.noteMenuOpen === index) {
|
|
1793
|
+
_this.setState({
|
|
1794
|
+
noteMenuOpen: null
|
|
1795
|
+
});
|
|
1796
|
+
} else {
|
|
1797
|
+
_this.setState({
|
|
1798
|
+
noteMenuOpen: index
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandlePDFFileChange", function (event) {
|
|
1804
|
+
var file = event.target.files[0];
|
|
1805
|
+
if (!file || _this.state.uploadingNoteAttachment) return;
|
|
1806
|
+
|
|
1807
|
+
var noteAttachments = _toConsumableArray__default['default'](_this.state.noteAttachments);
|
|
1808
|
+
|
|
1809
|
+
var newAttachment = {
|
|
1810
|
+
Uploading: true,
|
|
1811
|
+
Title: file.name
|
|
1812
|
+
};
|
|
1813
|
+
noteAttachments.push(newAttachment);
|
|
1814
|
+
|
|
1815
|
+
_this.setState({
|
|
1816
|
+
noteAttachments: noteAttachments
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
Apis.fileActions.uploadMediaAsync(file, file.name).then(function (fileRes) {
|
|
1820
|
+
newAttachment.Source = fileRes;
|
|
1821
|
+
newAttachment.Uploading = false;
|
|
1822
|
+
|
|
1823
|
+
_this.setState({
|
|
1824
|
+
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1825
|
+
});
|
|
1826
|
+
}).catch(function (uploadErrorRes) {
|
|
1827
|
+
console.log(uploadErrorRes);
|
|
1828
|
+
newAttachment.Uploading = false;
|
|
1829
|
+
|
|
1830
|
+
_this.setState({
|
|
1831
|
+
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1832
|
+
});
|
|
1833
|
+
});
|
|
1834
|
+
event.target.value = '';
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onRemoveAttachment", function (a) {
|
|
1838
|
+
var index = _this.state.noteAttachments.indexOf(a);
|
|
1839
|
+
|
|
1840
|
+
if (index > -1) {
|
|
1841
|
+
var newAttachments = _toConsumableArray__default['default'](_this.state.noteAttachments);
|
|
1842
|
+
|
|
1843
|
+
newAttachments.splice(index, 1);
|
|
1844
|
+
|
|
1845
|
+
_this.setState({
|
|
1846
|
+
noteAttachments: newAttachments
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
1852
|
+
var res;
|
|
1853
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1854
|
+
while (1) {
|
|
1855
|
+
switch (_context2.prev = _context2.next) {
|
|
1856
|
+
case 0:
|
|
1857
|
+
if (_this.isReadyToSaveNote()) {
|
|
1858
|
+
_context2.next = 2;
|
|
1859
|
+
break;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
return _context2.abrupt("return");
|
|
1863
|
+
|
|
1864
|
+
case 2:
|
|
1865
|
+
_context2.prev = 2;
|
|
1866
|
+
|
|
1867
|
+
_this.setState({
|
|
1868
|
+
submittingNote: true
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
_context2.next = 6;
|
|
1872
|
+
return _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
|
|
1873
|
+
return {
|
|
1874
|
+
Title: a.Title,
|
|
1875
|
+
Source: a.Source
|
|
1876
|
+
};
|
|
1877
|
+
})) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
|
|
1878
|
+
return {
|
|
1879
|
+
Title: a.Title,
|
|
1880
|
+
Source: a.Source
|
|
1881
|
+
};
|
|
1882
|
+
}));
|
|
1869
1883
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1884
|
+
case 6:
|
|
1885
|
+
res = _context2.sent;
|
|
1872
1886
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1887
|
+
_this.setState({
|
|
1888
|
+
job: res.data.job,
|
|
1889
|
+
submittingNote: false,
|
|
1890
|
+
addNoteOpen: false,
|
|
1891
|
+
noteInput: '',
|
|
1892
|
+
noteAttachments: [],
|
|
1893
|
+
editingNote: null
|
|
1894
|
+
}, function () {
|
|
1895
|
+
_this.props.jobsLoaded([_this.state.job]);
|
|
1896
|
+
});
|
|
1883
1897
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1887
|
-
className: "newTopBar clearfix flex flex-reverse"
|
|
1888
|
-
}, this.renderNotesButton(), this.renderStatusLabel(), /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
1889
|
-
type: "formTitleSmall",
|
|
1890
|
-
className: "flex-1"
|
|
1891
|
-
}, "Status History")), this.renderHistoryEntry(null, -1), ___default['default'].map(source, function (e, i) {
|
|
1892
|
-
switch (e.EntryType) {
|
|
1893
|
-
case 'status':
|
|
1894
|
-
return _this5.renderHistoryEntry(e, i);
|
|
1898
|
+
_context2.next = 13;
|
|
1899
|
+
break;
|
|
1895
1900
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
inline: true,
|
|
1906
|
-
buttonType: "tertiary",
|
|
1907
|
-
onClick: function onClick() {
|
|
1908
|
-
window.history.back();
|
|
1909
|
-
},
|
|
1910
|
-
isActive: true,
|
|
1911
|
-
style: {
|
|
1912
|
-
marginRight: 16
|
|
1901
|
+
case 10:
|
|
1902
|
+
_context2.prev = 10;
|
|
1903
|
+
_context2.t0 = _context2["catch"](2);
|
|
1904
|
+
console.error('onConfirmAddNote', _context2.t0);
|
|
1905
|
+
|
|
1906
|
+
case 13:
|
|
1907
|
+
case "end":
|
|
1908
|
+
return _context2.stop();
|
|
1909
|
+
}
|
|
1913
1910
|
}
|
|
1914
|
-
},
|
|
1915
|
-
|
|
1916
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Button, {
|
|
1917
|
-
inline: true,
|
|
1918
|
-
style: {
|
|
1919
|
-
marginRight: 25
|
|
1920
|
-
},
|
|
1921
|
-
buttonType: "outlined",
|
|
1922
|
-
isActive: true,
|
|
1923
|
-
onClick: this.editJob
|
|
1924
|
-
}, "Edit Details")));
|
|
1925
|
-
}
|
|
1926
|
-
}, {
|
|
1927
|
-
key: "renderAttachment",
|
|
1928
|
-
value: function renderAttachment(attachment, index, onRemove) {
|
|
1929
|
-
if (!attachment) return null;
|
|
1930
|
-
return /*#__PURE__*/React__default['default'].createElement(Components$2.Attachment, {
|
|
1931
|
-
key: index,
|
|
1932
|
-
uploading: attachment.Uploading,
|
|
1933
|
-
source: attachment.Source,
|
|
1934
|
-
title: attachment.Title,
|
|
1935
|
-
onRemove: onRemove ? function () {
|
|
1936
|
-
return onRemove(attachment);
|
|
1937
|
-
} : undefined
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
}, {
|
|
1941
|
-
key: "renderAddNotePopup",
|
|
1942
|
-
value: function renderAddNotePopup() {
|
|
1943
|
-
var _this6 = this;
|
|
1911
|
+
}, _callee2, null, [[2, 10]]);
|
|
1912
|
+
})));
|
|
1944
1913
|
|
|
1945
|
-
|
|
1914
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onDeleteNote", function (n) {
|
|
1915
|
+
if (!window.confirm('Are you sure you want to delete that note?')) {
|
|
1916
|
+
_this.setState({
|
|
1917
|
+
noteMenuOpen: null
|
|
1918
|
+
});
|
|
1946
1919
|
|
|
1947
|
-
|
|
1948
|
-
return /*#__PURE__*/React__default['default'].createElement(Components$2.Popup, {
|
|
1949
|
-
title: "Saving Note",
|
|
1950
|
-
maxWidth: 600,
|
|
1951
|
-
hasPadding: true
|
|
1952
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1953
|
-
className: "flex flex-center-row"
|
|
1954
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1955
|
-
className: "spinner",
|
|
1956
|
-
name: "spinner fa-pulse fa-fw"
|
|
1957
|
-
})));
|
|
1920
|
+
return;
|
|
1958
1921
|
}
|
|
1959
1922
|
|
|
1960
|
-
|
|
1961
|
-
title: "".concat(this.state.editingNote ? 'Edit' : 'Add', " Note"),
|
|
1962
|
-
onClose: this.onCloseAddNote,
|
|
1963
|
-
maxWidth: 600,
|
|
1964
|
-
hasPadding: true,
|
|
1965
|
-
buttons: [{
|
|
1966
|
-
type: 'primary',
|
|
1967
|
-
onClick: this.onConfirmAddNote,
|
|
1968
|
-
isActive: this.isReadyToSaveNote(),
|
|
1969
|
-
text: 'Save'
|
|
1970
|
-
}, {
|
|
1971
|
-
type: 'tertiary',
|
|
1972
|
-
onClick: this.onCloseAddNote,
|
|
1973
|
-
isActive: true,
|
|
1974
|
-
text: 'Cancel'
|
|
1975
|
-
}]
|
|
1976
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$2.GenericInput, {
|
|
1977
|
-
id: "noteInput",
|
|
1978
|
-
type: "textarea",
|
|
1979
|
-
componentClass: "textarea",
|
|
1980
|
-
value: this.state.noteInput,
|
|
1981
|
-
placeholder: "Enter note",
|
|
1982
|
-
onChange: function onChange(e) {
|
|
1983
|
-
return _this6.onHandleChange(e);
|
|
1984
|
-
},
|
|
1985
|
-
inputStyle: {
|
|
1986
|
-
width: 400
|
|
1987
|
-
}
|
|
1988
|
-
}), /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
1989
|
-
type: "h5"
|
|
1990
|
-
}, "Attachments"), this.state.noteAttachments.map(function (a, i) {
|
|
1991
|
-
return _this6.renderAttachment(a, i, _this6.onRemoveAttachment);
|
|
1992
|
-
}), /*#__PURE__*/React__default['default'].createElement("input", {
|
|
1993
|
-
ref: function ref(input) {
|
|
1994
|
-
return _this6.attachmentInput = input;
|
|
1995
|
-
},
|
|
1996
|
-
id: "attachmentInput",
|
|
1997
|
-
type: "file",
|
|
1998
|
-
className: "fileInput",
|
|
1999
|
-
onChange: function onChange(e) {
|
|
2000
|
-
return _this6.onHandlePDFFileChange(e);
|
|
2001
|
-
},
|
|
2002
|
-
accept: "application/pdf"
|
|
2003
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2004
|
-
className: "iconTextButton",
|
|
2005
|
-
onClick: function onClick() {
|
|
2006
|
-
_this6.attachmentInput.click();
|
|
2007
|
-
}
|
|
2008
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2009
|
-
className: "iconTextButton_icon",
|
|
2010
|
-
name: "paperclip"
|
|
2011
|
-
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2012
|
-
className: "iconTextButton_text"
|
|
2013
|
-
}, "Add Attachment")));
|
|
2014
|
-
}
|
|
2015
|
-
}, {
|
|
2016
|
-
key: "render",
|
|
2017
|
-
value: function render() {
|
|
2018
|
-
return /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPage, null, this.renderAddNotePopup(), /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPageContents, null, /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPageSection, {
|
|
2019
|
-
className: "pageSectionWrapper--newPopup"
|
|
2020
|
-
}, this.renderInner()), /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPageSection, {
|
|
2021
|
-
className: "pageSectionWrapper--newPopupSide pageSectionWrapper--newPopupSide-fixedWidth"
|
|
2022
|
-
}, this.renderOverview())), /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPageBottomButtons, null, this.renderButtons()));
|
|
2023
|
-
}
|
|
2024
|
-
}]);
|
|
2025
|
-
|
|
2026
|
-
return Job;
|
|
2027
|
-
}(React.Component);
|
|
1923
|
+
maintenanceActions.deleteNote(_this.state.jobId, n.Id);
|
|
2028
1924
|
|
|
2029
|
-
var
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
auth: auth
|
|
2033
|
-
};
|
|
2034
|
-
};
|
|
1925
|
+
var newNotes = ___default['default'].filter(_this.state.job.Notes, function (note) {
|
|
1926
|
+
return note.Id !== n.Id;
|
|
1927
|
+
});
|
|
2035
1928
|
|
|
2036
|
-
var
|
|
2037
|
-
jobsLoaded: jobsLoaded
|
|
2038
|
-
})(reactRouter.withRouter(Job));
|
|
1929
|
+
var newJob = _objectSpread$3({}, _this.state.job);
|
|
2039
1930
|
|
|
2040
|
-
|
|
1931
|
+
newJob.Notes = newNotes;
|
|
2041
1932
|
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
1933
|
+
_this.setState({
|
|
1934
|
+
job: newJob,
|
|
1935
|
+
noteMenuOpen: null
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
2047
1938
|
|
|
2048
|
-
|
|
2049
|
-
|
|
1939
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenEditNote", function (n) {
|
|
1940
|
+
_this.setState({
|
|
1941
|
+
noteAttachments: n.Attachments || [],
|
|
1942
|
+
noteInput: n.Note || '',
|
|
1943
|
+
addNoteOpen: true,
|
|
1944
|
+
editingNote: n.Id,
|
|
1945
|
+
noteMenuOpen: null
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
2050
1948
|
|
|
2051
|
-
|
|
1949
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "markSeen", function () {
|
|
1950
|
+
var job = _this.state.job;
|
|
1951
|
+
var auth = _this.props.auth; // Must have maintenance permission and not the requester
|
|
2052
1952
|
|
|
2053
|
-
|
|
2054
|
-
|
|
1953
|
+
if (!Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) return;
|
|
1954
|
+
if (auth.user.Id === job.userID) return;
|
|
2055
1955
|
|
|
2056
|
-
|
|
1956
|
+
_this.setState({
|
|
1957
|
+
updating: true
|
|
1958
|
+
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
1959
|
+
var update;
|
|
1960
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1961
|
+
while (1) {
|
|
1962
|
+
switch (_context3.prev = _context3.next) {
|
|
1963
|
+
case 0:
|
|
1964
|
+
_context3.prev = 0;
|
|
1965
|
+
update = {
|
|
1966
|
+
id: job.id,
|
|
1967
|
+
seen: true,
|
|
1968
|
+
status: job.status || 'Unassigned'
|
|
1969
|
+
};
|
|
1970
|
+
_context3.next = 4;
|
|
1971
|
+
return maintenanceActions.editJob(update, auth.site);
|
|
2057
1972
|
|
|
2058
|
-
|
|
1973
|
+
case 4:
|
|
1974
|
+
_context3.next = 11;
|
|
1975
|
+
break;
|
|
2059
1976
|
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
while (1) {
|
|
2064
|
-
switch (_context.prev = _context.next) {
|
|
2065
|
-
case 0:
|
|
2066
|
-
_context.prev = 0;
|
|
2067
|
-
_context.next = 3;
|
|
2068
|
-
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
1977
|
+
case 6:
|
|
1978
|
+
_context3.prev = 6;
|
|
1979
|
+
_context3.t0 = _context3["catch"](0);
|
|
2069
1980
|
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
1981
|
+
_this.setState({
|
|
1982
|
+
updating: false
|
|
1983
|
+
});
|
|
2073
1984
|
|
|
2074
|
-
|
|
1985
|
+
console.log('markSeen error', _context3.t0);
|
|
1986
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2075
1987
|
|
|
2076
|
-
|
|
2077
|
-
|
|
1988
|
+
case 11:
|
|
1989
|
+
case "end":
|
|
1990
|
+
return _context3.stop();
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
}, _callee3, null, [[0, 6]]);
|
|
1994
|
+
})));
|
|
1995
|
+
});
|
|
2078
1996
|
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
1997
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getComments", function () {
|
|
1998
|
+
reactionActions.getComments(_this.state.jobId, 'maintenancerequest', 0).then(function (res) {
|
|
1999
|
+
_this.setState({
|
|
2000
|
+
comments: res.data
|
|
2001
|
+
});
|
|
2002
|
+
});
|
|
2003
|
+
});
|
|
2083
2004
|
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
return _context.stop();
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
}, _callee, null, [[0, 8]]);
|
|
2090
|
-
})));
|
|
2005
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAddComment", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
2006
|
+
var _this$state2, commentInput, jobId, job, comments, res;
|
|
2091
2007
|
|
|
2092
|
-
|
|
2093
|
-
var res;
|
|
2094
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2008
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
2095
2009
|
while (1) {
|
|
2096
|
-
switch (
|
|
2010
|
+
switch (_context4.prev = _context4.next) {
|
|
2097
2011
|
case 0:
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
return maintenanceActions.getJobTypes(_this.props.auth.site);
|
|
2101
|
-
|
|
2102
|
-
case 3:
|
|
2103
|
-
res = _context2.sent;
|
|
2012
|
+
_this$state2 = _this.state, commentInput = _this$state2.commentInput, jobId = _this$state2.jobId, job = _this$state2.job, comments = _this$state2.comments;
|
|
2013
|
+
_context4.prev = 1;
|
|
2104
2014
|
|
|
2105
2015
|
_this.setState({
|
|
2106
|
-
|
|
2016
|
+
commentInput: ''
|
|
2107
2017
|
});
|
|
2108
2018
|
|
|
2109
|
-
|
|
2019
|
+
_context4.next = 5;
|
|
2020
|
+
return reactionActions.addComment(jobId, 'maintenancerequest', job.title, job.site, commentInput);
|
|
2110
2021
|
|
|
2111
|
-
|
|
2022
|
+
case 5:
|
|
2023
|
+
res = _context4.sent;
|
|
2024
|
+
|
|
2025
|
+
_this.setState({
|
|
2026
|
+
comments: [].concat(_toConsumableArray__default['default'](comments), [res.data])
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
_context4.next = 12;
|
|
2112
2030
|
break;
|
|
2113
2031
|
|
|
2114
|
-
case
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
console.error('
|
|
2032
|
+
case 9:
|
|
2033
|
+
_context4.prev = 9;
|
|
2034
|
+
_context4.t0 = _context4["catch"](1);
|
|
2035
|
+
console.error('onAddComment', _context4.t0);
|
|
2118
2036
|
|
|
2119
|
-
case
|
|
2037
|
+
case 12:
|
|
2120
2038
|
case "end":
|
|
2121
|
-
return
|
|
2039
|
+
return _context4.stop();
|
|
2122
2040
|
}
|
|
2123
2041
|
}
|
|
2124
|
-
},
|
|
2042
|
+
}, _callee4, null, [[1, 9]]);
|
|
2125
2043
|
})));
|
|
2126
2044
|
|
|
2127
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getDefaultJob", function () {
|
|
2128
|
-
if (_this.state.types.length !== 0 && _this.state.jobId == null) {
|
|
2129
|
-
_this.setState({
|
|
2130
|
-
type: _this.state.types[0].typeName
|
|
2131
|
-
});
|
|
2132
|
-
}
|
|
2133
|
-
});
|
|
2134
|
-
|
|
2135
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectType", function (key, e) {
|
|
2136
|
-
_this.setState({
|
|
2137
|
-
type: key
|
|
2138
|
-
});
|
|
2139
|
-
});
|
|
2140
|
-
|
|
2141
2045
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
2142
2046
|
var stateChange = {};
|
|
2143
2047
|
stateChange[event.target.getAttribute('id')] = event.target.value;
|
|
@@ -2145,348 +2049,534 @@ var AddJob = /*#__PURE__*/function (_Component) {
|
|
|
2145
2049
|
_this.setState(stateChange);
|
|
2146
2050
|
});
|
|
2147
2051
|
|
|
2148
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2052
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onToggleStatusChanger", function () {
|
|
2149
2053
|
_this.setState({
|
|
2150
|
-
|
|
2054
|
+
statusChangerOpen: !_this.state.statusChangerOpen
|
|
2151
2055
|
});
|
|
2056
|
+
});
|
|
2152
2057
|
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2058
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectStatus", /*#__PURE__*/function () {
|
|
2059
|
+
var _ref5 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(status) {
|
|
2060
|
+
var res;
|
|
2061
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
2062
|
+
while (1) {
|
|
2063
|
+
switch (_context5.prev = _context5.next) {
|
|
2064
|
+
case 0:
|
|
2065
|
+
_this.setState({
|
|
2066
|
+
job: _objectSpread$3(_objectSpread$3({}, _this.state.job), {}, {
|
|
2067
|
+
status: status
|
|
2068
|
+
}),
|
|
2069
|
+
statusChangerOpen: false
|
|
2070
|
+
});
|
|
2162
2071
|
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2072
|
+
_context5.prev = 1;
|
|
2073
|
+
_context5.next = 4;
|
|
2074
|
+
return maintenanceActions.editJobStatus(_this.state.job.id, status);
|
|
2166
2075
|
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
userID: _this.state.userID,
|
|
2170
|
-
userName: _this.state.userName,
|
|
2171
|
-
room: _this.state.room,
|
|
2172
|
-
phone: _this.state.phone,
|
|
2173
|
-
location: _this.state.location,
|
|
2174
|
-
title: _this.state.title,
|
|
2175
|
-
description: _this.state.description,
|
|
2176
|
-
isHome: _this.state.isHome,
|
|
2177
|
-
homeText: _this.state.homeText,
|
|
2178
|
-
type: _this.state.type,
|
|
2179
|
-
date: null,
|
|
2180
|
-
image: _this.state.image
|
|
2181
|
-
};
|
|
2076
|
+
case 4:
|
|
2077
|
+
res = _context5.sent;
|
|
2182
2078
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
});
|
|
2079
|
+
_this.setState({
|
|
2080
|
+
job: res.data.job
|
|
2081
|
+
}, function () {
|
|
2082
|
+
_this.props.jobsLoaded([_this.state.job]);
|
|
2083
|
+
});
|
|
2189
2084
|
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
_this.setState({
|
|
2193
|
-
updating: false
|
|
2194
|
-
});
|
|
2085
|
+
_context5.next = 11;
|
|
2086
|
+
break;
|
|
2195
2087
|
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
job.userID = 'undefined';
|
|
2201
|
-
maintenanceActions.createJob(job).then(function (res) {
|
|
2202
|
-
_this.setState({
|
|
2203
|
-
success: true,
|
|
2204
|
-
updating: false
|
|
2205
|
-
});
|
|
2088
|
+
case 8:
|
|
2089
|
+
_context5.prev = 8;
|
|
2090
|
+
_context5.t0 = _context5["catch"](1);
|
|
2091
|
+
console.error('onSelectStatus', _context5.t0);
|
|
2206
2092
|
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
}
|
|
2093
|
+
case 11:
|
|
2094
|
+
case "end":
|
|
2095
|
+
return _context5.stop();
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}, _callee5, null, [[1, 8]]);
|
|
2099
|
+
}));
|
|
2212
2100
|
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
}
|
|
2216
|
-
});
|
|
2101
|
+
return function (_x) {
|
|
2102
|
+
return _ref5.apply(this, arguments);
|
|
2103
|
+
};
|
|
2104
|
+
}());
|
|
2217
2105
|
|
|
2218
2106
|
_this.state = {
|
|
2219
|
-
jobId: Helper$1.safeReadParams(
|
|
2107
|
+
jobId: Helper$1.safeReadParams(props, 'jobId') ? props.match.params.jobId : null,
|
|
2220
2108
|
job: null,
|
|
2221
2109
|
showingSelector: false,
|
|
2222
2110
|
updating: false,
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
location: _this.props.auth.site,
|
|
2231
|
-
title: '',
|
|
2232
|
-
description: '',
|
|
2233
|
-
isHome: false,
|
|
2234
|
-
homeText: '',
|
|
2235
|
-
type: 'General',
|
|
2236
|
-
image: null,
|
|
2237
|
-
thumbnail: null,
|
|
2238
|
-
showWarnings: false,
|
|
2239
|
-
success: false
|
|
2111
|
+
comments: [],
|
|
2112
|
+
commentInput: '',
|
|
2113
|
+
loadingComments: false,
|
|
2114
|
+
statusChangerOpen: false,
|
|
2115
|
+
addNoteOpen: false,
|
|
2116
|
+
noteAttachments: [],
|
|
2117
|
+
noteInput: ''
|
|
2240
2118
|
};
|
|
2241
2119
|
return _this;
|
|
2242
2120
|
}
|
|
2243
2121
|
|
|
2244
|
-
_createClass__default['default'](
|
|
2245
|
-
key: "
|
|
2246
|
-
value: function
|
|
2122
|
+
_createClass__default['default'](Job, [{
|
|
2123
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
2124
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
2247
2125
|
Session$1.checkLoggedIn(this, this.props.auth);
|
|
2248
2126
|
}
|
|
2249
2127
|
}, {
|
|
2250
|
-
key: "componentDidMount",
|
|
2251
|
-
value: function componentDidMount() {
|
|
2252
|
-
this.
|
|
2253
|
-
|
|
2254
|
-
|
|
2128
|
+
key: "componentDidMount",
|
|
2129
|
+
value: function componentDidMount() {
|
|
2130
|
+
if (this.state.jobId) {
|
|
2131
|
+
this.getJob();
|
|
2132
|
+
this.getComments();
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}, {
|
|
2136
|
+
key: "renderStatusLabel",
|
|
2137
|
+
value: function renderStatusLabel() {
|
|
2138
|
+
if (!this.state.job.status) return null;
|
|
2139
|
+
var auth = this.props.auth;
|
|
2140
|
+
|
|
2141
|
+
if (Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) {
|
|
2142
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2143
|
+
className: "statusLabel pointer",
|
|
2144
|
+
onClick: this.onToggleStatusChanger,
|
|
2145
|
+
style: {
|
|
2146
|
+
backgroundColor: StatusTypes[this.state.job.status].color
|
|
2147
|
+
}
|
|
2148
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2149
|
+
className: "statusLabel_text"
|
|
2150
|
+
}, StatusTypes[this.state.job.status].text), this.renderStatusChanger());
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2154
|
+
className: "statusLabel",
|
|
2155
|
+
style: {
|
|
2156
|
+
backgroundColor: StatusTypes[this.state.job.status].color
|
|
2157
|
+
}
|
|
2158
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2159
|
+
className: "statusLabel_text"
|
|
2160
|
+
}, StatusTypes[this.state.job.status].text));
|
|
2161
|
+
}
|
|
2162
|
+
}, {
|
|
2163
|
+
key: "renderNotesButton",
|
|
2164
|
+
value: function renderNotesButton() {
|
|
2165
|
+
var auth = this.props.auth;
|
|
2166
|
+
if (!Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) return null;
|
|
2167
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2168
|
+
className: "statusLabel pointer",
|
|
2169
|
+
onClick: this.onOpenAddNote,
|
|
2170
|
+
style: {
|
|
2171
|
+
backgroundColor: FeatureConfig.env.colourBrandingMain,
|
|
2172
|
+
marginLeft: 8
|
|
2173
|
+
}
|
|
2174
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2175
|
+
className: "statusLabel_text"
|
|
2176
|
+
}, "Add Note"));
|
|
2255
2177
|
}
|
|
2256
2178
|
}, {
|
|
2257
|
-
key: "
|
|
2258
|
-
value: function
|
|
2179
|
+
key: "renderStatusChanger",
|
|
2180
|
+
value: function renderStatusChanger() {
|
|
2259
2181
|
var _this2 = this;
|
|
2260
2182
|
|
|
2261
|
-
|
|
2262
|
-
return
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2183
|
+
if (!this.state.statusChangerOpen) return null;
|
|
2184
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2185
|
+
className: "statusChanger statusChanger-maintenance"
|
|
2186
|
+
}, Object.keys(StatusTypes).map(function (statusKey) {
|
|
2187
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2188
|
+
key: statusKey,
|
|
2189
|
+
className: "statusLabel",
|
|
2190
|
+
onClick: function onClick() {
|
|
2191
|
+
return _this2.onSelectStatus(statusKey);
|
|
2192
|
+
},
|
|
2193
|
+
style: {
|
|
2194
|
+
backgroundColor: StatusTypes[statusKey].color
|
|
2195
|
+
}
|
|
2196
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2197
|
+
className: "statusLabel_text"
|
|
2198
|
+
}, StatusTypes[statusKey].text));
|
|
2199
|
+
}));
|
|
2200
|
+
}
|
|
2201
|
+
}, {
|
|
2202
|
+
key: "renderComment",
|
|
2203
|
+
value: function renderComment(c) {
|
|
2204
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2205
|
+
key: c.Id,
|
|
2206
|
+
className: "comment"
|
|
2207
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2208
|
+
className: "comment_text"
|
|
2209
|
+
}, Helper$1.toParagraphed(c.Comment)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2210
|
+
className: "comment_bottom"
|
|
2211
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.ProfilePic, {
|
|
2212
|
+
className: "comment_profilePic",
|
|
2213
|
+
size: 25,
|
|
2214
|
+
image: c.User.profilePic
|
|
2215
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2216
|
+
className: "comment_name"
|
|
2217
|
+
}, c.User.displayName), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2218
|
+
className: "comment_time"
|
|
2219
|
+
}, moment__default['default'].utc(c.Timestamp).local().format('D MMM YYYY • h:mma'))));
|
|
2220
|
+
}
|
|
2221
|
+
}, {
|
|
2222
|
+
key: "renderCommentSection",
|
|
2223
|
+
value: function renderCommentSection() {
|
|
2224
|
+
var _this3 = this;
|
|
2270
2225
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2226
|
+
if (this.state.loadingComments) return null;
|
|
2227
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2228
|
+
className: "padding-60 paddingLeft-20"
|
|
2229
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2230
|
+
className: "newTopBar paddingLeft-40"
|
|
2231
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2232
|
+
type: "formTitleSmall",
|
|
2233
|
+
className: "marginBottom-16"
|
|
2234
|
+
}, "Comments"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2235
|
+
className: "commentSection"
|
|
2236
|
+
}, this.state.comments.map(function (c) {
|
|
2237
|
+
return _this3.renderComment(c);
|
|
2238
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2239
|
+
className: "commentReply"
|
|
2240
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2241
|
+
className: "commentReply_button".concat(!___default['default'].isEmpty(this.state.commentInput) ? ' commentReply_button-active' : ''),
|
|
2242
|
+
onClick: this.onAddComment
|
|
2243
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2244
|
+
className: "commentReply_icon",
|
|
2245
|
+
name: "paper-plane-o"
|
|
2246
|
+
})), /*#__PURE__*/React__default['default'].createElement(Textarea__default['default'], {
|
|
2247
|
+
id: "commentInput",
|
|
2248
|
+
placeholder: "Reply here...",
|
|
2249
|
+
type: "text",
|
|
2250
|
+
className: "commentReply_input",
|
|
2251
|
+
value: this.state.commentInput,
|
|
2252
|
+
onChange: function onChange(e) {
|
|
2253
|
+
return _this3.onHandleChange(e);
|
|
2254
|
+
}
|
|
2255
|
+
}))));
|
|
2273
2256
|
}
|
|
2274
2257
|
}, {
|
|
2275
|
-
key: "
|
|
2276
|
-
value: function
|
|
2277
|
-
if (
|
|
2278
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2258
|
+
key: "renderInner",
|
|
2259
|
+
value: function renderInner() {
|
|
2260
|
+
if (this.state.job == null) return null;
|
|
2261
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2262
|
+
style: {
|
|
2263
|
+
paddingBottom: 40
|
|
2264
|
+
}
|
|
2265
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2266
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder relative"
|
|
2267
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2268
|
+
type: "formTitleLarge",
|
|
2269
|
+
className: "marginBottom-24"
|
|
2270
|
+
}, this.state.job.title || 'Request'), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2271
|
+
className: "marginTop-16"
|
|
2272
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2273
|
+
className: 'fieldLabel'
|
|
2274
|
+
}, "Request date"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2275
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2276
|
+
}, moment__default['default'].utc(this.state.job.createdTime).local().format('D MMM YY'))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2277
|
+
className: "marginTop-16"
|
|
2278
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2279
|
+
className: 'fieldLabel'
|
|
2280
|
+
}, "Type"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2281
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2282
|
+
}, this.state.job.type)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2283
|
+
className: "marginTop-16"
|
|
2284
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2285
|
+
className: 'fieldLabel'
|
|
2286
|
+
}, "Location"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2287
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2288
|
+
}, this.state.job.room)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2289
|
+
className: "marginTop-16"
|
|
2290
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2291
|
+
className: 'fieldLabel'
|
|
2292
|
+
}, "Description ", this.state.job.image ? '- (image supplied)' : ''), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2293
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2294
|
+
}, this.state.job.description))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2295
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2296
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2297
|
+
type: "formTitleSmall",
|
|
2298
|
+
className: "marginBottom-16"
|
|
2299
|
+
}, "Contact Details"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2300
|
+
className: "marginTop-16"
|
|
2301
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2302
|
+
className: 'fieldLabel'
|
|
2303
|
+
}, "Name"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2304
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2305
|
+
}, this.state.job.userName)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2306
|
+
className: "marginTop-16"
|
|
2307
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2308
|
+
className: 'fieldLabel'
|
|
2309
|
+
}, "Contact number"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2310
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2311
|
+
}, ___default['default'].isEmpty(this.state.job.phone) ? 'No phone provided' : this.state.job.phone)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2312
|
+
className: "marginTop-16"
|
|
2313
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2314
|
+
className: 'fieldLabel'
|
|
2315
|
+
}, "Should person be home?"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2316
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2317
|
+
}, this.state.job.isHome ? 'Yes' : 'No')), this.state.job.isHome && this.state.job.homeText && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2318
|
+
className: "marginTop-16"
|
|
2319
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2320
|
+
className: 'fieldLabel'
|
|
2321
|
+
}, "When"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2322
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2323
|
+
}, this.state.job.homeText))), (this.state.job.image || this.state.job.images) && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2324
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2325
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2326
|
+
type: "formTitleSmall",
|
|
2327
|
+
className: "marginBottom-16"
|
|
2328
|
+
}, "Image"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2329
|
+
style: {
|
|
2330
|
+
marginTop: 16,
|
|
2331
|
+
height: 180,
|
|
2332
|
+
width: 260,
|
|
2333
|
+
borderRadius: 4,
|
|
2334
|
+
border: '1px solid #aaa',
|
|
2335
|
+
backgroundColor: '#ddd',
|
|
2336
|
+
backgroundImage: "url(".concat(this.state.job.thumbnail, ")"),
|
|
2337
|
+
backgroundPosition: 'center'
|
|
2338
|
+
}
|
|
2339
|
+
})), this.renderCommentSection());
|
|
2340
|
+
}
|
|
2341
|
+
}, {
|
|
2342
|
+
key: "renderHistoryEntry",
|
|
2343
|
+
value: function renderHistoryEntry(e, i) {
|
|
2344
|
+
var job = this.state.job;
|
|
2345
|
+
var entryToUse = e || {
|
|
2346
|
+
timestamp: job.createdTime,
|
|
2347
|
+
status: 'Unassigned',
|
|
2348
|
+
user: {
|
|
2349
|
+
displayName: job.userName,
|
|
2350
|
+
id: job.userID,
|
|
2351
|
+
profilePic: job.userProfilePic
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2355
|
+
className: "ticketHistoryEntry",
|
|
2356
|
+
key: i
|
|
2357
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2358
|
+
className: "ticketHistoryEntry_timestamp"
|
|
2359
|
+
}, moment__default['default'].utc(entryToUse.timestamp).local().format('D MMM YYYY h:mma')), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2360
|
+
className: "statusLabel statusLabel-large statusLabel-full",
|
|
2361
|
+
style: {
|
|
2362
|
+
backgroundColor: StatusTypes[entryToUse.status].color
|
|
2363
|
+
}
|
|
2364
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2365
|
+
className: "statusLabel_text"
|
|
2366
|
+
}, e ? "Marked as ".concat(StatusTypes[entryToUse.status].text) : 'Job opened')));
|
|
2367
|
+
}
|
|
2368
|
+
}, {
|
|
2369
|
+
key: "renderNote",
|
|
2370
|
+
value: function renderNote(note, index) {
|
|
2371
|
+
var _this4 = this;
|
|
2372
|
+
|
|
2373
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2374
|
+
className: "ticketHistoryEntry",
|
|
2375
|
+
key: index
|
|
2376
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2377
|
+
className: "ticketHistoryEntry_timestamp"
|
|
2378
|
+
}, moment__default['default'].utc(note.Timestamp).local().format('D MMM YYYY h:mma')), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2379
|
+
className: "statusLabel statusLabel-large statusLabel-full",
|
|
2380
|
+
style: {
|
|
2381
|
+
backgroundColor: '#6e79c5'
|
|
2382
|
+
}
|
|
2383
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2384
|
+
className: "statusLabel_text"
|
|
2385
|
+
}, "Staff Notes")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2386
|
+
className: "maintenanceNote"
|
|
2387
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2388
|
+
className: "maintenanceNote_top"
|
|
2389
|
+
}, this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/React__default['default'].createElement(Components$1.SVGIcon, {
|
|
2390
|
+
colour: Colours.COLOUR_DUSK_LIGHT,
|
|
2391
|
+
icon: "more15",
|
|
2392
|
+
className: "maintenanceNote_moreIcon",
|
|
2393
|
+
onClick: function onClick() {
|
|
2394
|
+
return _this4.onOpenNoteMenu(index);
|
|
2395
|
+
}
|
|
2396
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2397
|
+
className: "maintenanceNote_name"
|
|
2398
|
+
}, note.User.displayName), this.state.noteMenuOpen === index && /*#__PURE__*/React__default['default'].createElement(Components$1.MoreMenu, {
|
|
2399
|
+
options: [{
|
|
2400
|
+
key: 'edit',
|
|
2401
|
+
text: 'Edit',
|
|
2402
|
+
onPress: function onPress() {
|
|
2403
|
+
return _this4.onOpenEditNote(note);
|
|
2404
|
+
}
|
|
2405
|
+
}, {
|
|
2406
|
+
key: 'delete',
|
|
2407
|
+
text: 'Delete',
|
|
2408
|
+
onPress: function onPress() {
|
|
2409
|
+
return _this4.onDeleteNote(note);
|
|
2410
|
+
}
|
|
2286
2411
|
}]
|
|
2287
|
-
})
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
if (___default['default'].isEmpty(this.state.userName)) return false;
|
|
2293
|
-
if (___default['default'].isEmpty(this.state.room)) return false;
|
|
2294
|
-
if (___default['default'].isEmpty(this.state.title)) return false;
|
|
2295
|
-
if (this.state.isHome && ___default['default'].isEmpty(this.state.homeText)) return false;
|
|
2296
|
-
return true;
|
|
2412
|
+
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2413
|
+
className: "maintenanceNote_text"
|
|
2414
|
+
}, Helper$1.toParagraphed(note.Note)), note.Attachments.map(function (a, i) {
|
|
2415
|
+
return _this4.renderAttachment(a, i);
|
|
2416
|
+
})));
|
|
2297
2417
|
}
|
|
2298
2418
|
}, {
|
|
2299
|
-
key: "
|
|
2300
|
-
value: function
|
|
2301
|
-
var
|
|
2419
|
+
key: "renderOverview",
|
|
2420
|
+
value: function renderOverview() {
|
|
2421
|
+
var _this5 = this;
|
|
2302
2422
|
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2423
|
+
var job = this.state.job;
|
|
2424
|
+
if (!job || !job.history) return null;
|
|
2425
|
+
|
|
2426
|
+
var source = ___default['default'].sortBy([].concat(_toConsumableArray__default['default'](job.history.map(function (e) {
|
|
2427
|
+
return _objectSpread$3(_objectSpread$3({}, e), {}, {
|
|
2428
|
+
EntryType: 'status'
|
|
2429
|
+
});
|
|
2430
|
+
})), _toConsumableArray__default['default']((job.Notes || []).map(function (e) {
|
|
2431
|
+
return _objectSpread$3(_objectSpread$3({}, e), {}, {
|
|
2432
|
+
timestamp: e.Timestamp,
|
|
2433
|
+
EntryType: 'note'
|
|
2434
|
+
});
|
|
2435
|
+
}))), 'timestamp');
|
|
2436
|
+
|
|
2437
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2438
|
+
className: "padding-32 paddingVertical-40 bottomDivideBorder relative"
|
|
2439
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2440
|
+
className: "newTopBar clearfix flex flex-reverse"
|
|
2441
|
+
}, this.renderNotesButton(), this.renderStatusLabel(), /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2442
|
+
type: "formTitleSmall",
|
|
2443
|
+
className: "flex-1"
|
|
2444
|
+
}, "Status History")), this.renderHistoryEntry(null, -1), ___default['default'].map(source, function (e, i) {
|
|
2445
|
+
switch (e.EntryType) {
|
|
2446
|
+
case 'status':
|
|
2447
|
+
return _this5.renderHistoryEntry(e, i);
|
|
2308
2448
|
|
|
2449
|
+
case 'note':
|
|
2450
|
+
return _this5.renderNote(e, i);
|
|
2451
|
+
}
|
|
2452
|
+
}));
|
|
2453
|
+
}
|
|
2454
|
+
}, {
|
|
2455
|
+
key: "renderButtons",
|
|
2456
|
+
value: function renderButtons() {
|
|
2309
2457
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Components$1.Button, {
|
|
2310
2458
|
inline: true,
|
|
2311
2459
|
buttonType: "tertiary",
|
|
2312
2460
|
onClick: function onClick() {
|
|
2313
|
-
|
|
2461
|
+
window.history.back();
|
|
2314
2462
|
},
|
|
2315
2463
|
isActive: true,
|
|
2316
2464
|
style: {
|
|
2317
2465
|
marginRight: 16
|
|
2318
2466
|
}
|
|
2319
|
-
}, "
|
|
2467
|
+
}, "Back"), Session$1.validateAccess(this.props.auth.site, 'maintenanceTracking', this.props.auth) && !___default['default'].isEmpty(this.state.job) && /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
2468
|
+
to: "/requestsHub/job/".concat(this.state.jobId)
|
|
2469
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Button, {
|
|
2320
2470
|
inline: true,
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2471
|
+
style: {
|
|
2472
|
+
marginRight: 25
|
|
2473
|
+
},
|
|
2474
|
+
buttonType: "outlined",
|
|
2475
|
+
isActive: true,
|
|
2476
|
+
onClick: this.editJob
|
|
2477
|
+
}, "Edit Details")));
|
|
2325
2478
|
}
|
|
2326
2479
|
}, {
|
|
2327
|
-
key: "
|
|
2328
|
-
value: function
|
|
2329
|
-
|
|
2480
|
+
key: "renderAttachment",
|
|
2481
|
+
value: function renderAttachment(attachment, index, onRemove) {
|
|
2482
|
+
if (!attachment) return null;
|
|
2483
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Attachment, {
|
|
2484
|
+
key: index,
|
|
2485
|
+
uploading: attachment.Uploading,
|
|
2486
|
+
source: attachment.Source,
|
|
2487
|
+
title: attachment.Title,
|
|
2488
|
+
onRemove: onRemove ? function () {
|
|
2489
|
+
return onRemove(attachment);
|
|
2490
|
+
} : undefined
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
}, {
|
|
2494
|
+
key: "renderAddNotePopup",
|
|
2495
|
+
value: function renderAddNotePopup() {
|
|
2496
|
+
var _this6 = this;
|
|
2330
2497
|
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
}
|
|
2357
|
-
}), /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2358
|
-
id: "room",
|
|
2359
|
-
type: "text",
|
|
2360
|
-
label: "Location",
|
|
2361
|
-
placeholder: "Insert address here",
|
|
2362
|
-
value: this.state.room,
|
|
2363
|
-
onChange: function onChange(e) {
|
|
2364
|
-
return _this4.onHandleChange(e);
|
|
2365
|
-
},
|
|
2366
|
-
isRequired: true,
|
|
2367
|
-
alwaysShowLabel: true,
|
|
2368
|
-
isValid: function isValid() {
|
|
2369
|
-
return !___default['default'].isEmpty(_this4.state.room);
|
|
2370
|
-
},
|
|
2371
|
-
showError: function showError() {
|
|
2372
|
-
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.room);
|
|
2373
|
-
}
|
|
2374
|
-
}), /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2375
|
-
id: "phone",
|
|
2376
|
-
type: "text",
|
|
2377
|
-
label: "Contact number",
|
|
2378
|
-
placeholder: "04XX XXX XXX",
|
|
2379
|
-
value: this.state.phone // showError={this.state.showWarnings && !this.validateImage()}
|
|
2380
|
-
,
|
|
2381
|
-
onChange: function onChange(e) {
|
|
2382
|
-
return _this4.onHandleChange(e);
|
|
2383
|
-
},
|
|
2384
|
-
alwaysShowLabel: true
|
|
2385
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2386
|
-
style: {
|
|
2387
|
-
marginBottom: 15
|
|
2388
|
-
}
|
|
2389
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2390
|
-
type: "formLabel"
|
|
2391
|
-
}, "Job Type"), /*#__PURE__*/React__default['default'].createElement(reactBootstrap.DropdownButton, {
|
|
2392
|
-
style: {
|
|
2393
|
-
minWidth: 80
|
|
2394
|
-
},
|
|
2395
|
-
bsStyle: "default",
|
|
2396
|
-
title: this.state.type,
|
|
2397
|
-
id: "typeSelect",
|
|
2398
|
-
onSelect: this.onSelectType
|
|
2399
|
-
}, this.renderTypeOptions())), /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2400
|
-
id: "title",
|
|
2401
|
-
label: "Title for the work required",
|
|
2402
|
-
type: "textarea",
|
|
2403
|
-
placeholder: "Title for the work required",
|
|
2404
|
-
value: this.state.title,
|
|
2405
|
-
onChange: function onChange(e) {
|
|
2406
|
-
return _this4.onHandleChange(e);
|
|
2407
|
-
},
|
|
2408
|
-
inputStyle: {
|
|
2409
|
-
height: 80
|
|
2410
|
-
},
|
|
2411
|
-
isRequired: true,
|
|
2412
|
-
isValid: function isValid() {
|
|
2413
|
-
return !___default['default'].isEmpty(_this4.state.title);
|
|
2414
|
-
},
|
|
2415
|
-
showError: function showError() {
|
|
2416
|
-
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.title);
|
|
2417
|
-
},
|
|
2418
|
-
alwaysShowLabel: true
|
|
2419
|
-
}), /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2420
|
-
id: "description",
|
|
2421
|
-
label: "Description of work required",
|
|
2422
|
-
type: "textarea",
|
|
2423
|
-
placeholder: "Description of work required",
|
|
2424
|
-
value: this.state.description,
|
|
2425
|
-
onChange: function onChange(e) {
|
|
2426
|
-
return _this4.onHandleChange(e);
|
|
2427
|
-
},
|
|
2428
|
-
inputStyle: {
|
|
2429
|
-
height: 80
|
|
2430
|
-
},
|
|
2431
|
-
alwaysShowLabel: true
|
|
2432
|
-
}), /*#__PURE__*/React__default['default'].createElement(Components$1.RadioButton, {
|
|
2433
|
-
label: "Person must be home during work?",
|
|
2434
|
-
isActive: this.state.isHome,
|
|
2435
|
-
options: [{
|
|
2436
|
-
Label: 'No',
|
|
2437
|
-
Value: false,
|
|
2438
|
-
onChange: function onChange() {
|
|
2439
|
-
return _this4.setState({
|
|
2440
|
-
isHome: false
|
|
2441
|
-
});
|
|
2442
|
-
}
|
|
2498
|
+
if (!this.state.addNoteOpen) return null;
|
|
2499
|
+
|
|
2500
|
+
if (this.state.submittingNote) {
|
|
2501
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Popup, {
|
|
2502
|
+
title: "Saving Note",
|
|
2503
|
+
maxWidth: 600,
|
|
2504
|
+
hasPadding: true
|
|
2505
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2506
|
+
className: "flex flex-center-row"
|
|
2507
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2508
|
+
className: "spinner",
|
|
2509
|
+
name: "spinner fa-pulse fa-fw"
|
|
2510
|
+
})));
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Popup, {
|
|
2514
|
+
title: "".concat(this.state.editingNote ? 'Edit' : 'Add', " Note"),
|
|
2515
|
+
onClose: this.onCloseAddNote,
|
|
2516
|
+
maxWidth: 600,
|
|
2517
|
+
hasPadding: true,
|
|
2518
|
+
buttons: [{
|
|
2519
|
+
type: 'primary',
|
|
2520
|
+
onClick: this.onConfirmAddNote,
|
|
2521
|
+
isActive: this.isReadyToSaveNote(),
|
|
2522
|
+
text: 'Save'
|
|
2443
2523
|
}, {
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
isHome: true
|
|
2449
|
-
});
|
|
2450
|
-
}
|
|
2524
|
+
type: 'tertiary',
|
|
2525
|
+
onClick: this.onCloseAddNote,
|
|
2526
|
+
isActive: true,
|
|
2527
|
+
text: 'Cancel'
|
|
2451
2528
|
}]
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
|
-
marginTop: 16
|
|
2455
|
-
},
|
|
2456
|
-
label: "Description of person's available times",
|
|
2457
|
-
id: "homeText",
|
|
2529
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2530
|
+
id: "noteInput",
|
|
2458
2531
|
type: "textarea",
|
|
2459
|
-
|
|
2460
|
-
value: this.state.
|
|
2532
|
+
componentClass: "textarea",
|
|
2533
|
+
value: this.state.noteInput,
|
|
2534
|
+
placeholder: "Enter note",
|
|
2461
2535
|
onChange: function onChange(e) {
|
|
2462
|
-
return
|
|
2463
|
-
},
|
|
2464
|
-
inputStyle: {
|
|
2465
|
-
height: 80
|
|
2536
|
+
return _this6.onHandleChange(e);
|
|
2466
2537
|
},
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2538
|
+
inputStyle: {
|
|
2539
|
+
width: 400
|
|
2540
|
+
}
|
|
2541
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2542
|
+
type: "h5"
|
|
2543
|
+
}, "Attachments"), this.state.noteAttachments.map(function (a, i) {
|
|
2544
|
+
return _this6.renderAttachment(a, i, _this6.onRemoveAttachment);
|
|
2545
|
+
}), /*#__PURE__*/React__default['default'].createElement("input", {
|
|
2546
|
+
ref: function ref(input) {
|
|
2547
|
+
return _this6.attachmentInput = input;
|
|
2470
2548
|
},
|
|
2471
|
-
|
|
2472
|
-
|
|
2549
|
+
id: "attachmentInput",
|
|
2550
|
+
type: "file",
|
|
2551
|
+
className: "fileInput",
|
|
2552
|
+
onChange: function onChange(e) {
|
|
2553
|
+
return _this6.onHandlePDFFileChange(e);
|
|
2473
2554
|
},
|
|
2474
|
-
|
|
2475
|
-
})
|
|
2555
|
+
accept: "application/pdf"
|
|
2556
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2557
|
+
className: "iconTextButton",
|
|
2558
|
+
onClick: function onClick() {
|
|
2559
|
+
_this6.attachmentInput.click();
|
|
2560
|
+
}
|
|
2561
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2562
|
+
className: "iconTextButton_icon",
|
|
2563
|
+
name: "paperclip"
|
|
2564
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2565
|
+
className: "iconTextButton_text"
|
|
2566
|
+
}, "Add Attachment")));
|
|
2476
2567
|
}
|
|
2477
2568
|
}, {
|
|
2478
2569
|
key: "render",
|
|
2479
2570
|
value: function render() {
|
|
2480
|
-
|
|
2481
|
-
return /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPage, null, /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageContents, {
|
|
2482
|
-
noBottomButtons: success
|
|
2483
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageSection, {
|
|
2571
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPage, null, this.renderAddNotePopup(), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageContents, null, /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageSection, {
|
|
2484
2572
|
className: "pageSectionWrapper--newPopup"
|
|
2485
|
-
},
|
|
2573
|
+
}, this.renderInner()), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageSection, {
|
|
2574
|
+
className: "pageSectionWrapper--newPopupSide pageSectionWrapper--newPopupSide-fixedWidth"
|
|
2575
|
+
}, this.renderOverview())), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageBottomButtons, null, this.renderButtons()));
|
|
2486
2576
|
}
|
|
2487
2577
|
}]);
|
|
2488
2578
|
|
|
2489
|
-
return
|
|
2579
|
+
return Job;
|
|
2490
2580
|
}(React.Component);
|
|
2491
2581
|
|
|
2492
2582
|
var mapStateToProps$1 = function mapStateToProps(state) {
|
|
@@ -2496,32 +2586,31 @@ var mapStateToProps$1 = function mapStateToProps(state) {
|
|
|
2496
2586
|
};
|
|
2497
2587
|
};
|
|
2498
2588
|
|
|
2499
|
-
var
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
addRecentlyCreated: Actions.addRecentlyCreated
|
|
2503
|
-
})(reactRouter.withRouter(AddJob));
|
|
2589
|
+
var Job$1 = reactRedux.connect(mapStateToProps$1, {
|
|
2590
|
+
jobsLoaded: jobsLoaded
|
|
2591
|
+
})(reactRouter.withRouter(Job));
|
|
2504
2592
|
|
|
2505
2593
|
function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
2506
2594
|
|
|
2507
2595
|
function _isNativeReflectConstruct$6() { 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; } }
|
|
2508
|
-
var
|
|
2596
|
+
var Actions = PlussCore__namespace.Actions,
|
|
2509
2597
|
Components = PlussCore__namespace.Components,
|
|
2510
|
-
Helper = PlussCore__namespace.Helper
|
|
2598
|
+
Helper = PlussCore__namespace.Helper,
|
|
2599
|
+
Session = PlussCore__namespace.Session;
|
|
2511
2600
|
|
|
2512
|
-
var
|
|
2513
|
-
_inherits__default['default'](
|
|
2601
|
+
var AddJob = /*#__PURE__*/function (_Component) {
|
|
2602
|
+
_inherits__default['default'](AddJob, _Component);
|
|
2514
2603
|
|
|
2515
|
-
var _super = _createSuper$6(
|
|
2604
|
+
var _super = _createSuper$6(AddJob);
|
|
2516
2605
|
|
|
2517
|
-
function
|
|
2606
|
+
function AddJob(props) {
|
|
2518
2607
|
var _this;
|
|
2519
2608
|
|
|
2520
|
-
_classCallCheck__default['default'](this,
|
|
2609
|
+
_classCallCheck__default['default'](this, AddJob);
|
|
2521
2610
|
|
|
2522
2611
|
_this = _super.call(this, props);
|
|
2523
2612
|
|
|
2524
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2613
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJob", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2525
2614
|
var res;
|
|
2526
2615
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
2527
2616
|
while (1) {
|
|
@@ -2529,141 +2618,76 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2529
2618
|
case 0:
|
|
2530
2619
|
_context.prev = 0;
|
|
2531
2620
|
_context.next = 3;
|
|
2532
|
-
return maintenanceActions.
|
|
2621
|
+
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
2533
2622
|
|
|
2534
2623
|
case 3:
|
|
2535
2624
|
res = _context.sent;
|
|
2536
|
-
|
|
2537
|
-
_context.next = 10;
|
|
2538
|
-
break;
|
|
2539
|
-
|
|
2540
|
-
case 7:
|
|
2541
|
-
_context.prev = 7;
|
|
2542
|
-
_context.t0 = _context["catch"](0);
|
|
2543
|
-
console.error('getJobTypes', _context.t0);
|
|
2625
|
+
res.data.location = res.data.site;
|
|
2544
2626
|
|
|
2545
|
-
|
|
2546
|
-
_context.prev = 10;
|
|
2627
|
+
_this.setState(res.data);
|
|
2547
2628
|
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
});
|
|
2629
|
+
_context.next = 11;
|
|
2630
|
+
break;
|
|
2551
2631
|
|
|
2552
|
-
|
|
2632
|
+
case 8:
|
|
2633
|
+
_context.prev = 8;
|
|
2634
|
+
_context.t0 = _context["catch"](0);
|
|
2635
|
+
console.error('getJob', _context.t0);
|
|
2553
2636
|
|
|
2554
|
-
case
|
|
2637
|
+
case 11:
|
|
2555
2638
|
case "end":
|
|
2556
2639
|
return _context.stop();
|
|
2557
2640
|
}
|
|
2558
2641
|
}
|
|
2559
|
-
}, _callee, null, [[0,
|
|
2642
|
+
}, _callee, null, [[0, 8]]);
|
|
2560
2643
|
})));
|
|
2561
2644
|
|
|
2562
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
});
|
|
2572
|
-
}
|
|
2573
|
-
});
|
|
2574
|
-
|
|
2575
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "validateEmail", function () {
|
|
2576
|
-
var jobTypeEmail = _this.state.jobTypeEmail;
|
|
2577
|
-
return !___default['default'].isEmpty(jobTypeEmail) && Helper.isEmail(jobTypeEmail);
|
|
2578
|
-
});
|
|
2579
|
-
|
|
2580
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "isJobTypeValid", function () {
|
|
2581
|
-
var _this$state = _this.state,
|
|
2582
|
-
jobTypeName = _this$state.jobTypeName,
|
|
2583
|
-
jobTypeDescription = _this$state.jobTypeDescription;
|
|
2584
|
-
if (___default['default'].isEmpty(jobTypeName)) return false;
|
|
2585
|
-
if (!_this.validateEmail()) return false;
|
|
2586
|
-
if (___default['default'].isEmpty(jobTypeDescription)) return false;
|
|
2587
|
-
return true;
|
|
2588
|
-
});
|
|
2589
|
-
|
|
2590
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onRemoveJobType", /*#__PURE__*/function () {
|
|
2591
|
-
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(ev) {
|
|
2592
|
-
var index, newJobTypes;
|
|
2593
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2594
|
-
while (1) {
|
|
2595
|
-
switch (_context2.prev = _context2.next) {
|
|
2596
|
-
case 0:
|
|
2597
|
-
if (window.confirm("Are you sure you want to delete ".concat(ev.typeName, "?"))) {
|
|
2598
|
-
_context2.next = 2;
|
|
2599
|
-
break;
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2602
|
-
return _context2.abrupt("return");
|
|
2603
|
-
|
|
2604
|
-
case 2:
|
|
2605
|
-
_context2.prev = 2;
|
|
2606
|
-
_context2.next = 5;
|
|
2607
|
-
return maintenanceActions.deleteJobType(_this.props.auth.site, ev.id);
|
|
2645
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJobTypes", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2646
|
+
var res;
|
|
2647
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2648
|
+
while (1) {
|
|
2649
|
+
switch (_context2.prev = _context2.next) {
|
|
2650
|
+
case 0:
|
|
2651
|
+
_context2.prev = 0;
|
|
2652
|
+
_context2.next = 3;
|
|
2653
|
+
return maintenanceActions.getJobTypes(_this.props.auth.site);
|
|
2608
2654
|
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
return job != null && job.id === ev.id;
|
|
2612
|
-
});
|
|
2655
|
+
case 3:
|
|
2656
|
+
res = _context2.sent;
|
|
2613
2657
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2658
|
+
_this.setState({
|
|
2659
|
+
types: res.data
|
|
2660
|
+
});
|
|
2617
2661
|
|
|
2618
|
-
|
|
2619
|
-
}
|
|
2662
|
+
_this.getDefaultJob();
|
|
2620
2663
|
|
|
2621
|
-
|
|
2622
|
-
|
|
2664
|
+
_context2.next = 11;
|
|
2665
|
+
break;
|
|
2623
2666
|
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
alert('Something went wrong with the request. Please try again.');
|
|
2667
|
+
case 8:
|
|
2668
|
+
_context2.prev = 8;
|
|
2669
|
+
_context2.t0 = _context2["catch"](0);
|
|
2670
|
+
console.error('getJobTypes', _context2.t0);
|
|
2629
2671
|
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
}
|
|
2672
|
+
case 11:
|
|
2673
|
+
case "end":
|
|
2674
|
+
return _context2.stop();
|
|
2634
2675
|
}
|
|
2635
|
-
}
|
|
2636
|
-
})
|
|
2637
|
-
|
|
2638
|
-
return function (_x) {
|
|
2639
|
-
return _ref2.apply(this, arguments);
|
|
2640
|
-
};
|
|
2641
|
-
}());
|
|
2642
|
-
|
|
2643
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onShowJobType", function () {
|
|
2644
|
-
var job = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2676
|
+
}
|
|
2677
|
+
}, _callee2, null, [[0, 8]]);
|
|
2678
|
+
})));
|
|
2645
2679
|
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
jobTypeLevel: job ? job.level : 1
|
|
2653
|
-
});
|
|
2680
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getDefaultJob", function () {
|
|
2681
|
+
if (_this.state.types.length !== 0 && _this.state.jobId == null) {
|
|
2682
|
+
_this.setState({
|
|
2683
|
+
type: _this.state.types[0].typeName
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2654
2686
|
});
|
|
2655
2687
|
|
|
2656
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2657
|
-
if (_this.state.submitting) return;
|
|
2658
|
-
|
|
2688
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectType", function (key, e) {
|
|
2659
2689
|
_this.setState({
|
|
2660
|
-
|
|
2661
|
-
showJobType: false,
|
|
2662
|
-
jobTypeId: null,
|
|
2663
|
-
jobTypeName: '',
|
|
2664
|
-
jobTypeEmail: '',
|
|
2665
|
-
jobTypeDescription: '',
|
|
2666
|
-
jobTypeLevel: 1
|
|
2690
|
+
type: key
|
|
2667
2691
|
});
|
|
2668
2692
|
});
|
|
2669
2693
|
|
|
@@ -2675,17 +2699,11 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2675
2699
|
});
|
|
2676
2700
|
|
|
2677
2701
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSave", function () {
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
jobTypeId = _this$state2.jobTypeId,
|
|
2682
|
-
jobTypeName = _this$state2.jobTypeName,
|
|
2683
|
-
jobTypeEmail = _this$state2.jobTypeEmail,
|
|
2684
|
-
jobTypeDescription = _this$state2.jobTypeDescription,
|
|
2685
|
-
jobTypeLevel = _this$state2.jobTypeLevel;
|
|
2686
|
-
if (submitting) return;
|
|
2702
|
+
_this.setState({
|
|
2703
|
+
showWarnings: false
|
|
2704
|
+
});
|
|
2687
2705
|
|
|
2688
|
-
if (!_this.
|
|
2706
|
+
if (!_this.validateForm()) {
|
|
2689
2707
|
_this.setState({
|
|
2690
2708
|
showWarnings: true
|
|
2691
2709
|
});
|
|
@@ -2693,391 +2711,349 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2693
2711
|
return;
|
|
2694
2712
|
}
|
|
2695
2713
|
|
|
2696
|
-
_this.
|
|
2697
|
-
submitting: true
|
|
2698
|
-
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
2699
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
2700
|
-
while (1) {
|
|
2701
|
-
switch (_context3.prev = _context3.next) {
|
|
2702
|
-
case 0:
|
|
2703
|
-
_context3.prev = 0;
|
|
2704
|
-
|
|
2705
|
-
if (!jobTypeId) {
|
|
2706
|
-
_context3.next = 6;
|
|
2707
|
-
break;
|
|
2708
|
-
}
|
|
2709
|
-
|
|
2710
|
-
_context3.next = 4;
|
|
2711
|
-
return maintenanceActions.editJobType(site, jobTypeId, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
2712
|
-
|
|
2713
|
-
case 4:
|
|
2714
|
-
_context3.next = 8;
|
|
2715
|
-
break;
|
|
2716
|
-
|
|
2717
|
-
case 6:
|
|
2718
|
-
_context3.next = 8;
|
|
2719
|
-
return maintenanceActions.addJobType(site, jobTypeName, jobTypeEmail, jobTypeDescription, jobTypeLevel);
|
|
2714
|
+
if (_this.state.updating) return;
|
|
2720
2715
|
|
|
2721
|
-
|
|
2722
|
-
|
|
2716
|
+
_this.setState({
|
|
2717
|
+
updating: true
|
|
2718
|
+
});
|
|
2723
2719
|
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2720
|
+
var job = {
|
|
2721
|
+
id: _this.state.id,
|
|
2722
|
+
userID: _this.state.userID,
|
|
2723
|
+
userName: _this.state.userName,
|
|
2724
|
+
room: _this.state.room,
|
|
2725
|
+
phone: _this.state.phone,
|
|
2726
|
+
location: _this.state.location,
|
|
2727
|
+
title: _this.state.title,
|
|
2728
|
+
description: _this.state.description,
|
|
2729
|
+
isHome: _this.state.isHome,
|
|
2730
|
+
homeText: _this.state.homeText,
|
|
2731
|
+
type: _this.state.type,
|
|
2732
|
+
date: null,
|
|
2733
|
+
image: _this.state.image
|
|
2734
|
+
};
|
|
2727
2735
|
|
|
2728
|
-
|
|
2729
|
-
|
|
2736
|
+
if (_this.state.id != null) {
|
|
2737
|
+
maintenanceActions.editJob(job, _this.props.auth.site).then(function (res) {
|
|
2738
|
+
_this.setState({
|
|
2739
|
+
success: true,
|
|
2740
|
+
updating: false
|
|
2741
|
+
});
|
|
2730
2742
|
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2743
|
+
_this.props.jobsLoaded([job]);
|
|
2744
|
+
}).catch(function (res) {
|
|
2745
|
+
_this.setState({
|
|
2746
|
+
updating: false
|
|
2747
|
+
});
|
|
2735
2748
|
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2749
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2750
|
+
});
|
|
2751
|
+
} else {
|
|
2752
|
+
// Create New Job
|
|
2753
|
+
job.userID = 'undefined';
|
|
2754
|
+
maintenanceActions.createJob(job).then(function (res) {
|
|
2755
|
+
_this.setState({
|
|
2756
|
+
success: true,
|
|
2757
|
+
updating: false
|
|
2758
|
+
});
|
|
2739
2759
|
|
|
2740
|
-
|
|
2760
|
+
_this.props.jobsUpdate(_this.props.auth.site);
|
|
2761
|
+
}).catch(function (res) {
|
|
2762
|
+
_this.setState({
|
|
2763
|
+
updating: false
|
|
2764
|
+
});
|
|
2741
2765
|
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
}, _callee3, null, [[0, 12]]);
|
|
2748
|
-
})));
|
|
2766
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2749
2769
|
});
|
|
2750
2770
|
|
|
2751
2771
|
_this.state = {
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2772
|
+
jobId: Helper.safeReadParams(_this.props, 'jobId') ? _this.props.match.params.jobId : null,
|
|
2773
|
+
job: null,
|
|
2774
|
+
showingSelector: false,
|
|
2775
|
+
updating: false,
|
|
2776
|
+
connected: false,
|
|
2777
|
+
types: [],
|
|
2778
|
+
id: null,
|
|
2779
|
+
userID: '',
|
|
2780
|
+
userName: '',
|
|
2781
|
+
room: '',
|
|
2782
|
+
phone: '',
|
|
2783
|
+
location: _this.props.auth.site,
|
|
2784
|
+
title: '',
|
|
2785
|
+
description: '',
|
|
2786
|
+
isHome: false,
|
|
2787
|
+
homeText: '',
|
|
2788
|
+
type: 'General',
|
|
2789
|
+
image: null,
|
|
2790
|
+
thumbnail: null,
|
|
2763
2791
|
showWarnings: false,
|
|
2764
|
-
|
|
2792
|
+
success: false
|
|
2765
2793
|
};
|
|
2766
2794
|
return _this;
|
|
2767
2795
|
}
|
|
2768
2796
|
|
|
2769
|
-
_createClass__default['default'](
|
|
2770
|
-
key: "
|
|
2771
|
-
value: function
|
|
2772
|
-
this.updateProps(this.props);
|
|
2797
|
+
_createClass__default['default'](AddJob, [{
|
|
2798
|
+
key: "UNSAFE_componentWillMount",
|
|
2799
|
+
value: function UNSAFE_componentWillMount() {
|
|
2773
2800
|
Session.checkLoggedIn(this, this.props.auth);
|
|
2774
2801
|
}
|
|
2775
2802
|
}, {
|
|
2776
2803
|
key: "componentDidMount",
|
|
2777
2804
|
value: function componentDidMount() {
|
|
2778
2805
|
this.getJobTypes();
|
|
2806
|
+
if (this.state.jobId) this.getJob();
|
|
2807
|
+
this.props.addRecentlyCreated('maintenance');
|
|
2779
2808
|
}
|
|
2780
2809
|
}, {
|
|
2781
|
-
key: "
|
|
2782
|
-
value: function
|
|
2783
|
-
this.updateProps(nextProps);
|
|
2784
|
-
}
|
|
2785
|
-
}, {
|
|
2786
|
-
key: "updateProps",
|
|
2787
|
-
value: function updateProps(props) {
|
|
2788
|
-
this.setState({
|
|
2789
|
-
jobList: props.jobtypes
|
|
2790
|
-
});
|
|
2791
|
-
}
|
|
2792
|
-
}, {
|
|
2793
|
-
key: "renderList",
|
|
2794
|
-
value: function renderList() {
|
|
2810
|
+
key: "renderTypeOptions",
|
|
2811
|
+
value: function renderTypeOptions() {
|
|
2795
2812
|
var _this2 = this;
|
|
2796
2813
|
|
|
2797
|
-
var source =
|
|
2798
|
-
|
|
2799
|
-
if (this.state.sortDesc) source.reverse();
|
|
2800
|
-
source = ___default['default'].filter(source, function (ev) {
|
|
2801
|
-
if (!ev) return false;
|
|
2802
|
-
if (ev.Deleted) return false;
|
|
2803
|
-
return true;
|
|
2804
|
-
});
|
|
2805
|
-
return source.map(function (ev, index) {
|
|
2814
|
+
var source = this.state.types;
|
|
2815
|
+
return source.map(function (ev) {
|
|
2806
2816
|
if (ev != null) {
|
|
2807
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
2808
|
-
key:
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
},
|
|
2812
|
-
onClick: function onClick() {
|
|
2813
|
-
return _this2.onShowJobType(ev);
|
|
2814
|
-
}
|
|
2815
|
-
}, ev.typeName)), /*#__PURE__*/React__default['default'].createElement("td", null, ev.description), /*#__PURE__*/React__default['default'].createElement("td", null, ev.email), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
2816
|
-
className: "table-options"
|
|
2817
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2818
|
-
style: {
|
|
2819
|
-
display: 'flex',
|
|
2820
|
-
alignItems: 'center'
|
|
2821
|
-
}
|
|
2822
|
-
}, Session.validateAccess(_this2.props.auth.site, 'maintenanceTypes', _this2.props.auth) && /*#__PURE__*/React__default['default'].createElement("a", {
|
|
2823
|
-
onClick: function onClick() {
|
|
2824
|
-
return _this2.onShowJobType(ev);
|
|
2825
|
-
}
|
|
2826
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2827
|
-
style: {
|
|
2828
|
-
fontSize: 20,
|
|
2829
|
-
padding: 5,
|
|
2830
|
-
marginLeft: 12,
|
|
2831
|
-
cursor: 'pointer'
|
|
2832
|
-
},
|
|
2833
|
-
name: "pencil"
|
|
2834
|
-
})), Session.validateAccess(_this2.props.auth.site, 'maintenanceTypes', _this2.props.auth) && /*#__PURE__*/React__default['default'].createElement("a", {
|
|
2835
|
-
onClick: function onClick() {
|
|
2836
|
-
return _this2.onRemoveJobType(ev);
|
|
2837
|
-
}
|
|
2838
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2839
|
-
style: {
|
|
2840
|
-
fontSize: 20,
|
|
2841
|
-
padding: 5,
|
|
2842
|
-
marginLeft: 8,
|
|
2843
|
-
cursor: 'pointer'
|
|
2844
|
-
},
|
|
2845
|
-
name: "minus-circle"
|
|
2846
|
-
})))));
|
|
2817
|
+
return /*#__PURE__*/React__default['default'].createElement(reactBootstrap.MenuItem, {
|
|
2818
|
+
key: ev.typeName,
|
|
2819
|
+
eventKey: ev.typeName,
|
|
2820
|
+
active: _this2.state.type === ev.typeName
|
|
2821
|
+
}, ev.typeName);
|
|
2847
2822
|
}
|
|
2848
2823
|
|
|
2849
2824
|
return null;
|
|
2850
2825
|
});
|
|
2851
2826
|
}
|
|
2852
2827
|
}, {
|
|
2853
|
-
key: "
|
|
2854
|
-
value: function
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
}, /*#__PURE__*/React__default['default'].createElement("thead", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
2867
|
-
style: {
|
|
2868
|
-
cursor: 'pointer'
|
|
2869
|
-
},
|
|
2870
|
-
onClick: function onClick() {
|
|
2871
|
-
return _this3.sortByCol('name');
|
|
2872
|
-
}
|
|
2873
|
-
}, "Request type"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
2874
|
-
style: {
|
|
2875
|
-
cursor: 'pointer'
|
|
2876
|
-
},
|
|
2877
|
-
onClick: function onClick() {
|
|
2878
|
-
return _this3.sortByCol('name');
|
|
2879
|
-
}
|
|
2880
|
-
}, "Type Description"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
2881
|
-
style: {
|
|
2882
|
-
cursor: 'pointer'
|
|
2883
|
-
},
|
|
2884
|
-
onClick: function onClick() {
|
|
2885
|
-
return _this3.sortByCol('email');
|
|
2886
|
-
}
|
|
2887
|
-
}, "Email"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
2888
|
-
style: {
|
|
2889
|
-
width: 70
|
|
2890
|
-
}
|
|
2891
|
-
}))), /*#__PURE__*/React__default['default'].createElement("tbody", null, this.renderList()));
|
|
2892
|
-
}
|
|
2893
|
-
}, {
|
|
2894
|
-
key: "renderEmpty",
|
|
2895
|
-
value: function renderEmpty() {
|
|
2896
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2897
|
-
style: {
|
|
2898
|
-
display: 'flex',
|
|
2899
|
-
flexDirection: 'column',
|
|
2900
|
-
flex: 1,
|
|
2901
|
-
justifyContent: 'center',
|
|
2902
|
-
alignItems: 'center',
|
|
2903
|
-
marginTop: 32
|
|
2904
|
-
}
|
|
2905
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2906
|
-
className: "emptyState"
|
|
2907
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2908
|
-
className: "marginTop-32",
|
|
2909
|
-
style: {
|
|
2910
|
-
maxWidth: 500,
|
|
2911
|
-
textAlign: 'center'
|
|
2912
|
-
}
|
|
2913
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2914
|
-
className: "fontRegular fontSize-13"
|
|
2915
|
-
}, "Please add the many categories of request types that exist in your village which work alongside the Maintenance area.")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2916
|
-
className: "marginTop-8 fontRegular fontSize-13",
|
|
2917
|
-
style: {
|
|
2918
|
-
maxWidth: 500,
|
|
2919
|
-
textAlign: 'center'
|
|
2920
|
-
}
|
|
2921
|
-
}, "Examples might be; OH&S, Electrical, General. Remember to add a description too."));
|
|
2828
|
+
key: "renderSuccess",
|
|
2829
|
+
value: function renderSuccess() {
|
|
2830
|
+
if (!this.state.success) return null;
|
|
2831
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.SuccessPopup, {
|
|
2832
|
+
text: "Maintenance request has been ".concat(this.state.id != null ? 'edited' : 'added'),
|
|
2833
|
+
buttons: [{
|
|
2834
|
+
type: 'outlined',
|
|
2835
|
+
onClick: function onClick() {
|
|
2836
|
+
window.history.back();
|
|
2837
|
+
},
|
|
2838
|
+
text: "Back to Maintenance"
|
|
2839
|
+
}]
|
|
2840
|
+
});
|
|
2922
2841
|
}
|
|
2923
|
-
}, {
|
|
2924
|
-
key: "
|
|
2925
|
-
value: function
|
|
2926
|
-
if (___default['default'].isEmpty(this.state.
|
|
2927
|
-
|
|
2842
|
+
}, {
|
|
2843
|
+
key: "validateForm",
|
|
2844
|
+
value: function validateForm() {
|
|
2845
|
+
if (___default['default'].isEmpty(this.state.userName)) return false;
|
|
2846
|
+
if (___default['default'].isEmpty(this.state.room)) return false;
|
|
2847
|
+
if (___default['default'].isEmpty(this.state.title)) return false;
|
|
2848
|
+
if (this.state.isHome && ___default['default'].isEmpty(this.state.homeText)) return false;
|
|
2849
|
+
return true;
|
|
2928
2850
|
}
|
|
2929
2851
|
}, {
|
|
2930
|
-
key: "
|
|
2931
|
-
value: function
|
|
2932
|
-
var
|
|
2933
|
-
|
|
2934
|
-
var _this$state3 = this.state,
|
|
2935
|
-
jobList = _this$state3.jobList,
|
|
2936
|
-
loading = _this$state3.loading;
|
|
2852
|
+
key: "renderSubmit",
|
|
2853
|
+
value: function renderSubmit() {
|
|
2854
|
+
var _this3 = this;
|
|
2937
2855
|
|
|
2938
|
-
if (
|
|
2939
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
}
|
|
2943
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2944
|
-
className: "padding-60 paddingVertical-40",
|
|
2945
|
-
style: {
|
|
2946
|
-
textAlign: 'center'
|
|
2947
|
-
}
|
|
2948
|
-
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2949
|
-
style: {
|
|
2950
|
-
fontSize: 30,
|
|
2951
|
-
color: FeatureConfig.env.colourBrandingOff
|
|
2952
|
-
},
|
|
2953
|
-
name: "spinner fa-pulse fa-fw"
|
|
2954
|
-
})));
|
|
2856
|
+
if (this.state.updating) {
|
|
2857
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2858
|
+
buttonType: "secondary"
|
|
2859
|
+
}, "Saving...");
|
|
2955
2860
|
}
|
|
2956
2861
|
|
|
2957
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
}
|
|
2961
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2962
|
-
className: "flex flex-row flex-center flex-between marginBottom-32"
|
|
2963
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components.PageTitle, null, "Request Types"), /*#__PURE__*/React__default['default'].createElement(Components.AddButton, {
|
|
2862
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2863
|
+
inline: true,
|
|
2864
|
+
buttonType: "tertiary",
|
|
2964
2865
|
onClick: function onClick() {
|
|
2965
|
-
return
|
|
2866
|
+
return _this3.props.history.push('/requestsHub');
|
|
2966
2867
|
},
|
|
2967
|
-
|
|
2968
|
-
|
|
2868
|
+
isActive: true,
|
|
2869
|
+
style: {
|
|
2870
|
+
marginRight: 16
|
|
2871
|
+
}
|
|
2872
|
+
}, "Cancel"), /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2873
|
+
inline: true,
|
|
2874
|
+
buttonType: "primary",
|
|
2875
|
+
onClick: this.onSave,
|
|
2876
|
+
isActive: this.validateForm()
|
|
2877
|
+
}, "Save"));
|
|
2969
2878
|
}
|
|
2970
2879
|
}, {
|
|
2971
|
-
key: "
|
|
2972
|
-
value: function
|
|
2973
|
-
var
|
|
2880
|
+
key: "renderMain",
|
|
2881
|
+
value: function renderMain() {
|
|
2882
|
+
var _this4 = this;
|
|
2974
2883
|
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
hasPadding: true,
|
|
2987
|
-
buttons: [{
|
|
2988
|
-
type: 'primaryAction',
|
|
2989
|
-
onClick: this.onSave,
|
|
2990
|
-
isActive: !submitting && this.isJobTypeValid(),
|
|
2991
|
-
text: submitting ? 'Saving...' : 'Save',
|
|
2992
|
-
className: 'popupButton'
|
|
2993
|
-
}, {
|
|
2994
|
-
type: 'outlinedAction',
|
|
2995
|
-
onClick: this.onHideJobType,
|
|
2996
|
-
isActive: !submitting,
|
|
2997
|
-
text: 'Cancel',
|
|
2998
|
-
className: 'popupButton'
|
|
2999
|
-
}],
|
|
3000
|
-
onClose: this.onHideJobType,
|
|
3001
|
-
title: jobTypeId ? 'Edit Request Type' : 'Create New Request Type'
|
|
3002
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3003
|
-
id: "jobTypeName",
|
|
2884
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2885
|
+
style: {
|
|
2886
|
+
marginBottom: 15
|
|
2887
|
+
}
|
|
2888
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2889
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2890
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.Text, {
|
|
2891
|
+
type: "formTitleLarge",
|
|
2892
|
+
className: "marginBottom-24"
|
|
2893
|
+
}, this.state.infoId == null ? 'New' : 'Edit', " Request"), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2894
|
+
id: "userName",
|
|
3004
2895
|
type: "text",
|
|
3005
|
-
label: "
|
|
3006
|
-
placeholder: "
|
|
3007
|
-
value:
|
|
3008
|
-
onChange:
|
|
2896
|
+
label: "Name",
|
|
2897
|
+
placeholder: "Insert name here",
|
|
2898
|
+
value: this.state.userName,
|
|
2899
|
+
onChange: function onChange(e) {
|
|
2900
|
+
return _this4.onHandleChange(e);
|
|
2901
|
+
},
|
|
3009
2902
|
isRequired: true,
|
|
2903
|
+
alwaysShowLabel: true,
|
|
3010
2904
|
isValid: function isValid() {
|
|
3011
|
-
return !___default['default'].isEmpty(
|
|
2905
|
+
return !___default['default'].isEmpty(_this4.state.userName);
|
|
3012
2906
|
},
|
|
3013
2907
|
showError: function showError() {
|
|
3014
|
-
return showWarnings && ___default['default'].isEmpty(
|
|
2908
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.userName);
|
|
2909
|
+
}
|
|
2910
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2911
|
+
id: "room",
|
|
2912
|
+
type: "text",
|
|
2913
|
+
label: "Location",
|
|
2914
|
+
placeholder: "Insert address here",
|
|
2915
|
+
value: this.state.room,
|
|
2916
|
+
onChange: function onChange(e) {
|
|
2917
|
+
return _this4.onHandleChange(e);
|
|
3015
2918
|
},
|
|
3016
|
-
|
|
2919
|
+
isRequired: true,
|
|
2920
|
+
alwaysShowLabel: true,
|
|
2921
|
+
isValid: function isValid() {
|
|
2922
|
+
return !___default['default'].isEmpty(_this4.state.room);
|
|
2923
|
+
},
|
|
2924
|
+
showError: function showError() {
|
|
2925
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.room);
|
|
2926
|
+
}
|
|
3017
2927
|
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3018
|
-
id: "
|
|
2928
|
+
id: "phone",
|
|
3019
2929
|
type: "text",
|
|
3020
|
-
label: "
|
|
3021
|
-
placeholder: "
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
onChange:
|
|
2930
|
+
label: "Contact number",
|
|
2931
|
+
placeholder: "04XX XXX XXX",
|
|
2932
|
+
value: this.state.phone // showError={this.state.showWarnings && !this.validateImage()}
|
|
2933
|
+
,
|
|
2934
|
+
onChange: function onChange(e) {
|
|
2935
|
+
return _this4.onHandleChange(e);
|
|
2936
|
+
},
|
|
2937
|
+
alwaysShowLabel: true
|
|
2938
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2939
|
+
style: {
|
|
2940
|
+
marginBottom: 15
|
|
2941
|
+
}
|
|
2942
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.Text, {
|
|
2943
|
+
type: "formLabel"
|
|
2944
|
+
}, "Job Type"), /*#__PURE__*/React__default['default'].createElement(reactBootstrap.DropdownButton, {
|
|
2945
|
+
style: {
|
|
2946
|
+
minWidth: 80
|
|
2947
|
+
},
|
|
2948
|
+
bsStyle: "default",
|
|
2949
|
+
title: this.state.type,
|
|
2950
|
+
id: "typeSelect",
|
|
2951
|
+
onSelect: this.onSelectType
|
|
2952
|
+
}, this.renderTypeOptions())), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2953
|
+
id: "title",
|
|
2954
|
+
label: "Title for the work required",
|
|
2955
|
+
type: "textarea",
|
|
2956
|
+
placeholder: "Title for the work required",
|
|
2957
|
+
value: this.state.title,
|
|
2958
|
+
onChange: function onChange(e) {
|
|
2959
|
+
return _this4.onHandleChange(e);
|
|
2960
|
+
},
|
|
2961
|
+
inputStyle: {
|
|
2962
|
+
height: 80
|
|
2963
|
+
},
|
|
3025
2964
|
isRequired: true,
|
|
3026
|
-
isValid:
|
|
2965
|
+
isValid: function isValid() {
|
|
2966
|
+
return !___default['default'].isEmpty(_this4.state.title);
|
|
2967
|
+
},
|
|
3027
2968
|
showError: function showError() {
|
|
3028
|
-
return showWarnings &&
|
|
2969
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.title);
|
|
3029
2970
|
},
|
|
3030
2971
|
alwaysShowLabel: true
|
|
3031
2972
|
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3032
|
-
id: "
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
placeholder: "
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
2973
|
+
id: "description",
|
|
2974
|
+
label: "Description of work required",
|
|
2975
|
+
type: "textarea",
|
|
2976
|
+
placeholder: "Description of work required",
|
|
2977
|
+
value: this.state.description,
|
|
2978
|
+
onChange: function onChange(e) {
|
|
2979
|
+
return _this4.onHandleChange(e);
|
|
2980
|
+
},
|
|
2981
|
+
inputStyle: {
|
|
2982
|
+
height: 80
|
|
2983
|
+
},
|
|
2984
|
+
alwaysShowLabel: true
|
|
2985
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components.RadioButton, {
|
|
2986
|
+
label: "Person must be home during work?",
|
|
2987
|
+
isActive: this.state.isHome,
|
|
2988
|
+
options: [{
|
|
2989
|
+
Label: 'No',
|
|
2990
|
+
Value: false,
|
|
2991
|
+
onChange: function onChange() {
|
|
2992
|
+
return _this4.setState({
|
|
2993
|
+
isHome: false
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
}, {
|
|
2997
|
+
Label: 'Yes',
|
|
2998
|
+
Value: true,
|
|
2999
|
+
onChange: function onChange() {
|
|
3000
|
+
return _this4.setState({
|
|
3001
|
+
isHome: true
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
}]
|
|
3005
|
+
}), this.state.isHome && /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3006
|
+
style: {
|
|
3007
|
+
marginTop: 16
|
|
3008
|
+
},
|
|
3009
|
+
label: "Description of person's available times",
|
|
3010
|
+
id: "homeText",
|
|
3011
|
+
type: "textarea",
|
|
3012
|
+
placeholder: "Description of person's available times",
|
|
3013
|
+
value: this.state.homeText,
|
|
3014
|
+
onChange: function onChange(e) {
|
|
3015
|
+
return _this4.onHandleChange(e);
|
|
3016
|
+
},
|
|
3017
|
+
inputStyle: {
|
|
3018
|
+
height: 80
|
|
3019
|
+
},
|
|
3039
3020
|
isRequired: true,
|
|
3040
3021
|
isValid: function isValid() {
|
|
3041
|
-
return !___default['default'].isEmpty(
|
|
3022
|
+
return !___default['default'].isEmpty(_this4.state.homeText);
|
|
3042
3023
|
},
|
|
3043
3024
|
showError: function showError() {
|
|
3044
|
-
return showWarnings && ___default['default'].isEmpty(
|
|
3025
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.homeText);
|
|
3045
3026
|
},
|
|
3046
3027
|
alwaysShowLabel: true
|
|
3047
|
-
}));
|
|
3028
|
+
})));
|
|
3048
3029
|
}
|
|
3049
3030
|
}, {
|
|
3050
3031
|
key: "render",
|
|
3051
3032
|
value: function render() {
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
style: {
|
|
3059
|
-
position: 'relative'
|
|
3060
|
-
}
|
|
3061
|
-
}, this.renderJobTypes()), this.renderNewUserTypePopup()));
|
|
3033
|
+
var success = this.state.success;
|
|
3034
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.OverlayPage, null, /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageContents, {
|
|
3035
|
+
noBottomButtons: success
|
|
3036
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageSection, {
|
|
3037
|
+
className: "pageSectionWrapper--newPopup"
|
|
3038
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", null, this.renderSuccess(), !success && this.renderMain()))), /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageBottomButtons, null, this.renderSubmit()));
|
|
3062
3039
|
}
|
|
3063
3040
|
}]);
|
|
3064
3041
|
|
|
3065
|
-
return
|
|
3042
|
+
return AddJob;
|
|
3066
3043
|
}(React.Component);
|
|
3067
3044
|
|
|
3068
3045
|
var mapStateToProps = function mapStateToProps(state) {
|
|
3069
|
-
var jobtypes = state.maintenance.jobtypes;
|
|
3070
3046
|
var auth = state.auth;
|
|
3071
3047
|
return {
|
|
3072
|
-
jobtypes: jobtypes,
|
|
3073
3048
|
auth: auth
|
|
3074
3049
|
};
|
|
3075
3050
|
};
|
|
3076
3051
|
|
|
3077
|
-
var
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3052
|
+
var AddJob$1 = reactRedux.connect(mapStateToProps, {
|
|
3053
|
+
jobsUpdate: jobsUpdate,
|
|
3054
|
+
jobsLoaded: jobsLoaded,
|
|
3055
|
+
addRecentlyCreated: Actions.addRecentlyCreated
|
|
3056
|
+
})(reactRouter.withRouter(AddJob));
|
|
3081
3057
|
|
|
3082
3058
|
function ownKeys$2(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; }
|
|
3083
3059
|
|
|
@@ -3472,8 +3448,7 @@ var Reducers = {
|
|
|
3472
3448
|
var Screens = {
|
|
3473
3449
|
RequestsHub: RequestsHub$1,
|
|
3474
3450
|
Job: Job$1,
|
|
3475
|
-
AddJob: AddJob$1
|
|
3476
|
-
JobTypes: JobTypes$1
|
|
3451
|
+
AddJob: AddJob$1
|
|
3477
3452
|
};
|
|
3478
3453
|
|
|
3479
3454
|
exports.ActivityText = ActivityText;
|