diff --git a/client/dist/completedProjects.bundle.js b/client/dist/completedProjects.bundle.js
index a96b6e4d1a967611b7261a651fe44ea3eb35018e..3218af28339d6a41a6bc7523583a3c6eac5e3b53 100644
--- a/client/dist/completedProjects.bundle.js
+++ b/client/dist/completedProjects.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/currentProjects.bundle.js b/client/dist/currentProjects.bundle.js
index 8e0f54b502d782ff296e29b9aab295fc6c482aac..9d60ee253ae902710b02467afaaf58da15425a02 100644
--- a/client/dist/currentProjects.bundle.js
+++ b/client/dist/currentProjects.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/homePage.bundle.js b/client/dist/homePage.bundle.js
index 92435d47a8989daee3437c22118930460adf1dc3..f30d69334dab585dfeaf48063d1d392f0e24963d 100644
--- a/client/dist/homePage.bundle.js
+++ b/client/dist/homePage.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/ideaBank.bundle.js b/client/dist/ideaBank.bundle.js
index 451baa6308eb112f7922a839878f9ec463f1ea30..be49d84c69714f88409e9f27d0bbc061092d41c7 100644
--- a/client/dist/ideaBank.bundle.js
+++ b/client/dist/ideaBank.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/initiateIdea.bundle.js b/client/dist/initiateIdea.bundle.js
index c40ea1e22ea8b1bdea9bdf7d5ba52d0988efc444..3461b2566e72281d63fbd3d0e519960208f2d376 100644
--- a/client/dist/initiateIdea.bundle.js
+++ b/client/dist/initiateIdea.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/login.bundle.js b/client/dist/login.bundle.js
index 57f1ae80c0021b4238ddd95a8176006102c0855f..25ab92cf1484f6817d32b9245391c6aac7de12fa 100644
--- a/client/dist/login.bundle.js
+++ b/client/dist/login.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/makeSuggestion.bundle.js b/client/dist/makeSuggestion.bundle.js
index 67fd354980e2ffb05bb63048bdcd4bd10b1b904c..562603b8c40b6ee06fb7b71a6aeecf347f689544 100644
--- a/client/dist/makeSuggestion.bundle.js
+++ b/client/dist/makeSuggestion.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/pageHandler.bundle.js b/client/dist/pageHandler.bundle.js
index 15526d1b5215dcf5d184cdee19ece3147d4bbe80..f04320ea8352409ec2f8dad15ae78b60c391317e 100644
--- a/client/dist/pageHandler.bundle.js
+++ b/client/dist/pageHandler.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/projectPageA.bundle.js b/client/dist/projectPageA.bundle.js
index 23dfc7a6e4892fa260ae60c2b75d8e403d18d47c..7cb4c0a94f9371d3a6c5271bab4482394c627535 100644
--- a/client/dist/projectPageA.bundle.js
+++ b/client/dist/projectPageA.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/projectPageG.bundle.js b/client/dist/projectPageG.bundle.js
index 8d79b14d58eaa59fc009f110749e1c76abe17049..7dd3e44ce823db807c416842749d9da707c8f56d 100644
--- a/client/dist/projectPageG.bundle.js
+++ b/client/dist/projectPageG.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/projectPageP.bundle.js b/client/dist/projectPageP.bundle.js
index 0da3717725008d46f7d29b718cfb32ae682a5ac5..203524de9994f547502fc067573a55b24c8e1caa 100644
--- a/client/dist/projectPageP.bundle.js
+++ b/client/dist/projectPageP.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/client/dist/projectPageS.bundle.js b/client/dist/projectPageS.bundle.js
index 2cb716143ae9bd84f473941220e05e4c8a315d0b..98a6cb319c1404cc7987803fd76091eb76b316d9 100644
--- a/client/dist/projectPageS.bundle.js
+++ b/client/dist/projectPageS.bundle.js
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \****************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */   getProjects: () => (/* binding */ getProjects),\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_database_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./projectPage/projectPage.js */ \"./client/projectPage/projectPage.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert(\"logout\");\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_1__.logout)();\n}\nvar myIdeaCards = {};\nvar cache = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID, dateCreated) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n    this.dateCreated = dateCreated;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \" \").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateCreated), \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n              <div class=\\\"upvoteDivHP\\\">\\n              <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>              <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\"> \").concat(this.upvoteCount, \"</div>\\n\\n              </div>\\n          </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id, suggestion.dateCreated);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n          addListner(userSuggestions, container);\n        case 9:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID, dateCreated) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID, dateCreated);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n      while (1) switch (_context6.prev = _context6.next) {\n        case 0:\n          container = document.querySelector(\"#container-fluid\");\n          if (container) {\n            _context6.next = 3;\n            break;\n          }\n          return _context6.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch(\"homePage.html\").then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n              var _this3 = this;\n              var tempContainer, specificElement, inputNotes, _tmp, uid, _user, userNotes, tmp, user, suggestionContainer, nameHeaderElement, userFullName, projectContainer, startGetProjects, departmentContainer, departmentDiv;\n              return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                while (1) switch (_context5.prev = _context5.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement(\"div\");\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector(\".main-content\");\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    inputNotes = document.getElementById(\"input-text-notes\");\n                    if (!inputNotes) {\n                      _context5.next = 20;\n                      break;\n                    }\n                    console.log(\"InputNotes exist\");\n                    _tmp = localStorage.getItem(\"user\");\n                    if (_tmp) {\n                      _context5.next = 11;\n                      break;\n                    }\n                    console.log(\"There is not a user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 11:\n                    uid = JSON.parse(_tmp)[0].uid;\n                    _context5.next = 14;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getUsers)({\n                      uid: uid\n                    });\n                  case 14:\n                    _user = _context5.sent;\n                    userNotes = _user[0].notes; // Set the value of the input box\n                    inputNotes.value = userNotes || \"\";\n                    inputNotes.addEventListener(\"input\", function () {\n                      return __awaiter(_this3, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n                        var inputNotesValue;\n                        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                          while (1) switch (_context4.prev = _context4.next) {\n                            case 0:\n                              inputNotesValue = inputNotes.value;\n                              _context4.prev = 1;\n                              if (!_user[0].id) {\n                                _context4.next = 6;\n                                break;\n                              }\n                              _context4.next = 5;\n                              return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.addNoteToUser)(_user[0].id, inputNotesValue);\n                            case 5:\n                              console.log(\"Saved notes\");\n                            case 6:\n                              _context4.next = 11;\n                              break;\n                            case 8:\n                              _context4.prev = 8;\n                              _context4.t0 = _context4[\"catch\"](1);\n                              console.log(\"Error saving notes\", _context4.t0);\n                            case 11:\n                            case \"end\":\n                              return _context4.stop();\n                          }\n                        }, _callee4, null, [[1, 8]]);\n                      }));\n                    });\n                    _context5.next = 21;\n                    break;\n                  case 20:\n                    console.log(\"No notes to be saved\");\n                  case 21:\n                    tmp = localStorage.getItem(\"user\");\n                    console.log(tmp);\n                    if (tmp) {\n                      _context5.next = 26;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context5.abrupt(\"return\");\n                  case 26:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context5.next = 32;\n                      break;\n                    }\n                    _context5.next = 31;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 31:\n                    addListner(myIdeaCards, container);\n                  case 32:\n                    nameHeaderElement = document.getElementById(\"user-name-header\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    if (nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      startGetProjects = performance.now();\n                      getProjects(projectContainer, listenersLoaded, user.id);\n                      console.log(\"getProjects duration: \".concat(performance.now() - startGetProjects, \" ms\"));\n                    }\n                    console.log(\"innan\");\n                    departmentContainer = document.getElementById(\"department-container\");\n                    departmentDiv = document.getElementById(\"nolanAct\");\n                    if (!(departmentContainer && document.getElementById(\"nolanAct\") && departmentDiv.innerHTML.trim() === \"\")) {\n                      _context5.next = 44;\n                      break;\n                    }\n                    console.log(\"anropar funktionen\");\n                    _context5.next = 44;\n                    return improvementWorkInfo(departmentContainer, user);\n                  case 44:\n                  case \"end\":\n                    return _context5.stop();\n                }\n              }, _callee5);\n            }));\n          })[\"catch\"](function (error) {\n            console.error(\"Failed to load the external HTML file:\", error);\n          });\n        case 4:\n        case \"end\":\n          return _context6.stop();\n      }\n    }, _callee6);\n  }));\n}\nfunction addEventListener(projectId, card) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {\n    return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n      while (1) switch (_context8.prev = _context8.next) {\n        case 0:\n          $(\"#homepage-\" + projectId).off(\"click\").on(\"click\", function () {\n            return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n              var tmp, currentStage;\n              return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n                while (1) switch (_context7.prev = _context7.next) {\n                  case 0:\n                    _context7.next = 2;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"improvementWork\", projectId);\n                  case 2:\n                    tmp = _context7.sent;\n                    currentStage = tmp.currentStage;\n                    if (currentStage === \"Act\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageA)(projectId);\n                    } else if (currentStage === \"Study\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageS)(projectId);\n                    } else if (currentStage === \"Do\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageG)(projectId);\n                    } else if (currentStage === \"Plan\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    } else if (currentStage === \"Finished\") {\n                      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadProjectPageP)(projectId);\n                    }\n                  case 5:\n                  case \"end\":\n                    return _context7.stop();\n                }\n              }, _callee7);\n            }));\n          });\n        case 1:\n        case \"end\":\n          return _context8.stop();\n      }\n    }, _callee8);\n  }));\n}\nvar patientRiskLevelMapping = {\n  Grön: \"Green\",\n  Blå: \"Blue\",\n  Gul: \"Yellow\",\n  Röd: \"Red\"\n};\nvar nolanStageMapping = {\n  Planera: \"Plan\",\n  Göra: \"Do\",\n  Studera: \"Study\",\n  Agera: \"Act\"\n};\n/*\nasync function performSearch(searchBar: HTMLInputElement, container: HTMLElement) {\n  let inputValue = searchBar.value;\n  //make first character uppercase\n  inputValue = inputValue.toLowerCase();\n  console.log(\"Search query:\", inputValue);\n  // Remove each element\n  projectCards = [];\n\n  let query: { [key: string]: string } = {};\n\n  removeCardsFromDiv(\"div.projectCardCardDiv\");\n    \n  if (inputValue !== \"\") {\n    const matchedStage = Object.keys(nolanStageMapping).find((stage) =>\n      stage.toLowerCase().includes(inputValue.toLowerCase())\n    );\n\n    if (matchedStage) {\n      query.nolanStage = nolanStageMapping[matchedStage];\n    } else {\n      query.name = inputValue;\n    }\n  }\n  filteredImprovementWorks = await getImprovementWorks(query);\n  await getProjects(container, true, filteredImprovementWorks);\n}\n*/\nfunction improvementWorkInfo(departmentContainer, user) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {\n    var improvementWorks, improvementWorksPlan, improvementWorksDo, improvementWorkStudy, improvementWorksAct, _iterator, _step, improvementWork, improvementWorkContainer, improvementWorkContainerElement, nolanAct, actElement, nolanPlan, planElement, nolanDo, doElement, nolanStudy, studyElement;\n    return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n      while (1) switch (_context9.prev = _context9.next) {\n        case 0:\n          _context9.next = 2;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorks)({\n            unitId: user.unitId\n          });\n        case 2:\n          improvementWorks = _context9.sent;\n          console.log(\"i funktionen\");\n          //Count number of improvement works in the department in each stage\n          improvementWorksPlan = 0;\n          improvementWorksDo = 0;\n          improvementWorkStudy = 0;\n          improvementWorksAct = 0;\n          _iterator = _createForOfIteratorHelper(improvementWorks);\n          try {\n            for (_iterator.s(); !(_step = _iterator.n()).done;) {\n              improvementWork = _step.value;\n              if (improvementWork.currentStage == \"Plan\") {\n                improvementWorksPlan += 1;\n              } else if (improvementWork.currentStage == \"Do\") {\n                improvementWorksDo += 1;\n              } else if (improvementWork.currentStage == \"Study\") {\n                improvementWorkStudy += 1;\n              } else if (improvementWork.currentStage == \"Act\") {\n                improvementWorksAct += 1;\n              }\n            }\n          } catch (err) {\n            _iterator.e(err);\n          } finally {\n            _iterator.f();\n          }\n          improvementWorkContainer = document.getElementById(\"numberOfImprovementWorks\"); //Append a div displaying the number of improvement works in the user's department\n          improvementWorkContainerElement = document.createElement(\"p\");\n          improvementWorkContainerElement.innerHTML = \"Antal pågående förbättringsarbeten i din avdelning: \" + improvementWorks.length;\n          if (improvementWorkContainer && improvementWorkContainer.innerHTML.trim() === \"\") {\n            improvementWorkContainer.appendChild(improvementWorkContainerElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage act\n          nolanAct = document.getElementById(\"nolanAct\");\n          actElement = document.createElement(\"p\");\n          actElement.innerHTML = \"Agera: \" + improvementWorksAct;\n          actElement.style.margin = \"5px\";\n          if (nolanAct) {\n            nolanAct.appendChild(actElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage plan\n          nolanPlan = document.getElementById(\"nolanPlan\");\n          planElement = document.createElement(\"p\");\n          planElement.innerHTML = \"Planera: \" + improvementWorksPlan;\n          planElement.style.margin = \"5px\";\n          if (nolanPlan) {\n            nolanPlan.appendChild(planElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage do\n          nolanDo = document.getElementById(\"nolanDo\");\n          doElement = document.createElement(\"p\");\n          doElement.innerHTML = \"Göra: \" + improvementWorksDo;\n          doElement.style.margin = \"5px\";\n          if (nolanDo) {\n            nolanDo.appendChild(doElement);\n          }\n          //Append the text displaying the number of improvement works that are in the stage study\n          nolanStudy = document.getElementById(\"nolanStudy\");\n          studyElement = document.createElement(\"p\");\n          studyElement.innerHTML = \"Studera: \" + improvementWorkStudy;\n          studyElement.style.margin = \"5px\";\n          if (nolanStudy) {\n            nolanStudy.appendChild(studyElement);\n          }\n        case 34:\n        case \"end\":\n          return _context9.stop();\n      }\n    }, _callee9);\n  }));\n}\nfunction getProjects(selectElement, listenersLoaded, userHsaId) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {\n    var _this4 = this;\n    var data, startGetCachedProjects, startGetImprovementWorksForUser, id;\n    return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n      while (1) switch (_context11.prev = _context11.next) {\n        case 0:\n          data = [];\n          if (!cache[userHsaId]) {\n            _context11.next = 7;\n            break;\n          }\n          startGetCachedProjects = performance.now();\n          data = cache[userHsaId];\n          console.log(\"getCachedProjects duration: \".concat(performance.now() - startGetCachedProjects, \" ms\"));\n          _context11.next = 13;\n          break;\n        case 7:\n          startGetImprovementWorksForUser = performance.now();\n          _context11.next = 10;\n          return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorksForUser)(userHsaId);\n        case 10:\n          data = _context11.sent;\n          cache[userHsaId] = data;\n          console.log(\"getImprovementWorksForUser duration: \".concat(performance.now() - startGetImprovementWorksForUser, \" ms\"));\n        case 13:\n          id = 0;\n          data.forEach(function (project) {\n            return __awaiter(_this4, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {\n              var title, department, responsible, name, description, i, dateStarted, card, startGenerateHTML, cardHTML, div, datesDiv, stageDiv;\n              return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n                while (1) switch (_context10.prev = _context10.next) {\n                  case 0:\n                    title = project.name;\n                    _context10.next = 3;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getObjectById)(\"unit\", project.unitId);\n                  case 3:\n                    department = _context10.sent;\n                    _context10.next = 6;\n                    return (0,_Database_database_js__WEBPACK_IMPORTED_MODULE_0__.getImprovementWorkResponsible)(project.id);\n                  case 6:\n                    responsible = _context10.sent;\n                    if (!department) {\n                      _context10.next = 30;\n                      break;\n                    }\n                    name = responsible.firstName + \" \" + responsible.lastName;\n                    description = project.content;\n                    i = id;\n                    dateStarted = project.dateStarted;\n                    card = new projectCard(i, name, department.name, title, description, project.id, dateStarted);\n                    projectCards[i] = card;\n                    startGenerateHTML = performance.now();\n                    cardHTML = card.generateHTML();\n                    console.log(\"GenerateHTML duration \".concat(performance.now() - startGenerateHTML, \" ms\"));\n                    div = document.createElement(\"div\");\n                    div.className = \"homePageProjectCardDiv\"; // Set the class name(s) here\n                    div.innerHTML = cardHTML;\n                    if (selectElement) {\n                      _context10.next = 22;\n                      break;\n                    }\n                    return _context10.abrupt(\"return\");\n                  case 22:\n                    selectElement.appendChild(div); // Stop if the container isn't found\n                    addEventListener(project.id, card);\n                    if (project.completed) {\n                      datesDiv = document.getElementById(\"ongoingCardDatesHomePage\" + project.id);\n                      if (datesDiv) {\n                        datesDiv.innerText += \" till \" + (0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(project.endDate);\n                      }\n                    }\n                    stageDiv = document.getElementById(\"currentStageLetterHomePage\" + project.id);\n                    if (stageDiv) {\n                      if (project.completed) {\n                        stageDiv.innerText = \"Avslutat\";\n                        stageDiv.style.fontSize = \"25px\";\n                        stageDiv.style.marginLeft = \"5px\";\n                        stageDiv.style.marginTop = \"30px\";\n                      } else if (project.currentStage == \"Plan\") {\n                        stageDiv.innerHTML = \"P\";\n                      } else if (project.currentStage == \"Do\") {\n                        stageDiv.innerHTML = \"G\";\n                      } else if (project.currentStage == \"Study\") {\n                        stageDiv.innerText = \"S\";\n                      } else if (project.currentStage == \"Act\") {\n                        stageDiv.innerText = \"A\";\n                      }\n                    }\n                    id++;\n                    _context10.next = 31;\n                    break;\n                  case 30:\n                    console.log(project.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n                  case 31:\n                  case \"end\":\n                    return _context10.stop();\n                }\n              }, _callee10);\n            }));\n          });\n        case 15:\n        case \"end\":\n          return _context11.stop();\n      }\n    }, _callee11);\n  }));\n}\nvar projectCards = {};\nvar projectCard = /*#__PURE__*/function () {\n  function projectCard(id, name, department, title, description, projectId, dateStarted) {\n    _classCallCheck(this, projectCard);\n    this.name = name;\n    this.department = department;\n    this.title = title;\n    this.description = description;\n    this.id = id;\n    this.projectId = projectId;\n    this.dateStarted = dateStarted;\n    //this.endDate = endDate;\n  }\n  _createClass(projectCard, [{\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }, {\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"homeTotalExpandedOngoingWorkCard\\\">\\n        <div style=\\\"cursor: pointer;\\\" class=\\\"flex-container ongoingCard\\\" id=\\\"homepage-\".concat(this.projectId, \"\\\">\\n            <div class=\\\"ongoingCardImageContainer toSinglePage\\\">\\n              <div id=\\\"borderPinkFaded\\\">\\n                <div class = \\\"flex-box ongoingCardImage toSinglePage\\\">\\n                  <div id=\\\"currentStageLetterHomePage\").concat(this.projectId, \"\\\" style=\\\"font-size: 50px; font-weight: bolder;\\n                  color: #845380;\\n                  position: inherit; margin-left: 35px; margin-top: 10px;\\\"></div>\\n                </div>\\n              </div>\\n            </div>\\n            <div class=\\\"div ongoingCardInfo toSinglePage\\\">\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardIdeaTitle\\\">\").concat(this.title, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardDepartment\\\">\").concat(this.department, \"</p>\\n                <p class=\\\"toSinglePage\\\" id=\\\"ongoingCardManager\\\">\").concat(this.name, \"</p>\\n                <p class=\\\"toSinglePage\\\" style=\\\"font-style: italic; margin-top: 5px;\\\" id=\\\"ongoingCardDatesHomePage\").concat(this.projectId, \"\\\">\").concat((0,_projectPage_projectPage_js__WEBPACK_IMPORTED_MODULE_3__.formatDate)(this.dateStarted), \" </p>\\n            </div>\\n\\n            <!--<button id=\\\"homepage-project-button-\").concat(this.projectId, \"\\\" data-project-id=\\\"\").concat(this.id, \"\\\" class=\\\"projectButton\\\" role=\\\"button\\\">G\\xE5 till projektsidan</button>-->\\n\\n\\n            <div class=\\\"container ongoingSeeCardDetails toSinglePage\\\">\\n                <div class=\\\"ongoingSeeCardDetailsInner\\\">\\n                    \\n                </div>\\n            </div>\\n        </div> \\n        <div class = \\\"expandedOngoingWorkCard\\\" id=\\\"homepage-expandedOngoingWorkCard\").concat(this.projectId, \"\\\" style=\\\"display: none;\\\">\\n            <div class =\\\"homepage-expandedTextOngoingWorkCard\\\">\\n            \").concat(this.description, \"\\n            </div>\\n        </div>\\n        </div> \");\n    }\n  }]);\n  return projectCard;\n}(); //<p id=\"homepage-ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/homePage.js?");
 
 /***/ }),
 
