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