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