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