@@ -306,7 +306,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
   \*******************************/
 /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <p class=\\\"ideaCardFont\\\">Kommentarer</p>\\n                      <p class=\\\"ideaCardFont\\\">Komment 1</p>\\n                      <p class=\\\"ideaCardFont\\\">K0mment 2</p>\\n                  </div>\\n                  <div class=\\\"expandedButton\\\">\\n                  <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera Projekt</button>\\n                  </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_2__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   loadPage: () => (/* binding */ loadPage)\n/* harmony export */ });\n/* harmony import */ var _Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Database/authentication.js */ \"./client/Database/authentication.js\");\n/* harmony import */ var _client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/Database/database.js */ \"./client/Database/database.js\");\n/* harmony import */ var _SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SidebarAndHeader/pageHandler.js */ \"./client/SidebarAndHeader/pageHandler.js\");\n/* harmony import */ var _homePage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./homePage.js */ \"./client/homePage.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n  function adopt(value) {\n    return value instanceof P ? value : new P(function (resolve) {\n      resolve(value);\n    });\n  }\n  return new (P || (P = Promise))(function (resolve, reject) {\n    function fulfilled(value) {\n      try {\n        step(generator.next(value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function rejected(value) {\n      try {\n        step(generator[\"throw\"](value));\n      } catch (e) {\n        reject(e);\n      }\n    }\n    function step(result) {\n      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n    }\n    step((generator = generator.apply(thisArg, _arguments || [])).next());\n  });\n};\n\n\n\n\nfunction logoutUser(event) {\n  event.preventDefault();\n  alert('logout');\n  (0,_Database_authentication_js__WEBPACK_IMPORTED_MODULE_0__.logout)();\n}\nvar myIdeaCards = {};\nvar IdeaCard = /*#__PURE__*/function () {\n  function IdeaCard(id, header, department, name, description, upvoteCount, suggestionID) {\n    _classCallCheck(this, IdeaCard);\n    this.header = header;\n    this.department = department;\n    this.name = name;\n    this.description = description;\n    this.upvoteCount = upvoteCount;\n    this.id = id;\n    this.suggestionID = suggestionID;\n  }\n  _createClass(IdeaCard, [{\n    key: \"generateHTML\",\n    value: function generateHTML() {\n      return \"<div class=\\\"totalExpandedIdeaCard\\\">\\n          <div class=\\\"ideaCard\\\">\\n              <div class=\\\"ideaCardBorder\\\">\\n                  <div class=\\\"ideaCardImageHP\\\">\\n                      <img src=\\\"../images/pinkFaded.png\\\" class =\\\"pinkFadedHP\\\" alt=\\\"pinkFaded\\\">\\n                  </div>\\n                  <div class=\\\"ideaCardMiddleText\\\">\\n                      <p id=\\\"ideaCardHeader\\\" class=\\\"ideaCardFont\\\">\".concat(this.header, \"</p>\\n                      <p id=\\\"ideaCardDepartment\\\" class=\\\"ideaCardFont\\\">\").concat(this.department, \"</p>\\n                      <p id=\\\"ideaCardName\\\" class=\\\"ideaCardFont\\\">\").concat(this.name, \"</p>\\n                      <p id=\\\"ideaCardMoreInfo\").concat(this.id, \"\\\" class=\\\"ideaCardFont moreInfoClass\\\"> > Mer information</p>\\n                  </div>\\n              </div>\\n              <div class=\\\"ideaCardUpvotesHP\\\">\\n                  <div class=\\\"upvoteDivHP\\\">\\n                  <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"28\\\" height=\\\"28\\\" fill=\\\"currentColor\\\" class=\\\"bi bi-caret-up upvoteSymbol\\\" viewBox=\\\"0 0 16 16\\\">\\n  <path d=\\\"M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z\\\"/>\\n</svg>                  <div id =\\\"upvoteNumber\\\" class=\\\"ideaCardFont\\\">\").concat(this.upvoteCount, \"</div>\\n\\n                  </div>\\n              </div>\\n          </div>\\n          <div id=\\\"expandedContent\").concat(this.id, \"\\\" class= \\\"expandedIdeaContent\\\" style =\\\"display : none;\\\">\\n              <div class=\\\"expandedDescriptionText\\\">\\n                  <p class=\\\"ideaCardFontComments\\\" id=\\\"expandedHeader\\\">Om ideen</p>\\n                  <p class=\\\"ideaCardFont\\\" id=\\\"expandedDescription\\\">\").concat(this.description, \"</p>\\n              </div>\\n              <div class=\\\"expandedCommentAndButton id = \\\"expandedCommentAndButton\").concat(this.id, \"\\\">\\n                  <div class=\\\"expandedComment\\\">\\n                      <button class=\\\"ideaCardFontComments\\\" id=\\\"commentsProjectCard\\\">Kommentarer</button>\\n                  </div>\\n\\n                  <div class=\\\"expandedButton\\\">\\n                      <button class=\\\"initiateProjectButton\\\" id=\\\"initiateProjectFromCard\").concat(this.suggestionID, \"\\\">Initiera F\\xF6rb\\xE4ttringsf\\xF6rslag</button>\\n                  </div>\\n\\n                  <!-- commentsModal.html -->\\n                    <div id=\\\"commentsModal\\\" class=\\\"modal\\\">\\n                      <div class=\\\"modal-content\\\">\\n                        <span class=\\\"close\\\" id=\\\"closeModal\\\">&times;</span>\\n                        <div id=\\\"existingComments\\\">\\n                          <!-- Display existing comments here -->\\n                          <div class=\\\"comment-container\\\">\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">John Doe</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                        \\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Jane Smith</div>\\n                              <div class=\\\"comment-text\\\">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>\\n                            </div>\\n\\n                            <div class=\\\"comment\\\">\\n                              <div class=\\\"comment-author\\\">Erik Svensson</div>\\n                              <div class=\\\"comment-text\\\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\\n                            </div>\\n                          </div>\\n                        </div>\\n                        <form id=\\\"addCommentForm\\\">\\n                          <input type=\\\"text\\\" id=\\\"commentInput\\\" name=\\\"commentInput\\\">\\n                          <button type=\\\"button\\\" id=\\\"addCommentBtn\\\">Publicera</button>\\n                        </form>\\n                      </div>\\n                    </div>\\n              </div>\\n          </div>\\n      </div>\");\n    }\n  }, {\n    key: \"showMoreInfo\",\n    value: function showMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"flex\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"^ Stäng detaljer\";\n      }\n    }\n  }, {\n    key: \"closeMoreInfo\",\n    value: function closeMoreInfo(blockId, thisTextId) {\n      var blockElement = document.getElementById(blockId);\n      if (blockElement) {\n        blockElement.style.display = \"none\";\n      }\n      var textElement = document.getElementById(thisTextId);\n      if (textElement) {\n        textElement.innerText = \"> Mer information\";\n      }\n    }\n  }, {\n    key: \"loadInitiatePage\",\n    value: function loadInitiatePage() {\n      alert(\"The initiate project page should now be loaded\");\n    }\n  }]);\n  return IdeaCard;\n}();\nfunction createNewCards(className, container, signedInUserHsaID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n    var _this = this;\n    var user, userSuggestions, counter;\n    return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n      while (1) switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", signedInUserHsaID);\n        case 2:\n          user = _context2.sent;\n          _context2.next = 5;\n          return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getSuggestions)({\n            creatorHsaId: user.id\n          });\n        case 5:\n          userSuggestions = _context2.sent;\n          //If there exist filter use those instead to get matching suggestions rest should not need to be changed\n          counter = 0;\n          userSuggestions.forEach(function (suggestion) {\n            return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var unit, user;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    _context.next = 2;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"unit\", suggestion.unitId);\n                  case 2:\n                    unit = _context.sent;\n                    _context.next = 5;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getObjectById)(\"users\", suggestion.creatorHsaId);\n                  case 5:\n                    user = _context.sent;\n                    createNewIdeaCard(suggestion.name, unit.name, user.firstName + \" \" + user.lastName, suggestion.content, suggestion.upvotes.length, className, container, counter, suggestion.id);\n                    counter = counter + 1;\n                  case 8:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }));\n          });\n        case 8:\n        case \"end\":\n          return _context2.stop();\n      }\n    }, _callee2);\n  }));\n}\nfunction createNewIdeaCard(header, department, name, description, upvoteCount, className, container, ID, suggestionID) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var card, cardHTML, div;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          card = new IdeaCard(ID, header, department, name, description, upvoteCount, suggestionID);\n          cardHTML = card.generateHTML();\n          myIdeaCards[ID] = card;\n          div = document.createElement(\"div\");\n          div.className = className; // Set the class name(s) here\n          div.innerHTML = cardHTML;\n          container.appendChild(div);\n        case 7:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3);\n  }));\n}\nfunction loadPage(listenersLoaded) {\n  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n    var _this2 = this;\n    var container;\n    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n      while (1) switch (_context5.prev = _context5.next) {\n        case 0:\n          container = document.querySelector('#container-fluid');\n          if (container) {\n            _context5.next = 3;\n            break;\n          }\n          return _context5.abrupt(\"return\");\n        case 3:\n          // Stop if the container isn't found\n          fetch('profilePage.html').then(function (response) {\n            return response.text();\n          }).then(function (data) {\n            return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n              var tempContainer, specificElement, tmp, user, suggestionContainer, nameHeaderElement, nameElement, emailElement, roleElement, unitElement, userFullName, userUnits, userUnit, projectContainer;\n              return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                while (1) switch (_context4.prev = _context4.next) {\n                  case 0:\n                    // Create a temporary container element to hold the loaded content\n                    tempContainer = document.createElement('div');\n                    tempContainer.innerHTML = data;\n                    // Select the specific element with the class you want\n                    specificElement = tempContainer.querySelector('.main-content');\n                    if (specificElement) {\n                      // Insert the specific element into the target element\n                      container.insertBefore(specificElement, container.firstChild);\n                    }\n                    tmp = localStorage.getItem('user');\n                    console.log(tmp);\n                    if (tmp) {\n                      _context4.next = 9;\n                      break;\n                    }\n                    console.log(\"there is not an user in localStorage\");\n                    return _context4.abrupt(\"return\");\n                  case 9:\n                    user = JSON.parse(tmp)[0];\n                    suggestionContainer = document.getElementById(\"suggestion-container\");\n                    if (!suggestionContainer) {\n                      _context4.next = 14;\n                      break;\n                    }\n                    _context4.next = 14;\n                    return createNewCards(\"HomePageIdeaCardDiv\", suggestionContainer, user.id);\n                  case 14:\n                    addListner(myIdeaCards, container);\n                    console.log(user.firstName + \"user.firstname\");\n                    nameHeaderElement = document.getElementById('user-name-header');\n                    nameElement = document.getElementById('user-name');\n                    emailElement = document.getElementById('user-email');\n                    roleElement = document.getElementById('user-role');\n                    unitElement = document.getElementById(\"user-unit\");\n                    userFullName = user.firstName + \" \" + user.lastName;\n                    _context4.next = 24;\n                    return (0,_client_Database_database_js__WEBPACK_IMPORTED_MODULE_1__.getUnits)({\n                      unitId: user.unitId\n                    });\n                  case 24:\n                    userUnits = _context4.sent;\n                    userUnit = userUnits[0];\n                    if (emailElement && roleElement && nameElement && unitElement && nameHeaderElement) {\n                      nameHeaderElement.textContent = userFullName;\n                      nameElement.textContent = userFullName;\n                      unitElement.textContent = userUnit.name;\n                      emailElement.textContent = user.email;\n                      roleElement.textContent = user.role;\n                    }\n                    projectContainer = document.getElementById(\"project-container\");\n                    if (projectContainer) {\n                      (0,_homePage_js__WEBPACK_IMPORTED_MODULE_3__.getProjects)(projectContainer, listenersLoaded, user.id);\n                    }\n                  case 29:\n                  case \"end\":\n                    return _context4.stop();\n                }\n              }, _callee4);\n            }));\n          })[\"catch\"](function (error) {\n            console.error('Failed to load the external HTML file:', error);\n          });\n        case 4:\n        case \"end\":\n          return _context5.stop();\n      }\n    }, _callee5);\n  }));\n}\nfunction addListner(cardArray, element) {\n  element.addEventListener(\"click\", function (event) {\n    var target = event.target;\n    //Adds an eventlistener for the more info of the card\n    if (target && target.className === \"ideaCardFont moreInfoClass\") {\n      var cardId = parseInt(target.id.replace(\"ideaCardMoreInfo\", \"\"), 10);\n      if (cardArray[cardId]) {\n        var card = cardArray[cardId];\n        var expandedDiv = document.getElementById(\"expandedContent\".concat(cardId));\n        console.log(expandedDiv);\n        if (expandedDiv) {\n          if (expandedDiv.style.display === \"none\") {\n            card.showMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          } else {\n            card.closeMoreInfo(\"expandedContent\".concat(cardId), \"ideaCardMoreInfo\".concat(cardId));\n          }\n        } else {\n          console.error(\"Expanded div not found\");\n        }\n      }\n    }\n    if (target && target.className === \"initiateProjectButton\") {\n      var _cardId = target.id.replace(\"initiateProjectFromCard\", \"\");\n      (0,_SidebarAndHeader_pageHandler_js__WEBPACK_IMPORTED_MODULE_2__.loadInitiatePage)(_cardId);\n    }\n  });\n}\nvar projectCards = [];\n// async function getProjects(\n//   selectElement: Element,\n//   listenersLoaded: boolean,\n//   improvementWorks: any[]\n// ) {\n//   let id = 0;\n//   projectCards = [];\n//   improvementWorks.forEach(async (improvementWork) => {\n//     let title = improvementWork.name;\n//     let department = await getObjectById(\"unit\", improvementWork.unitId);\n//     let projectLeader = await getImprovementWorkResponsible(improvementWork.id);\n//     if (department) {\n//       let card = new projectCard(\n//         id,\n//         projectLeader.firstName + \" \" + projectLeader.lastName,\n//         department.name,\n//         title,\n//         improvementWork.content,\n//         improvementWork.id,\n//         improvementWork.currentStage,\n//         improvementWork.dateStarted,\n//         improvementWork.endDate,\n//         improvementWork.completed,\n//       );\n//       projectCards.push(card);\n//       let cardHTML = card.generateHTML();\n//       let div = document.createElement(\"div\");\n//       div.className = \"projectCardCardDiv\"; // Set the class name(s) here\n//       div.innerHTML = cardHTML;\n//       if (!selectElement) return;\n//       selectElement.appendChild(div); // Stop if the container isn't found\n//       addEventListener(improvementWork.id, card);\n//       // Display end date for completed projects\n//       if (improvementWork.completed) {\n//         const datesDiv = document.getElementById(\n//           \"ongoingCardDatesCurrentProjects\" + improvementWork.id\n//         );\n//         if (datesDiv) {\n//           datesDiv.innerText +=\n//             \" till \" + formatDate(improvementWork.endDate);\n//         }\n//       }\n//       // Display \"Avslutat\" for completed projects\n//       const stageDiv = document.getElementById(\n//         \"currentStageLetter\" + improvementWork.id\n//       );\n//       if (stageDiv) {\n//         if (improvementWork.completed) {\n//           stageDiv.innerText = \"Avslutat\";\n//           stageDiv.style.fontSize = \"25px\";\n//           stageDiv.style.marginLeft = \"5px\";\n//           stageDiv.style.marginTop = \"30px\";\n//         } else if (improvementWork.currentStage == \"Plan\") {\n//           console.log(\"hej\");\n//           stageDiv.innerHTML = \"P\";\n//         } else if (improvementWork.currentStage == \"Do\") {\n//           stageDiv.innerHTML = \"D\";\n//         } else if (improvementWork.currentStage == \"Study\") {\n//           stageDiv.innerText = \"S\";\n//         } else if (improvementWork.currentStage == \"Act\") {\n//           stageDiv.innerText = \"A\";\n//         }\n//       }\n//       id++;\n//     } else {\n//       console.log(improvementWork.unitId + \" is not a unit\"); //Unit Ids on improvement work that do not exist\n//     }\n//   });\n// }\n//<p id=\"ongoingSeeDetailsButton${this.projectId}\" class = \"moreInfoClass\">> Mer information</p>\n\n//# sourceURL=webpack://c3/./client/profilePage.js?");
 
 /***/ }),
 
