{"version":3,"sources":["events.js"],"names":["document","getElementById","Vue","data","nodeId","eventsData","category","orderBy","pagination","currentPage","total","maxSize","itemsPerPage","enabledTopics","fakeLink","baseUrl","window","location","protocol","host","methods","changeOrderBy","item","this","getData","setLink","newurl","history","pushState","path","title","setPage","pageNo","getQueryVariable","variable","vars","search","substring","split","i","length","pair","paginationPosition","querySelector","classList","add","self","axios","post","headers","Content-Type","then","response","replace","$","animate","scrollTop","offset","top","remove","error","console","log","created","decodeURI","parseInt","computed","orderByArr","cat","slice","filteredData","paginatedData","firstIndex","stopBeforeIndex","$mount"],"mappings":"aAAIA,SAASC,eAAe,iBAC1B,IAAIC,IAAI,CACNC,KAAM,WAAA,MAAO,CACXC,OAAQA,OACRC,WAAY,GACZC,SAAU,GACVC,QAAS,MACTC,WAAY,CACVC,YAAa,GAEfC,MAAO,IACPC,QAAS,EACTC,aAAc,GACdC,cAAe,GACfC,UAAU,EACVC,QACEC,OAAOC,SAASC,SAAW,KAAOF,OAAOC,SAASE,KAAO,gBAE7DC,QAAS,CACPC,cADO,SACOC,GACZC,KAAKhB,QAAUe,EACbC,KAAKC,QAAQ,IAEjBC,QALO,WAML,IAAIC,EACFV,OAAOC,SAASC,SAChB,KACAF,OAAOC,SAASE,KAChB,uBACAI,KAAKhB,QACL,gBACAgB,KAAKf,WAAWC,YAClBO,OAAOW,QAAQC,UAAU,CAAEC,KAAMH,GAAU1B,SAAS8B,MAAOJ,IAE7DK,QAAS,SAAUC,GACjBT,KAAKf,WAAWC,YAAcuB,GAEhCC,iBAnBO,SAmBUC,GAGf,IAFA,IACIC,EADQnB,OAAOC,SAASmB,OAAOC,UAAU,GAC5BC,MAAM,KACdC,EAAI,EAAGA,EAAIJ,EAAKK,OAAQD,IAAK,CACpC,IAAIE,EAAON,EAAKI,GAAGD,MAAM,KACzB,GAAIG,EAAK,IAAMP,EACb,OAAOO,EAAK,GAGhB,MAAO,IAETjB,QA9BO,SA8BCkB,GACN1C,SAAS2C,cAAc,QAAQC,U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C,YAAcc,KAAKX,aAIzD,OAHI6D,EAAkBlD,KAAK+C,aAAa9B,SACtCiC,EAAkBlD,KAAK+C,aAAa9B,QAE/BjB,KAAK+C,aAAaD,MAAMG,EAAYC,QAIhDC,OAAO","file":"events.min.js","sourcesContent":["if (document.getElementById(\"eventSection\")) {\r\n new Vue({\r\n data: () => ({\r\n nodeId: nodeId,\r\n eventsData: [],\r\n category: \"\",\r\n orderBy: \"All\",\r\n pagination: {\r\n currentPage: 1,\r\n },\r\n total: 100,\r\n maxSize: 3,\r\n itemsPerPage: 10,\r\n enabledTopics: [],\r\n fakeLink: false,\r\n baseUrl:\r\n window.location.protocol + \"//\" + window.location.host + \"/event-list\",\r\n }),\r\n methods: {\r\n changeOrderBy(item) {\r\n this.orderBy = item;\r\n this.getData(1);\r\n },\r\n setLink() {\r\n let newurl =\r\n window.location.protocol +\r\n \"//\" +\r\n window.location.host +\r\n \"/event-list?orderBy=\" +\r\n this.orderBy +\r\n \"¤tPage=\" +\r\n this.pagination.currentPage;\r\n window.history.pushState({ path: newurl }, document.title, newurl);\r\n },\r\n setPage: function (pageNo) {\r\n this.pagination.currentPage = pageNo;\r\n },\r\n getQueryVariable(variable) {\r\n var query = window.location.search.substring(1);\r\n var vars = query.split(\"&\");\r\n for (var i = 0; i < vars.length; i++) {\r\n var pair = vars[i].split(\"=\");\r\n if (pair[0] == variable) {\r\n return pair[1];\r\n }\r\n }\r\n return \"\";\r\n },\r\n getData(paginationPosition) {\r\n document.querySelector(\"html\").classList.add(\"loading\");\r\n if (paginationPosition) {\r\n paginationPosition = 1;\r\n } else {\r\n paginationPosition = this.pagination.currentPage;\r\n }\r\n const self = this;\r\n axios\r\n .post(\r\n \"/Umbraco/Api/XoserveAdditionalApi/CalendarFilter\",\r\n {\r\n nodeId: self.nodeId,\r\n orderBy: self.orderBy !== 'All' ? self.orderBy : '',\r\n },\r\n {\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n }\r\n )\r\n .then(function (response) {\r\n self.eventsData = response.data;\r\n if (!self.fakeLink && response.data.length === 0) {\r\n window.location.replace(self.baseUrl);\r\n self.fakeLink = true;\r\n self.getData();\r\n }\r\n })\r\n .then(function () {\r\n $(\"html, body\").animate(\r\n {\r\n scrollTop: $(\".main\").offset().top,\r\n },\r\n 300,\r\n function () {\r\n self.setLink();\r\n document.querySelector(\"html\").classList.remove(\"loading\");\r\n }\r\n );\r\n })\r\n .catch(function (error) {\r\n console.log(error);\r\n });\r\n },\r\n },\r\n created() {\r\n if (decodeURI(this.getQueryVariable(\"orderBy\"))) {\r\n this.orderBy = decodeURI(this.getQueryVariable(\"orderBy\"));\r\n }\r\n if (decodeURI(this.getQueryVariable(\"currentPage\"))) {\r\n this.pagination.currentPage = parseInt(\r\n decodeURI(this.getQueryVariable(\"currentPage\"))\r\n );\r\n }\r\n this.getData();\r\n return false;\r\n },\r\n computed: {\r\n orderByArr() {\r\n var vars = cat.slice(0, -1).split(\";\");\r\n return vars;\r\n },\r\n filteredData() {\r\n this.total = this.eventsData.length;\r\n this.setLink();\r\n return this.eventsData;\r\n },\r\n paginatedData() {\r\n if (this.filteredData.length > 0) {\r\n var firstIndex =\r\n (this.pagination.currentPage - 1) * this.itemsPerPage;\r\n if (firstIndex >= this.filteredData.length) {\r\n this.setPage(1);\r\n firstIndex = (this.pagination.currentPage - 1) * this.itemsPerPage;\r\n }\r\n\r\n var stopBeforeIndex = this.pagination.currentPage * this.itemsPerPage;\r\n if (stopBeforeIndex > this.filteredData.length) {\r\n stopBeforeIndex = this.filteredData.length;\r\n }\r\n return this.filteredData.slice(firstIndex, stopBeforeIndex);\r\n }\r\n },\r\n },\r\n }).$mount(\"#eventSection\");\r\n}\r\n"]}