From cb25d2a919b2a675efb96656c29f66f8cbaa3454 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 7 Aug 2019 15:21:16 -0400 Subject: [PATCH] returning data from the ajax models to the react views. working on the redux store reducers and dispatch functions --- dist/js/glma-app-notifications.js | 32 +++-- js/components/Controller.jsx | 3 +- js/components/HOC/ListHOC.jsx | 2 +- js/components/container/Dashboard.jsx | 2 +- js/components/container/NewNotification.jsx | 127 ++++++++++++------ js/init.js | 6 +- js/store/actions/types.js | 3 +- js/store/actions/updateNewNotificationData.js | 13 +- js/store/reducers/newNotificationReducer.js | 37 ++--- models/admin/ajax/data_requests.php | 40 +++++- .../{init => appNotifications}/index.php | 52 ++++++- setup/adminMenus.php | 8 +- .../create_database_V0.0.1.sql | 4 +- setup/validActions.php | 2 +- views/admin/appNotifications/index.html | 3 + views/admin/init/index.html | 1 - 16 files changed, 247 insertions(+), 88 deletions(-) rename models/admin/{init => appNotifications}/index.php (61%) create mode 100755 views/admin/appNotifications/index.html delete mode 100755 views/admin/init/index.html diff --git a/dist/js/glma-app-notifications.js b/dist/js/glma-app-notifications.js index 9190085..d6109e5 100644 --- a/dist/js/glma-app-notifications.js +++ b/dist/js/glma-app-notifications.js @@ -118,7 +118,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _sto /***/ (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 Controller; });\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _container_DashboardContainer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./container/DashboardContainer */ \"./js/components/container/DashboardContainer.jsx\");\n/* harmony import */ var _container_NotificationList__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./container/NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Paper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Paper */ \"./node_modules/@material-ui/core/esm/Paper/index.js\");\n/* harmony import */ var _material_ui_core_Typography__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/Typography */ \"./node_modules/@material-ui/core/esm/Typography/index.js\");\n/* harmony import */ var _container_App__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./container/App */ \"./js/components/container/App.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Controller() {\n /*\n useState takes a value that is passed to arg1 by default\n useState has a state update method that is arg2 that acts like setState\n arg1 : title === this.state.title\n arg2 : updateTitle === this.setState({title: val})\n */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])('WP Kiosk'),\n _useState2 = _slicedToArray(_useState, 2),\n title = _useState2[0],\n updateTitle = _useState2[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n // on component mount logic here\n\n /* Run cleanup() when the component unmountse */\n return function cleanup() {// clean up logic here\n };\n });\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"Provider\"], {\n store: _store_index__WEBPACK_IMPORTED_MODULE_3__[\"store\"]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"MemoryRouter\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_container_App__WEBPACK_IMPORTED_MODULE_10__[\"default\"], null)));\n}\n\n//# sourceURL=webpack:///./js/components/Controller.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Controller; });\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _container_DashboardContainer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./container/DashboardContainer */ \"./js/components/container/DashboardContainer.jsx\");\n/* harmony import */ var _container_NotificationList__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./container/NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Paper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Paper */ \"./node_modules/@material-ui/core/esm/Paper/index.js\");\n/* harmony import */ var _material_ui_core_Typography__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/Typography */ \"./node_modules/@material-ui/core/esm/Typography/index.js\");\n/* harmony import */ var _container_App__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./container/App */ \"./js/components/container/App.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Controller(props) {\n /*\n useState takes a value that is passed to arg1 by default\n useState has a state update method that is arg2 that acts like setState\n arg1 : title === this.state.title\n arg2 : updateTitle === this.setState({title: val})\n */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])('WP Kiosk'),\n _useState2 = _slicedToArray(_useState, 2),\n title = _useState2[0],\n updateTitle = _useState2[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n console.log(props); // on component mount logic here\n\n /* Run cleanup() when the component unmountse */\n\n return function cleanup() {// clean up logic here\n };\n });\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"Provider\"], {\n store: _store_index__WEBPACK_IMPORTED_MODULE_3__[\"store\"]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"MemoryRouter\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_container_App__WEBPACK_IMPORTED_MODULE_10__[\"default\"], null)));\n}\n\n//# sourceURL=webpack:///./js/components/Controller.jsx?"); /***/ }), @@ -130,7 +130,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 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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material-ui/core/ListItem */ \"./node_modules/@material-ui/core/esm/ListItem/index.js\");\n/* harmony import */ var _material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/ListItemIcon */ \"./node_modules/@material-ui/core/esm/ListItemIcon/index.js\");\n/* harmony import */ var _material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/ListItemText */ \"./node_modules/@material-ui/core/esm/ListItemText/index.js\");\n/* harmony import */ var _material_ui_core_Collapse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Collapse */ \"./node_modules/@material-ui/core/esm/Collapse/index.js\");\n/* harmony import */ var _material_ui_core_List__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/List */ \"./node_modules/@material-ui/core/esm/List/index.js\");\n/* harmony import */ var _Manifests__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Manifests */ \"./js/Manifests.js\");\n/* harmony import */ var _container_NotificationList__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../container/NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _container_NewNotification__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../container/NewNotification */ \"./js/components/container/NewNotification.jsx\");\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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar ListHOC = function ListHOC(props) {\n var Icon = props.icon; // const classes = useStyles();\n\n var _React$useState = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n open = _React$useState2[0],\n setOpen = _React$useState2[1];\n\n var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState(false),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n redirect = _React$useState4[0],\n setRedirect = _React$useState4[1];\n\n var _React$useState5 = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState('Dashboard'),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n route = _React$useState6[0],\n setRoute = _React$useState6[1];\n\n function handleClick() {\n setOpen(!open);\n }\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n setRoute(props.location.pathname.substring(1));\n console.log(route);\n });\n\n function changeRoute(e) {\n var route = e.currentTarget.dataset.listitem;\n setRedirect(true);\n setRoute(route);\n }\n\n var activeClass = route === props.route ? \"active-link\" : \"inactive-link\";\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, props.nested ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true,\n component: function component(props) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Link, _extends({\n to: \"/\".concat(route)\n }, props));\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(InboxIcon, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: props.text\n }), open ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ExpandLess, null) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ExpandMore, null)), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Collapse__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"in\": open,\n timeout: \"auto\",\n unmountOnExit: true\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_List__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n component: \"div\",\n disablePadding: true\n }, _Manifests__WEBPACK_IMPORTED_MODULE_10__[\"Manifests\"].Categories.map(function (listItem) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(StarBorder, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: listItem\n }));\n })))) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true,\n component: function component(props) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"NavLink\"], props);\n },\n onClick: function onClick(e) {\n return changeRoute(e);\n },\n to: \"/\".concat(props.route),\n \"data-listitem\": props.route,\n className: [activeClass]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Icon, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: props.text\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"withRouter\"])(Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(null, null)(ListHOC)));\n\n//# sourceURL=webpack:///./js/components/HOC/ListHOC.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material-ui/core/ListItem */ \"./node_modules/@material-ui/core/esm/ListItem/index.js\");\n/* harmony import */ var _material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/ListItemIcon */ \"./node_modules/@material-ui/core/esm/ListItemIcon/index.js\");\n/* harmony import */ var _material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/ListItemText */ \"./node_modules/@material-ui/core/esm/ListItemText/index.js\");\n/* harmony import */ var _material_ui_core_Collapse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Collapse */ \"./node_modules/@material-ui/core/esm/Collapse/index.js\");\n/* harmony import */ var _material_ui_core_List__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/List */ \"./node_modules/@material-ui/core/esm/List/index.js\");\n/* harmony import */ var _Manifests__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Manifests */ \"./js/Manifests.js\");\n/* harmony import */ var _container_NotificationList__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../container/NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _container_NewNotification__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../container/NewNotification */ \"./js/components/container/NewNotification.jsx\");\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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar ListHOC = function ListHOC(props) {\n var Icon = props.icon; // const classes = useStyles();\n\n var _React$useState = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n open = _React$useState2[0],\n setOpen = _React$useState2[1];\n\n var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState(false),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n redirect = _React$useState4[0],\n setRedirect = _React$useState4[1];\n\n var _React$useState5 = react__WEBPACK_IMPORTED_MODULE_0___default.a.useState('Dashboard'),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n route = _React$useState6[0],\n setRoute = _React$useState6[1];\n\n function handleClick() {\n setOpen(!open);\n }\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n setRoute(props.location.pathname.substring(1));\n });\n\n function changeRoute(e) {\n var route = e.currentTarget.dataset.listitem;\n setRedirect(true);\n setRoute(route);\n }\n\n var activeClass = route === props.route ? \"active-link\" : \"inactive-link\";\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, props.nested ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true,\n component: function component(props) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Link, _extends({\n to: \"/\".concat(route)\n }, props));\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(InboxIcon, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: props.text\n }), open ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ExpandLess, null) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ExpandMore, null)), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Collapse__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"in\": open,\n timeout: \"auto\",\n unmountOnExit: true\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_List__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n component: \"div\",\n disablePadding: true\n }, _Manifests__WEBPACK_IMPORTED_MODULE_10__[\"Manifests\"].Categories.map(function (listItem) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(StarBorder, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: listItem\n }));\n })))) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItem__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n button: true,\n component: function component(props) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"NavLink\"], props);\n },\n onClick: function onClick(e) {\n return changeRoute(e);\n },\n to: \"/\".concat(props.route),\n \"data-listitem\": props.route,\n className: [activeClass]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemIcon__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Icon, {\n style: {\n color: \"white\"\n }\n })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_ListItemText__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n primary: props.text\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_router_dom__WEBPACK_IMPORTED_MODULE_4__[\"withRouter\"])(Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(null, null)(ListHOC)));\n\n//# sourceURL=webpack:///./js/components/HOC/ListHOC.jsx?"); /***/ }), @@ -154,7 +154,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _NotificationList__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Paper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/Paper */ \"./node_modules/@material-ui/core/esm/Paper/index.js\");\n/* harmony import */ var _material_ui_core_Typography__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Typography */ \"./node_modules/@material-ui/core/esm/Typography/index.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\nvar Dashboard = function Dashboard() {\n /*\n useState takes a value that is passed to arg1 by default\n useState has a state update method that is arg2 that acts like setState\n arg1 : title === this.state.title\n arg2 : updateTitle === this.setState({title: val})\n */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])('WP Kiosk'),\n _useState2 = _slicedToArray(_useState, 2),\n title = _useState2[0],\n updateTitle = _useState2[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n console.log(\"mount\");\n /* Run cleanup() when the component unmounts */\n\n return function cleanup() {\n console.log(\"clean up\");\n };\n });\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null, \"dashboard\");\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(null, null)(Dashboard));\n\n//# sourceURL=webpack:///./js/components/container/Dashboard.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.js\");\n/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../store/index */ \"./js/store/index.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _NotificationList__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NotificationList */ \"./js/components/container/NotificationList.jsx\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Paper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/Paper */ \"./node_modules/@material-ui/core/esm/Paper/index.js\");\n/* harmony import */ var _material_ui_core_Typography__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/Typography */ \"./node_modules/@material-ui/core/esm/Typography/index.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\nvar Dashboard = function Dashboard() {\n /*\n useState takes a value that is passed to arg1 by default\n useState has a state update method that is arg2 that acts like setState\n arg1 : title === this.state.title\n arg2 : updateTitle === this.setState({title: val})\n */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])('WP Kiosk'),\n _useState2 = _slicedToArray(_useState, 2),\n title = _useState2[0],\n updateTitle = _useState2[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n /* Run cleanup() when the component unmounts */\n return function cleanup() {\n console.log(\"clean up\");\n };\n });\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null, \"dashboard\");\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(null, null)(Dashboard));\n\n//# sourceURL=webpack:///./js/components/container/Dashboard.jsx?"); /***/ }), @@ -190,7 +190,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.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 _material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material-ui/core/TextField */ \"./node_modules/@material-ui/core/esm/TextField/index.js\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Input__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/Input */ \"./node_modules/@material-ui/core/esm/Input/index.js\");\n/* harmony import */ var _material_ui_core_OutlinedInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/OutlinedInput */ \"./node_modules/@material-ui/core/esm/OutlinedInput/index.js\");\n/* harmony import */ var _material_ui_core_FilledInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/FilledInput */ \"./node_modules/@material-ui/core/esm/FilledInput/index.js\");\n/* harmony import */ var _material_ui_core_InputLabel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/InputLabel */ \"./node_modules/@material-ui/core/esm/InputLabel/index.js\");\n/* harmony import */ var _material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @material-ui/core/MenuItem */ \"./node_modules/@material-ui/core/esm/MenuItem/index.js\");\n/* harmony import */ var _material_ui_core_FormHelperText__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @material-ui/core/FormHelperText */ \"./node_modules/@material-ui/core/esm/FormHelperText/index.js\");\n/* harmony import */ var _material_ui_core_FormControl__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @material-ui/core/FormControl */ \"./node_modules/@material-ui/core/esm/FormControl/index.js\");\n/* harmony import */ var _material_ui_core_Select__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @material-ui/core/Select */ \"./node_modules/@material-ui/core/esm/Select/index.js\");\n/* harmony import */ var _Util__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Util */ \"./js/Util.js\");\n/* harmony import */ var _material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @material-ui/core/Button */ \"./node_modules/@material-ui/core/esm/Button/index.js\");\n/* harmony import */ var _functional_ImageContainer__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../functional/ImageContainer */ \"./js/components/functional/ImageContainer.jsx\");\n/* harmony import */ var _store_reducers_newNotificationReducer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../store/reducers/newNotificationReducer */ \"./js/store/reducers/newNotificationReducer.js\");\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 _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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar NewNotification = function NewNotification(props) {\n var inputLabel = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useRef\"])(null);\n var classes = useStyles();\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(0),\n _useState2 = _slicedToArray(_useState, 2),\n labelWidth = _useState2[0],\n setLabelWidth = _useState2[1];\n /* Categories for each */\n\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])({\n notification_headline: '',\n notification_message: '',\n notification_image: '',\n notification_type: [''],\n notification_type_category: '',\n notification_message_status: '',\n notification_date: '',\n notification_admin_status: '',\n submissionDisabled: true,\n initDraft: false\n }),\n _useState4 = _slicedToArray(_useState3, 2),\n formValues = _useState4[0],\n setFormValues = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n _Util__WEBPACK_IMPORTED_MODULE_14__[\"default\"].MediaLibrary(); // setLabelWidth(inputLabel.current.offsetWidth);\n\n if (formValues.firstLoad) {\n setFormValues(function (oldValues) {\n return _extends({}, oldValues, {\n firstLoad: false\n });\n });\n }\n\n return function cleanup() {};\n }, []);\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n if (formValues.initDraft === true) {\n var intervalID = setInterval(function () {\n console.log(\"draft\");\n }, 3000);\n return function cleanup() {\n clearInterval(intervalID);\n };\n }\n });\n\n function handleNotificationValues(event) {\n event.persist();\n setFormValues(function (oldValues) {\n var _props$updateNewNotif;\n\n props.updateNewNotificationData((_props$updateNewNotif = {}, _defineProperty(_props$updateNewNotif, event.target.name, event.target.value), _defineProperty(_props$updateNewNotif, \"notification_message_status\", \"draft\"), _defineProperty(_props$updateNewNotif, \"initDraft\", true), _props$updateNewNotif));\n return _extends({}, oldValues, _defineProperty({\n initDraft: true\n }, event.target.name, event.target.value));\n });\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_FormControl__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n variant: \"outlined\",\n className: [classes.formControl, classes.notificationType]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_InputLabel__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n ref: inputLabel,\n htmlFor: \"notification-type\"\n }, \"Notification Type\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Select__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: formValues.notification_type,\n onChange: handleNotificationValues,\n input: react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_OutlinedInput__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n name: \"notification_type\",\n id: \"notification-type\"\n })\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"em\", null, \"None\")), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"event\"\n }, \"Event\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"location\"\n }, \"Location\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"package\"\n }, \"Package\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"deal\"\n }, \"Deal\"))), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", {\n id: \"glm-message-image-container\",\n className: [classes.formControl],\n style: {\n display: \"inline-block\",\n position: \"relative\"\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n variant: \"contained\",\n className: [\"upload-custom-img\", classes.button]\n }, \"Add Image\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_functional_ImageContainer__WEBPACK_IMPORTED_MODULE_16__[\"default\"], null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n variant: \"contained\",\n className: [classes.bottom, \"hide\", \"delete-custom-img\", classes.button, classes.removeButton]\n }, \"Remove Image\")), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n name: \"notification_headline\",\n id: \"outlined-search\",\n label: \"Notification Headline\",\n type: \"search\",\n className: classes.textField,\n margin: \"normal\",\n variant: \"outlined\",\n style: {\n width: \"50%\",\n display: \"flex\"\n },\n required: true,\n onChange: handleNotificationValues\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n name: \"notification_message\",\n id: \"outlined-search\",\n label: \"Notification Message\",\n type: \"search\",\n className: classes.textField,\n margin: \"normal\",\n variant: \"outlined\",\n multiline: true,\n rows: 4,\n rowsMax: 4,\n fullWidth: true,\n required: true,\n onChange: handleNotificationValues\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n disabled: formValues.submissionDisabled,\n variant: \"contained\",\n style: {\n width: \"200px\"\n },\n className: [classes.submitButton]\n }, \"Submit Notification\"));\n};\n\nvar useStyles = Object(_material_ui_core_styles__WEBPACK_IMPORTED_MODULE_5__[\"makeStyles\"])(function (theme) {\n return {\n container: {\n display: 'flex',\n flexWrap: 'wrap'\n },\n textField: {// marginLeft: theme.spacing(1),\n // marginRight: theme.spacing(1),\n },\n dense: {\n marginTop: theme.spacing(2)\n },\n menu: {\n width: 200\n },\n formControl: {\n margin: theme.spacing(2, 1),\n minWidth: 120\n },\n notificationType: {\n width: \"125px\"\n },\n selectEmpty: {\n marginTop: theme.spacing(2)\n },\n submitButton: {\n background: \"#4CAF50\",\n color: \"white\",\n marginTop: \"50px\"\n },\n button: {\n margin: theme.spacing(0, 2),\n color: \"white\",\n background: \"#0568B3\",\n width: \"150px\"\n },\n bottom: {\n position: \"absolute\",\n bottom: \"-25px\",\n left: \"43%\",\n transform: \"translateX(-50%)\"\n },\n input: {\n display: 'none'\n },\n hide: {\n display: \"none !important\"\n },\n removeButton: {\n background: \"#F44336\",\n \"float\": \"right\"\n }\n };\n});\n\nvar mapStateToProps = function mapStateToProps(state) {\n return state;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(mapStateToProps, _store_reducers_newNotificationReducer__WEBPACK_IMPORTED_MODULE_17__[\"mapDispatchToProps\"])(NewNotification));\n\n//# sourceURL=webpack:///./js/components/container/NewNotification.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-redux */ \"./node_modules/react-redux/es/index.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 _material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material-ui/core/TextField */ \"./node_modules/@material-ui/core/esm/TextField/index.js\");\n/* harmony import */ var _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material-ui/core/styles */ \"./node_modules/@material-ui/core/esm/styles/index.js\");\n/* harmony import */ var _material_ui_core_Input__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material-ui/core/Input */ \"./node_modules/@material-ui/core/esm/Input/index.js\");\n/* harmony import */ var _material_ui_core_OutlinedInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material-ui/core/OutlinedInput */ \"./node_modules/@material-ui/core/esm/OutlinedInput/index.js\");\n/* harmony import */ var _material_ui_core_FilledInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @material-ui/core/FilledInput */ \"./node_modules/@material-ui/core/esm/FilledInput/index.js\");\n/* harmony import */ var _material_ui_core_InputLabel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @material-ui/core/InputLabel */ \"./node_modules/@material-ui/core/esm/InputLabel/index.js\");\n/* harmony import */ var _material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @material-ui/core/MenuItem */ \"./node_modules/@material-ui/core/esm/MenuItem/index.js\");\n/* harmony import */ var _material_ui_core_FormHelperText__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @material-ui/core/FormHelperText */ \"./node_modules/@material-ui/core/esm/FormHelperText/index.js\");\n/* harmony import */ var _material_ui_core_FormControl__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @material-ui/core/FormControl */ \"./node_modules/@material-ui/core/esm/FormControl/index.js\");\n/* harmony import */ var _material_ui_core_Select__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @material-ui/core/Select */ \"./node_modules/@material-ui/core/esm/Select/index.js\");\n/* harmony import */ var _Util__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Util */ \"./js/Util.js\");\n/* harmony import */ var _material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @material-ui/core/Button */ \"./node_modules/@material-ui/core/esm/Button/index.js\");\n/* harmony import */ var _functional_ImageContainer__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../functional/ImageContainer */ \"./js/components/functional/ImageContainer.jsx\");\n/* harmony import */ var _store_reducers_newNotificationReducer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../store/reducers/newNotificationReducer */ \"./js/store/reducers/newNotificationReducer.js\");\n/* harmony import */ var _material_ui_core_styles_MuiThemeProvider__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @material-ui/core/styles/MuiThemeProvider */ \"./node_modules/@material-ui/core/styles/MuiThemeProvider.js\");\n/* harmony import */ var _material_ui_core_styles_MuiThemeProvider__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_material_ui_core_styles_MuiThemeProvider__WEBPACK_IMPORTED_MODULE_18__);\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 _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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar validateRequired = function validateRequired(props) {\n var data = props.newNotificationReducer;\n console.log(data.notification_headline, data.notification_message, data.notification_type);\n return data.notification_headline && data.notification_message && data.notification_type ? true : false;\n};\n\nvar NewNotification = function NewNotification(props) {\n var inputLabel = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useRef\"])(null);\n var classes = useStyles();\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(0),\n _useState2 = _slicedToArray(_useState, 2),\n labelWidth = _useState2[0],\n setLabelWidth = _useState2[1];\n\n var submissionDisabled;\n /* Categories for each */\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])({\n notification_headline: '',\n notification_message: '',\n notification_image: '',\n notification_type: [''],\n notification_type_category: '',\n notification_status: '',\n notification_date: '',\n notification_admin_status: ''\n }),\n _useState4 = _slicedToArray(_useState3, 2),\n formValues = _useState4[0],\n setFormValues = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState6 = _slicedToArray(_useState5, 2),\n initDraft = _useState6[0],\n setDraftStatus = _useState6[1];\n\n var updateState = function updateState(stateObj) {\n setFormValues(function (oldValues) {\n return _extends({}, oldValues, stateObj);\n });\n };\n\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n _Util__WEBPACK_IMPORTED_MODULE_14__[\"default\"].MediaLibrary();\n\n if (formValues.firstLoad) {\n updateState({\n firstLoad: false\n });\n }\n\n return function cleanup() {};\n }, []);\n Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useEffect\"])(function () {\n console.log(initDraft);\n\n if (initDraft === true) {\n var intervalID = setInterval(function () {\n console.log(\"draft\");\n }, 3000);\n return function cleanup() {\n clearInterval(intervalID);\n };\n }\n });\n\n function submitNotification() {\n console.log(\"SUBMITTED\");\n var data = props.newNotificationReducer;\n console.log(_extends({}, data));\n props.updateNewNotificationDB(_extends({}, data));\n }\n\n function handleNotificationValues(event) {\n event.persist();\n setFormValues(function (oldValues) {\n var _props$updateNewNotif;\n\n props.updateNewNotificationData((_props$updateNewNotif = {}, _defineProperty(_props$updateNewNotif, event.target.name, event.target.value), _defineProperty(_props$updateNewNotif, \"notification_message_status\", \"draft\"), _props$updateNewNotif));\n return _extends({}, oldValues, _defineProperty({}, event.target.name, event.target.value));\n });\n setDraftStatus(true);\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_styles_MuiThemeProvider__WEBPACK_IMPORTED_MODULE_18___default.a, {\n theme: formLabelsTheme\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_FormControl__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n required: true,\n variant: \"outlined\",\n className: [classes.formControl, classes.notificationType]\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_InputLabel__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n ref: inputLabel,\n htmlFor: \"notification-type\"\n }, \"Notification Type\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Select__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: formValues.notification_type,\n onChange: handleNotificationValues,\n required: true,\n input: react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_OutlinedInput__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n name: \"notification_type\",\n id: \"notification-type\"\n })\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n disabled: true,\n value: \"\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"em\", null, \"None\")), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"event\"\n }, \"Event\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"location\"\n }, \"Location\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"package\"\n }, \"Package\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_MenuItem__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: \"deal\"\n }, \"Deal\")))), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", {\n id: \"glm-message-image-container\",\n className: [classes.formControl],\n style: {\n display: \"inline-block\",\n position: \"relative\",\n \"float\": \"right\"\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n variant: \"contained\",\n style: {\n \"float\": \"right\"\n },\n className: [\"upload-custom-img\", classes.button]\n }, \"Add Image\"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_functional_ImageContainer__WEBPACK_IMPORTED_MODULE_16__[\"default\"], null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n variant: \"contained\",\n className: [classes.bottom, \"hide\", \"delete-custom-img\", classes.button, classes.removeButton]\n }, \"Remove Image\")), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n name: \"notification_headline\",\n id: \"outlined-search\",\n label: \"Notification Headline\",\n type: \"search\",\n className: classes.textField,\n margin: \"normal\",\n variant: \"outlined\",\n style: {\n width: \"50%\",\n display: \"flex\"\n },\n required: true,\n onChange: handleNotificationValues\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_TextField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n name: \"notification_message\",\n id: \"outlined-search\",\n label: \"Notification Message\",\n type: \"search\",\n className: classes.textField,\n margin: \"normal\",\n variant: \"outlined\",\n multiline: true,\n rows: 4,\n rowsMax: 4,\n fullWidth: true,\n required: true,\n onChange: handleNotificationValues\n }), validateRequired(props) ? submissionDisabled = false : submissionDisabled = true, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n onClick: submitNotification,\n disabled: submissionDisabled,\n variant: \"contained\",\n style: {\n width: \"200px\"\n },\n className: [classes.submitButton]\n }, \"Submit Notification\"));\n};\n\nvar formLabelsTheme = Object(_material_ui_core_styles__WEBPACK_IMPORTED_MODULE_5__[\"createMuiTheme\"])({\n overrides: {\n MuiFormLabel: {\n asterisk: {\n color: '#db3131',\n '&$error': {\n color: '#db3131'\n }\n }\n }\n }\n});\nvar useStyles = Object(_material_ui_core_styles__WEBPACK_IMPORTED_MODULE_5__[\"makeStyles\"])(function (theme) {\n return {\n container: {\n display: 'flex',\n flexWrap: 'wrap'\n },\n textField: {// marginLeft: theme.spacing(1),\n // marginRight: theme.spacing(1),\n },\n MuiFormLabel: {\n asterisk: {\n color: '#db3131',\n '&$error': {\n color: '#db3131'\n }\n }\n },\n required: {\n color: \"red\"\n },\n dense: {\n marginTop: theme.spacing(2)\n },\n menu: {\n width: 200\n },\n formControl: {\n margin: theme.spacing(2, 1),\n minWidth: 120\n },\n notificationType: {\n width: \"135px\"\n },\n selectEmpty: {\n marginTop: theme.spacing(2)\n },\n submitButton: {\n background: \"#4CAF50\",\n color: \"white\",\n marginTop: \"50px\"\n },\n button: {\n margin: theme.spacing(0, 2),\n color: \"white\",\n background: \"#0568B3\",\n width: \"150px\"\n },\n bottom: {\n position: \"absolute\",\n bottom: \"-25px\",\n left: \"43%\",\n transform: \"translateX(-50%)\"\n },\n input: {\n display: 'none'\n },\n hide: {\n display: \"none !important\"\n },\n removeButton: {\n background: \"#F44336\",\n \"float\": \"right\"\n }\n };\n});\n\nvar mapStateToProps = function mapStateToProps(state) {\n return state;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(react_redux__WEBPACK_IMPORTED_MODULE_2__[\"connect\"])(mapStateToProps, _store_reducers_newNotificationReducer__WEBPACK_IMPORTED_MODULE_17__[\"mapDispatchToProps\"])(NewNotification));\n\n//# sourceURL=webpack:///./js/components/container/NewNotification.jsx?"); /***/ }), @@ -250,7 +250,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _components_Controller_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/Controller.jsx */ \"./js/components/Controller.jsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Controller_jsx__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null), document.getElementById('glma-app-notifications-mount'));\n\n//# sourceURL=webpack:///./js/init.js?"); +eval("__webpack_require__.r(__webpack_exports__);\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 react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _components_Controller_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/Controller.jsx */ \"./js/components/Controller.jsx\");\n\n\n\nvar mount = document.getElementById('glma-app-notifications-mount');\nvar initData = mount.dataset;\nconsole.log(initData);\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Controller_jsx__WEBPACK_IMPORTED_MODULE_2__[\"default\"], mount.dataset), mount);\n\n//# sourceURL=webpack:///./js/init.js?"); /***/ }), @@ -258,11 +258,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac /*!***********************************!*\ !*** ./js/store/actions/types.js ***! \***********************************/ -/*! exports provided: UPDATE_NOTIFICATION_DATA, UPDATE_NEW_NOTIFICATION_DATA */ +/*! exports provided: UPDATE_NOTIFICATION_DATA, UPDATE_NEW_NOTIFICATION_DATA, UPDATE_NEW_NOTIFICATION_DB */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UPDATE_NOTIFICATION_DATA\", function() { return UPDATE_NOTIFICATION_DATA; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UPDATE_NEW_NOTIFICATION_DATA\", function() { return UPDATE_NEW_NOTIFICATION_DATA; });\nvar UPDATE_NOTIFICATION_DATA = \"UPDATE_NOTIFICATION_DATA\";\nvar UPDATE_NEW_NOTIFICATION_DATA = \"UPDATE_NEW_NOTIFICATION_DATA\";\n\n//# sourceURL=webpack:///./js/store/actions/types.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UPDATE_NOTIFICATION_DATA\", function() { return UPDATE_NOTIFICATION_DATA; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UPDATE_NEW_NOTIFICATION_DATA\", function() { return UPDATE_NEW_NOTIFICATION_DATA; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UPDATE_NEW_NOTIFICATION_DB\", function() { return UPDATE_NEW_NOTIFICATION_DB; });\nvar UPDATE_NOTIFICATION_DATA = \"UPDATE_NOTIFICATION_DATA\";\nvar UPDATE_NEW_NOTIFICATION_DATA = \"UPDATE_NEW_NOTIFICATION_DATA\";\nvar UPDATE_NEW_NOTIFICATION_DB = \"UPDATE_NEW_NOTIFICATION_DB\";\n\n//# sourceURL=webpack:///./js/store/actions/types.js?"); /***/ }), @@ -282,11 +282,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /*!*******************************************************!*\ !*** ./js/store/actions/updateNewNotificationData.js ***! \*******************************************************/ -/*! exports provided: updateNewNotificationData */ +/*! exports provided: updateNewNotificationData, updateNewNotificationDB */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"updateNewNotificationData\", function() { return updateNewNotificationData; });\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ \"./js/store/actions/types.js\");\n\nvar updateNewNotificationData = function updateNewNotificationData(newNotificationData) {\n return function (dispatch) {\n return new Promise(function (resolve, reject) {\n dispatch({\n type: _types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DATA\"],\n newNotificationData: newNotificationData\n });\n resolve();\n });\n };\n};\n\n//# sourceURL=webpack:///./js/store/actions/updateNewNotificationData.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"updateNewNotificationData\", function() { return updateNewNotificationData; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"updateNewNotificationDB\", function() { return updateNewNotificationDB; });\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ \"./js/store/actions/types.js\");\n\nvar updateNewNotificationData = function updateNewNotificationData(newNotificationData) {\n return function (dispatch) {\n return new Promise(function (resolve, reject) {\n dispatch({\n type: _types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DATA\"],\n newNotificationData: newNotificationData\n });\n resolve();\n });\n };\n};\nvar updateNewNotificationDB = function updateNewNotificationDB(newNotificationData) {\n return function (dispatch) {\n return new Promise(function (resolve, reject) {\n dispatch({\n type: _types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DB\"],\n newNotificationData: newNotificationData\n });\n resolve();\n });\n };\n};\n\n//# sourceURL=webpack:///./js/store/actions/updateNewNotificationData.js?"); /***/ }), @@ -310,7 +310,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__, \"newNotificationReducer\", function() { return newNotificationReducer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mapDispatchToProps\", function() { return mapDispatchToProps; });\n/* harmony import */ var _actions_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../actions/types */ \"./js/store/actions/types.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _actions_updateNewNotificationData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/updateNewNotificationData */ \"./js/store/actions/updateNewNotificationData.js\");\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\n\n\n\nvar initialNewNotificationState = {\n member_id: 0,\n notification_headline: '',\n notification_message: '',\n notification_image: '',\n notification_type: '',\n notification_type_category: '',\n notification_message_status: '',\n notification_date: '',\n notification_admin_status: '' // Reducer\n\n};\nvar newNotificationReducer = function newNotificationReducer() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialNewNotificationState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case _actions_types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DATA\"]:\n return Object.assign({}, state, _extends({}, action.newNotificationData));\n // case UPDATE_NEW_NOTIFICATION_STATUS : \n // const requestData = {\n // action : \"glm_members_admin_ajax\",\n // glm_action : \"data_requests\",\n // payload : action.newNotificationData\n // }\n // $.ajax({\n // method : \"POST\",\n // url : window.ajaxurl,\n // data : requestData\n // })\n // break;\n }\n\n return state;\n};\nvar mapDispatchToProps = function mapDispatchToProps(dispatch) {\n return {\n updateNewNotificationData: function updateNewNotificationData(newNotificationData) {\n return dispatch(Object(_actions_updateNewNotificationData__WEBPACK_IMPORTED_MODULE_2__[\"updateNewNotificationData\"])(newNotificationData));\n },\n updateNewNotificationStatus: function (_updateNewNotificationStatus) {\n function updateNewNotificationStatus(_x) {\n return _updateNewNotificationStatus.apply(this, arguments);\n }\n\n updateNewNotificationStatus.toString = function () {\n return _updateNewNotificationStatus.toString();\n };\n\n return updateNewNotificationStatus;\n }(function (newNotificationStatus) {\n return dispatch(updateNewNotificationStatus(newNotificationStatus));\n })\n };\n};\n\n//# sourceURL=webpack:///./js/store/reducers/newNotificationReducer.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"newNotificationReducer\", function() { return newNotificationReducer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mapDispatchToProps\", function() { return mapDispatchToProps; });\n/* harmony import */ var _actions_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../actions/types */ \"./js/store/actions/types.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _actions_updateNewNotificationData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/updateNewNotificationData */ \"./js/store/actions/updateNewNotificationData.js\");\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\n\n\n\nvar initialNewNotificationState = {\n member_id: 0,\n notification_headline: '',\n notification_message: '',\n notification_image: '',\n notification_type: '',\n notification_type_category: '',\n notification_message_status: '',\n notification_date: '',\n notification_admin_status: '' // Reducer\n\n};\nvar newNotificationReducer = function newNotificationReducer() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialNewNotificationState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case _actions_types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DATA\"]:\n return Object.assign({}, state, _extends({}, action.newNotificationData));\n\n case _actions_types__WEBPACK_IMPORTED_MODULE_0__[\"UPDATE_NEW_NOTIFICATION_DB\"]:\n action.newNotificationData.notification_status = \"active\";\n var requestData = {\n action: \"glm_members_admin_ajax\",\n glm_action: \"data_requests\",\n dataAction: \"insertNewNotification\",\n payload: action.newNotificationData\n };\n $.ajax({\n method: \"POST\",\n url: window.glmUrl + '/wp-admin/admin-ajax.php',\n data: requestData,\n complete: function complete(response) {\n console.log(response);\n }\n });\n return Object.assign({}, state, _extends({}, action.newNotificationData));\n }\n\n return state;\n};\nvar mapDispatchToProps = function mapDispatchToProps(dispatch) {\n return {\n updateNewNotificationData: function updateNewNotificationData(newNotificationData) {\n return dispatch(Object(_actions_updateNewNotificationData__WEBPACK_IMPORTED_MODULE_2__[\"updateNewNotificationData\"])(newNotificationData));\n },\n updateNewNotificationDB: function updateNewNotificationDB(newNotificationData) {\n return dispatch(Object(_actions_updateNewNotificationData__WEBPACK_IMPORTED_MODULE_2__[\"updateNewNotificationDB\"])(newNotificationData));\n }\n };\n};\n\n//# sourceURL=webpack:///./js/store/reducers/newNotificationReducer.js?"); /***/ }), @@ -2092,6 +2092,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ }), +/***/ "./node_modules/@material-ui/core/styles/MuiThemeProvider.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@material-ui/core/styles/MuiThemeProvider.js ***! + \*******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _styles = __webpack_require__(/*! @material-ui/styles */ \"./node_modules/@material-ui/styles/esm/index.js\");\n\n/**\n * @ignore - do not document.\n */\nvar _default = _styles.ThemeProvider;\nexports.default = _default;\n\n//# sourceURL=webpack:///./node_modules/@material-ui/core/styles/MuiThemeProvider.js?"); + +/***/ }), + /***/ "./node_modules/@material-ui/icons/Dashboard.js": /*!******************************************************!*\ !*** ./node_modules/@material-ui/icons/Dashboard.js ***! diff --git a/js/components/Controller.jsx b/js/components/Controller.jsx index 99ea1b4..220bc68 100755 --- a/js/components/Controller.jsx +++ b/js/components/Controller.jsx @@ -11,7 +11,7 @@ import Typography from '@material-ui/core/Typography'; import App from './container/App'; -export default function Controller() { +export default function Controller(props) { /* useState takes a value that is passed to arg1 by default useState has a state update method that is arg2 that acts like setState @@ -21,6 +21,7 @@ export default function Controller() { const [title, updateTitle] = useState('WP Kiosk'); useEffect(() => { + console.log(props) // on component mount logic here /* Run cleanup() when the component unmountse */ return function cleanup(){ diff --git a/js/components/HOC/ListHOC.jsx b/js/components/HOC/ListHOC.jsx index bc25973..791c524 100755 --- a/js/components/HOC/ListHOC.jsx +++ b/js/components/HOC/ListHOC.jsx @@ -26,7 +26,7 @@ const ListHOC = (props) => { useEffect(() =>{ setRoute(props.location.pathname.substring(1)) - console.log(route) + }) function changeRoute(e){ diff --git a/js/components/container/Dashboard.jsx b/js/components/container/Dashboard.jsx index 500611a..b4025d1 100755 --- a/js/components/container/Dashboard.jsx +++ b/js/components/container/Dashboard.jsx @@ -18,7 +18,7 @@ const Dashboard = () => { const [title, updateTitle] = useState('WP Kiosk'); useEffect(() => { - console.log("mount") + /* Run cleanup() when the component unmounts */ return function cleanup(){ diff --git a/js/components/container/NewNotification.jsx b/js/components/container/NewNotification.jsx index 1a52a2e..71f9f28 100755 --- a/js/components/container/NewNotification.jsx +++ b/js/components/container/NewNotification.jsx @@ -11,16 +11,26 @@ import InputLabel from '@material-ui/core/InputLabel'; import MenuItem from '@material-ui/core/MenuItem'; import FormHelperText from '@material-ui/core/FormHelperText'; import FormControl from '@material-ui/core/FormControl'; +import { createMuiTheme } from '@material-ui/core/styles'; import Select from '@material-ui/core/Select'; import Util from '../../Util'; import Button from '@material-ui/core/Button'; import ImageContainer from '../functional/ImageContainer'; import { mapDispatchToProps } from '../../store/reducers/newNotificationReducer'; +import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider'; + +const validateRequired = (props) => { + + const data = props.newNotificationReducer; + console.log(data.notification_headline, data.notification_message , data.notification_type); + return (data.notification_headline && data.notification_message && data.notification_type) ? true : false; +} const NewNotification = (props) => { const inputLabel = useRef(null); const classes = useStyles(); const [labelWidth, setLabelWidth] = useState(0); + let submissionDisabled; /* Categories for each */ const [formValues, setFormValues] = useState({ @@ -29,29 +39,31 @@ const NewNotification = (props) => { notification_image : '', notification_type : [''], notification_type_category : '', - notification_message_status : '', + notification_status : '', notification_date : '', - notification_admin_status : '', - submissionDisabled : true, - initDraft : false + notification_admin_status : '' }); + const [initDraft, setDraftStatus] = useState(false); + const updateState = (stateObj) => { + setFormValues(oldValues => { + return ({ + ...oldValues, + ...stateObj, + })}); + } useEffect(() => { Util.MediaLibrary(); - // setLabelWidth(inputLabel.current.offsetWidth); if(formValues.firstLoad){ - setFormValues(oldValues => { - return ({ - ...oldValues, - firstLoad: false, - })}); + updateState({firstLoad: false}) } return function cleanup(){} }, []); useEffect(() => { - if(formValues.initDraft === true){ + console.log(initDraft) + if(initDraft === true){ const intervalID = setInterval(() => { console.log("draft") }, 3000) @@ -61,41 +73,50 @@ const NewNotification = (props) => { } } }); - + function submitNotification(){ + console.log("SUBMITTED"); + + const data = props.newNotificationReducer; + console.log({...data}) + props.updateNewNotificationDB({...data}) + } + function handleNotificationValues(event) { event.persist(); setFormValues(oldValues => { - props.updateNewNotificationData({[event.target.name]: event.target.value, notification_message_status: "draft",initDraft: true,}) + props.updateNewNotificationData({[event.target.name]: event.target.value, notification_message_status: "draft"}) return ({ ...oldValues, - initDraft: true, [event.target.name]: event.target.value, })}); - - } + setDraftStatus(true); } return ( - - - Notification Type - - - - - + + + + Notification Type + + + + + + + @@ -126,15 +147,26 @@ const NewNotification = (props) => { required onChange={handleNotificationValues} /> - - + { + (validateRequired(props))? submissionDisabled = false : submissionDisabled = true + } + ) } - - - +const formLabelsTheme = createMuiTheme({ + overrides: { + MuiFormLabel: { + asterisk: { + color: '#db3131', + '&$error': { + color: '#db3131' + }, + } + } + } + }) const useStyles = makeStyles(theme => ({ container: { @@ -145,6 +177,17 @@ const useStyles = makeStyles(theme => ({ // marginLeft: theme.spacing(1), // marginRight: theme.spacing(1), }, + MuiFormLabel:{ + asterisk: { + color: '#db3131', + '&$error': { + color: '#db3131' + }, + } + }, + required :{ + color: "red" + }, dense: { marginTop: theme.spacing(2), }, @@ -156,7 +199,7 @@ const useStyles = makeStyles(theme => ({ minWidth: 120, }, notificationType: { - width: "125px" + width: "135px" }, selectEmpty: { marginTop: theme.spacing(2), diff --git a/js/init.js b/js/init.js index 49208ce..92dbdda 100755 --- a/js/init.js +++ b/js/init.js @@ -1,5 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import Controller from './components/Controller.jsx'; - -ReactDOM.render(, document.getElementById('glma-app-notifications-mount')); \ No newline at end of file +let mount = document.getElementById('glma-app-notifications-mount'); +let initData = mount.dataset; +console.log(initData) +ReactDOM.render(, mount); \ No newline at end of file diff --git a/js/store/actions/types.js b/js/store/actions/types.js index 1f42341..4825aaa 100755 --- a/js/store/actions/types.js +++ b/js/store/actions/types.js @@ -1,2 +1,3 @@ export const UPDATE_NOTIFICATION_DATA = "UPDATE_NOTIFICATION_DATA"; -export const UPDATE_NEW_NOTIFICATION_DATA = "UPDATE_NEW_NOTIFICATION_DATA"; \ No newline at end of file +export const UPDATE_NEW_NOTIFICATION_DATA = "UPDATE_NEW_NOTIFICATION_DATA"; +export const UPDATE_NEW_NOTIFICATION_DB = "UPDATE_NEW_NOTIFICATION_DB"; \ No newline at end of file diff --git a/js/store/actions/updateNewNotificationData.js b/js/store/actions/updateNewNotificationData.js index 0c6818b..543addd 100644 --- a/js/store/actions/updateNewNotificationData.js +++ b/js/store/actions/updateNewNotificationData.js @@ -1,4 +1,4 @@ -import { UPDATE_NEW_NOTIFICATION_DATA} from './types'; +import { UPDATE_NEW_NOTIFICATION_DATA, UPDATE_NEW_NOTIFICATION_DB } from './types'; export const updateNewNotificationData = (newNotificationData) => { return dispatch => { @@ -11,3 +11,14 @@ export const updateNewNotificationData = (newNotificationData) => { }); } } +export const updateNewNotificationDB = (newNotificationData) => { + return dispatch => { + return new Promise((resolve, reject) => { + dispatch({ + type: UPDATE_NEW_NOTIFICATION_DB, + newNotificationData + }); + resolve() + }); + } +} diff --git a/js/store/reducers/newNotificationReducer.js b/js/store/reducers/newNotificationReducer.js index 939b73c..e265eba 100644 --- a/js/store/reducers/newNotificationReducer.js +++ b/js/store/reducers/newNotificationReducer.js @@ -1,6 +1,6 @@ -import { UPDATE_NEW_NOTIFICATION_DATA } from '../actions/types'; +import { UPDATE_NEW_NOTIFICATION_DATA, UPDATE_NEW_NOTIFICATION_DB } from '../actions/types'; import React, { Component } from 'react'; -import { updateNewNotificationData } from '../actions/updateNewNotificationData'; +import { updateNewNotificationData, updateNewNotificationDB } from '../actions/updateNewNotificationData'; const initialNewNotificationState = { member_id: 0, @@ -23,19 +23,26 @@ export const newNotificationReducer = (state = initialNewNotificationState, acti ...action.newNotificationData }); - // case UPDATE_NEW_NOTIFICATION_STATUS : - // const requestData = { - // action : "glm_members_admin_ajax", - // glm_action : "data_requests", - // payload : action.newNotificationData - // } - // $.ajax({ - // method : "POST", - // url : window.ajaxurl, - // data : requestData + case UPDATE_NEW_NOTIFICATION_DB: + action.newNotificationData.notification_status = "active"; + const requestData = { + action : "glm_members_admin_ajax", + glm_action : "data_requests", + dataAction : "insertNewNotification", + payload : action.newNotificationData, + } + $.ajax({ + method : "POST", + url : window.glmUrl + '/wp-admin/admin-ajax.php', + data : requestData, + complete : function(response){ + console.log(response) + } - // }) - // break; + }) + return Object.assign({}, state,{ + ...action.newNotificationData + }); } return state; } @@ -43,6 +50,6 @@ export const newNotificationReducer = (state = initialNewNotificationState, acti export const mapDispatchToProps = (dispatch) => { return { updateNewNotificationData : (newNotificationData) => dispatch(updateNewNotificationData(newNotificationData)), - updateNewNotificationStatus : (newNotificationStatus) => dispatch(updateNewNotificationStatus(newNotificationStatus)), + updateNewNotificationDB : (newNotificationData) => dispatch(updateNewNotificationDB(newNotificationData)), } } \ No newline at end of file diff --git a/models/admin/ajax/data_requests.php b/models/admin/ajax/data_requests.php index 0de22de..5e0ba05 100755 --- a/models/admin/ajax/data_requests.php +++ b/models/admin/ajax/data_requests.php @@ -94,10 +94,46 @@ class GlmMembersAdmin_ajax_data_requests { global $wpdb; $this->write_log($_REQUEST); + $membersList = false; + + switch($_REQUEST['dataAction']){ + case "insertNewNotification" : + // TODO: Sanitize Request Data + $wpdb->insert( + GLM_MEMBERS_APP_NOTIFICATIONS_PLUGIN_DB_PREFIX .'notifications', + array( + 'member_id' => $_REQUEST['payload']['member_id'], + 'notification_headline' => $_REQUEST['payload']['notification_headline'], + 'notification_message' => $_REQUEST['payload']['notification_message'], + 'notification_image' => $_REQUEST['payload']['notification_image'], + 'notification_type' => $_REQUEST['payload']['notification_type'], + 'type_category' => $_REQUEST['payload']['type_category'], + 'notification_status' => $_REQUEST['payload']['notification_status'], + 'notification_date' => date("Y-m-d H:i:s"), + ), + array( + "%d", + "%s", + "%s", + "%d", + "%s", + "%s", + "%s", + "%s", + ) + ); + break; + case "getMemberList" : + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php'; + $membersObj = new GlmDataMembers($this->wpdb, $this->config); + $membersList = $membersObj->getIdName(); + + } + $return = array( - 'status' => false, // Assume nothing works + 'status' => 'success', + 'memberList' => $membersList // Assume nothing works ); - header('Content-type:application/json;charset=utf-8', true); echo json_encode($return); wp_die(); diff --git a/models/admin/init/index.php b/models/admin/appNotifications/index.php similarity index 61% rename from models/admin/init/index.php rename to models/admin/appNotifications/index.php index ca8968a..62e1d20 100755 --- a/models/admin/init/index.php +++ b/models/admin/appNotifications/index.php @@ -18,7 +18,7 @@ * Each Add-On can have one or more dashboards. */ -class GlmMembersAdmin_init_index +class GlmMembersAdmin_appNotifications_index { /** * Word Press Database Object @@ -93,16 +93,60 @@ class GlmMembersAdmin_init_index * */ public function modelAction ( $actionData = false ){ + ?> + + config['settings']['member_events_moderated'] ) { + $isModerated = true; + } + $memberID = $lockedToMember; + } else { + // If members manager, get list of members + + + // Try to get member ID + // $memberID = (isset($_REQUEST['member']) ? $_REQUEST['member'] : 0); + + // If there's no valid member ID, we can't continue + // if ($memberID == 0) { + // return array( + // 'status' => false, + // 'menuItemRedirect' => 'error', + // 'modelRedirect' => 'index', + // 'view' => 'admin/error/index.html', + // 'data' => array( + // 'reason' => 'No member ID was provided.' + // ) + // ); + // } + } + // Compile template data. $templateData = array( - + 'memberRestricted' => $isModerated, + 'memberID' => $memberID, + 'membersList' => $membersList ); // Return status, suggested view, and data to controller. @@ -110,7 +154,7 @@ class GlmMembersAdmin_init_index 'status' => true, 'menuItemRedirect' => false, 'modelRedirect' => false, - 'view' => 'admin/init/index.html', + 'view' => 'admin/appNotifications/index.html', 'data' => $templateData ); } diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 7285918..6316de8 100755 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -56,8 +56,8 @@ if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser'][ 'App Notifications', // Page title 'App Notifications', // Menu Title 'glm_members_edit_my_entity', // Capability required - 'glm-members-admin-menu-init-index', // Menu slug - function() {$this->controller('init', 'index');} + 'glm-members-admin-menu-appNotifications-index', // Menu slug + function() {$this->controller('appNotifications', 'index');} ); // Otherwise it's an administrator @@ -68,7 +68,7 @@ if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser'][ 'App Notifications', // Page title 'App Notifications', // Menu Title 'glm_members_members', // Capability required - 'glm-members-admin-menu-init-index', // Menu slug - function() {$this->controller('init', 'index');} + 'glm-members-admin-menu-appNotifications-index', // Menu slug + function() {$this->controller('appNotifications', 'index');} ); } \ No newline at end of file diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index abee004..a8e84da 100755 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -14,9 +14,9 @@ CREATE TABLE {prefix}notifications ( id INT NOT NULL AUTO_INCREMENT, member_id INT NULL, -- Associated member id notification_headline TEXT NULL, -- Header / Subject of the notification - notification_body TEXT NULL, -- Notification contents + notification_message TEXT NULL, -- Notification contents notification_image INT NULL, -- Optional attached image to the notification. - notification_type INT NULL, -- Type of notification: Event, Location, Promotional Deal + notification_type TINYTEXT NULL, -- Type of notification: Event, Location, Promotional Deal type_category TEXT NULL, -- Category associated with the type: Event category, member category, package category notification_status TINYTEXT NULL, -- Status for "Sent, Draft or Trashed" notification_date DATETIME NULL, -- Date the notification was created diff --git a/setup/validActions.php b/setup/validActions.php index 22cfcce..b6b9b89 100755 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -62,7 +62,7 @@ $glmMembersAppNotificationsAddOnValidActions = array( 'ajax' => array( 'data_requests' => GLM_MEMBERS_APP_NOTIFICATIONS_PLUGIN_SLUG ), - 'init' => array( + 'appNotifications' => array( 'index' => GLM_MEMBERS_APP_NOTIFICATIONS_PLUGIN_SLUG ) ), diff --git a/views/admin/appNotifications/index.html b/views/admin/appNotifications/index.html new file mode 100755 index 0000000..d4b31f6 --- /dev/null +++ b/views/admin/appNotifications/index.html @@ -0,0 +1,3 @@ + +
+ diff --git a/views/admin/init/index.html b/views/admin/init/index.html deleted file mode 100755 index a293afd..0000000 --- a/views/admin/init/index.html +++ /dev/null @@ -1 +0,0 @@ -
-- 2.17.1