(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[5405],{ /***/ 48312: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (window.__NEXT_P = window.__NEXT_P || []).push([ "/", function () { return __webpack_require__(74119); } ]); if(false) {} /***/ }), /***/ 83898: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": function() { return /* binding */ ConfirmationModal; } /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41120); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35117); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5566); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(73637); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(79895); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22318); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(41749); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(282); var useStyles = (0,_material_ui_core__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(function(theme) { return (0,_material_ui_core__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)({ "@keyframes fadeIn": { from: { opacity: 0 }, to: { opacity: 1 } }, buttonNorm: { color: "white", marginTop: "5px", marginRight: "5px" }, modal: { zIndex: 999999, display: "flex", alignItems: "center", justifyContent: "center" }, modalPaper: { backgroundColor: theme.palette.background.paper, boxShadow: theme.shadows[5], padding: theme.spacing(2, 4, 3), textAlign: "center" } }); }); function ConfirmationModal(props) { var confirmationAction = props.confirmationAction, header = props.header, toggleVisibility = props.toggleVisibility, visible = props.visible, negativeAction = props.negativeAction, subheader = props.subheader; var classes = useStyles(); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { className: classes.modal, open: visible, onClose: function() { return toggleVisibility(false); }, closeAfterTransition: true, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { in: visible, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_material_ui_core__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { className: classes.modalPaper, children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h3", { style: { textAlign: "center" }, children: header }), subheader && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { variant: "subtitle1", children: subheader }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_material_ui_core__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, { container: true, style: { width: "100%", justifyContent: "center" }, children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, { item: true, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { variant: "contained", color: "primary", className: classes.buttonNorm, onClick: function() { confirmationAction(); toggleVisibility(false); }, children: "Yes" }) }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, { item: true, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { variant: "contained", className: classes.buttonNorm, color: "secondary", onClick: function() { if (negativeAction) { negativeAction(); } toggleVisibility(false); }, children: "No" }) }) ] }) ] }) }) }); } /***/ }), /***/ 92414: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "v": function() { return /* binding */ InlineConfirm; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95477); /* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(62087); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _mdi_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(55317); var InlineConfirm = function(props) { var ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(36), width = ref[0], setWidth = ref[1]; var ref1 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("center"), justifyContent = ref1[0], setJustifyContent = ref1[1]; var ref2 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false), open = ref2[0], setOpen = ref2[1]; // sets open var transformA = function() { setWidth(72); setJustifyContent("start"); }; // sets closed var transformB = function() { setWidth(36); setJustifyContent("center"); }; var doClose = function(e) { if (props.loading === true) { return; } setOpen(false); if (props.onClose !== undefined) { props.onClose(e); } }; var doOpen = function(e) { setOpen(true); if (props.onOpen !== undefined) { props.onOpen(e); } }; var doConfirm = function(e) { if (props.onConfirm !== undefined) { props.onConfirm(e); } }; var doToggle = function(e) { if (open === true) { setOpen(false); doClose(e); } else { setOpen(true); doOpen(e); } }; (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function() { if (open === true) { transformA(); } else { transformB(); } }, [ open ]); var CloseIcon = props.CloseIcon, Icon = props.Icon, ConfirmIcon = props.ConfirmIcon; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { style: (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)({}, props.style), { transition: "all 0.3s cubic-bezier(.25,.8,.25,1)", display: "inline-flex", height: "36px", width: "".concat(width, "px"), borderRadius: "20px", padding: "12px", flex: "0 0 auto", position: "relative", alignItems: "center", userSelect: "none", justifyContent: justifyContent, verticalAlign: "middle", margin: 0, textAlign: "center", overflow: "hidden", cursor: "pointer" }), onMouseLeave: doClose, children: props.loading ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { size: 25, color: "inherit" }) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { style: { display: "flex", left: "5px", position: "absolute" }, children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { style: { display: "inline-flex", alignItems: "inherit", justifyItems: "inherit" }, onClick: doToggle, children: open ? CloseIcon : Icon }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", { style: { display: "inline-flex", alignItems: "inherit", justifyItems: "inherit", marginLeft: "14px" }, onClick: doConfirm, children: ConfirmIcon }) ] }) }) }); }; InlineConfirm.defaultProps = { ConfirmIcon: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: _mdi_js__WEBPACK_IMPORTED_MODULE_6__/* .mdiCheck */ .oL1 }) }), CloseIcon: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: _mdi_js__WEBPACK_IMPORTED_MODULE_6__/* .mdiClose */ .r5M }) }), Icon: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_material_ui_core__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: _mdi_js__WEBPACK_IMPORTED_MODULE_6__/* .mdiDelete */ .x9U }) }), style: {} }; /***/ }), /***/ 74119: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* binding */ pages; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_async_to_generator.mjs var _async_to_generator = __webpack_require__(47568); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/node_modules/tslib/tslib.es6.js var tslib_es6 = __webpack_require__(20414); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Button/Button.js var Button = __webpack_require__(282); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/SvgIcon/SvgIcon.js var SvgIcon = __webpack_require__(62087); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/LinearProgress/LinearProgress.js var LinearProgress = __webpack_require__(33681); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Typography/Typography.js var Typography = __webpack_require__(22318); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_to_consumable_array.mjs + 2 modules var _to_consumable_array = __webpack_require__(29815); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Modal/Modal.js + 3 modules var Modal = __webpack_require__(5566); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Card/Card.js var Card = __webpack_require__(18463); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/CardContent/CardContent.js var CardContent = __webpack_require__(79912); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Paper/Paper.js var Paper = __webpack_require__(79895); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/CircularProgress/CircularProgress.js var CircularProgress = __webpack_require__(95477); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Grid/Grid.js var Grid = __webpack_require__(41749); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Icon/Icon.js var Icon = __webpack_require__(92863); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/TextField/TextField.js + 2 modules var TextField = __webpack_require__(36131); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/List/List.js var List = __webpack_require__(62822); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/ListItem/ListItem.js var ListItem = __webpack_require__(50998); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/ListItemText/ListItemText.js var ListItemText = __webpack_require__(95757); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/ListItemSecondaryAction/ListItemSecondaryAction.js var ListItemSecondaryAction = __webpack_require__(81860); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/IconButton/IconButton.js var IconButton = __webpack_require__(17812); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Checkbox/Checkbox.js + 3 modules var Checkbox = __webpack_require__(80797); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Divider/Divider.js var Divider = __webpack_require__(55517); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/CardActions/CardActions.js var CardActions = __webpack_require__(51907); // EXTERNAL MODULE: ../shared/source/Common/API/client/index.ts var client = __webpack_require__(41884); // EXTERNAL MODULE: ./node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js var react_beautiful_dnd_esm = __webpack_require__(15948); // EXTERNAL MODULE: ./node_modules/@material-ui/styles/esm/makeStyles/makeStyles.js + 4 modules var makeStyles = __webpack_require__(11719); // EXTERNAL MODULE: ./node_modules/@material-ui/styles/esm/createStyles/createStyles.js var createStyles = __webpack_require__(10150); ;// CONCATENATED MODULE: ./src/jss/awards/index.ts var useStyles = (0,makeStyles/* default */.Z)(function(theme) { return (0,createStyles/* default */.Z)({ awardCard: { minHeight: "150px" }, awardCardMedia: { backgroundSize: "contain", height: 140 }, modal: { display: "flex", alignItems: "center", justifyContent: "center" }, modalPaper: { backgroundColor: theme.palette.background.paper, boxShadow: theme.shadows[12], padding: theme.spacing(2, 4, 3), width: 820, height: 700, "& .MuiTextField-root": { margin: theme.spacing(1), width: "25ch" } } }); }); // EXTERNAL MODULE: ./src/util/index.ts var util = __webpack_require__(45153); ;// CONCATENATED MODULE: ./src/util/rtwf/awards/index.ts var defaultAward = { id: "", displayName: "", image: "", nominees: [], slot: -1, nextUp: false, description: "", decision: "undecided", subtitle: "" }; var defaultNominee = { displayName: "", slot: -1, selected: false }; // EXTERNAL MODULE: ./src/components/InlineConfirm.tsx var InlineConfirm = __webpack_require__(92414); // EXTERNAL MODULE: ./node_modules/@mdi/js/mdi.js var mdi = __webpack_require__(55317); ;// CONCATENATED MODULE: ./src/components/award/AwardModal.tsx var AwardModal = function(props) { var open = props.open, onClose = props.onClose, data = props.data; var ref = (0,react.useState)(open), _open = ref[0], _setOpen = ref[1]; var ref1 = (0,react.useState)(onClose), _onClose = ref1[0], _setOnClose = ref1[1]; var ref2 = (0,react.useState)((0,_object_spread/* default */.Z)({}, data)), _data = ref2[0], _setData = ref2[1]; var ref3 = (0,react.useState)((0,_object_spread/* default */.Z)({}, data)), _originalData = ref3[0], _setOriginalData = ref3[1]; var ref4 = (0,react.useState)(false), _addNominee = ref4[0], _setAddNominee = ref4[1]; var ref5 = (0,react.useState)(false), _addNomineeLoading = ref5[0], _setAddNomineeLoading = ref5[1]; var ref6 = (0,react.useState)((0,_object_spread/* default */.Z)({}, defaultNominee)), _addNomineeData = ref6[0], _setAddNomineeData = ref6[1]; var ref7 = (0,react.useState)(0), blurOpacity = ref7[0], setBlurOpacity = ref7[1]; var ref8 = (0,react.useState)(false), _nomineeModal = ref8[0], _setNomineeModal = ref8[1]; var ref9 = (0,react.useState)([]), _nomineeList = ref9[0], _setNomineeList = ref9[1]; var ref10 = (0,react.useState)(false), _awardSaveLoading = ref10[0], _setAwardSaveLoading = ref10[1]; var ref11 = (0,react.useState)(false), _awardNextUpLoading = ref11[0], _setAwardNextUpLoading = ref11[1]; var ref12 = (0,react.useState)(false), _awardDeleteLoading = ref12[0], _setAwardDeleteLoading = ref12[1]; var ref13 = (0,react.useState)(false), _nomineeListLoading = ref13[0], _setNomineeListLoading = ref13[1]; var ref14 = (0,react.useState)([]), _checkedNominees = ref14[0], _setCheckedNominees = ref14[1]; var ref15 = (0,react.useState)(false), _appendNomineeLoading = ref15[0], _setAppendNomineeLoading = ref15[1]; var ref16 = (0,react.useState)(false), _decideCheck = ref16[0], _setDecideCheck = ref16[1]; var ref17 = (0,react.useState)(-1), _editIndex = ref17[0], _setEditIndex = ref17[1]; var ref18 = (0,react.useState)(""), _editNomineeName = ref18[0], _setEditNomineeName = ref18[1]; var ref19 = (0,react.useState)(false), _changePending = ref19[0], _setChangePending = ref19[1]; var ref20 = (0,react.useState)(-1), _deletingNominee = ref20[0], _setDeletingNominee = ref20[1]; var classes = useStyles(); var i = 0; var closeMe = function() { for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ args[_key] = arguments[_key]; } _setAddNominee(false); _setDecideCheck(false); _setAddNomineeData((0,_object_spread/* default */.Z)({}, defaultNominee)); props.endEditAward(true); }; var addNomineeList = function() { var _ref = (0,_async_to_generator/* default */.Z)(function() { var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, nomineeId, err; return (0,tslib_es6.__generator)(this, function(_state) { switch(_state.label){ case 0: _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; _state.label = 1; case 1: _state.trys.push([ 1, 6, 7, 8 ]); _iterator = _checkedNominees[Symbol.iterator](); _state.label = 2; case 2: if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [ 3, 5 ]; nomineeId = _step.value; return [ 4, client/* APIClient.addNomineeToAward */.l.addNomineeToAward(data.id, nomineeId) ]; case 3: _state.sent(); _state.label = 4; case 4: _iteratorNormalCompletion = true; return [ 3, 2 ]; case 5: return [ 3, 8 ]; case 6: err = _state.sent(); _didIteratorError = true; _iteratorError = err; return [ 3, 8 ]; case 7: try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally{ if (_didIteratorError) { throw _iteratorError; } } return [ 7 ]; case 8: return [ 2 ]; } }); }); return function addNomineeList() { return _ref.apply(this, arguments); }; }(); var getNominees = function() { _setNomineeListLoading(true); client/* APIClient.getNominees */.l.getNominees().then(function(results) { _setNomineeList(results); _setNomineeListLoading(false); }); }; var toggleCheckedNominee = function(toggle, nomineeId) { var idx = _checkedNominees.findIndex(function(v) { return v === nomineeId; }); var tmp = (0,_to_consumable_array/* default */.Z)(_checkedNominees); if (toggle === true) { if (idx !== -1) { return; } _setCheckedNominees((0,_to_consumable_array/* default */.Z)(_checkedNominees).concat([ nomineeId ])); } else { if (idx === -1) { return; } tmp.splice(idx, 1); _setCheckedNominees((0,_to_consumable_array/* default */.Z)(tmp)); } }; var onDragEnd = function(result, provided) { if (!result.destination) { return; } var items = (0,util/* reorder */.HP)((0,_to_consumable_array/* default */.Z)(_data.nominees), result.source.index, result.destination.index); var orderedItems = items.map(function(v, i) { v.slot = i; return v; }); _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: orderedItems })); }; (0,react.useEffect)(function() { _setOpen(open); if (open === true) { _setDecideCheck(data.decision === "decided"); } }, [ open ]); (0,react.useEffect)(function() { _setOnClose(onClose); }, [ onClose ]); (0,react.useEffect)(function() { _setData((0,_object_spread/* default */.Z)({}, data)); _setOriginalData((0,_object_spread/* default */.Z)({}, data)); }, [ data ]); (0,react.useEffect)(function() { var nm = JSON.parse(JSON.stringify(_originalData.nominees)); _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _originalData), { nominees: nm })); }, [ _originalData ]); (0,react.useEffect)(function() { var check1 = JSON.stringify(_data) !== JSON.stringify(_originalData); _setChangePending(check1); }, [ JSON.stringify(_data) ]); (0,react.useEffect)(function() { if (_decideCheck === true) { updateData("decision", "decided"); } else { updateData("decision", "undecided"); } }, [ _decideCheck ]); var updateData = function(key, value) { var tmpData = (0,_object_spread/* default */.Z)({}, _data); tmpData[key] = value; _setData(tmpData); }; var ref21 = (0,react.useState)(""), _winner = ref21[0], _setWinner = ref21[1]; var setWinner = function(checked, nominee) { if (checked) { var nominees = (0,_to_consumable_array/* default */.Z)(_data.nominees); var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = nominees[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ var nom = _step.value; if (nom.displayName === nominee.displayName) { nom.selected = true; } else { nom.selected = false; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally{ try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally{ if (_didIteratorError) { throw _iteratorError; } } } _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: (0,_to_consumable_array/* default */.Z)(nominees) })); } else { var nominees1 = (0,_to_consumable_array/* default */.Z)(data.nominees); var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined; try { for(var _iterator1 = nominees1[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){ var nom1 = _step1.value; nom1.selected = false; } } catch (err) { _didIteratorError1 = true; _iteratorError1 = err; } finally{ try { if (!_iteratorNormalCompletion1 && _iterator1.return != null) { _iterator1.return(); } } finally{ if (_didIteratorError1) { throw _iteratorError1; } } } _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: (0,_to_consumable_array/* default */.Z)(nominees1) })); } }; var saveAward = function() { var _ref = (0,_async_to_generator/* default */.Z)(function() { var response, response1, e; return (0,tslib_es6.__generator)(this, function(_state) { switch(_state.label){ case 0: _state.trys.push([ 0, 5, , 6 ]); if (!(_data.id !== "")) return [ 3, 2 ]; return [ 4, client/* APIClient.saveAward */.l.saveAward(_data) ]; case 1: response = _state.sent(); return [ 3, 4 ]; case 2: return [ 4, client/* APIClient.createAward */.l.createAward(_data) ]; case 3: response1 = _state.sent(); _state.label = 4; case 4: return [ 3, 6 ]; case 5: e = _state.sent(); throw e; case 6: return [ 2 ]; } }); }); return function saveAward() { return _ref.apply(this, arguments); }; }(); var commitNominee = function() { _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: (0,_to_consumable_array/* default */.Z)(_data.nominees).concat([ _addNomineeData ]) })); // _setAddNomineeData({ ...defaultNominee }); _setAddNominee(false); _setAddNomineeData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _addNomineeData), { displayName: "" })); }; var uploaderRef = /*#__PURE__*/ (0,react.createRef)(); var nomineeUploaderRef = /*#__PURE__*/ (0,react.createRef)(); return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Modal/* default */.Z, { className: classes.modal, open: _open, onClose: function() { for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ args[_key] = arguments[_key]; } closeMe(args); }, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Card/* default */.Z, { className: classes.modalPaper, children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(CardContent/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Modal/* default */.Z, { className: classes.modal, open: _nomineeModal, onClose: function() { return null; }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Paper/* default */.Z, { className: classes.modalPaper, style: { width: "300px", height: "400px" }, children: _nomineeListLoading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, {}) : /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(Button/* default */.Z, { variant: "contained", color: "primary", startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiContentSave */.Tls }) }), disabled: _appendNomineeLoading, onClick: function() { _setAppendNomineeLoading(true); addNomineeList().then(function() { _setAppendNomineeLoading(false); props.refresh(); }); }, children: [ "Save (", _checkedNominees.length, ")" ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { variant: "contained", color: "inherit", onClick: function() { _setNomineeModal(false); _setCheckedNominees([]); }, children: "Close" }) ] }) }) }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.Z, { container: true, style: { justifyContent: "end" }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.Z, { item: true, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { color: "primary", variant: "contained", style: { margin: "5px" }, startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiContentSave */.Tls }) }), onClick: function() { _setAwardSaveLoading(true); saveAward().then(function() { props.refresh(function() { _setChangePending(false); }); }).catch(function(e) { console.log("ERROE", e); }).finally(function() { _setAwardSaveLoading(false); }); }, children: _awardSaveLoading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, { size: 25, variant: "indeterminate", color: "inherit" }) : "Save ".concat(_changePending ? "*" : "") }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { style: { margin: "5px" }, variant: "contained", color: "primary", disabled: data.nextUp || _awardNextUpLoading, onClick: function() { _setAwardNextUpLoading(true); client/* APIClient.setAwardNextUp */.l.setAwardNextUp(data.id).then(function() { props.refresh(); }).catch(function() {}).finally(function() { _setAwardNextUpLoading(false); }); }, children: _awardNextUpLoading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, { size: 25, variant: "indeterminate", color: "inherit" }) : "Set Next Up" }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { variant: "contained", color: "secondary", style: { margin: "5px" }, startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiDelete */.x9U }) }), onClick: function() { _setAwardDeleteLoading(true); client/* APIClient.deleteAward */.l.deleteAward(data.id).then(function() { console.log("complete"); closeMe(); props.refresh(); }).catch(function() {}).finally(function() { _setAwardDeleteLoading(false); }); }, children: _awardDeleteLoading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, { size: 25, variant: "indeterminate", color: "inherit" }) : "Delete" }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { item: true, sm: 1, style: { textAlign: "right" }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon/* default */.Z, { style: { cursor: "pointer" }, onClick: function() { return closeMe(); }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiClose */.r5M }) }) }) }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { container: true, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { item: true, sm: 12, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.Z, { container: true, style: { marginTop: "10px" }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.Z, { item: true, sm: 12, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(TextField/* default */.Z, { style: { width: "420px" }, label: "Display Name*", required: true, value: _data.displayName, variant: "outlined", onChange: function(e) { updateData("displayName", e.target.value); } }), /*#__PURE__*/ (0,jsx_runtime.jsx)("input", { hidden: true, ref: uploaderRef, type: "file", onChange: function(e) { console.log("uploading"); client/* APIClient.uploadAwardImage */.l.uploadAwardImage(e.target.files.item(0)).then(function(v) { console.log("RESPONSE", v); updateData("image", v.Location); }).catch(function(e) { console.log("ERROR", e); }); } }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { item: true, sm: 12, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(TextField/* default */.Z, { style: { width: "420px" }, label: "Subtitle", variant: "outlined", value: _data.subtitle, onChange: function(e) { updateData("subtitle", e.target.value); } }) }) ] }) }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { container: true, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.Z, { item: true, xs: 12, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Typography/* default */.Z, { children: "Nominees" }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { color: "primary", startIcon: /*#__PURE__*/ (0,jsx_runtime.jsxs)(SvgIcon/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiPlusBox */.U1m }), " " ] }), onClick: function() { _setAddNominee(true); }, disabled: _addNominee, children: "Add" }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(List/* default */.Z, { style: { overflowY: "auto" }, children: [ _addNominee && /*#__PURE__*/ (0,jsx_runtime.jsx)(ListItem/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItemText/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(TextField/* default */.Z, { placeholder: "Nominee Name", value: _addNomineeData.displayName, onChange: function(e) { _setAddNomineeData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _addNomineeData), { displayName: e.target.value })); }, onKeyDown: function(e) { if (e.key === "Enter") { commitNominee(); } } }), /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", { style: { textAlign: "right" }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { variant: "contained", color: "inherit", style: { marginRight: "5px" }, onClick: function() { _setAddNominee(false); _setAddNomineeData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _addNomineeData), { displayName: "" })); }, children: "Cancel" }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { variant: "contained", color: "primary", disabled: _addNomineeLoading, onClick: function() { commitNominee(); }, children: "Confirm" }) ] }) ] }) }, "add-nominee-1"), /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* DragDropContext */.Z5, { onDragEnd: onDragEnd, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Droppable */.bK, { droppableId: "droppable2", children: function(provided, snapshot) { return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, provided.droppableProps), { ref: provided.innerRef, children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { style: { maxHeight: "300px", overflowY: "auto", minHeight: "300px" }, children: _data.nominees.map(function(nominee, i) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Draggable */._l, { draggableId: "".concat(nominee.displayName, "-").concat(i), index: i, children: function(provided, snapshot) { return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItem/* default */.Z, { onContextMenu: function(e) { e.preventDefault(); props.openMenu(nominee, "nominee"); }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItemText/* default */.Z, { children: [ _editIndex === i ? /*#__PURE__*/ (0,jsx_runtime.jsx)(TextField/* default */.Z, { defaultValue: nominee.displayName, onChange: function(e) { _setEditNomineeName(e.target.value); } }) : nominee.displayName, " ", _originalData.nominees.find(function(v) { return v.displayName.toUpperCase() === nominee.displayName.toUpperCase(); }) ? null : "*" ] }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItemSecondaryAction/* default */.Z, { children: [ _editIndex === i ? /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, { onClick: function() { var tmpArr = (0,_to_consumable_array/* default */.Z)(_data.nominees); tmpArr[i].displayName = _editNomineeName; _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: tmpArr })); _setEditIndex(-1); }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiContentSave */.Tls }) }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, { onClick: function() { _setEditIndex(-1); _setEditNomineeName(nominee.displayName); }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiCloseCircle */.lY3 }) }) }) ] }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, { onClick: function() { _setEditIndex(i); }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiPencil */.r9 }) }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Checkbox/* default */.Z, { checked: nominee.selected, onChange: function(e) { setWinner(e.target.checked, nominee); } }), /*#__PURE__*/ (0,jsx_runtime.jsx)(InlineConfirm/* InlineConfirm */.v, { loading: _deletingNominee === i, onConfirm: function() { if (_originalData.nominees.find(function(v) { return v.displayName.toUpperCase() === nominee.displayName.toUpperCase(); })) { _setDeletingNominee(i); client/* APIClient.removeNomineeFromAward */.l.removeNomineeFromAward(data.id, nominee.displayName).then(function() { props.refresh(function() { _setDeletingNominee(-1); }); }); } else { var tmpArr = (0,_to_consumable_array/* default */.Z)(_data.nominees); tmpArr.splice(i, 1); _setData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, _data), { nominees: tmpArr })); } } }) ] }) ] }, "nominee-".concat(i)), /*#__PURE__*/ (0,jsx_runtime.jsx)(Divider/* default */.Z, { component: "li" }) ] }), "provided-".concat(i)); } }, "".concat(nominee.displayName, "-").concat(i + 1)) }); }) }) }), "dropItem-".concat(i++)); } }) }) ] }) ] }) }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(CardActions/* default */.Z, { style: { justifyContent: "flex-end" } }) ] }) }) }); }; // EXTERNAL MODULE: ./src/components/ConfirmationModal.tsx var ConfirmationModal = __webpack_require__(83898); // EXTERNAL MODULE: ./src/hoc/withLayout.tsx + 2 modules var withLayout = __webpack_require__(30988); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/Box/Box.js + 12 modules var Box = __webpack_require__(80343); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/ListItemIcon/ListItemIcon.js var ListItemIcon = __webpack_require__(46869); // EXTERNAL MODULE: ./node_modules/@material-ui/core/esm/FormControlLabel/FormControlLabel.js var FormControlLabel = __webpack_require__(30553); // EXTERNAL MODULE: ./node_modules/@mdi/react/Icon.js var react_Icon = __webpack_require__(8849); ;// CONCATENATED MODULE: ./src/components/award/AwardItem.tsx var AwardItem = function(props) { var classes = useStyles(); var award = props.award, setActiveLoading = props.setActiveLoading, activeLoading = props.activeLoading; var toggleCheck = function(id, checked) { setActiveLoading({ id: id, state: true }); if (checked) { client/* APIClient.setAwardNextUp */.l.setAwardNextUp(award.id).then(function() { props.refresh(function() { setActiveLoading((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, activeLoading), { state: false })); }); }); } else { var tmpAward = (0,_object_spread/* default */.Z)({}, award); tmpAward.nextUp = false; client/* APIClient.saveAward */.l.saveAward(tmpAward).then(function() { props.refresh(function() { setActiveLoading((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, activeLoading), { state: false })); }); }); } }; (0,react.useEffect)(function() { _setNextUpChecked(award.nextUp); }, [ award ]); var ref = (0,react.useState)(false), _nextUpChecked = ref[0], _setNextUpChecked = ref[1]; return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItem/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(ListItemIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", { style: { color: award.nominees.some(function(v) { return v.selected === true; }) ? "#E5B45CFF" : "#DDD" }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_Icon.Icon, { size: 1, path: mdi/* mdiStar */.Vip }) }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(ListItemText/* default */.Z, { primary: award.displayName, secondary: award.subtitle === "" ? "No Subtitle" : award.subtitle }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItemSecondaryAction/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, { onClick: function() { props.beginEditAward(award); }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_Icon.Icon, { size: 1, path: mdi/* mdiPencil */.r9 }) }), activeLoading.id === award.id && activeLoading.state === true ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, { size: 30, color: "primary", variant: "indeterminate" }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(FormControlLabel/* default */.Z, { control: /*#__PURE__*/ (0,jsx_runtime.jsx)(Checkbox/* default */.Z, { disabled: activeLoading.id !== award.id && activeLoading.state === true, checked: _nextUpChecked, onChange: function(e) { toggleCheck(award.id, e.target.checked); } }), label: "Next Up Toggle", labelPlacement: "end" }) ] }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Divider/* default */.Z, { component: "hr" }) ] }); }; ;// CONCATENATED MODULE: ./src/components/award/AwardList.tsx var AwardList = function(props) { var awards = props.awards; var ref = (0,react.useState)(false), _menuOpen = ref[0], _setMenuOpen = ref[1]; var ref1 = (0,react.useState)(false), reorderLoading = ref1[0], setReorderloading = ref1[1]; var onDragEnd = function(result, provided) { if (!result.destination) { return; } setReorderloading(true); var items = (0,util/* reorder */.HP)((0,_to_consumable_array/* default */.Z)(awards), result.source.index, result.destination.index); var orderedItems = items.map(function(v, i) { v.slot = i; return v; }); props.setAwards(orderedItems); client/* APIClient.saveAwardBatch */.l.saveAwardBatch(orderedItems).then(function() { props.refresh(function() { setReorderloading(false); }); }).catch(function() { setReorderloading(false); }); }; var ref2 = (0,react.useState)({ id: "", state: false }), activeLoading = ref2[0], setActiveLoading = ref2[1]; return /*#__PURE__*/ (0,jsx_runtime.jsx)(react.Fragment, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { sx: { flexGrow: 1 }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { container: true, spacing: 2, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { item: true, lg: 9, xs: 12, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* DragDropContext */.Z5, { onDragEnd: onDragEnd, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Droppable */.bK, { droppableId: "droppable", children: function(provided, snapshot) { return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, provided.droppableProps), { ref: provided.innerRef, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(List/* default */.Z, { children: [ reorderLoading && /*#__PURE__*/ (0,jsx_runtime.jsxs)(ListItem/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(ListItemText/* default */.Z, { children: "Updating order..." }), /*#__PURE__*/ (0,jsx_runtime.jsx)(ListItemSecondaryAction/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, { variant: "indeterminate", color: "primary" }) }) ] }), awards.map(function(award, i) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Draggable */._l, { draggableId: award.id, index: i, isDragDisabled: reorderLoading, children: function(provided, snapshot) { return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps), { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.Z, { item: true, xs: 12, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(AwardItem, { setActiveLoading: setActiveLoading, activeLoading: activeLoading, award: award, beginEditAward: props.beginEditAward, openMenu: props.openMenu, setAwards: props.setAwards, refresh: props.refresh, awards: props.awards, reorderLoading: reorderLoading, setReorderLoading: setReorderloading }) }) })); } }, award.id); }) ] }) })); } }) }) }) }) }) }); }; ;// CONCATENATED MODULE: ./src/pages/index.tsx /** * Will start editing an award with given parameter */ function Awards() { var classes = useStyles(); var ref = (0,react.useState)([]), awards = ref[0], setAwards = ref[1]; var ref1 = (0,react.useState)(false), awardModalOpen = ref1[0], setAwardModalOpen = ref1[1]; var ref2 = (0,react.useState)(defaultAward), awardEditData = ref2[0], setAwardEditData = ref2[1]; var ref3 = (0,react.useState)(false), _menuOpen = ref3[0], _setMenuOpen = ref3[1]; var ref4 = (0,react.useState)({ mouseX: null, mouseY: null }), contextState = ref4[0], setContextState = ref4[1]; var nullFile = new File([ new ArrayBuffer(0) ], ""); var ref5 = (0,react.useState)(false), _awardsLoading = ref5[0], _setAwardsLoading = ref5[1]; var ref6 = (0,react.useState)(false), _truncateVisible = ref6[0], _setTruncateVisible = ref6[1]; var ref7 = (0,react.useState)(false), _beforeUpload = ref7[0], _setBeforeUpload = ref7[1]; var ref8 = (0,react.useState)(""), _jsonData = ref8[0], _setJsonData = ref8[1]; var ref9 = (0,react.useState)(""), _jsonType = ref9[0], _setJsonType = ref9[1]; var ref10 = (0,react.useState)(nullFile), _file = ref10[0], _setFile = ref10[1]; var uploaderRef = /*#__PURE__*/ (0,react.createRef)(); var openMenu = function(data, type) { var state = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; _setMenuOpen(state); _setJsonData(JSON.stringify(data, null, 2)); _setJsonType(type); }; var getAwards = function() { var _ref = (0,_async_to_generator/* default */.Z)(function() { return (0,tslib_es6.__generator)(this, function(_state) { _setAwardsLoading(true); return [ 2, client/* APIClient.getAwards */.l.getAwards().then(function(data) { setAwards(data); _setAwardsLoading(false); if (awardEditData.id === "" && awardModalOpen === true) { setAwardModalOpen(false); setAwardEditData(defaultAward); return; } var currentEdit = data.find(function(v) { return v.id === awardEditData.id; }); if (currentEdit) { setAwardEditData(currentEdit); } }).catch(function(e) { console.error("failed to fetch awards", e); _setAwardsLoading(false); }) ]; }); }); return function getAwards() { return _ref.apply(this, arguments); }; }(); var beginEditAward = function(award) { setAwardModalOpen(true); setAwardEditData(award); }; var endEditAward = function(reset) { setAwardModalOpen(false); setAwardEditData(defaultAward); }; var beginNewAward = function() { setAwardModalOpen(true); setAwardEditData((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, defaultAward), { displayName: "" })); }; var refresh = function(cb) { getAwards().then(function() { if (typeof cb === "function") { cb(); } }); }; (0,react.useEffect)(function() { if (_file.size > 0) { _setBeforeUpload(true); } }, [ _file ]); (0,react.useEffect)(function() { refresh(); }, []); return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(ConfirmationModal/* default */.Z, { confirmationAction: function() { _setAwardsLoading(true); client/* APIClient.truncateAwards */.l.truncateAwards().then(function() { refresh(); }); }, header: "Delete All Awards?", toggleVisibility: function(v) { return _setTruncateVisible(v); }, visible: _truncateVisible }), /*#__PURE__*/ (0,jsx_runtime.jsx)(ConfirmationModal/* default */.Z, { confirmationAction: function() { _setAwardsLoading(true); client/* APIClient.generateAwards */.l.generateAwards(_file).then(function() { refresh(); _setFile(nullFile); }).catch(function() { _setFile(nullFile); }); }, header: "Upload Awards Data?", toggleVisibility: function(v) { return _setBeforeUpload(v); }, visible: _beforeUpload }), /*#__PURE__*/ (0,jsx_runtime.jsx)(AwardModal, { refresh: refresh, endEditAward: endEditAward, onClose: function() { return null; }, open: awardModalOpen, data: awardEditData, openMenu: openMenu, setAwards: setAwards, awards: awards }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { style: { margin: "10px" }, variant: "contained", color: "primary", startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiPlusBox */.U1m }) }), onClick: function() { beginNewAward(); }, children: "Add Award" }), /*#__PURE__*/ (0,jsx_runtime.jsx)("input", { type: "file", ref: uploaderRef, hidden: true, accept: "application/json", onChange: function(e) { var target = e.target.files.item(0); if (target) { _setFile(target); } } }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { variant: "contained", style: { backgroundColor: "green", color: "white" }, startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiPaperclip */.P6k }) }), onClick: function() { if (uploaderRef.current) { _setFile(nullFile); uploaderRef.current.value = null; uploaderRef.current.click(); } }, children: "Upload" }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { style: { margin: "10px" }, variant: "contained", color: "secondary", startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(SvgIcon/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { d: mdi/* mdiDeleteSweep */.MNB }) }), disabled: _awardsLoading || (awards === null || awards === void 0 ? void 0 : awards.length) === 0, onClick: function() { _setTruncateVisible(true); }, children: "Delete All" }), _awardsLoading && /*#__PURE__*/ (0,jsx_runtime.jsx)(LinearProgress/* default */.Z, { color: "primary", variant: "indeterminate" }), awards.length > 0 ? /*#__PURE__*/ (0,jsx_runtime.jsx)(AwardList, { refresh: refresh, openMenu: openMenu, endEditAward: endEditAward, awards: awards, beginEditAward: beginEditAward, setAwards: setAwards }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(Typography/* default */.Z, { variant: "h4", children: "No awards" }) ] }); } /* harmony default export */ var pages = ((0,withLayout/* default */.Z)({ breadcrumbs: [ { active: true, name: "Awards" } ], title: "Awards" })(Awards)); /***/ }) }, /******/ function(__webpack_require__) { // webpackRuntimeModules /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } /******/ __webpack_require__.O(0, [7702,630,5624,5401,4019,6683,6131,4905,7321,3915,4332,988,1884,9774,2888,179], function() { return __webpack_exec__(48312); }); /******/ var __webpack_exports__ = __webpack_require__.O(); /******/ _N_E = __webpack_exports__; /******/ } ]);