diff --git a/test/db.test.js b/test/db.test.js
index 0d3b76fb6a15dc14c3b04a690fdceac89a3245e1..7de772aa2f9404e26b02bc7cbe35571448e72ee9 100644
--- a/test/db.test.js
+++ b/test/db.test.js
@@ -197,7 +197,6 @@ describe("Database Cleanup", function () {
     const unitIdsToDelete = "unit_012jkl";
     const improvementWorkIdsToDelete = "proj_0002";
     const taskIdsToDelete = "task_006";
-    const hospitalIdsToDelete = "elasmo";
     const suggestionIdsToDelete = "suggestion_001";
     // Test to delete users
     it("should delete added users from the database", function () {
@@ -255,20 +254,6 @@ describe("Database Cleanup", function () {
             }
         });
     });
-    // Test to delete hospitals
-    it("should delete added hospitals from the database", function () {
-        return __awaiter(this, void 0, void 0, function* () {
-            try {
-                yield deleteInstance("hospital", hospitalIdsToDelete);
-                // Verify that hospitals are deleted
-                const deletedHospital = yield getObjectById("hospital", hospitalIdsToDelete);
-                assert.strictEqual(deletedHospital, null, `Deleted hospital ${hospitalIdsToDelete} still found`);
-            }
-            catch (error) {
-                assert.fail(`Unexpected error: ${error}`);
-            }
-        });
-    });
     // Test to delete suggestions
     it("should delete added suggestions from the database", function () {
         return __awaiter(this, void 0, void 0, function* () {