@plusscommunities/pluss-maintenance-web 1.0.24 → 1.0.28-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 +1848 -1877
- package/dist/index.esm.js +1848 -1877
- package/dist/index.umd.js +1851 -1880
- package/package.json +6 -5
- 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 +51 -41
package/dist/index.cjs.js
CHANGED
|
@@ -13,13 +13,13 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
13
13
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var reactRedux = require('react-redux');
|
|
16
|
+
var reactRouter = require('react-router');
|
|
16
17
|
var _ = require('lodash');
|
|
17
18
|
var moment = require('moment');
|
|
18
19
|
var FontAwesome = require('react-fontawesome');
|
|
19
20
|
var PlussCore = require('@plusscommunities/pluss-core-web');
|
|
20
21
|
var Cookies = require('js-cookie');
|
|
21
22
|
var reactBootstrap = require('react-bootstrap');
|
|
22
|
-
var reactRouter = require('react-router');
|
|
23
23
|
var reactRouterDom = require('react-router-dom');
|
|
24
24
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
25
25
|
var Textarea = require('react-textarea-autosize');
|
|
@@ -321,13 +321,14 @@ var maintenanceActions = {
|
|
|
321
321
|
var Helper$3 = PlussCore__namespace.Helper,
|
|
322
322
|
Session$5 = PlussCore__namespace.Session;
|
|
323
323
|
var reactionActions = {
|
|
324
|
-
addComment: function addComment(entityId, entityType, entityName, site, comment, image) {
|
|
324
|
+
addComment: function addComment(entityId, entityType, entityName, site, comment, image, parentId) {
|
|
325
325
|
var data = {
|
|
326
326
|
entityId: entityId,
|
|
327
327
|
entityType: entityType,
|
|
328
328
|
entityName: entityName,
|
|
329
329
|
site: site,
|
|
330
|
-
comment: comment
|
|
330
|
+
comment: comment,
|
|
331
|
+
parentId: parentId
|
|
331
332
|
};
|
|
332
333
|
|
|
333
334
|
if (!___default['default'].isEmpty(image)) {
|
|
@@ -468,8 +469,7 @@ var StatusTypes = {
|
|
|
468
469
|
function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
469
470
|
|
|
470
471
|
function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
471
|
-
var Session$4 = PlussCore__namespace.Session
|
|
472
|
-
Components$4 = PlussCore__namespace.Components;
|
|
472
|
+
var Session$4 = PlussCore__namespace.Session;
|
|
473
473
|
|
|
474
474
|
var JobList = /*#__PURE__*/function (_Component) {
|
|
475
475
|
_inherits__default['default'](JobList, _Component);
|
|
@@ -577,10 +577,6 @@ var JobList = /*#__PURE__*/function (_Component) {
|
|
|
577
577
|
};
|
|
578
578
|
}());
|
|
579
579
|
|
|
580
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenJobTypes", function () {
|
|
581
|
-
_this.props.history.push('/requestTypes');
|
|
582
|
-
});
|
|
583
|
-
|
|
584
580
|
_this.state = {
|
|
585
581
|
showCompleted: false,
|
|
586
582
|
sortColumn: 'createdUnix',
|
|
@@ -720,27 +716,6 @@ var JobList = /*#__PURE__*/function (_Component) {
|
|
|
720
716
|
}
|
|
721
717
|
}, "Example might be; Fix my light bulb, hand rail is broken, or please send flowers to Mum."));
|
|
722
718
|
}
|
|
723
|
-
}, {
|
|
724
|
-
key: "renderButtons",
|
|
725
|
-
value: function renderButtons() {
|
|
726
|
-
if (!Session$4.validateAccess(this.props.auth.site, 'maintenanceTypes', this.props.auth)) return null;
|
|
727
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
728
|
-
className: "flex-reverse"
|
|
729
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$4.Button, {
|
|
730
|
-
inline: true,
|
|
731
|
-
buttonType: "primaryAction",
|
|
732
|
-
onClick: this.onOpenJobTypes,
|
|
733
|
-
isActive: true
|
|
734
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
735
|
-
className: "flex flex-row flex-center"
|
|
736
|
-
}, /*#__PURE__*/React__default['default'].createElement(Components$4.SVGIcon, {
|
|
737
|
-
colour: '#fff',
|
|
738
|
-
icon: "maintenance2",
|
|
739
|
-
height: "17px"
|
|
740
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
741
|
-
className: "marginLeft-10"
|
|
742
|
-
}, "Request Types"))));
|
|
743
|
-
}
|
|
744
719
|
}, {
|
|
745
720
|
key: "renderContent",
|
|
746
721
|
value: function renderContent() {
|
|
@@ -812,7 +787,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,1235 @@ 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: 'eye',
|
|
1564
|
+
isFontAwesome: true,
|
|
1565
|
+
selected: this.state.selectedSection === 'all',
|
|
1566
|
+
onClick: function onClick() {
|
|
1567
|
+
_this2.setState({
|
|
1568
|
+
selectedSection: 'all'
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
if (Session$2.validateAccess(this.props.auth.site, 'maintenanceTypes', this.props.auth)) {
|
|
1574
|
+
sectionItems.push({
|
|
1575
|
+
type: 'navItem',
|
|
1576
|
+
text: 'Request Types',
|
|
1577
|
+
// icon: 'maintenance2',
|
|
1578
|
+
// isSVG: true,
|
|
1579
|
+
selected: this.state.selectedSection === 'requestTypes',
|
|
1639
1580
|
onClick: function onClick() {
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
backgroundColor: StatusTypes[statusKey].color
|
|
1581
|
+
_this2.setState({
|
|
1582
|
+
selectedSection: 'requestTypes'
|
|
1583
|
+
});
|
|
1644
1584
|
}
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$2.HubSidebar, {
|
|
1589
|
+
sections: [{
|
|
1590
|
+
title: 'Requests',
|
|
1591
|
+
items: sectionItems
|
|
1592
|
+
}]
|
|
1593
|
+
});
|
|
1649
1594
|
}
|
|
1650
1595
|
}, {
|
|
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'))));
|
|
1596
|
+
key: "renderRight",
|
|
1597
|
+
value: function renderRight() {
|
|
1598
|
+
if (this.state.selectedSection === 'requestTypes') {
|
|
1599
|
+
return /*#__PURE__*/React__default['default'].createElement(JobTypes$1, null);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
return /*#__PURE__*/React__default['default'].createElement(JobList$1, {
|
|
1603
|
+
source: this.state.allList
|
|
1604
|
+
});
|
|
1669
1605
|
}
|
|
1670
1606
|
}, {
|
|
1671
|
-
key: "
|
|
1672
|
-
value: function
|
|
1673
|
-
var _this3 = this;
|
|
1674
|
-
|
|
1675
|
-
if (this.state.loadingComments) return null;
|
|
1607
|
+
key: "render",
|
|
1608
|
+
value: function render() {
|
|
1676
1609
|
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());
|
|
1610
|
+
className: "hub-wrapperContainer"
|
|
1611
|
+
}, this.renderLeftBar(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1612
|
+
className: "hub-headerContentWrapper"
|
|
1613
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Header, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1614
|
+
className: "hub-contentWrapper"
|
|
1615
|
+
}, this.renderRight())));
|
|
1789
1616
|
}
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1617
|
+
}]);
|
|
1618
|
+
|
|
1619
|
+
return RequestsHub;
|
|
1620
|
+
}(React.Component);
|
|
1621
|
+
|
|
1622
|
+
var styles$4 = {
|
|
1623
|
+
sideBarTitleSection: {
|
|
1624
|
+
lineHeight: '40px',
|
|
1625
|
+
marginTop: 30,
|
|
1626
|
+
marginBottom: 30,
|
|
1627
|
+
paddingLeft: 24,
|
|
1628
|
+
paddingRight: 24
|
|
1629
|
+
},
|
|
1630
|
+
sideBarSection: {
|
|
1631
|
+
weight: '100%',
|
|
1632
|
+
minWidth: 200,
|
|
1633
|
+
padding: 32,
|
|
1634
|
+
paddingLeft: 24,
|
|
1635
|
+
cursor: 'pointer',
|
|
1636
|
+
display: 'flex',
|
|
1637
|
+
flexDirection: 'column',
|
|
1638
|
+
justifyContent: 'center'
|
|
1639
|
+
},
|
|
1640
|
+
spinner: {
|
|
1641
|
+
fontSize: 32,
|
|
1642
|
+
color: FeatureConfig.env.colourBrandingOff
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
var mapStateToProps$2 = function mapStateToProps(state) {
|
|
1647
|
+
var jobs = state.maintenance.jobs;
|
|
1648
|
+
var auth = state.auth;
|
|
1649
|
+
return {
|
|
1650
|
+
jobs: jobs,
|
|
1651
|
+
auth: auth
|
|
1652
|
+
};
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
var RequestsHub$1 = reactRedux.connect(mapStateToProps$2, {
|
|
1656
|
+
jobsLoaded: jobsLoaded
|
|
1657
|
+
})(reactRouter.withRouter(RequestsHub));
|
|
1658
|
+
|
|
1659
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1660
|
+
|
|
1661
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1662
|
+
|
|
1663
|
+
function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
1664
|
+
|
|
1665
|
+
function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1666
|
+
var Apis = PlussCore__namespace.Apis,
|
|
1667
|
+
Helper$1 = PlussCore__namespace.Helper,
|
|
1668
|
+
Session$1 = PlussCore__namespace.Session,
|
|
1669
|
+
Colours = PlussCore__namespace.Colours,
|
|
1670
|
+
Components$1 = PlussCore__namespace.Components;
|
|
1671
|
+
|
|
1672
|
+
var Job = /*#__PURE__*/function (_Component) {
|
|
1673
|
+
_inherits__default['default'](Job, _Component);
|
|
1674
|
+
|
|
1675
|
+
var _super = _createSuper$7(Job);
|
|
1676
|
+
|
|
1677
|
+
function Job(props) {
|
|
1678
|
+
var _this;
|
|
1679
|
+
|
|
1680
|
+
_classCallCheck__default['default'](this, Job);
|
|
1681
|
+
|
|
1682
|
+
_this = _super.call(this, props);
|
|
1683
|
+
|
|
1684
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJob", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
1685
|
+
var res;
|
|
1686
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1687
|
+
while (1) {
|
|
1688
|
+
switch (_context.prev = _context.next) {
|
|
1689
|
+
case 0:
|
|
1690
|
+
_context.prev = 0;
|
|
1691
|
+
_context.next = 3;
|
|
1692
|
+
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
1693
|
+
|
|
1694
|
+
case 3:
|
|
1695
|
+
res = _context.sent;
|
|
1696
|
+
|
|
1697
|
+
_this.setState({
|
|
1698
|
+
updating: false
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
res.data.location = res.data.site;
|
|
1702
|
+
|
|
1703
|
+
_this.setJob(res.data);
|
|
1704
|
+
|
|
1705
|
+
_context.next = 12;
|
|
1706
|
+
break;
|
|
1707
|
+
|
|
1708
|
+
case 9:
|
|
1709
|
+
_context.prev = 9;
|
|
1710
|
+
_context.t0 = _context["catch"](0);
|
|
1711
|
+
console.error('getJob', _context.t0);
|
|
1712
|
+
|
|
1713
|
+
case 12:
|
|
1714
|
+
case "end":
|
|
1715
|
+
return _context.stop();
|
|
1716
|
+
}
|
|
1801
1717
|
}
|
|
1718
|
+
}, _callee, null, [[0, 9]]);
|
|
1719
|
+
})));
|
|
1720
|
+
|
|
1721
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "setJob", function (job) {
|
|
1722
|
+
job.typeIcon = job.type === 'General' ? 'wrench' : 'tree';
|
|
1723
|
+
job.typeColour = job.type === 'General' ? '#666' : 'green';
|
|
1724
|
+
|
|
1725
|
+
if (___default['default'].isEmpty(job.lastActivity)) {
|
|
1726
|
+
job.lastActivity = '-- --';
|
|
1727
|
+
job.noActivity = true;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
if (___default['default'].isEmpty(job.status)) {
|
|
1731
|
+
job.status = 'Unassigned';
|
|
1732
|
+
job.notStatus = true;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
if (___default['default'].isEmpty(job.audience)) {
|
|
1736
|
+
job.audience = [{
|
|
1737
|
+
displayName: 'Unassigned',
|
|
1738
|
+
isEmpty: true
|
|
1739
|
+
}];
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
var needToMarkSeen = false;
|
|
1743
|
+
|
|
1744
|
+
if (!job.seen) {
|
|
1745
|
+
job.seen = true;
|
|
1746
|
+
needToMarkSeen = true;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
_this.setState({
|
|
1750
|
+
job: job
|
|
1751
|
+
}, function () {
|
|
1752
|
+
if (needToMarkSeen) _this.markSeen();
|
|
1753
|
+
});
|
|
1754
|
+
|
|
1755
|
+
_this.props.jobsLoaded([job]);
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "editJob", function () {});
|
|
1759
|
+
|
|
1760
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "isReadyToSaveNote", function () {
|
|
1761
|
+
var _this$state = _this.state,
|
|
1762
|
+
noteAttachments = _this$state.noteAttachments,
|
|
1763
|
+
noteInput = _this$state.noteInput;
|
|
1764
|
+
if (___default['default'].some(noteAttachments, function (n) {
|
|
1765
|
+
return n.Uploading;
|
|
1766
|
+
})) return false;
|
|
1767
|
+
return !___default['default'].isEmpty(noteInput) || !___default['default'].isEmpty(noteAttachments);
|
|
1768
|
+
});
|
|
1769
|
+
|
|
1770
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenAddNote", function () {
|
|
1771
|
+
_this.setState({
|
|
1772
|
+
addNoteOpen: true,
|
|
1773
|
+
editingNote: null
|
|
1774
|
+
});
|
|
1775
|
+
});
|
|
1776
|
+
|
|
1777
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onCloseAddNote", function () {
|
|
1778
|
+
var newState = {
|
|
1779
|
+
addNoteOpen: false,
|
|
1780
|
+
editingNote: null
|
|
1802
1781
|
};
|
|
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
1782
|
|
|
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
|
-
|
|
1783
|
+
if (!!_this.state.editingNote) {
|
|
1784
|
+
newState.noteInput = '';
|
|
1785
|
+
newState.noteAttachments = [];
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
_this.setState(newState);
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenNoteMenu", function (index) {
|
|
1792
|
+
if (_this.state.noteMenuOpen === index) {
|
|
1793
|
+
_this.setState({
|
|
1794
|
+
noteMenuOpen: null
|
|
1795
|
+
});
|
|
1796
|
+
} else {
|
|
1797
|
+
_this.setState({
|
|
1798
|
+
noteMenuOpen: index
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandlePDFFileChange", function (event) {
|
|
1804
|
+
var file = event.target.files[0];
|
|
1805
|
+
if (!file || _this.state.uploadingNoteAttachment) return;
|
|
1806
|
+
|
|
1807
|
+
var noteAttachments = _toConsumableArray__default['default'](_this.state.noteAttachments);
|
|
1808
|
+
|
|
1809
|
+
var newAttachment = {
|
|
1810
|
+
Uploading: true,
|
|
1811
|
+
Title: file.name
|
|
1812
|
+
};
|
|
1813
|
+
noteAttachments.push(newAttachment);
|
|
1814
|
+
|
|
1815
|
+
_this.setState({
|
|
1816
|
+
noteAttachments: noteAttachments
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
Apis.fileActions.uploadMediaAsync(file, file.name).then(function (fileRes) {
|
|
1820
|
+
newAttachment.Source = fileRes;
|
|
1821
|
+
newAttachment.Uploading = false;
|
|
1822
|
+
|
|
1823
|
+
_this.setState({
|
|
1824
|
+
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1825
|
+
});
|
|
1826
|
+
}).catch(function (uploadErrorRes) {
|
|
1827
|
+
console.log(uploadErrorRes);
|
|
1828
|
+
newAttachment.Uploading = false;
|
|
1829
|
+
|
|
1830
|
+
_this.setState({
|
|
1831
|
+
noteAttachments: _toConsumableArray__default['default'](_this.state.noteAttachments)
|
|
1832
|
+
});
|
|
1833
|
+
});
|
|
1834
|
+
event.target.value = '';
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onRemoveAttachment", function (a) {
|
|
1838
|
+
var index = _this.state.noteAttachments.indexOf(a);
|
|
1839
|
+
|
|
1840
|
+
if (index > -1) {
|
|
1841
|
+
var newAttachments = _toConsumableArray__default['default'](_this.state.noteAttachments);
|
|
1842
|
+
|
|
1843
|
+
newAttachments.splice(index, 1);
|
|
1844
|
+
|
|
1845
|
+
_this.setState({
|
|
1846
|
+
noteAttachments: newAttachments
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onConfirmAddNote", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
1852
|
+
var res;
|
|
1853
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1854
|
+
while (1) {
|
|
1855
|
+
switch (_context2.prev = _context2.next) {
|
|
1856
|
+
case 0:
|
|
1857
|
+
if (_this.isReadyToSaveNote()) {
|
|
1858
|
+
_context2.next = 2;
|
|
1859
|
+
break;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
return _context2.abrupt("return");
|
|
1863
|
+
|
|
1864
|
+
case 2:
|
|
1865
|
+
_context2.prev = 2;
|
|
1866
|
+
|
|
1867
|
+
_this.setState({
|
|
1868
|
+
submittingNote: true
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
_context2.next = 6;
|
|
1872
|
+
return _this.state.editingNote ? maintenanceActions.editNote(_this.state.jobId, _this.state.editingNote, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
|
|
1873
|
+
return {
|
|
1874
|
+
Title: a.Title,
|
|
1875
|
+
Source: a.Source
|
|
1876
|
+
};
|
|
1877
|
+
})) : maintenanceActions.addNote(_this.state.jobId, _this.state.noteInput, _this.state.noteAttachments.map(function (a) {
|
|
1878
|
+
return {
|
|
1879
|
+
Title: a.Title,
|
|
1880
|
+
Source: a.Source
|
|
1881
|
+
};
|
|
1882
|
+
}));
|
|
1871
1883
|
|
|
1872
|
-
|
|
1873
|
-
|
|
1884
|
+
case 6:
|
|
1885
|
+
res = _context2.sent;
|
|
1874
1886
|
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1887
|
+
_this.setState({
|
|
1888
|
+
job: res.data.job,
|
|
1889
|
+
submittingNote: false,
|
|
1890
|
+
addNoteOpen: false,
|
|
1891
|
+
noteInput: '',
|
|
1892
|
+
noteAttachments: [],
|
|
1893
|
+
editingNote: null
|
|
1894
|
+
}, function () {
|
|
1895
|
+
_this.props.jobsLoaded([_this.state.job]);
|
|
1896
|
+
});
|
|
1885
1897
|
|
|
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);
|
|
1898
|
+
_context2.next = 13;
|
|
1899
|
+
break;
|
|
1897
1900
|
|
|
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
|
|
1901
|
+
case 10:
|
|
1902
|
+
_context2.prev = 10;
|
|
1903
|
+
_context2.t0 = _context2["catch"](2);
|
|
1904
|
+
console.error('onConfirmAddNote', _context2.t0);
|
|
1905
|
+
|
|
1906
|
+
case 13:
|
|
1907
|
+
case "end":
|
|
1908
|
+
return _context2.stop();
|
|
1909
|
+
}
|
|
1915
1910
|
}
|
|
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;
|
|
1911
|
+
}, _callee2, null, [[2, 10]]);
|
|
1912
|
+
})));
|
|
1946
1913
|
|
|
1947
|
-
|
|
1914
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onDeleteNote", function (n) {
|
|
1915
|
+
if (!window.confirm('Are you sure you want to delete that note?')) {
|
|
1916
|
+
_this.setState({
|
|
1917
|
+
noteMenuOpen: null
|
|
1918
|
+
});
|
|
1948
1919
|
|
|
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
|
-
})));
|
|
1920
|
+
return;
|
|
1960
1921
|
}
|
|
1961
1922
|
|
|
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);
|
|
1923
|
+
maintenanceActions.deleteNote(_this.state.jobId, n.Id);
|
|
2030
1924
|
|
|
2031
|
-
var
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
auth: auth
|
|
2035
|
-
};
|
|
2036
|
-
};
|
|
1925
|
+
var newNotes = ___default['default'].filter(_this.state.job.Notes, function (note) {
|
|
1926
|
+
return note.Id !== n.Id;
|
|
1927
|
+
});
|
|
2037
1928
|
|
|
2038
|
-
var
|
|
2039
|
-
jobsLoaded: jobsLoaded
|
|
2040
|
-
})(reactRouter.withRouter(Job));
|
|
1929
|
+
var newJob = _objectSpread$3({}, _this.state.job);
|
|
2041
1930
|
|
|
2042
|
-
|
|
1931
|
+
newJob.Notes = newNotes;
|
|
2043
1932
|
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1933
|
+
_this.setState({
|
|
1934
|
+
job: newJob,
|
|
1935
|
+
noteMenuOpen: null
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
2049
1938
|
|
|
2050
|
-
|
|
2051
|
-
|
|
1939
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onOpenEditNote", function (n) {
|
|
1940
|
+
_this.setState({
|
|
1941
|
+
noteAttachments: n.Attachments || [],
|
|
1942
|
+
noteInput: n.Note || '',
|
|
1943
|
+
addNoteOpen: true,
|
|
1944
|
+
editingNote: n.Id,
|
|
1945
|
+
noteMenuOpen: null
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
2052
1948
|
|
|
2053
|
-
|
|
1949
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "markSeen", function () {
|
|
1950
|
+
var job = _this.state.job;
|
|
1951
|
+
var auth = _this.props.auth; // Must have maintenance permission and not the requester
|
|
2054
1952
|
|
|
2055
|
-
|
|
2056
|
-
|
|
1953
|
+
if (!Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) return;
|
|
1954
|
+
if (auth.user.Id === job.userID) return;
|
|
2057
1955
|
|
|
2058
|
-
|
|
1956
|
+
_this.setState({
|
|
1957
|
+
updating: true
|
|
1958
|
+
}, /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
1959
|
+
var update;
|
|
1960
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1961
|
+
while (1) {
|
|
1962
|
+
switch (_context3.prev = _context3.next) {
|
|
1963
|
+
case 0:
|
|
1964
|
+
_context3.prev = 0;
|
|
1965
|
+
update = {
|
|
1966
|
+
id: job.id,
|
|
1967
|
+
seen: true,
|
|
1968
|
+
status: job.status || 'Unassigned'
|
|
1969
|
+
};
|
|
1970
|
+
_context3.next = 4;
|
|
1971
|
+
return maintenanceActions.editJob(update, auth.site);
|
|
2059
1972
|
|
|
2060
|
-
|
|
1973
|
+
case 4:
|
|
1974
|
+
_context3.next = 11;
|
|
1975
|
+
break;
|
|
2061
1976
|
|
|
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);
|
|
1977
|
+
case 6:
|
|
1978
|
+
_context3.prev = 6;
|
|
1979
|
+
_context3.t0 = _context3["catch"](0);
|
|
2071
1980
|
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
1981
|
+
_this.setState({
|
|
1982
|
+
updating: false
|
|
1983
|
+
});
|
|
2075
1984
|
|
|
2076
|
-
|
|
1985
|
+
console.log('markSeen error', _context3.t0);
|
|
1986
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2077
1987
|
|
|
2078
|
-
|
|
2079
|
-
|
|
1988
|
+
case 11:
|
|
1989
|
+
case "end":
|
|
1990
|
+
return _context3.stop();
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
}, _callee3, null, [[0, 6]]);
|
|
1994
|
+
})));
|
|
1995
|
+
});
|
|
2080
1996
|
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
1997
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getComments", function () {
|
|
1998
|
+
reactionActions.getComments(_this.state.jobId, 'maintenancerequest', 0).then(function (res) {
|
|
1999
|
+
_this.setState({
|
|
2000
|
+
comments: res.data
|
|
2001
|
+
});
|
|
2002
|
+
});
|
|
2003
|
+
});
|
|
2085
2004
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
return _context.stop();
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
}, _callee, null, [[0, 8]]);
|
|
2092
|
-
})));
|
|
2005
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onAddComment", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
2006
|
+
var _this$state2, commentInput, jobId, job, comments, res;
|
|
2093
2007
|
|
|
2094
|
-
|
|
2095
|
-
var res;
|
|
2096
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2008
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
2097
2009
|
while (1) {
|
|
2098
|
-
switch (
|
|
2010
|
+
switch (_context4.prev = _context4.next) {
|
|
2099
2011
|
case 0:
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
return maintenanceActions.getJobTypes(_this.props.auth.site);
|
|
2103
|
-
|
|
2104
|
-
case 3:
|
|
2105
|
-
res = _context2.sent;
|
|
2012
|
+
_this$state2 = _this.state, commentInput = _this$state2.commentInput, jobId = _this$state2.jobId, job = _this$state2.job, comments = _this$state2.comments;
|
|
2013
|
+
_context4.prev = 1;
|
|
2106
2014
|
|
|
2107
2015
|
_this.setState({
|
|
2108
|
-
|
|
2016
|
+
commentInput: ''
|
|
2109
2017
|
});
|
|
2110
2018
|
|
|
2111
|
-
|
|
2019
|
+
_context4.next = 5;
|
|
2020
|
+
return reactionActions.addComment(jobId, 'maintenancerequest', job.title, job.site, commentInput);
|
|
2112
2021
|
|
|
2113
|
-
|
|
2022
|
+
case 5:
|
|
2023
|
+
res = _context4.sent;
|
|
2024
|
+
|
|
2025
|
+
_this.setState({
|
|
2026
|
+
comments: [].concat(_toConsumableArray__default['default'](comments), [res.data])
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
_context4.next = 12;
|
|
2114
2030
|
break;
|
|
2115
2031
|
|
|
2116
|
-
case
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
console.error('
|
|
2032
|
+
case 9:
|
|
2033
|
+
_context4.prev = 9;
|
|
2034
|
+
_context4.t0 = _context4["catch"](1);
|
|
2035
|
+
console.error('onAddComment', _context4.t0);
|
|
2120
2036
|
|
|
2121
|
-
case
|
|
2037
|
+
case 12:
|
|
2122
2038
|
case "end":
|
|
2123
|
-
return
|
|
2039
|
+
return _context4.stop();
|
|
2124
2040
|
}
|
|
2125
2041
|
}
|
|
2126
|
-
},
|
|
2042
|
+
}, _callee4, null, [[1, 9]]);
|
|
2127
2043
|
})));
|
|
2128
2044
|
|
|
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
2045
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
2144
2046
|
var stateChange = {};
|
|
2145
2047
|
stateChange[event.target.getAttribute('id')] = event.target.value;
|
|
@@ -2147,348 +2049,534 @@ var AddJob = /*#__PURE__*/function (_Component) {
|
|
|
2147
2049
|
_this.setState(stateChange);
|
|
2148
2050
|
});
|
|
2149
2051
|
|
|
2150
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2052
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onToggleStatusChanger", function () {
|
|
2151
2053
|
_this.setState({
|
|
2152
|
-
|
|
2054
|
+
statusChangerOpen: !_this.state.statusChangerOpen
|
|
2153
2055
|
});
|
|
2056
|
+
});
|
|
2154
2057
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2058
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectStatus", /*#__PURE__*/function () {
|
|
2059
|
+
var _ref5 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(status) {
|
|
2060
|
+
var res;
|
|
2061
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
2062
|
+
while (1) {
|
|
2063
|
+
switch (_context5.prev = _context5.next) {
|
|
2064
|
+
case 0:
|
|
2065
|
+
_this.setState({
|
|
2066
|
+
job: _objectSpread$3(_objectSpread$3({}, _this.state.job), {}, {
|
|
2067
|
+
status: status
|
|
2068
|
+
}),
|
|
2069
|
+
statusChangerOpen: false
|
|
2070
|
+
});
|
|
2164
2071
|
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2072
|
+
_context5.prev = 1;
|
|
2073
|
+
_context5.next = 4;
|
|
2074
|
+
return maintenanceActions.editJobStatus(_this.state.job.id, status);
|
|
2168
2075
|
|
|
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
|
-
};
|
|
2076
|
+
case 4:
|
|
2077
|
+
res = _context5.sent;
|
|
2184
2078
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
});
|
|
2079
|
+
_this.setState({
|
|
2080
|
+
job: res.data.job
|
|
2081
|
+
}, function () {
|
|
2082
|
+
_this.props.jobsLoaded([_this.state.job]);
|
|
2083
|
+
});
|
|
2191
2084
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
_this.setState({
|
|
2195
|
-
updating: false
|
|
2196
|
-
});
|
|
2085
|
+
_context5.next = 11;
|
|
2086
|
+
break;
|
|
2197
2087
|
|
|
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
|
-
});
|
|
2088
|
+
case 8:
|
|
2089
|
+
_context5.prev = 8;
|
|
2090
|
+
_context5.t0 = _context5["catch"](1);
|
|
2091
|
+
console.error('onSelectStatus', _context5.t0);
|
|
2208
2092
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
}
|
|
2093
|
+
case 11:
|
|
2094
|
+
case "end":
|
|
2095
|
+
return _context5.stop();
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}, _callee5, null, [[1, 8]]);
|
|
2099
|
+
}));
|
|
2214
2100
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2101
|
+
return function (_x) {
|
|
2102
|
+
return _ref5.apply(this, arguments);
|
|
2103
|
+
};
|
|
2104
|
+
}());
|
|
2219
2105
|
|
|
2220
2106
|
_this.state = {
|
|
2221
|
-
jobId: Helper$1.safeReadParams(
|
|
2107
|
+
jobId: Helper$1.safeReadParams(props, 'jobId') ? props.match.params.jobId : null,
|
|
2222
2108
|
job: null,
|
|
2223
2109
|
showingSelector: false,
|
|
2224
2110
|
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
|
|
2111
|
+
comments: [],
|
|
2112
|
+
commentInput: '',
|
|
2113
|
+
loadingComments: false,
|
|
2114
|
+
statusChangerOpen: false,
|
|
2115
|
+
addNoteOpen: false,
|
|
2116
|
+
noteAttachments: [],
|
|
2117
|
+
noteInput: ''
|
|
2242
2118
|
};
|
|
2243
2119
|
return _this;
|
|
2244
2120
|
}
|
|
2245
2121
|
|
|
2246
|
-
_createClass__default['default'](
|
|
2247
|
-
key: "
|
|
2248
|
-
value: function
|
|
2122
|
+
_createClass__default['default'](Job, [{
|
|
2123
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
2124
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
2249
2125
|
Session$1.checkLoggedIn(this, this.props.auth);
|
|
2250
2126
|
}
|
|
2251
2127
|
}, {
|
|
2252
|
-
key: "componentDidMount",
|
|
2253
|
-
value: function componentDidMount() {
|
|
2254
|
-
this.
|
|
2255
|
-
|
|
2256
|
-
|
|
2128
|
+
key: "componentDidMount",
|
|
2129
|
+
value: function componentDidMount() {
|
|
2130
|
+
if (this.state.jobId) {
|
|
2131
|
+
this.getJob();
|
|
2132
|
+
this.getComments();
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}, {
|
|
2136
|
+
key: "renderStatusLabel",
|
|
2137
|
+
value: function renderStatusLabel() {
|
|
2138
|
+
if (!this.state.job.status) return null;
|
|
2139
|
+
var auth = this.props.auth;
|
|
2140
|
+
|
|
2141
|
+
if (Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) {
|
|
2142
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2143
|
+
className: "statusLabel pointer",
|
|
2144
|
+
onClick: this.onToggleStatusChanger,
|
|
2145
|
+
style: {
|
|
2146
|
+
backgroundColor: StatusTypes[this.state.job.status].color
|
|
2147
|
+
}
|
|
2148
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2149
|
+
className: "statusLabel_text"
|
|
2150
|
+
}, StatusTypes[this.state.job.status].text), this.renderStatusChanger());
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2154
|
+
className: "statusLabel",
|
|
2155
|
+
style: {
|
|
2156
|
+
backgroundColor: StatusTypes[this.state.job.status].color
|
|
2157
|
+
}
|
|
2158
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2159
|
+
className: "statusLabel_text"
|
|
2160
|
+
}, StatusTypes[this.state.job.status].text));
|
|
2161
|
+
}
|
|
2162
|
+
}, {
|
|
2163
|
+
key: "renderNotesButton",
|
|
2164
|
+
value: function renderNotesButton() {
|
|
2165
|
+
var auth = this.props.auth;
|
|
2166
|
+
if (!Session$1.validateAccess(auth.site, 'maintenanceTracking', auth)) return null;
|
|
2167
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2168
|
+
className: "statusLabel pointer",
|
|
2169
|
+
onClick: this.onOpenAddNote,
|
|
2170
|
+
style: {
|
|
2171
|
+
backgroundColor: FeatureConfig.env.colourBrandingMain,
|
|
2172
|
+
marginLeft: 8
|
|
2173
|
+
}
|
|
2174
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2175
|
+
className: "statusLabel_text"
|
|
2176
|
+
}, "Add Note"));
|
|
2257
2177
|
}
|
|
2258
2178
|
}, {
|
|
2259
|
-
key: "
|
|
2260
|
-
value: function
|
|
2179
|
+
key: "renderStatusChanger",
|
|
2180
|
+
value: function renderStatusChanger() {
|
|
2261
2181
|
var _this2 = this;
|
|
2262
2182
|
|
|
2263
|
-
|
|
2264
|
-
return
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2183
|
+
if (!this.state.statusChangerOpen) return null;
|
|
2184
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2185
|
+
className: "statusChanger statusChanger-maintenance"
|
|
2186
|
+
}, Object.keys(StatusTypes).map(function (statusKey) {
|
|
2187
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2188
|
+
key: statusKey,
|
|
2189
|
+
className: "statusLabel",
|
|
2190
|
+
onClick: function onClick() {
|
|
2191
|
+
return _this2.onSelectStatus(statusKey);
|
|
2192
|
+
},
|
|
2193
|
+
style: {
|
|
2194
|
+
backgroundColor: StatusTypes[statusKey].color
|
|
2195
|
+
}
|
|
2196
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2197
|
+
className: "statusLabel_text"
|
|
2198
|
+
}, StatusTypes[statusKey].text));
|
|
2199
|
+
}));
|
|
2200
|
+
}
|
|
2201
|
+
}, {
|
|
2202
|
+
key: "renderComment",
|
|
2203
|
+
value: function renderComment(c) {
|
|
2204
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2205
|
+
key: c.Id,
|
|
2206
|
+
className: "comment"
|
|
2207
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2208
|
+
className: "comment_text"
|
|
2209
|
+
}, Helper$1.toParagraphed(c.Comment)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2210
|
+
className: "comment_bottom"
|
|
2211
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.ProfilePic, {
|
|
2212
|
+
className: "comment_profilePic",
|
|
2213
|
+
size: 25,
|
|
2214
|
+
image: c.User.profilePic
|
|
2215
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2216
|
+
className: "comment_name"
|
|
2217
|
+
}, c.User.displayName), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2218
|
+
className: "comment_time"
|
|
2219
|
+
}, moment__default['default'].utc(c.Timestamp).local().format('D MMM YYYY • h:mma'))));
|
|
2220
|
+
}
|
|
2221
|
+
}, {
|
|
2222
|
+
key: "renderCommentSection",
|
|
2223
|
+
value: function renderCommentSection() {
|
|
2224
|
+
var _this3 = this;
|
|
2272
2225
|
|
|
2273
|
-
|
|
2274
|
-
|
|
2226
|
+
if (this.state.loadingComments) return null;
|
|
2227
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2228
|
+
className: "padding-60 paddingLeft-20"
|
|
2229
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2230
|
+
className: "newTopBar paddingLeft-40"
|
|
2231
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2232
|
+
type: "formTitleSmall",
|
|
2233
|
+
className: "marginBottom-16"
|
|
2234
|
+
}, "Comments"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2235
|
+
className: "commentSection"
|
|
2236
|
+
}, this.state.comments.map(function (c) {
|
|
2237
|
+
return _this3.renderComment(c);
|
|
2238
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2239
|
+
className: "commentReply"
|
|
2240
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2241
|
+
className: "commentReply_button".concat(!___default['default'].isEmpty(this.state.commentInput) ? ' commentReply_button-active' : ''),
|
|
2242
|
+
onClick: this.onAddComment
|
|
2243
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2244
|
+
className: "commentReply_icon",
|
|
2245
|
+
name: "paper-plane-o"
|
|
2246
|
+
})), /*#__PURE__*/React__default['default'].createElement(Textarea__default['default'], {
|
|
2247
|
+
id: "commentInput",
|
|
2248
|
+
placeholder: "Reply here...",
|
|
2249
|
+
type: "text",
|
|
2250
|
+
className: "commentReply_input",
|
|
2251
|
+
value: this.state.commentInput,
|
|
2252
|
+
onChange: function onChange(e) {
|
|
2253
|
+
return _this3.onHandleChange(e);
|
|
2254
|
+
}
|
|
2255
|
+
}))));
|
|
2275
2256
|
}
|
|
2276
2257
|
}, {
|
|
2277
|
-
key: "
|
|
2278
|
-
value: function
|
|
2279
|
-
if (
|
|
2280
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2258
|
+
key: "renderInner",
|
|
2259
|
+
value: function renderInner() {
|
|
2260
|
+
if (this.state.job == null) return null;
|
|
2261
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2262
|
+
style: {
|
|
2263
|
+
paddingBottom: 40
|
|
2264
|
+
}
|
|
2265
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2266
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder relative"
|
|
2267
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2268
|
+
type: "formTitleLarge",
|
|
2269
|
+
className: "marginBottom-24"
|
|
2270
|
+
}, this.state.job.title || 'Request'), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2271
|
+
className: "marginTop-16"
|
|
2272
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2273
|
+
className: 'fieldLabel'
|
|
2274
|
+
}, "Request date"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2275
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2276
|
+
}, moment__default['default'].utc(this.state.job.createdTime).local().format('D MMM YY'))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2277
|
+
className: "marginTop-16"
|
|
2278
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2279
|
+
className: 'fieldLabel'
|
|
2280
|
+
}, "Type"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2281
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2282
|
+
}, this.state.job.type)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2283
|
+
className: "marginTop-16"
|
|
2284
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2285
|
+
className: 'fieldLabel'
|
|
2286
|
+
}, "Location"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2287
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2288
|
+
}, this.state.job.room)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2289
|
+
className: "marginTop-16"
|
|
2290
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2291
|
+
className: 'fieldLabel'
|
|
2292
|
+
}, "Description ", this.state.job.image ? '- (image supplied)' : ''), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2293
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2294
|
+
}, this.state.job.description))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2295
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2296
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2297
|
+
type: "formTitleSmall",
|
|
2298
|
+
className: "marginBottom-16"
|
|
2299
|
+
}, "Contact Details"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2300
|
+
className: "marginTop-16"
|
|
2301
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2302
|
+
className: 'fieldLabel'
|
|
2303
|
+
}, "Name"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2304
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2305
|
+
}, this.state.job.userName)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2306
|
+
className: "marginTop-16"
|
|
2307
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2308
|
+
className: 'fieldLabel'
|
|
2309
|
+
}, "Contact number"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2310
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2311
|
+
}, ___default['default'].isEmpty(this.state.job.phone) ? 'No phone provided' : this.state.job.phone)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2312
|
+
className: "marginTop-16"
|
|
2313
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2314
|
+
className: 'fieldLabel'
|
|
2315
|
+
}, "Should person be home?"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2316
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2317
|
+
}, this.state.job.isHome ? 'Yes' : 'No')), this.state.job.isHome && this.state.job.homeText && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2318
|
+
className: "marginTop-16"
|
|
2319
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2320
|
+
className: 'fieldLabel'
|
|
2321
|
+
}, "When"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2322
|
+
className: 'fontRegular fontSize-16 text-dark marginTop-5'
|
|
2323
|
+
}, this.state.job.homeText))), (this.state.job.image || this.state.job.images) && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2324
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2325
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2326
|
+
type: "formTitleSmall",
|
|
2327
|
+
className: "marginBottom-16"
|
|
2328
|
+
}, "Image"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2329
|
+
style: {
|
|
2330
|
+
marginTop: 16,
|
|
2331
|
+
height: 180,
|
|
2332
|
+
width: 260,
|
|
2333
|
+
borderRadius: 4,
|
|
2334
|
+
border: '1px solid #aaa',
|
|
2335
|
+
backgroundColor: '#ddd',
|
|
2336
|
+
backgroundImage: "url(".concat(this.state.job.thumbnail, ")"),
|
|
2337
|
+
backgroundPosition: 'center'
|
|
2338
|
+
}
|
|
2339
|
+
})), this.renderCommentSection());
|
|
2340
|
+
}
|
|
2341
|
+
}, {
|
|
2342
|
+
key: "renderHistoryEntry",
|
|
2343
|
+
value: function renderHistoryEntry(e, i) {
|
|
2344
|
+
var job = this.state.job;
|
|
2345
|
+
var entryToUse = e || {
|
|
2346
|
+
timestamp: job.createdTime,
|
|
2347
|
+
status: 'Unassigned',
|
|
2348
|
+
user: {
|
|
2349
|
+
displayName: job.userName,
|
|
2350
|
+
id: job.userID,
|
|
2351
|
+
profilePic: job.userProfilePic
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2355
|
+
className: "ticketHistoryEntry",
|
|
2356
|
+
key: i
|
|
2357
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2358
|
+
className: "ticketHistoryEntry_timestamp"
|
|
2359
|
+
}, moment__default['default'].utc(entryToUse.timestamp).local().format('D MMM YYYY h:mma')), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2360
|
+
className: "statusLabel statusLabel-large statusLabel-full",
|
|
2361
|
+
style: {
|
|
2362
|
+
backgroundColor: StatusTypes[entryToUse.status].color
|
|
2363
|
+
}
|
|
2364
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2365
|
+
className: "statusLabel_text"
|
|
2366
|
+
}, e ? "Marked as ".concat(StatusTypes[entryToUse.status].text) : 'Job opened')));
|
|
2367
|
+
}
|
|
2368
|
+
}, {
|
|
2369
|
+
key: "renderNote",
|
|
2370
|
+
value: function renderNote(note, index) {
|
|
2371
|
+
var _this4 = this;
|
|
2372
|
+
|
|
2373
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2374
|
+
className: "ticketHistoryEntry",
|
|
2375
|
+
key: index
|
|
2376
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2377
|
+
className: "ticketHistoryEntry_timestamp"
|
|
2378
|
+
}, moment__default['default'].utc(note.Timestamp).local().format('D MMM YYYY h:mma')), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2379
|
+
className: "statusLabel statusLabel-large statusLabel-full",
|
|
2380
|
+
style: {
|
|
2381
|
+
backgroundColor: '#6e79c5'
|
|
2382
|
+
}
|
|
2383
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2384
|
+
className: "statusLabel_text"
|
|
2385
|
+
}, "Staff Notes")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2386
|
+
className: "maintenanceNote"
|
|
2387
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2388
|
+
className: "maintenanceNote_top"
|
|
2389
|
+
}, this.props.auth && this.props.auth.user && this.props.auth.user.Id === note.User.id && /*#__PURE__*/React__default['default'].createElement(Components$1.SVGIcon, {
|
|
2390
|
+
colour: Colours.COLOUR_DUSK_LIGHT,
|
|
2391
|
+
icon: "more15",
|
|
2392
|
+
className: "maintenanceNote_moreIcon",
|
|
2393
|
+
onClick: function onClick() {
|
|
2394
|
+
return _this4.onOpenNoteMenu(index);
|
|
2395
|
+
}
|
|
2396
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2397
|
+
className: "maintenanceNote_name"
|
|
2398
|
+
}, note.User.displayName), this.state.noteMenuOpen === index && /*#__PURE__*/React__default['default'].createElement(Components$1.MoreMenu, {
|
|
2399
|
+
options: [{
|
|
2400
|
+
key: 'edit',
|
|
2401
|
+
text: 'Edit',
|
|
2402
|
+
onPress: function onPress() {
|
|
2403
|
+
return _this4.onOpenEditNote(note);
|
|
2404
|
+
}
|
|
2405
|
+
}, {
|
|
2406
|
+
key: 'delete',
|
|
2407
|
+
text: 'Delete',
|
|
2408
|
+
onPress: function onPress() {
|
|
2409
|
+
return _this4.onDeleteNote(note);
|
|
2410
|
+
}
|
|
2288
2411
|
}]
|
|
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;
|
|
2412
|
+
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2413
|
+
className: "maintenanceNote_text"
|
|
2414
|
+
}, Helper$1.toParagraphed(note.Note)), note.Attachments.map(function (a, i) {
|
|
2415
|
+
return _this4.renderAttachment(a, i);
|
|
2416
|
+
})));
|
|
2299
2417
|
}
|
|
2300
2418
|
}, {
|
|
2301
|
-
key: "
|
|
2302
|
-
value: function
|
|
2303
|
-
var
|
|
2419
|
+
key: "renderOverview",
|
|
2420
|
+
value: function renderOverview() {
|
|
2421
|
+
var _this5 = this;
|
|
2304
2422
|
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2423
|
+
var job = this.state.job;
|
|
2424
|
+
if (!job || !job.history) return null;
|
|
2425
|
+
|
|
2426
|
+
var source = ___default['default'].sortBy([].concat(_toConsumableArray__default['default'](job.history.map(function (e) {
|
|
2427
|
+
return _objectSpread$3(_objectSpread$3({}, e), {}, {
|
|
2428
|
+
EntryType: 'status'
|
|
2429
|
+
});
|
|
2430
|
+
})), _toConsumableArray__default['default']((job.Notes || []).map(function (e) {
|
|
2431
|
+
return _objectSpread$3(_objectSpread$3({}, e), {}, {
|
|
2432
|
+
timestamp: e.Timestamp,
|
|
2433
|
+
EntryType: 'note'
|
|
2434
|
+
});
|
|
2435
|
+
}))), 'timestamp');
|
|
2436
|
+
|
|
2437
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2438
|
+
className: "padding-32 paddingVertical-40 bottomDivideBorder relative"
|
|
2439
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2440
|
+
className: "newTopBar clearfix flex flex-reverse"
|
|
2441
|
+
}, this.renderNotesButton(), this.renderStatusLabel(), /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2442
|
+
type: "formTitleSmall",
|
|
2443
|
+
className: "flex-1"
|
|
2444
|
+
}, "Status History")), this.renderHistoryEntry(null, -1), ___default['default'].map(source, function (e, i) {
|
|
2445
|
+
switch (e.EntryType) {
|
|
2446
|
+
case 'status':
|
|
2447
|
+
return _this5.renderHistoryEntry(e, i);
|
|
2310
2448
|
|
|
2449
|
+
case 'note':
|
|
2450
|
+
return _this5.renderNote(e, i);
|
|
2451
|
+
}
|
|
2452
|
+
}));
|
|
2453
|
+
}
|
|
2454
|
+
}, {
|
|
2455
|
+
key: "renderButtons",
|
|
2456
|
+
value: function renderButtons() {
|
|
2311
2457
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Components$1.Button, {
|
|
2312
2458
|
inline: true,
|
|
2313
2459
|
buttonType: "tertiary",
|
|
2314
2460
|
onClick: function onClick() {
|
|
2315
|
-
|
|
2461
|
+
window.history.back();
|
|
2316
2462
|
},
|
|
2317
2463
|
isActive: true,
|
|
2318
2464
|
style: {
|
|
2319
2465
|
marginRight: 16
|
|
2320
2466
|
}
|
|
2321
|
-
}, "
|
|
2467
|
+
}, "Back"), Session$1.validateAccess(this.props.auth.site, 'maintenanceTracking', this.props.auth) && !___default['default'].isEmpty(this.state.job) && /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
2468
|
+
to: "/requestsHub/job/".concat(this.state.jobId)
|
|
2469
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.Button, {
|
|
2322
2470
|
inline: true,
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2471
|
+
style: {
|
|
2472
|
+
marginRight: 25
|
|
2473
|
+
},
|
|
2474
|
+
buttonType: "outlined",
|
|
2475
|
+
isActive: true,
|
|
2476
|
+
onClick: this.editJob
|
|
2477
|
+
}, "Edit Details")));
|
|
2327
2478
|
}
|
|
2328
2479
|
}, {
|
|
2329
|
-
key: "
|
|
2330
|
-
value: function
|
|
2331
|
-
|
|
2480
|
+
key: "renderAttachment",
|
|
2481
|
+
value: function renderAttachment(attachment, index, onRemove) {
|
|
2482
|
+
if (!attachment) return null;
|
|
2483
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Attachment, {
|
|
2484
|
+
key: index,
|
|
2485
|
+
uploading: attachment.Uploading,
|
|
2486
|
+
source: attachment.Source,
|
|
2487
|
+
title: attachment.Title,
|
|
2488
|
+
onRemove: onRemove ? function () {
|
|
2489
|
+
return onRemove(attachment);
|
|
2490
|
+
} : undefined
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
}, {
|
|
2494
|
+
key: "renderAddNotePopup",
|
|
2495
|
+
value: function renderAddNotePopup() {
|
|
2496
|
+
var _this6 = this;
|
|
2332
2497
|
|
|
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
|
-
}
|
|
2498
|
+
if (!this.state.addNoteOpen) return null;
|
|
2499
|
+
|
|
2500
|
+
if (this.state.submittingNote) {
|
|
2501
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Popup, {
|
|
2502
|
+
title: "Saving Note",
|
|
2503
|
+
maxWidth: 600,
|
|
2504
|
+
hasPadding: true
|
|
2505
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2506
|
+
className: "flex flex-center-row"
|
|
2507
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2508
|
+
className: "spinner",
|
|
2509
|
+
name: "spinner fa-pulse fa-fw"
|
|
2510
|
+
})));
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.Popup, {
|
|
2514
|
+
title: "".concat(this.state.editingNote ? 'Edit' : 'Add', " Note"),
|
|
2515
|
+
onClose: this.onCloseAddNote,
|
|
2516
|
+
maxWidth: 600,
|
|
2517
|
+
hasPadding: true,
|
|
2518
|
+
buttons: [{
|
|
2519
|
+
type: 'primary',
|
|
2520
|
+
onClick: this.onConfirmAddNote,
|
|
2521
|
+
isActive: this.isReadyToSaveNote(),
|
|
2522
|
+
text: 'Save'
|
|
2445
2523
|
}, {
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
isHome: true
|
|
2451
|
-
});
|
|
2452
|
-
}
|
|
2524
|
+
type: 'tertiary',
|
|
2525
|
+
onClick: this.onCloseAddNote,
|
|
2526
|
+
isActive: true,
|
|
2527
|
+
text: 'Cancel'
|
|
2453
2528
|
}]
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
marginTop: 16
|
|
2457
|
-
},
|
|
2458
|
-
label: "Description of person's available times",
|
|
2459
|
-
id: "homeText",
|
|
2529
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components$1.GenericInput, {
|
|
2530
|
+
id: "noteInput",
|
|
2460
2531
|
type: "textarea",
|
|
2461
|
-
|
|
2462
|
-
value: this.state.
|
|
2532
|
+
componentClass: "textarea",
|
|
2533
|
+
value: this.state.noteInput,
|
|
2534
|
+
placeholder: "Enter note",
|
|
2463
2535
|
onChange: function onChange(e) {
|
|
2464
|
-
return
|
|
2465
|
-
},
|
|
2466
|
-
inputStyle: {
|
|
2467
|
-
height: 80
|
|
2536
|
+
return _this6.onHandleChange(e);
|
|
2468
2537
|
},
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2538
|
+
inputStyle: {
|
|
2539
|
+
width: 400
|
|
2540
|
+
}
|
|
2541
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
|
|
2542
|
+
type: "h5"
|
|
2543
|
+
}, "Attachments"), this.state.noteAttachments.map(function (a, i) {
|
|
2544
|
+
return _this6.renderAttachment(a, i, _this6.onRemoveAttachment);
|
|
2545
|
+
}), /*#__PURE__*/React__default['default'].createElement("input", {
|
|
2546
|
+
ref: function ref(input) {
|
|
2547
|
+
return _this6.attachmentInput = input;
|
|
2472
2548
|
},
|
|
2473
|
-
|
|
2474
|
-
|
|
2549
|
+
id: "attachmentInput",
|
|
2550
|
+
type: "file",
|
|
2551
|
+
className: "fileInput",
|
|
2552
|
+
onChange: function onChange(e) {
|
|
2553
|
+
return _this6.onHandlePDFFileChange(e);
|
|
2475
2554
|
},
|
|
2476
|
-
|
|
2477
|
-
})
|
|
2555
|
+
accept: "application/pdf"
|
|
2556
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2557
|
+
className: "iconTextButton",
|
|
2558
|
+
onClick: function onClick() {
|
|
2559
|
+
_this6.attachmentInput.click();
|
|
2560
|
+
}
|
|
2561
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2562
|
+
className: "iconTextButton_icon",
|
|
2563
|
+
name: "paperclip"
|
|
2564
|
+
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
2565
|
+
className: "iconTextButton_text"
|
|
2566
|
+
}, "Add Attachment")));
|
|
2478
2567
|
}
|
|
2479
2568
|
}, {
|
|
2480
2569
|
key: "render",
|
|
2481
2570
|
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, {
|
|
2571
|
+
return /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPage, null, this.renderAddNotePopup(), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageContents, null, /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageSection, {
|
|
2486
2572
|
className: "pageSectionWrapper--newPopup"
|
|
2487
|
-
},
|
|
2573
|
+
}, this.renderInner()), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageSection, {
|
|
2574
|
+
className: "pageSectionWrapper--newPopupSide pageSectionWrapper--newPopupSide-fixedWidth"
|
|
2575
|
+
}, this.renderOverview())), /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPageBottomButtons, null, this.renderButtons()));
|
|
2488
2576
|
}
|
|
2489
2577
|
}]);
|
|
2490
2578
|
|
|
2491
|
-
return
|
|
2579
|
+
return Job;
|
|
2492
2580
|
}(React.Component);
|
|
2493
2581
|
|
|
2494
2582
|
var mapStateToProps$1 = function mapStateToProps(state) {
|
|
@@ -2498,32 +2586,31 @@ var mapStateToProps$1 = function mapStateToProps(state) {
|
|
|
2498
2586
|
};
|
|
2499
2587
|
};
|
|
2500
2588
|
|
|
2501
|
-
var
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
addRecentlyCreated: Actions.addRecentlyCreated
|
|
2505
|
-
})(reactRouter.withRouter(AddJob));
|
|
2589
|
+
var Job$1 = reactRedux.connect(mapStateToProps$1, {
|
|
2590
|
+
jobsLoaded: jobsLoaded
|
|
2591
|
+
})(reactRouter.withRouter(Job));
|
|
2506
2592
|
|
|
2507
2593
|
function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
2508
2594
|
|
|
2509
2595
|
function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2510
|
-
var
|
|
2596
|
+
var Actions = PlussCore__namespace.Actions,
|
|
2511
2597
|
Components = PlussCore__namespace.Components,
|
|
2512
|
-
Helper = PlussCore__namespace.Helper
|
|
2598
|
+
Helper = PlussCore__namespace.Helper,
|
|
2599
|
+
Session = PlussCore__namespace.Session;
|
|
2513
2600
|
|
|
2514
|
-
var
|
|
2515
|
-
_inherits__default['default'](
|
|
2601
|
+
var AddJob = /*#__PURE__*/function (_Component) {
|
|
2602
|
+
_inherits__default['default'](AddJob, _Component);
|
|
2516
2603
|
|
|
2517
|
-
var _super = _createSuper$6(
|
|
2604
|
+
var _super = _createSuper$6(AddJob);
|
|
2518
2605
|
|
|
2519
|
-
function
|
|
2606
|
+
function AddJob(props) {
|
|
2520
2607
|
var _this;
|
|
2521
2608
|
|
|
2522
|
-
_classCallCheck__default['default'](this,
|
|
2609
|
+
_classCallCheck__default['default'](this, AddJob);
|
|
2523
2610
|
|
|
2524
2611
|
_this = _super.call(this, props);
|
|
2525
2612
|
|
|
2526
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2613
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJob", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2527
2614
|
var res;
|
|
2528
2615
|
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
2529
2616
|
while (1) {
|
|
@@ -2531,141 +2618,76 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2531
2618
|
case 0:
|
|
2532
2619
|
_context.prev = 0;
|
|
2533
2620
|
_context.next = 3;
|
|
2534
|
-
return maintenanceActions.
|
|
2621
|
+
return maintenanceActions.getJob(_this.props.auth.site, _this.state.jobId);
|
|
2535
2622
|
|
|
2536
2623
|
case 3:
|
|
2537
2624
|
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);
|
|
2625
|
+
res.data.location = res.data.site;
|
|
2546
2626
|
|
|
2547
|
-
|
|
2548
|
-
_context.prev = 10;
|
|
2627
|
+
_this.setState(res.data);
|
|
2549
2628
|
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
});
|
|
2629
|
+
_context.next = 11;
|
|
2630
|
+
break;
|
|
2553
2631
|
|
|
2554
|
-
|
|
2632
|
+
case 8:
|
|
2633
|
+
_context.prev = 8;
|
|
2634
|
+
_context.t0 = _context["catch"](0);
|
|
2635
|
+
console.error('getJob', _context.t0);
|
|
2555
2636
|
|
|
2556
|
-
case
|
|
2637
|
+
case 11:
|
|
2557
2638
|
case "end":
|
|
2558
2639
|
return _context.stop();
|
|
2559
2640
|
}
|
|
2560
2641
|
}
|
|
2561
|
-
}, _callee, null, [[0,
|
|
2642
|
+
}, _callee, null, [[0, 8]]);
|
|
2562
2643
|
})));
|
|
2563
2644
|
|
|
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);
|
|
2645
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getJobTypes", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2646
|
+
var res;
|
|
2647
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2648
|
+
while (1) {
|
|
2649
|
+
switch (_context2.prev = _context2.next) {
|
|
2650
|
+
case 0:
|
|
2651
|
+
_context2.prev = 0;
|
|
2652
|
+
_context2.next = 3;
|
|
2653
|
+
return maintenanceActions.getJobTypes(_this.props.auth.site);
|
|
2610
2654
|
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
return job != null && job.id === ev.id;
|
|
2614
|
-
});
|
|
2655
|
+
case 3:
|
|
2656
|
+
res = _context2.sent;
|
|
2615
2657
|
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2658
|
+
_this.setState({
|
|
2659
|
+
types: res.data
|
|
2660
|
+
});
|
|
2619
2661
|
|
|
2620
|
-
|
|
2621
|
-
}
|
|
2662
|
+
_this.getDefaultJob();
|
|
2622
2663
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2664
|
+
_context2.next = 11;
|
|
2665
|
+
break;
|
|
2625
2666
|
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
alert('Something went wrong with the request. Please try again.');
|
|
2667
|
+
case 8:
|
|
2668
|
+
_context2.prev = 8;
|
|
2669
|
+
_context2.t0 = _context2["catch"](0);
|
|
2670
|
+
console.error('getJobTypes', _context2.t0);
|
|
2631
2671
|
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
}
|
|
2672
|
+
case 11:
|
|
2673
|
+
case "end":
|
|
2674
|
+
return _context2.stop();
|
|
2636
2675
|
}
|
|
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;
|
|
2676
|
+
}
|
|
2677
|
+
}, _callee2, null, [[0, 8]]);
|
|
2678
|
+
})));
|
|
2647
2679
|
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
jobTypeLevel: job ? job.level : 1
|
|
2655
|
-
});
|
|
2680
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getDefaultJob", function () {
|
|
2681
|
+
if (_this.state.types.length !== 0 && _this.state.jobId == null) {
|
|
2682
|
+
_this.setState({
|
|
2683
|
+
type: _this.state.types[0].typeName
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2656
2686
|
});
|
|
2657
2687
|
|
|
2658
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "
|
|
2659
|
-
if (_this.state.submitting) return;
|
|
2660
|
-
|
|
2688
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSelectType", function (key, e) {
|
|
2661
2689
|
_this.setState({
|
|
2662
|
-
|
|
2663
|
-
showJobType: false,
|
|
2664
|
-
jobTypeId: null,
|
|
2665
|
-
jobTypeName: '',
|
|
2666
|
-
jobTypeEmail: '',
|
|
2667
|
-
jobTypeDescription: '',
|
|
2668
|
-
jobTypeLevel: 1
|
|
2690
|
+
type: key
|
|
2669
2691
|
});
|
|
2670
2692
|
});
|
|
2671
2693
|
|
|
@@ -2677,17 +2699,11 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2677
2699
|
});
|
|
2678
2700
|
|
|
2679
2701
|
_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;
|
|
2702
|
+
_this.setState({
|
|
2703
|
+
showWarnings: false
|
|
2704
|
+
});
|
|
2689
2705
|
|
|
2690
|
-
if (!_this.
|
|
2706
|
+
if (!_this.validateForm()) {
|
|
2691
2707
|
_this.setState({
|
|
2692
2708
|
showWarnings: true
|
|
2693
2709
|
});
|
|
@@ -2695,393 +2711,349 @@ var JobTypes = /*#__PURE__*/function (_Component) {
|
|
|
2695
2711
|
return;
|
|
2696
2712
|
}
|
|
2697
2713
|
|
|
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);
|
|
2714
|
+
if (_this.state.updating) return;
|
|
2722
2715
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2716
|
+
_this.setState({
|
|
2717
|
+
updating: true
|
|
2718
|
+
});
|
|
2725
2719
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2720
|
+
var job = {
|
|
2721
|
+
id: _this.state.id,
|
|
2722
|
+
userID: _this.state.userID,
|
|
2723
|
+
userName: _this.state.userName,
|
|
2724
|
+
room: _this.state.room,
|
|
2725
|
+
phone: _this.state.phone,
|
|
2726
|
+
location: _this.state.location,
|
|
2727
|
+
title: _this.state.title,
|
|
2728
|
+
description: _this.state.description,
|
|
2729
|
+
isHome: _this.state.isHome,
|
|
2730
|
+
homeText: _this.state.homeText,
|
|
2731
|
+
type: _this.state.type,
|
|
2732
|
+
date: null,
|
|
2733
|
+
image: _this.state.image
|
|
2734
|
+
};
|
|
2729
2735
|
|
|
2730
|
-
|
|
2731
|
-
|
|
2736
|
+
if (_this.state.id != null) {
|
|
2737
|
+
maintenanceActions.editJob(job, _this.props.auth.site).then(function (res) {
|
|
2738
|
+
_this.setState({
|
|
2739
|
+
success: true,
|
|
2740
|
+
updating: false
|
|
2741
|
+
});
|
|
2732
2742
|
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2743
|
+
_this.props.jobsLoaded([job]);
|
|
2744
|
+
}).catch(function (res) {
|
|
2745
|
+
_this.setState({
|
|
2746
|
+
updating: false
|
|
2747
|
+
});
|
|
2737
2748
|
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2749
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2750
|
+
});
|
|
2751
|
+
} else {
|
|
2752
|
+
// Create New Job
|
|
2753
|
+
job.userID = 'undefined';
|
|
2754
|
+
maintenanceActions.createJob(job).then(function (res) {
|
|
2755
|
+
_this.setState({
|
|
2756
|
+
success: true,
|
|
2757
|
+
updating: false
|
|
2758
|
+
});
|
|
2741
2759
|
|
|
2742
|
-
|
|
2760
|
+
_this.props.jobsUpdate(_this.props.auth.site);
|
|
2761
|
+
}).catch(function (res) {
|
|
2762
|
+
_this.setState({
|
|
2763
|
+
updating: false
|
|
2764
|
+
});
|
|
2743
2765
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
}
|
|
2748
|
-
}
|
|
2749
|
-
}, _callee3, null, [[0, 12]]);
|
|
2750
|
-
})));
|
|
2766
|
+
alert('Something went wrong with the request. Please try again.');
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2751
2769
|
});
|
|
2752
2770
|
|
|
2753
2771
|
_this.state = {
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2772
|
+
jobId: Helper.safeReadParams(_this.props, 'jobId') ? _this.props.match.params.jobId : null,
|
|
2773
|
+
job: null,
|
|
2774
|
+
showingSelector: false,
|
|
2775
|
+
updating: false,
|
|
2776
|
+
connected: false,
|
|
2777
|
+
types: [],
|
|
2778
|
+
id: null,
|
|
2779
|
+
userID: '',
|
|
2780
|
+
userName: '',
|
|
2781
|
+
room: '',
|
|
2782
|
+
phone: '',
|
|
2783
|
+
location: _this.props.auth.site,
|
|
2784
|
+
title: '',
|
|
2785
|
+
description: '',
|
|
2786
|
+
isHome: false,
|
|
2787
|
+
homeText: '',
|
|
2788
|
+
type: 'General',
|
|
2789
|
+
image: null,
|
|
2790
|
+
thumbnail: null,
|
|
2765
2791
|
showWarnings: false,
|
|
2766
|
-
|
|
2792
|
+
success: false
|
|
2767
2793
|
};
|
|
2768
2794
|
return _this;
|
|
2769
2795
|
}
|
|
2770
2796
|
|
|
2771
|
-
_createClass__default['default'](
|
|
2772
|
-
key: "
|
|
2773
|
-
value: function
|
|
2774
|
-
this.updateProps(this.props);
|
|
2797
|
+
_createClass__default['default'](AddJob, [{
|
|
2798
|
+
key: "UNSAFE_componentWillMount",
|
|
2799
|
+
value: function UNSAFE_componentWillMount() {
|
|
2775
2800
|
Session.checkLoggedIn(this, this.props.auth);
|
|
2776
2801
|
}
|
|
2777
2802
|
}, {
|
|
2778
2803
|
key: "componentDidMount",
|
|
2779
2804
|
value: function componentDidMount() {
|
|
2780
2805
|
this.getJobTypes();
|
|
2806
|
+
if (this.state.jobId) this.getJob();
|
|
2807
|
+
this.props.addRecentlyCreated('maintenance');
|
|
2781
2808
|
}
|
|
2782
2809
|
}, {
|
|
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() {
|
|
2810
|
+
key: "renderTypeOptions",
|
|
2811
|
+
value: function renderTypeOptions() {
|
|
2797
2812
|
var _this2 = this;
|
|
2798
2813
|
|
|
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) {
|
|
2814
|
+
var source = this.state.types;
|
|
2815
|
+
return source.map(function (ev) {
|
|
2808
2816
|
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
|
-
})))));
|
|
2817
|
+
return /*#__PURE__*/React__default['default'].createElement(reactBootstrap.MenuItem, {
|
|
2818
|
+
key: ev.typeName,
|
|
2819
|
+
eventKey: ev.typeName,
|
|
2820
|
+
active: _this2.state.type === ev.typeName
|
|
2821
|
+
}, ev.typeName);
|
|
2849
2822
|
}
|
|
2850
2823
|
|
|
2851
2824
|
return null;
|
|
2852
2825
|
});
|
|
2853
2826
|
}
|
|
2854
2827
|
}, {
|
|
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."));
|
|
2828
|
+
key: "renderSuccess",
|
|
2829
|
+
value: function renderSuccess() {
|
|
2830
|
+
if (!this.state.success) return null;
|
|
2831
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.SuccessPopup, {
|
|
2832
|
+
text: "Maintenance request has been ".concat(this.state.id != null ? 'edited' : 'added'),
|
|
2833
|
+
buttons: [{
|
|
2834
|
+
type: 'outlined',
|
|
2835
|
+
onClick: function onClick() {
|
|
2836
|
+
window.history.back();
|
|
2837
|
+
},
|
|
2838
|
+
text: "Back to Maintenance"
|
|
2839
|
+
}]
|
|
2840
|
+
});
|
|
2924
2841
|
}
|
|
2925
2842
|
}, {
|
|
2926
|
-
key: "
|
|
2927
|
-
value: function
|
|
2928
|
-
if (___default['default'].isEmpty(this.state.
|
|
2929
|
-
|
|
2843
|
+
key: "validateForm",
|
|
2844
|
+
value: function validateForm() {
|
|
2845
|
+
if (___default['default'].isEmpty(this.state.userName)) return false;
|
|
2846
|
+
if (___default['default'].isEmpty(this.state.room)) return false;
|
|
2847
|
+
if (___default['default'].isEmpty(this.state.title)) return false;
|
|
2848
|
+
if (this.state.isHome && ___default['default'].isEmpty(this.state.homeText)) return false;
|
|
2849
|
+
return true;
|
|
2930
2850
|
}
|
|
2931
2851
|
}, {
|
|
2932
|
-
key: "
|
|
2933
|
-
value: function
|
|
2934
|
-
var
|
|
2935
|
-
|
|
2936
|
-
var _this$state3 = this.state,
|
|
2937
|
-
jobList = _this$state3.jobList,
|
|
2938
|
-
loading = _this$state3.loading;
|
|
2852
|
+
key: "renderSubmit",
|
|
2853
|
+
value: function renderSubmit() {
|
|
2854
|
+
var _this3 = this;
|
|
2939
2855
|
|
|
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
|
-
})));
|
|
2856
|
+
if (this.state.updating) {
|
|
2857
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2858
|
+
buttonType: "secondary"
|
|
2859
|
+
}, "Saving...");
|
|
2957
2860
|
}
|
|
2958
2861
|
|
|
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, {
|
|
2862
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2863
|
+
inline: true,
|
|
2864
|
+
buttonType: "tertiary",
|
|
2966
2865
|
onClick: function onClick() {
|
|
2967
|
-
return
|
|
2866
|
+
return _this3.props.history.push('/requestsHub');
|
|
2968
2867
|
},
|
|
2969
|
-
|
|
2970
|
-
|
|
2868
|
+
isActive: true,
|
|
2869
|
+
style: {
|
|
2870
|
+
marginRight: 16
|
|
2871
|
+
}
|
|
2872
|
+
}, "Cancel"), /*#__PURE__*/React__default['default'].createElement(Components.Button, {
|
|
2873
|
+
inline: true,
|
|
2874
|
+
buttonType: "primary",
|
|
2875
|
+
onClick: this.onSave,
|
|
2876
|
+
isActive: this.validateForm()
|
|
2877
|
+
}, "Save"));
|
|
2971
2878
|
}
|
|
2972
2879
|
}, {
|
|
2973
|
-
key: "
|
|
2974
|
-
value: function
|
|
2975
|
-
var
|
|
2880
|
+
key: "renderMain",
|
|
2881
|
+
value: function renderMain() {
|
|
2882
|
+
var _this4 = this;
|
|
2976
2883
|
|
|
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",
|
|
2884
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2885
|
+
style: {
|
|
2886
|
+
marginBottom: 15
|
|
2887
|
+
}
|
|
2888
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2889
|
+
className: "padding-60 paddingVertical-40 bottomDivideBorder"
|
|
2890
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.Text, {
|
|
2891
|
+
type: "formTitleLarge",
|
|
2892
|
+
className: "marginBottom-24"
|
|
2893
|
+
}, this.state.infoId == null ? 'New' : 'Edit', " Request"), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2894
|
+
id: "userName",
|
|
3006
2895
|
type: "text",
|
|
3007
|
-
label: "
|
|
3008
|
-
placeholder: "
|
|
3009
|
-
value:
|
|
3010
|
-
onChange:
|
|
2896
|
+
label: "Name",
|
|
2897
|
+
placeholder: "Insert name here",
|
|
2898
|
+
value: this.state.userName,
|
|
2899
|
+
onChange: function onChange(e) {
|
|
2900
|
+
return _this4.onHandleChange(e);
|
|
2901
|
+
},
|
|
3011
2902
|
isRequired: true,
|
|
2903
|
+
alwaysShowLabel: true,
|
|
3012
2904
|
isValid: function isValid() {
|
|
3013
|
-
return !___default['default'].isEmpty(
|
|
2905
|
+
return !___default['default'].isEmpty(_this4.state.userName);
|
|
3014
2906
|
},
|
|
3015
2907
|
showError: function showError() {
|
|
3016
|
-
return showWarnings && ___default['default'].isEmpty(
|
|
2908
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.userName);
|
|
2909
|
+
}
|
|
2910
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2911
|
+
id: "room",
|
|
2912
|
+
type: "text",
|
|
2913
|
+
label: "Location",
|
|
2914
|
+
placeholder: "Insert address here",
|
|
2915
|
+
value: this.state.room,
|
|
2916
|
+
onChange: function onChange(e) {
|
|
2917
|
+
return _this4.onHandleChange(e);
|
|
3017
2918
|
},
|
|
3018
|
-
|
|
2919
|
+
isRequired: true,
|
|
2920
|
+
alwaysShowLabel: true,
|
|
2921
|
+
isValid: function isValid() {
|
|
2922
|
+
return !___default['default'].isEmpty(_this4.state.room);
|
|
2923
|
+
},
|
|
2924
|
+
showError: function showError() {
|
|
2925
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.room);
|
|
2926
|
+
}
|
|
3019
2927
|
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3020
|
-
id: "
|
|
2928
|
+
id: "phone",
|
|
3021
2929
|
type: "text",
|
|
3022
|
-
label: "
|
|
3023
|
-
placeholder: "
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
onChange:
|
|
2930
|
+
label: "Contact number",
|
|
2931
|
+
placeholder: "04XX XXX XXX",
|
|
2932
|
+
value: this.state.phone // showError={this.state.showWarnings && !this.validateImage()}
|
|
2933
|
+
,
|
|
2934
|
+
onChange: function onChange(e) {
|
|
2935
|
+
return _this4.onHandleChange(e);
|
|
2936
|
+
},
|
|
2937
|
+
alwaysShowLabel: true
|
|
2938
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2939
|
+
style: {
|
|
2940
|
+
marginBottom: 15
|
|
2941
|
+
}
|
|
2942
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.Text, {
|
|
2943
|
+
type: "formLabel"
|
|
2944
|
+
}, "Job Type"), /*#__PURE__*/React__default['default'].createElement(reactBootstrap.DropdownButton, {
|
|
2945
|
+
style: {
|
|
2946
|
+
minWidth: 80
|
|
2947
|
+
},
|
|
2948
|
+
bsStyle: "default",
|
|
2949
|
+
title: this.state.type,
|
|
2950
|
+
id: "typeSelect",
|
|
2951
|
+
onSelect: this.onSelectType
|
|
2952
|
+
}, this.renderTypeOptions())), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
2953
|
+
id: "title",
|
|
2954
|
+
label: "Title for the work required",
|
|
2955
|
+
type: "textarea",
|
|
2956
|
+
placeholder: "Title for the work required",
|
|
2957
|
+
value: this.state.title,
|
|
2958
|
+
onChange: function onChange(e) {
|
|
2959
|
+
return _this4.onHandleChange(e);
|
|
2960
|
+
},
|
|
2961
|
+
inputStyle: {
|
|
2962
|
+
height: 80
|
|
2963
|
+
},
|
|
3027
2964
|
isRequired: true,
|
|
3028
|
-
isValid:
|
|
2965
|
+
isValid: function isValid() {
|
|
2966
|
+
return !___default['default'].isEmpty(_this4.state.title);
|
|
2967
|
+
},
|
|
3029
2968
|
showError: function showError() {
|
|
3030
|
-
return showWarnings &&
|
|
2969
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.title);
|
|
3031
2970
|
},
|
|
3032
2971
|
alwaysShowLabel: true
|
|
3033
2972
|
}), /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3034
|
-
id: "
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
placeholder: "
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
2973
|
+
id: "description",
|
|
2974
|
+
label: "Description of work required",
|
|
2975
|
+
type: "textarea",
|
|
2976
|
+
placeholder: "Description of work required",
|
|
2977
|
+
value: this.state.description,
|
|
2978
|
+
onChange: function onChange(e) {
|
|
2979
|
+
return _this4.onHandleChange(e);
|
|
2980
|
+
},
|
|
2981
|
+
inputStyle: {
|
|
2982
|
+
height: 80
|
|
2983
|
+
},
|
|
2984
|
+
alwaysShowLabel: true
|
|
2985
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components.RadioButton, {
|
|
2986
|
+
label: "Person must be home during work?",
|
|
2987
|
+
isActive: this.state.isHome,
|
|
2988
|
+
options: [{
|
|
2989
|
+
Label: 'No',
|
|
2990
|
+
Value: false,
|
|
2991
|
+
onChange: function onChange() {
|
|
2992
|
+
return _this4.setState({
|
|
2993
|
+
isHome: false
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
}, {
|
|
2997
|
+
Label: 'Yes',
|
|
2998
|
+
Value: true,
|
|
2999
|
+
onChange: function onChange() {
|
|
3000
|
+
return _this4.setState({
|
|
3001
|
+
isHome: true
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
}]
|
|
3005
|
+
}), this.state.isHome && /*#__PURE__*/React__default['default'].createElement(Components.GenericInput, {
|
|
3006
|
+
style: {
|
|
3007
|
+
marginTop: 16
|
|
3008
|
+
},
|
|
3009
|
+
label: "Description of person's available times",
|
|
3010
|
+
id: "homeText",
|
|
3011
|
+
type: "textarea",
|
|
3012
|
+
placeholder: "Description of person's available times",
|
|
3013
|
+
value: this.state.homeText,
|
|
3014
|
+
onChange: function onChange(e) {
|
|
3015
|
+
return _this4.onHandleChange(e);
|
|
3016
|
+
},
|
|
3017
|
+
inputStyle: {
|
|
3018
|
+
height: 80
|
|
3019
|
+
},
|
|
3041
3020
|
isRequired: true,
|
|
3042
3021
|
isValid: function isValid() {
|
|
3043
|
-
return !___default['default'].isEmpty(
|
|
3022
|
+
return !___default['default'].isEmpty(_this4.state.homeText);
|
|
3044
3023
|
},
|
|
3045
3024
|
showError: function showError() {
|
|
3046
|
-
return showWarnings && ___default['default'].isEmpty(
|
|
3025
|
+
return _this4.state.showWarnings && ___default['default'].isEmpty(_this4.state.homeText);
|
|
3047
3026
|
},
|
|
3048
3027
|
alwaysShowLabel: true
|
|
3049
|
-
}));
|
|
3028
|
+
})));
|
|
3050
3029
|
}
|
|
3051
3030
|
}, {
|
|
3052
3031
|
key: "render",
|
|
3053
3032
|
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
|
-
})));
|
|
3033
|
+
var success = this.state.success;
|
|
3034
|
+
return /*#__PURE__*/React__default['default'].createElement(Components.OverlayPage, null, /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageContents, {
|
|
3035
|
+
noBottomButtons: success
|
|
3036
|
+
}, /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageSection, {
|
|
3037
|
+
className: "pageSectionWrapper--newPopup"
|
|
3038
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", null, this.renderSuccess(), !success && this.renderMain()))), /*#__PURE__*/React__default['default'].createElement(Components.OverlayPageBottomButtons, null, this.renderSubmit()));
|
|
3066
3039
|
}
|
|
3067
3040
|
}]);
|
|
3068
3041
|
|
|
3069
|
-
return
|
|
3042
|
+
return AddJob;
|
|
3070
3043
|
}(React.Component);
|
|
3071
3044
|
|
|
3072
3045
|
var mapStateToProps = function mapStateToProps(state) {
|
|
3073
|
-
var jobtypes = state.maintenance.jobtypes;
|
|
3074
3046
|
var auth = state.auth;
|
|
3075
3047
|
return {
|
|
3076
|
-
jobtypes: jobtypes,
|
|
3077
3048
|
auth: auth
|
|
3078
3049
|
};
|
|
3079
3050
|
};
|
|
3080
3051
|
|
|
3081
|
-
var
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3052
|
+
var AddJob$1 = reactRedux.connect(mapStateToProps, {
|
|
3053
|
+
jobsUpdate: jobsUpdate,
|
|
3054
|
+
jobsLoaded: jobsLoaded,
|
|
3055
|
+
addRecentlyCreated: Actions.addRecentlyCreated
|
|
3056
|
+
})(reactRouter.withRouter(AddJob));
|
|
3085
3057
|
|
|
3086
3058
|
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
3087
3059
|
|
|
@@ -3476,8 +3448,7 @@ var Reducers = {
|
|
|
3476
3448
|
var Screens = {
|
|
3477
3449
|
RequestsHub: RequestsHub$1,
|
|
3478
3450
|
Job: Job$1,
|
|
3479
|
-
AddJob: AddJob$1
|
|
3480
|
-
JobTypes: JobTypes$1
|
|
3451
|
+
AddJob: AddJob$1
|
|
3481
3452
|
};
|
|
3482
3453
|
|
|
3483
3454
|
exports.ActivityText = ActivityText;
|