{"version":3,"sources":["dedra.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"../dedra.js","sourcesContent":["\r\n// This javascript should be loaded only for Dedra customer\r\n$(document).ready(function () {\r\n\r\n const DedraDomain = 'https://katalogy.dedra.cz';\r\n\r\n // Get the URL of the current page\r\n const url = window.location.href;\r\n\r\n // Extract the catalogue name and PPK parameter from the URL\r\n\r\n const catalogue = new URL(url).pathname;\r\n // Remove all \"/\" signs from the string\r\n const catalogueName = catalogue.replace(/\\//g, \"\");\r\n const currentCatalogue = JSON.stringify({ catalogueName: catalogueName });\r\n\r\n const ppkValue = new URL(url).searchParams.get('ppk');\r\n var queryPpk = \"\";\r\n if (ppkValue && parseInt(ppkValue) > 100000) {\r\n // Skip ppk for Dedra director with PPK < 100000\r\n queryPpk = `?ppk=${ppkValue}`;\r\n }\r\n\r\n // Make the AJAX request to fetch valid Dedra catalogues JSON\r\n $.ajax({\r\n type: 'POST',\r\n url: '/Home/GetValidCatalogues',\r\n contentType: \"application/json; charset=utf-8\",\r\n dataType: \"json\",\r\n data: currentCatalogue,\r\n success: function (data) {\r\n renderCatalogues(data);\r\n },\r\n error: function (xhr, status, error) {\r\n console.log(error); // Handle the error\r\n }\r\n });\r\n\r\n function renderCatalogues(cataloguesJson) {\r\n\r\n // Exit the function if empty\r\n if (cataloguesJson === undefined || cataloguesJson === '') {\r\n return;\r\n }\r\n\r\n const catalogues = JSON.parse(cataloguesJson);\r\n\r\n // Iterate over catalogues and generate dynamically HTML\r\n var html = '';\r\n var index = 0;\r\n for (const catalogue of catalogues) {\r\n\r\n var catalogueLink = `${DedraDomain}/${catalogue.RemotePath}/${queryPpk}`;\r\n\r\n html += '