diff --git a/js/admin.min.js b/js/admin.min.js index d25304f..b69537a 100644 --- a/js/admin.min.js +++ b/js/admin.min.js @@ -7723,7 +7723,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return EditUser; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var _elements_alert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../elements/alert */ \"./src/elements/alert.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _include_select2_min_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../include/select2.min.css */ \"./src/include/select2.min.css\");\n/* harmony import */ var _include_select2_min_css__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_include_select2_min_css__WEBPACK_IMPORTED_MODULE_4__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(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; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar EditUser = /*#__PURE__*/function (_React$Component) {\n _inherits(EditUser, _React$Component);\n\n var _super = _createSuper(EditUser);\n\n function EditUser(props) {\n var _this;\n\n _classCallCheck(this, EditUser);\n\n _this = _super.call(this, props);\n _this.parent = {\n api: props.api\n };\n _this.state = {\n user: {},\n alerts: [],\n fetchError: null,\n loaded: false,\n isSaving: false,\n groups: {},\n searchString: \"\",\n searchActive: false\n };\n _this.searchBox = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createRef\"]();\n return _this;\n }\n\n _createClass(EditUser, [{\n key: \"removeAlert\",\n value: function removeAlert(i) {\n if (i >= 0 && i < this.state.alerts.length) {\n var alerts = this.state.alerts.slice();\n alerts.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n alerts: alerts\n }));\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.parent.api.getUser(this.props.match.params[\"userId\"]).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n user: _objectSpread(_objectSpread({}, res.user), {}, {\n password: \"\"\n })\n }));\n\n _this2.parent.api.fetchGroups(1, 50).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n groups: res.groups,\n loaded: true\n }));\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n fetchError: res.msg,\n loaded: true\n }));\n }\n });\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n fetchError: res.msg,\n loaded: true\n }));\n }\n });\n }\n }, {\n key: \"onChangeInput\",\n value: function onChangeInput(event) {\n var target = event.target;\n var value = target.value;\n var name = target.name;\n\n if (name === \"search\") {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n searchString: value\n }));\n } else {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, _defineProperty({}, name, value))\n }));\n }\n }\n }, {\n key: \"onToggleSearch\",\n value: function onToggleSearch(e) {\n e.stopPropagation();\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n searchActive: !this.state.searchActive\n }));\n this.searchBox.current.focus();\n }\n }, {\n key: \"onSubmitForm\",\n value: function onSubmitForm(event) {\n var _this3 = this;\n\n event.preventDefault();\n event.stopPropagation();\n var id = this.props.match.params[\"userId\"];\n var username = this.state.user[\"name\"];\n var email = this.state.user[\"email\"];\n var password = this.state.user[\"password\"].length > 0 ? this.state.user[\"password\"] : null;\n var groups = Object.keys(this.state.user.groups);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n isSaving: true\n }));\n this.parent.api.editUser(id, username, email, password, groups).then(function (res) {\n var alerts = _this3.state.alerts.slice();\n\n if (res.success) {\n alerts.push({\n title: \"Success\",\n message: \"User was successfully updated.\",\n type: \"success\"\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n isSaving: false,\n alerts: alerts,\n user: _objectSpread(_objectSpread({}, _this3.state.user), {}, {\n password: \"\"\n })\n }));\n } else {\n alerts.push({\n title: \"Error updating user\",\n message: res.msg,\n type: \"danger\"\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n isSaving: false,\n alerts: alerts,\n user: _objectSpread(_objectSpread({}, _this3.state.user), {}, {\n password: \"\"\n })\n }));\n }\n });\n }\n }, {\n key: \"onRemoveGroup\",\n value: function onRemoveGroup(event, groupId) {\n event.stopPropagation();\n\n if (this.state.user.groups.hasOwnProperty(groupId)) {\n var groups = _objectSpread({}, this.state.user.groups);\n\n delete groups[groupId];\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, {\n groups: groups\n })\n }));\n }\n }\n }, {\n key: \"onAddGroup\",\n value: function onAddGroup(event, groupId) {\n event.stopPropagation();\n\n if (!this.state.user.groups.hasOwnProperty(groupId)) {\n var groups = _objectSpread(_objectSpread({}, this.state.user.groups), {}, _defineProperty({}, groupId, _objectSpread({}, this.state.groups[groupId])));\n\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, {\n groups: groups\n }),\n searchActive: false,\n searchString: \"\"\n }));\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h2\", {\n className: \"text-center\"\n }, \"Loading\\u2026\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"br\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"spinner\",\n className: \"mt-3 text-muted fa-2x\"\n }));\n }\n\n var alerts = [];\n var form = null;\n\n if (this.state.fetchError) {\n alerts.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n key: \"error-fetch\",\n title: \"Error fetching data\",\n type: \"danger\",\n message: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", null, this.state.fetchError, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"br\", null), \"You can meanwhile return to the\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\"\n }, \"user overview\"))\n }));\n } else {\n var _loop = function _loop(i) {\n alerts.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_2__[\"default\"], _extends({\n key: \"error-\" + i,\n onClose: function onClose() {\n return _this4.removeAlert(i);\n }\n }, _this4.state.alerts[i])));\n };\n\n for (var i = 0; i < this.state.alerts.length; i++) {\n _loop(i);\n }\n\n var possibleOptions = [];\n var renderedOptions = [];\n\n var _loop2 = function _loop2(groupId) {\n if (_this4.state.groups.hasOwnProperty(groupId)) {\n var groupName = _this4.state.groups[groupId].name;\n var groupColor = _this4.state.groups[groupId].color;\n\n if (_this4.state.user.groups.hasOwnProperty(groupId)) {\n renderedOptions.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-selection__choice\",\n key: \"group-\" + groupId,\n title: groupName,\n style: {\n backgroundColor: groupColor\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-selection__choice__remove\",\n role: \"presentation\",\n onClick: function onClick(e) {\n return _this4.onRemoveGroup(e, groupId);\n }\n }, \"\\xD7\"), groupName));\n } else {\n if (_this4.state.searchString.length === 0 || groupName.toLowerCase().includes(_this4.state.searchString.toLowerCase())) {\n possibleOptions.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-results__option\",\n role: \"option\",\n key: \"group-\" + groupId,\n \"aria-selected\": false,\n onClick: function onClick(e) {\n return _this4.onAddGroup(e, groupId);\n }\n }, groupName));\n }\n }\n }\n };\n\n for (var groupId in this.state.groups) {\n _loop2(groupId);\n }\n\n var searchWidth = \"100%\";\n var placeholder = \"Select Groups\";\n var searchVisible = this.state.searchString.length > 0 || this.state.searchActive ? \"block\" : \"none\";\n\n if (renderedOptions.length > 0) {\n searchWidth = 0.75 + this.state.searchString.length * 0.75 + \"em\";\n placeholder = \"\";\n }\n\n form = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"form\", {\n role: \"form\",\n onSubmit: this.onSubmitForm.bind(this)\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"username\"\n }, \"Username\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"text\",\n className: \"form-control\",\n placeholder: \"Enter username\",\n name: \"username\",\n id: \"username\",\n maxLength: 32,\n value: this.state.user.name,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"email\"\n }, \"E-Mail\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"email\",\n className: \"form-control\",\n placeholder: \"E-Mail address\",\n id: \"email\",\n name: \"email\",\n maxLength: 64,\n value: this.state.user.email,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"password\"\n }, \"Password\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"password\",\n className: \"form-control\",\n placeholder: \"(unchanged)\",\n id: \"password\",\n name: \"password\",\n value: this.state.user.password,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group position-relative\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", null, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2 select2-container select2-container--default select2-container--below\",\n dir: \"ltr\",\n style: {\n width: \"100%\"\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"selection\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-selection select2-selection--multiple\",\n role: \"combobox\",\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": false,\n \"aria-disabled\": false,\n onClick: this.onToggleSearch.bind(this)\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"select2-selection__rendered\"\n }, renderedOptions, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-search select2-search--inline\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n className: \"select2-search__field\",\n type: \"search\",\n tabIndex: 0,\n autoComplete: \"off\",\n autoCorrect: \"off\",\n autoCapitalize: \"none\",\n spellCheck: false,\n role: \"searchbox\",\n \"aria-autocomplete\": \"list\",\n placeholder: placeholder,\n name: \"search\",\n style: {\n width: searchWidth\n },\n value: this.state.searchString,\n onChange: this.onChangeInput.bind(this),\n ref: this.searchBox\n }))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"dropdown-wrapper\",\n \"aria-hidden\": \"true\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-container select2-container--default select2-container--open\",\n style: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n width: \"100%\",\n display: searchVisible\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-dropdown select2-dropdown--below\",\n dir: \"ltr\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-results\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"select2-results__options\",\n role: \"listbox\",\n \"aria-multiselectable\": true,\n \"aria-expanded\": true,\n \"aria-hidden\": false\n }, possibleOptions))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\",\n className: \"btn btn-info mt-2 mr-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"arrow-left\"\n }), \"\\xA0Back\"), this.state.isSaving ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"button\", {\n type: \"submit\",\n className: \"btn btn-primary mt-2\",\n disabled: true\n }, \"Saving\\u2026\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"circle-notch\"\n })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"button\", {\n type: \"submit\",\n className: \"btn btn-primary mt-2\"\n }, \"Save\"));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Edit User\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\"\n }, \"Users\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Add User\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6 pl-5 pr-5\"\n }, alerts, form))));\n }\n }]);\n\n return EditUser;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/edituser.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return EditUser; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var _elements_alert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../elements/alert */ \"./src/elements/alert.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _include_select2_min_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../include/select2.min.css */ \"./src/include/select2.min.css\");\n/* harmony import */ var _include_select2_min_css__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_include_select2_min_css__WEBPACK_IMPORTED_MODULE_4__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(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; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar EditUser = /*#__PURE__*/function (_React$Component) {\n _inherits(EditUser, _React$Component);\n\n var _super = _createSuper(EditUser);\n\n function EditUser(props) {\n var _this;\n\n _classCallCheck(this, EditUser);\n\n _this = _super.call(this, props);\n _this.parent = {\n api: props.api\n };\n _this.state = {\n user: {},\n alerts: [],\n fetchError: null,\n loaded: false,\n isSaving: false,\n groups: {},\n searchString: \"\",\n searchActive: false\n };\n _this.searchBox = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createRef\"]();\n return _this;\n }\n\n _createClass(EditUser, [{\n key: \"removeAlert\",\n value: function removeAlert(i) {\n if (i >= 0 && i < this.state.alerts.length) {\n var alerts = this.state.alerts.slice();\n alerts.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n alerts: alerts\n }));\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.parent.api.getUser(this.props.match.params[\"userId\"]).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n user: _objectSpread(_objectSpread({}, res.user), {}, {\n password: \"\"\n })\n }));\n\n _this2.parent.api.fetchGroups(1, 50).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n groups: res.groups,\n loaded: true\n }));\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n fetchError: res.msg,\n loaded: true\n }));\n }\n });\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n fetchError: res.msg,\n loaded: true\n }));\n }\n });\n }\n }, {\n key: \"onChangeInput\",\n value: function onChangeInput(event) {\n var target = event.target;\n var value = target.value;\n var name = target.name;\n\n if (name === \"search\") {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n searchString: value\n }));\n } else {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, _defineProperty({}, name, value))\n }));\n }\n }\n }, {\n key: \"onToggleSearch\",\n value: function onToggleSearch(e) {\n e.stopPropagation();\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n searchActive: !this.state.searchActive\n }));\n this.searchBox.current.focus();\n }\n }, {\n key: \"onSubmitForm\",\n value: function onSubmitForm(event) {\n var _this3 = this;\n\n event.preventDefault();\n event.stopPropagation();\n var id = this.props.match.params[\"userId\"];\n var username = this.state.user[\"name\"];\n var email = this.state.user[\"email\"];\n var password = this.state.user[\"password\"].length > 0 ? this.state.user[\"password\"] : null;\n var groups = Object.keys(this.state.user.groups);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n isSaving: true\n }));\n this.parent.api.editUser(id, username, email, password, groups).then(function (res) {\n var alerts = _this3.state.alerts.slice();\n\n if (res.success) {\n alerts.push({\n title: \"Success\",\n message: \"User was successfully updated.\",\n type: \"success\"\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n isSaving: false,\n alerts: alerts,\n user: _objectSpread(_objectSpread({}, _this3.state.user), {}, {\n password: \"\"\n })\n }));\n } else {\n alerts.push({\n title: \"Error updating user\",\n message: res.msg,\n type: \"danger\"\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n isSaving: false,\n alerts: alerts,\n user: _objectSpread(_objectSpread({}, _this3.state.user), {}, {\n password: \"\"\n })\n }));\n }\n });\n }\n }, {\n key: \"onRemoveGroup\",\n value: function onRemoveGroup(event, groupId) {\n event.stopPropagation();\n\n if (this.state.user.groups.hasOwnProperty(groupId)) {\n var groups = _objectSpread({}, this.state.user.groups);\n\n delete groups[groupId];\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, {\n groups: groups\n })\n }));\n }\n }\n }, {\n key: \"onAddGroup\",\n value: function onAddGroup(event, groupId) {\n event.stopPropagation();\n\n if (!this.state.user.groups.hasOwnProperty(groupId)) {\n var groups = _objectSpread(_objectSpread({}, this.state.user.groups), {}, _defineProperty({}, groupId, _objectSpread({}, this.state.groups[groupId])));\n\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n user: _objectSpread(_objectSpread({}, this.state.user), {}, {\n groups: groups\n }),\n searchActive: false,\n searchString: \"\"\n }));\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h2\", {\n className: \"text-center\"\n }, \"Loading\\u2026\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"br\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"spinner\",\n className: \"mt-3 text-muted fa-2x\"\n }));\n }\n\n var alerts = [];\n var form = null;\n\n if (this.state.fetchError) {\n alerts.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n key: \"error-fetch\",\n title: \"Error fetching data\",\n type: \"danger\",\n message: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", null, this.state.fetchError, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"br\", null), \"You can meanwhile return to the\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\"\n }, \"user overview\"))\n }));\n } else {\n var _loop = function _loop(i) {\n alerts.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_2__[\"default\"], _extends({\n key: \"error-\" + i,\n onClose: function onClose() {\n return _this4.removeAlert(i);\n }\n }, _this4.state.alerts[i])));\n };\n\n for (var i = 0; i < this.state.alerts.length; i++) {\n _loop(i);\n }\n\n var possibleOptions = [];\n var renderedOptions = [];\n\n var _loop2 = function _loop2(groupId) {\n if (_this4.state.groups.hasOwnProperty(groupId)) {\n var groupName = _this4.state.groups[groupId].name;\n var groupColor = _this4.state.groups[groupId].color;\n\n if (_this4.state.user.groups.hasOwnProperty(groupId)) {\n renderedOptions.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-selection__choice\",\n key: \"group-\" + groupId,\n title: groupName,\n style: {\n backgroundColor: groupColor\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-selection__choice__remove\",\n role: \"presentation\",\n onClick: function onClick(e) {\n return _this4.onRemoveGroup(e, groupId);\n }\n }, \"\\xD7\"), groupName));\n } else {\n if (_this4.state.searchString.length === 0 || groupName.toLowerCase().includes(_this4.state.searchString.toLowerCase())) {\n possibleOptions.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-results__option\",\n role: \"option\",\n key: \"group-\" + groupId,\n \"aria-selected\": false,\n onClick: function onClick(e) {\n return _this4.onAddGroup(e, groupId);\n }\n }, groupName));\n }\n }\n }\n };\n\n for (var groupId in this.state.groups) {\n _loop2(groupId);\n }\n\n var searchWidth = \"100%\";\n var placeholder = \"Select Groups\";\n var searchVisible = this.state.searchString.length > 0 || this.state.searchActive ? \"block\" : \"none\";\n\n if (renderedOptions.length > 0) {\n searchWidth = 0.75 + this.state.searchString.length * 0.75 + \"em\";\n placeholder = \"\";\n }\n\n if (this.state.searchString.length > 0 && possibleOptions.length === 0) {\n possibleOptions.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-results__option\",\n role: \"option\",\n key: \"group-notfound\",\n \"aria-selected\": true\n }, \"Group not found\"));\n }\n\n form = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"form\", {\n role: \"form\",\n onSubmit: this.onSubmitForm.bind(this)\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"username\"\n }, \"Username\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"text\",\n className: \"form-control\",\n placeholder: \"Enter username\",\n name: \"username\",\n id: \"username\",\n maxLength: 32,\n value: this.state.user.name,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"email\"\n }, \"E-Mail\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"email\",\n className: \"form-control\",\n placeholder: \"E-Mail address\",\n id: \"email\",\n name: \"email\",\n maxLength: 64,\n value: this.state.user.email,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", {\n htmlFor: \"password\"\n }, \"Password\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n type: \"password\",\n className: \"form-control\",\n placeholder: \"(unchanged)\",\n id: \"password\",\n name: \"password\",\n value: this.state.user.password,\n onChange: this.onChangeInput.bind(this)\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"form-group position-relative\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"label\", null, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2 select2-container select2-container--default select2-container--below\",\n dir: \"ltr\",\n style: {\n width: \"100%\"\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"selection\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-selection select2-selection--multiple\",\n role: \"combobox\",\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": false,\n \"aria-disabled\": false,\n onClick: this.onToggleSearch.bind(this)\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"select2-selection__rendered\"\n }, renderedOptions, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"select2-search select2-search--inline\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"input\", {\n className: \"select2-search__field\",\n type: \"search\",\n tabIndex: 0,\n autoComplete: \"off\",\n autoCorrect: \"off\",\n autoCapitalize: \"none\",\n spellCheck: false,\n role: \"searchbox\",\n \"aria-autocomplete\": \"list\",\n placeholder: placeholder,\n name: \"search\",\n style: {\n width: searchWidth\n },\n value: this.state.searchString,\n onChange: this.onChangeInput.bind(this),\n ref: this.searchBox\n }))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"dropdown-wrapper\",\n \"aria-hidden\": \"true\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-container select2-container--default select2-container--open\",\n style: {\n position: \"absolute\",\n bottom: 0,\n left: 0,\n width: \"100%\",\n display: searchVisible\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-dropdown select2-dropdown--below\",\n dir: \"ltr\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"select2-results\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"select2-results__options\",\n role: \"listbox\",\n \"aria-multiselectable\": true,\n \"aria-expanded\": true,\n \"aria-hidden\": false\n }, possibleOptions))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\",\n className: \"btn btn-info mt-2 mr-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"arrow-left\"\n }), \"\\xA0Back\"), this.state.isSaving ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"button\", {\n type: \"submit\",\n className: \"btn btn-primary mt-2\",\n disabled: true\n }, \"Saving\\u2026\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"circle-notch\"\n })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"button\", {\n type: \"submit\",\n className: \"btn btn-primary mt-2\"\n }, \"Save\"));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Edit User\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_3__[\"Link\"], {\n to: \"/admin/users\"\n }, \"Users\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Add User\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6 pl-5 pr-5\"\n }, alerts, form))));\n }\n }]);\n\n return EditUser;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/edituser.js?"); /***/ }), diff --git a/src/src/views/edituser.js b/src/src/views/edituser.js index 3aa418f..4973b20 100644 --- a/src/src/views/edituser.js +++ b/src/src/views/edituser.js @@ -170,6 +170,14 @@ export default class EditUser extends React.Component { placeholder = ""; } + if (this.state.searchString.length > 0 && possibleOptions.length === 0) { + possibleOptions.push( +