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