{"version":3,"sources":["api/utils.js","api/requests.js","pages/Main/MainPage__index.js"],"names":["getFromAPI","async","fetch","URL","then","result","_result$message","response","json","message","type","text","pl","text_en","en","error_code","errcode","error_reason","e","console","log","concat","status","ok","error","wrongParams","description","arguments","length","undefined","API","process","getAutocompleteFromAPI","_DATA$message","searchText","_ref","DATA","getBasicDataFromAPI","terrID","_ref2","getAreasFromAPI","_ref4","getTableDataFromAPI","areaID","_ref5","getUnitsTreeFromAPI","_DATA$message2","filter","d","czy_portret","map","findItemN","find","f","id_teryt","getBarChartDataFromAPI","indicatorID","year","_ref6","hasWrongParams","push","getLineChartDataFromAPI","_ref7","getRankLokChartDataFromAPI","sort","_ref9","getPineDataFromAPI","_ref10","isPl","document","documentElement","lang","getChartFromAPI","chartID","_ref11","getUnitByIdFromAPI","_ref12","getIndicatorByIdFromAPI","_ref14","API_URL","statusText","getSearchIndicatorFromApi","terrId","_ref15","option","firstLetter","nazwa","toUpperCase","test","_result","_result2","Preloader","React","lazy","PagePreloader","AppApiError","LeftPanel","PDF","Map","Info","Table","ChartBarLine","Rank","Search","SearchIndicator","Accordioned","useStyles","makeStyles","theme","root","width","display","justifyContent","flexWrap","marginBottom","spacing","position","MainPageWrapper","margin","breakpoints","down","padding","flexGridItem","alignItems","mainTitle","flexGrow","fontWeight","typography","fontWeightRegular","fontSize","textAlign","borderBottom","textTransform","outlinedBtn","border","borderRadius","color","palette","common","black","componentWrapper","top","left","right","bottom","zIndex","componentHolder","height","toTopBtn","backgroundColor","primary","main","transform","marginTop","componentsHolder","infoBlock","pagePreloader","getUnitById","id","title","expanded","setError","dispatch","history","setOnTop","redirect","isNaN","Number","_result$","_result$$woj","setSelectedTreeItem","setScrolledItem","setOnTopId","woj","setExpandedItems","toString","processByUrlParams","_ref3","clear","errors","units","_result$message2","catch","areas","_result$message3","_areaIds","r","_r$id","includes","tableData","_result$message4","_result$rows","_result2$rows","_indicatorIds","rows","_r$id2","_indicatorIds$","_indicatorIds$$split","split","row","_rowKeys","Object","keys","rowValues","values","precision","decimalCount","String","_extRow","forEach","key","_row$key","val","pre","fid","finally","S2V","DOLNOSLASKIE","LUBELSKIE","LUBUSKIE","LODZKIE","MALOPOLSKIE","MAZOWIECKIE","OPOLSKIE","PODKARPACKIE","PODLASKIE","POMORSKIE","SLASKIE","SWIETOKRZYSKIE","WIELKOPOLSKIE","ZACHODNIOPOMORSKIE","subdomainToVoivodship","_window$location$host","SUBDOMAIN","window","location","hostname","reverse","num","numStr","MainPage","props","_props$match","_props$match$params","_props$match2","_props$match2$params","_props$match3","_props$match3$params","_selectedItem$id_tery","_currentSection$id","_currentIndicator$id2","useHistory","classes","useDispatch","query","URLSearchParams","useLocation","search","t","i18n","useTranslation","get","match","params","_id","href","trackPageView","useMatomo","useEffect","pdfRefs","setPdfRefs","useState","loading","setLoading","UrlParams","setUrlParams","selectedItem","useSelector","getSelectedTreeItem","currentSection","getCurrentSection","currentIndicator","getCurrentIndicator","getDefaultData","setCurrentSection","setCurrentIndicator","setTableData","_result$errors","_result$units","_result$areas","_result$tableData","_result$errors2","_result$units2","_result$units3","_result$units3$","setTableAreas","_result$tableData2","name","name_ang","newIndicator","i","_currentIndicator$id3","_currentIndicator$id4","_path$filter","_path","_history","join","setTimeout","_currentIndicator$id","_currentIndicator$id$","voivodshipId","navigator","geolocation","getCurrentPosition","pos","_woj$properties","pt","point","coords","longitude","latitude","GEO_WOJS","features","feature","booleanPointInPolygon","geo_woj_id","properties","err","warn","code","enableHighAccuracy","timeout","maximumAge","handleOnRef","ref","_jsxs","_Fragment","children","_jsx","className","Container","maxWidth","Grid","container","item","xs","Suspense","fallback","md","onRef","style","urlParams","Button","language","variant","fullWidth","startIcon","Launch","target","IconButton","onClick","scrollToTop","scrollTo","behavior","ArrowUpward"],"mappings":"uhBAAO,MAAMA,EAAaC,UACtB,IAgDI,aA/CmBC,MAAMC,GAAKC,MAAKH,UAC/B,IAAII,EACJ,IAAK,IAADC,EACAD,QAAeE,EAASC,OAEK,WAAX,QA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ACdC,cAACQ,WAAQ,CAACC,SAAUT,cAACvP,EAAS,CAACjF,KAAM,WAAauU,SAC9CC,cAACzO,EAAW,CAACoP,MAAQf,GAAQD,GAAY,CAAEC,MAAKpU,KAAM,eAI9DwU,cAACI,IAAI,CAACE,MAAI,EAACC,GAAI,GAAGR,SACdC,cAACc,IAAM,CACHvF,KAAI,uBAAApP,OACkB,OAAlB8O,EAAK8F,SAAoB,MAAQ,MAAK,aAAA5U,OAC9BiB,GACZ4T,QAAS,WACTC,WAAS,EACTL,MAAO,CACHzM,gBAAiB,OACjBjB,cAAe,aACfN,WAAY,SACZG,SAAU,QAEdmO,UAAWlB,cAACmB,IAAM,IAClB7N,MAAO,UACP8N,OAAQ,SACR,aAAY,kBAAkBrB,SAE7B/E,EAAE,sDAIfgF,cAACqB,IAAU,CACPC,QApHJC,KAChB/H,OAAOgI,SAAS,CACZ7N,IAAK,EACL8N,SAAU,UACZ,EAiHkBxB,UAAWvF,EAAQxG,SACnB,aAAY,uCAA0B6L,SAEtCC,cAAC0B,IAAW,CAAC3O,SAAS,iBAI5B+I,IACEkE,cAAA,OAAKC,UAAWvF,EAAQhG,cAAcqL,SAClCC,cAACpP,EAAa,WAK/B,C","file":"static/js/74.33f5395a.chunk.js","sourcesContent":["export const getFromAPI = async (URL) => {\r\n try {\r\n const DATA = await fetch(URL).then(async (response) => {\r\n let result;\r\n try {\r\n result = await response.json();\r\n\r\n if (result.message?.type === \"Error\") {\r\n result.message = {\r\n ...result.message,\r\n text: result.message.pl,\r\n text_en: result.message.en,\r\n };\r\n }\r\n\r\n if (result.error_code) {\r\n result.errcode = result.error_code;\r\n result.message = {\r\n ...result,\r\n type: \"Error\",\r\n text: result.error_reason,\r\n text_en: result.error_reason,\r\n };\r\n }\r\n } catch (e) {\r\n console.log(\"catch 1\", e);\r\n result = {\r\n ...result,\r\n message: {\r\n type: \"Error\",\r\n text: `Błąd API (${response.status})`,\r\n text_en: `API error (${response.status})`,\r\n },\r\n errcode: response.status,\r\n };\r\n }\r\n if (!response.ok) {\r\n result = {\r\n ...result,\r\n message: {\r\n type: \"Error\",\r\n text: result.error_reason || `Błąd API (${response.status})`,\r\n text_en: result.error_reason || `API error (${response.status})`,\r\n },\r\n error: true,\r\n };\r\n }\r\n return result;\r\n });\r\n return DATA;\r\n } catch (error) {\r\n console.log(\"catch 2\", error);\r\n return {\r\n message: {\r\n type: \"Error\",\r\n text: `Błąd API${error.message ? `: \"${error.message}\"` : \"\"}`,\r\n text_en: `API error${error.message ? `: \"${error.message}\"` : \"\"}`,\r\n },\r\n };\r\n }\r\n};\r\n\r\nexport const wrongParams = (description = \"\") => {\r\n return {\r\n message: {\r\n type: \"Error\",\r\n text: `Wrong parameters for request${description ? ` (${description})` : \"\"}`,\r\n },\r\n };\r\n};\r\n","import { getFromAPI, wrongParams } from \"./utils\";\r\nconst API = process.env.REACT_APP_API_URL;\r\n\r\n/** + */\r\nexport const getAutocompleteFromAPI = async ({ searchText }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!searchText) return wrongParams(\"searchText\");\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/search/${searchText}`;\r\n const DATA = await getFromAPI(URL);\r\n\r\n if (DATA.message?.type === \"Error\") return DATA;\r\n\r\n // const ZITs = DATA.filter((d) => d.mpozn_kod === \"5\" && d.nazwa_dod === \"miasto na prawach powiatu\")\r\n // .map((d) => ({ ...d, is_zit: true }))\r\n // .sort((a, b) => a.nazwa.localeCompare(b.nazwa));\r\n return [\r\n ...DATA,\r\n // ...ZITs\r\n ];\r\n\r\n // return DATA;\r\n};\r\n\r\n/** + */\r\nexport const getBasicDataFromAPI = async ({ terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!terrID) return wrongParams(\"terrID\");\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getBasicInfo/${terrID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getSectionsDataFromAPI = async ({ terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!terrID) return wrongParams(\"terrID\");\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getSectionsData/${terrID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\nexport const getAreasFromAPI = async ({ terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!terrID) return wrongParams(\"terrID\");\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getAreas/${terrID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\nexport const getTableDataFromAPI = async ({ terrID, areaID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!terrID) return wrongParams(\"terrID\");\r\n if (!areaID) return wrongParams(\"areaID\");\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getTable/${terrID}/${areaID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getUnitsTreeFromAPI = async () => {\r\n const URL = `${API}/SVS/getUnitsTree`;\r\n const DATA = await getFromAPI(URL);\r\n\r\n if (DATA.message?.type === \"Error\") return DATA;\r\n\r\n // const ZITs = DATA.filter((d) => d.mpozn_kod === \"5\" && d.nazwa_dod === \"miasto na prawach powiatu\")\r\n // .map((d) => ({ ...d, is_zit: true }))\r\n // .sort((a, b) => a.nazwa.localeCompare(b.nazwa));\r\n return [\r\n ...DATA.filter((d) => !d.czy_portret || d.czy_portret === \"T\").map((d) => {\r\n const findItemN = DATA.find((f) => f.czy_portret === \"N\" && f.id_teryt === d.id_teryt) || {};\r\n return {\r\n ...d,\r\n ...findItemN,\r\n };\r\n }),\r\n // ...ZITs,\r\n ];\r\n //czy_portret\r\n};\r\n\r\n/** + */\r\nexport const getBarChartDataFromAPI = async ({ terrID, indicatorID, year }) => {\r\n const hasWrongParams = [];\r\n /** Check required parameters...*/\r\n if (!terrID) hasWrongParams.push(\"terrID\");\r\n if (!indicatorID) hasWrongParams.push(\"indicatorID\");\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getBarsChart/${terrID}/${indicatorID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getLineChartDataFromAPI = async ({ indicatorID, terrID }) => {\r\n const hasWrongParams = [];\r\n /** Check required parameters...*/\r\n if (!terrID) hasWrongParams.push(\"terrID\");\r\n if (!indicatorID) hasWrongParams.push(\"indicatorID\");\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getLineChart/${indicatorID}/${terrID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getRankChartDataFromAPI = async ({ terrID, indicatorID }) => {\r\n const hasWrongParams = [];\r\n /** Check required parameters...*/\r\n if (!terrID) hasWrongParams.push(\"terrID\");\r\n if (!indicatorID) hasWrongParams.push(\"indicatorID\");\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getRankChartData/${terrID}/${indicatorID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getRankLokChartDataFromAPI = async ({ terrID, indicatorID, type, sort }) => {\r\n const hasWrongParams = [];\r\n /** Check required parameters...*/\r\n if (!terrID) hasWrongParams.push(\"terrID\");\r\n if (!indicatorID) hasWrongParams.push(\"indicatorID\");\r\n if (!type) hasWrongParams.push(\"type\");\r\n if (!sort) hasWrongParams.push(\"sort\");\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getRankLokChartData/${terrID}/${indicatorID}/${type}/${sort}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getPineDataFromAPI = async ({ terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n let isPl = true;\r\n if (!terrID) return wrongParams(\"terrID\");\r\n if (document.documentElement.lang === \"en\") {\r\n isPl = false;\r\n }\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getPineData/${terrID}?czy_pl=${isPl}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\nexport const getChartFromAPI = async ({ chartID, terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n let isPl = true;\r\n if (!terrID) return wrongParams(\"terrID\");\r\n if (!chartID) return wrongParams(\"chartID\");\r\n if (document.documentElement.lang === \"en\") {\r\n isPl = false;\r\n }\r\n\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getChartById/${chartID}/${terrID}/${isPl}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** + */\r\nexport const getUnitByIdFromAPI = async ({ terrID }) => {\r\n /** Check required parameters and return errors if any...*/\r\n if (!terrID) return wrongParams(\"terrID\");\r\n /** ...else request API */\r\n const URL = `${API}/SVS/getUnitById/${terrID}`;\r\n return await getFromAPI(URL);\r\n};\r\n\r\n/** deprecated */\r\nexport const getMapDataFromAPI = async ({ terrID, year, indicatorID }) => {\r\n return {\r\n message: {\r\n type: \"Error\",\r\n text: \"API deprecated\",\r\n },\r\n };\r\n // const API_URL = `${API}/SVS/getMapData/${terrID}/${year}/${indicatorID}`;\r\n // const DATA = await fetch(API_URL).then(async (response) => {\r\n // let result;\r\n // try {\r\n // result = await response.json();\r\n // } catch (e) {\r\n // result = {\r\n // message: response.statusText,\r\n // errcode: response.status,\r\n // };\r\n // }\r\n // if (!response.ok) {\r\n // result = {\r\n // ...result,\r\n // error: true,\r\n // };\r\n // }\r\n // return result;\r\n // });\r\n // return DATA;\r\n};\r\n\r\nexport const getIndicatorByIdFromAPI = async ({ terrID, year, indicatorID }) => {\r\n const API_URL = `${API}/SVS/getIndicatorById/${terrID}/${year}/${indicatorID}`;\r\n const DATA = await fetch(API_URL).then(async (response) => {\r\n let result;\r\n try {\r\n result = await response.json();\r\n } catch (e) {\r\n result = {\r\n message: response.statusText,\r\n errcode: response.status,\r\n };\r\n }\r\n if (!response.ok) {\r\n result = {\r\n ...result,\r\n error: true,\r\n };\r\n }\r\n return result;\r\n });\r\n return DATA;\r\n};\r\n\r\nexport const getSearchIndicatorFromApi = async ({ searchText, terrId, lang = \"PL\" }) => {\r\n const API_URL = `${API}/SVS/getSearchIndicator/${terrId}/${searchText}?jezyk=${lang}`;\r\n const DATA = await fetch(API_URL).then(async (response) => {\r\n let result;\r\n try {\r\n result = await response.json();\r\n result = result.map((option) => {\r\n const firstLetter = option.nazwa[0].toUpperCase();\r\n return {\r\n firstLetter: /[0-9]/.test(firstLetter) ? firstLetter + \"...\" : firstLetter,\r\n ...option,\r\n };\r\n });\r\n } catch (e) {\r\n result = {\r\n message: result?.message || response.statusText,\r\n errcode: result?.errcode || response.status,\r\n error: true,\r\n };\r\n }\r\n if (!response.ok) {\r\n result = {\r\n ...result,\r\n error: true,\r\n };\r\n }\r\n return result;\r\n });\r\n return DATA;\r\n};\r\n","import React, { Suspense, useEffect, useState } from \"react\";\r\nimport { useHistory, useLocation } from \"react-router-dom\";\r\n\r\n/** Matomo */\r\nimport { useMatomo } from \"@datapunt/matomo-tracker-react\";\r\n\r\n/** MUI */\r\nimport { Container, Grid, IconButton, Button } from \"@material-ui/core\";\r\nimport { makeStyles } from \"@material-ui/core/styles\";\r\nimport { ArrowUpward, Launch } from \"@material-ui/icons\";\r\n\r\n/** Redux */\r\nimport { useDispatch, useSelector } from \"react-redux\";\r\nimport {\r\n getSelectedTreeItem,\r\n setExpandedItems,\r\n setOnTopId,\r\n setScrolledItem,\r\n setSelectedTreeItem,\r\n} from \"../../_store/TREE\";\r\n// eslint-disable-next-line\r\nimport { getDefaultData, setDefaultData, setRange, setYear } from \"../../_store/MAIN\";\r\nimport {\r\n getCurrentIndicator,\r\n getCurrentSection,\r\n setCurrentIndicator,\r\n setCurrentSection,\r\n setTableAreas,\r\n setTableData,\r\n} from \"../../_store/TABLE\";\r\n\r\n/** API */\r\nimport { getAreasFromAPI, getBasicDataFromAPI, getTableDataFromAPI, getUnitByIdFromAPI } from \"../../api\";\r\n\r\n/** Helpers & utils */\r\nimport { booleanPointInPolygon, point } from \"@turf/turf\";\r\nimport GEO_WOJS from \"../../components/Map/geodata/2023/wojewodztwa.json\";\r\nimport { useTranslation } from \"react-i18next\";\r\n\r\n/** UI */\r\nconst Preloader = React.lazy(() => import(\"../../components/common/Preloader\"));\r\nconst PagePreloader = React.lazy(() => import(\"../../components/common/PagePreloader\"));\r\nconst AppApiError = React.lazy(() => import(\"../../components/common/AppApiError\"));\r\nconst LeftPanel = React.lazy(() => import(\"../../components/LeftPanel/LeftPanel\"));\r\nconst PDF = React.lazy(() => import(\"../../components/PDF/PDF\"));\r\nconst Map = React.lazy(() => import(\"../../components/Map/Map\"));\r\nconst Info = React.lazy(() => import(\"../../components/Info/Info\"));\r\nconst Table = React.lazy(() => import(\"../../components/Table/Table\"));\r\nconst Pine = React.lazy(() => import(\"../../components/Pine/Pine\"));\r\nconst Accordion = React.lazy(() => import(\"../../components/AccordionCharts/Accordion\"));\r\nconst ChartBarLine = React.lazy(() => import(\"../../components/ChartBarLine/ChartBarLine\"));\r\nconst Rank = React.lazy(() => import(\"../../components/Rank/Rank\"));\r\nconst Search = React.lazy(() => import(\"../../components/Search/Search\"));\r\nconst SearchIndicator = React.lazy(() => import(\"../../components/Search/SearchIndicator\"));\r\nconst StackedBar = React.lazy(() => import(\"../../components/AccordionCharts/StackedBar\"));\r\nconst MultiBar = React.lazy(() => import(\"../../components/AccordionCharts/BarMulti\"));\r\nconst Linefill = React.lazy(() => import(\"../../components/AccordionCharts/Linefill\"));\r\n\r\nconst Accordioned = React.lazy(() => import(\"../../components/AccordionCharts/Accordioned\"));\r\n\r\nconst useQuery = () => {\r\n return new URLSearchParams(useLocation().search);\r\n};\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n root: {\r\n width: \"100%\",\r\n display: \"flex\",\r\n justifyContent: \"center\",\r\n flexWrap: \"wrap\",\r\n marginBottom: theme.spacing(4),\r\n position: \"relative\",\r\n },\r\n MainPageWrapper: {\r\n width: \"80%\",\r\n margin: theme.spacing(0, 4, 1, 4),\r\n [theme.breakpoints.down(\"xs\")]: {\r\n margin: theme.spacing(10, 0, 1, 0),\r\n width: \"100%\",\r\n padding: theme.spacing(0, 1.5),\r\n },\r\n },\r\n flexGridItem: {\r\n display: \"flex\",\r\n alignItems: \"flex-start\",\r\n },\r\n mainTitle: {\r\n flexGrow: 1,\r\n fontWeight: theme.typography.fontWeightRegular,\r\n fontSize: \"1.5rem\",\r\n textAlign: \"center\",\r\n margin: theme.spacing(0, 1, 4, 0),\r\n borderBottom: `2px solid #CCC`,\r\n \"& small\": {\r\n textTransform: \"uppercase\",\r\n fontSize: \"0.875rem\",\r\n },\r\n },\r\n outlinedBtn: {\r\n border: \"1px solid rgba(0,0,0,0.2)\",\r\n padding: theme.spacing(2, 1),\r\n borderRadius: theme.spacing(0.5),\r\n margin: theme.spacing(0, 1, 0, 0),\r\n \"& svg\": {\r\n color: theme.palette.common.black,\r\n },\r\n },\r\n componentWrapper: {\r\n position: \"absolute\",\r\n top: 12,\r\n left: 12,\r\n right: 12,\r\n bottom: 12,\r\n zIndex: -1,\r\n },\r\n componentHolder: {\r\n width: 1920,\r\n height: 1200,\r\n },\r\n toTopBtn: {\r\n position: \"absolute\",\r\n right: 100,\r\n backgroundColor: theme.palette.primary.main,\r\n color: \"#fff\",\r\n width: 42,\r\n height: 42,\r\n \"&:hover\": {\r\n backgroundColor: theme.palette.primary.main,\r\n },\r\n [theme.breakpoints.down(\"xs\")]: {\r\n position: \"relative\",\r\n right: \"auto\",\r\n left: \"50%\",\r\n transform: \"translateX(-50%)\",\r\n marginTop: theme.spacing(3),\r\n },\r\n },\r\n componentsHolder: {\r\n margin: theme.spacing(0, 0, 0, -1.5),\r\n \"& > div\": {\r\n marginBottom: theme.spacing(2),\r\n },\r\n // [theme.breakpoints.down(\"xs\")]: {\r\n // },\r\n },\r\n infoBlock: {\r\n [theme.breakpoints.down(\"xs\")]: {\r\n marginTop: 64,\r\n },\r\n },\r\n pagePreloader: {\r\n position: \"fixed\",\r\n top: 0,\r\n right: 0,\r\n bottom: 0,\r\n left: 0,\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n backgroundColor: \"rgba(255, 255, 255, 0.95)\",\r\n zIndex: 9999,\r\n },\r\n}));\r\n\r\nconst MainPage = (props) => {\r\n // const { voivodship } = props.match.params;\r\n const history = useHistory();\r\n const classes = useStyles();\r\n const dispatch = useDispatch();\r\n const query = useQuery();\r\n const { t, i18n } = useTranslation();\r\n\r\n const getGeo = () => {\r\n const options = {\r\n enableHighAccuracy: true,\r\n timeout: 5000,\r\n maximumAge: 0,\r\n };\r\n\r\n const success = (pos) => {\r\n const pt = point([pos.coords.longitude, pos.coords.latitude]);\r\n const woj = GEO_WOJS.features.find((feature) => {\r\n return booleanPointInPolygon(pt, feature);\r\n });\r\n const geo_woj_id = woj?.properties?.id_teryt || 7;\r\n\r\n getUnitById({\r\n id: geo_woj_id,\r\n title: \"Portret województwa\",\r\n expanded: [\"2200000\" + geo_woj_id, geo_woj_id.toString()],\r\n setError,\r\n dispatch,\r\n history,\r\n setOnTop: true,\r\n });\r\n };\r\n\r\n const error = (err) => {\r\n console.warn(`ERROR(${err.code}): ${err.message}\\n Set default`);\r\n getUnitById({\r\n id: 7,\r\n title: \"Portret województwa\",\r\n expanded: [\"expanded\"],\r\n setError,\r\n dispatch,\r\n history,\r\n setOnTop: true,\r\n });\r\n };\r\n\r\n navigator.geolocation.getCurrentPosition(success, error, options);\r\n };\r\n\r\n // http://localhost:2925/?id=2&a=89&i=534 \"Wybrane dane statystyczne\" - \"Urodzenia żywe na 1000 ludności [osoba] \"\r\n // http://localhost:2925/2/89/534 \"Wybrane dane statystyczne\" - \"Urodzenia żywe na 1000 ludności [osoba] \"\r\n // http://localhost:2925/?id=2&a=84&i=227 \"Ludność według wieku\" - \"Ludność w wieku 20–24 lata [osoba] \"\r\n // http://localhost:2925/2/84/227 \"Ludność według wieku\" - \"Ludność w wieku 20–24 lata [osoba] \"\r\n\r\n /** territory */\r\n let id =\r\n query.get(\"id\") ||\r\n query.get(\"t\") ||\r\n query.get(\"tid\") ||\r\n query.get(\"territoryId\") ||\r\n props?.match?.params?.terrID;\r\n\r\n if (id && isNaN(Number(id))) {\r\n window.location.href = `/${subdomainToVoivodship(id?.toUpperCase())}`;\r\n id = false;\r\n }\r\n\r\n const terrID = id;\r\n\r\n /** area */\r\n const areaID = query.get(\"a\") || query.get(\"aid\") || query.get(\"areaId\") || props?.match?.params?.areaID;\r\n\r\n /** indicator */\r\n const indicatorID =\r\n query.get(\"i\") || query.get(\"iid\") || query.get(\"indicatorId\") || props?.match?.params?.indicatorID;\r\n\r\n /** Matomo */\r\n const { trackPageView } = useMatomo();\r\n React.useEffect(() => {\r\n trackPageView();\r\n // eslint-disable-next-line\r\n }, []);\r\n\r\n /** States */\r\n const [pdfRefs, setPdfRefs] = useState(null);\r\n const [loading, setLoading] = useState(false);\r\n const [error, setError] = useState(false);\r\n const [UrlParams, setUrlParams] = useState(false);\r\n /** - redux */\r\n const selectedItem = useSelector(getSelectedTreeItem);\r\n const currentSection = useSelector(getCurrentSection);\r\n const currentIndicator = useSelector(getCurrentIndicator);\r\n const defaultData = useSelector(getDefaultData);\r\n /** /end States */\r\n\r\n /** empty url */\r\n if (!terrID && !areaID && !indicatorID) {\r\n /** nothing saved */\r\n if (!selectedItem) {\r\n const voivodshipId = subdomainToVoivodship();\r\n if (voivodshipId) {\r\n getUnitById({\r\n id: voivodshipId,\r\n setError,\r\n dispatch,\r\n history,\r\n setOnTop: true,\r\n });\r\n // history.replace(`/${voivodshipId}`)\r\n }\r\n getGeo();\r\n } else {\r\n if (!!selectedItem && !!currentIndicator && !!currentSection) {\r\n history.push(\r\n `/${selectedItem?.id_teryt}/${currentSection?.id}/${currentIndicator?.id?.split(\"-\")?.[1]}`\r\n );\r\n }\r\n }\r\n } else if (\r\n /** not empty url, but nothing changed (F%) */\r\n (terrID?.toString() === selectedItem?.id_teryt?.toString() &&\r\n areaID?.toString() === currentSection?.id?.toString() &&\r\n `${areaID}-${indicatorID}` === currentIndicator?.id?.toString()) ||\r\n loading\r\n ) {\r\n /** nothing to do */\r\n } else {\r\n setLoading(true);\r\n // dispatch(setDefaultData(null));\r\n processByUrlParams({\r\n terrID,\r\n areaID,\r\n indicatorID,\r\n dispatch,\r\n setCurrentSection,\r\n setCurrentIndicator,\r\n setTableData,\r\n setError,\r\n history,\r\n })\r\n .then((result) => {\r\n if (result.errors?.length) return;\r\n\r\n if (result?.units?.length) {\r\n dispatch(\r\n setSelectedTreeItem({\r\n ...result?.units?.[0],\r\n title: \" \",\r\n })\r\n );\r\n dispatch(setScrolledItem(result?.units?.[0]?.id_teryt + \"|scroll\"));\r\n }\r\n if (result?.areas?.length) {\r\n dispatch(setTableAreas(result?.areas));\r\n }\r\n if (result?.tableData?.length) {\r\n const { id, name, name_ang, rows } = result?.tableData?.[0];\r\n const newIndicator = rows?.find((i) => i.id === `${areaID}-${indicatorID}`) || rows[0];\r\n dispatch(setCurrentSection({ id, name, name_ang }));\r\n dispatch(setCurrentIndicator(newIndicator));\r\n dispatch(setTableData(result?.tableData));\r\n }\r\n\r\n if (!result?.errors?.length) {\r\n // window?.location?.reload();\r\n const _path = [\r\n terrID || selectedItem?.id_teryt,\r\n areaID || currentSection?.id,\r\n indicatorID || currentIndicator?.id?.split(\"-\")?.[1],\r\n ];\r\n\r\n // const _history = _path?.length === 3 ? \"/\" + _path?.join(\"/\") : \"/\";\r\n const _history = \"/\" + _path?.filter((f) => f)?.join(\"/\");\r\n\r\n // history.push(\"/\");\r\n history.push(_history);\r\n }\r\n })\r\n .catch((e) => console.log(e))\r\n .finally(() => {\r\n setUrlParams({ terrID, areaID, indicatorID });\r\n setTimeout(() => {\r\n setLoading(false);\r\n }, 2000);\r\n // processing = false;\r\n });\r\n }\r\n\r\n /** Handlers */\r\n const handleOnRef = ({ type, ref }) => {\r\n if (ref) {\r\n setPdfRefs({\r\n ...pdfRefs,\r\n [type]: ref,\r\n });\r\n }\r\n };\r\n\r\n const scrollToTop = () => {\r\n window.scrollTo({\r\n top: 0,\r\n behavior: \"smooth\",\r\n });\r\n };\r\n /** /end Handlers */\r\n\r\n return (\r\n <>\r\n \r\n
\r\n {!!error && }\r\n {/* {defaultData && !!selectedItem && !error && !loading ? ( */}\r\n\r\n {/*
{JSON.stringify({defaultData})}
\r\n
{JSON.stringify({selectedItem})}
\r\n
{JSON.stringify({loading})}
*/}\r\n\r\n {/* {!!defaultData && !!selectedItem && !loading ? ( */}\r\n {!loading && selectedItem ? (\r\n \r\n \r\n \r\n }>\r\n \r\n \r\n {loading ? null : }\r\n \r\n \r\n }>\r\n handleOnRef({ ref, type: \"map\" })} />\r\n \r\n \r\n \r\n }>\r\n {/* */}\r\n \r\n \r\n \r\n \r\n }>\r\n \r\n \r\n \r\n \r\n }>\r\n \r\n \r\n \r\n \r\n }>\r\n handleOnRef({ ref, type: \"bar\" })} />\r\n \r\n
\r\n \r\n handleOnRef({\r\n ref,\r\n type: \"pdfline\",\r\n })\r\n }\r\n />\r\n
\r\n\r\n
\r\n handleOnRef({ ref, type: \"pdfbar\" })} />\r\n
\r\n
\r\n\r\n \r\n }>\r\n handleOnRef({ ref, type: \"rank\" })} />\r\n \r\n \r\n\r\n {/* \r\n }>\r\n handleOnRef({ ref, type: \"pine\" })} />\r\n \r\n */}\r\n {/* \r\n }>\r\n handleOnRef({ ref, type: \"pine\" })} />\r\n \r\n */}\r\n \r\n }>\r\n handleOnRef({ ref, type: \"pine\" })} />\r\n \r\n \r\n\r\n \r\n }\r\n color={\"primary\"}\r\n target={\"_blank\"}\r\n aria-label={\"przejdz do SMUP\"}\r\n >\r\n {t(\"System Monitorowania Usług Publicznych\")}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ) : (\r\n !!loading && (\r\n
\r\n \r\n
\r\n )\r\n )}\r\n \r\n \r\n );\r\n};\r\n\r\n// http://dolnoslaskie.svs.local:2925/\r\n\r\nconst getUnitById = async ({ id, title, expanded, setError, dispatch, history, setOnTop = false, redirect = true }) => {\r\n if (isNaN(Number(id))) return;\r\n\r\n await getUnitByIdFromAPI({ terrID: id }).then((result) => {\r\n if (result.message?.type === \"Error\") {\r\n setError(result);\r\n // return false;\r\n } else {\r\n if (result.length) {\r\n dispatch(setSelectedTreeItem({ ...result[0], title: title || \" \" }));\r\n dispatch(setScrolledItem(result[0].id_teryt + \"|scroll\"));\r\n setOnTop && dispatch(setOnTopId(result[0].woj));\r\n expanded?.length && dispatch(setExpandedItems([result[0]?.woj?.toString()]));\r\n }\r\n\r\n redirect && history.push(\"/\");\r\n }\r\n });\r\n};\r\n\r\nconst processByUrlParams = async ({ terrID, areaID, indicatorID, setError, history }) => {\r\n console.clear();\r\n const errors = [];\r\n\r\n const units =\r\n terrID &&\r\n (await getUnitByIdFromAPI({ terrID })\r\n .then((result) => {\r\n if (result.message?.type === \"Error\") {\r\n errors.push(result);\r\n // setError(result);\r\n history.push(\"/wrong-id?err=territoryID\");\r\n return;\r\n }\r\n return result;\r\n })\r\n .catch((e) => console.log(e)));\r\n\r\n const areas =\r\n areaID &&\r\n (await getAreasFromAPI({ terrID })\r\n .then((result) => {\r\n if (result.message?.type === \"Error\") {\r\n errors.push(result);\r\n // setError(result);\r\n return result;\r\n }\r\n\r\n const _areaIds = result?.map((r) => r?.id?.toString());\r\n\r\n if (!_areaIds?.includes(areaID?.toString())) {\r\n if (_areaIds?.length) {\r\n errors.push(\"wrong-id?err=areaID\");\r\n history.push(`/${terrID}/${_areaIds[0]}`);\r\n } else {\r\n errors.push(\"wrong-id?err=areaID\");\r\n history.push(\"/wrong-id?err=areaID\");\r\n }\r\n return;\r\n }\r\n return result;\r\n })\r\n .catch((e) => console.log(e)));\r\n\r\n const tableData =\r\n areaID &&\r\n (await getTableDataFromAPI({ terrID, areaID })\r\n .then((result) => {\r\n if (result.message?.type === \"Error\") {\r\n errors.push(result);\r\n // setError(result);\r\n return result;\r\n }\r\n\r\n const _indicatorIds = result?.rows?.map((r) => r?.id?.toString());\r\n\r\n if (!_indicatorIds?.includes(`${areaID}-${indicatorID}`)) {\r\n if (_indicatorIds?.length) {\r\n errors.push(\"wrong-id?err=indicatorID\");\r\n history.push(`/${terrID}/${areaID}/${_indicatorIds?.[0]?.split(\"-\")?.[1]}`);\r\n } else {\r\n errors.push(\"wrong-id?err=indicatorID\");\r\n history.push(\"/wrong-id?err=indicatorID\");\r\n }\r\n return false;\r\n }\r\n\r\n result.rows = result?.rows?.map((row) => {\r\n const _rowKeys = Object.keys(row);\r\n const rowValues = Object.values(row).filter((r) => typeof r === \"number\" && r !== null);\r\n const precision = decimalCount(rowValues.find((r) => String(r).includes(\".\")) || rowValues[0]);\r\n\r\n let _extRow = {};\r\n _rowKeys?.forEach((key) => {\r\n _extRow[key] =\r\n !row[key]?.val && (typeof row[key] === \"number\" || row[key] === null)\r\n ? {\r\n val: row[key],\r\n pre: precision,\r\n fid: row[key] === null ? 5 : 1,\r\n }\r\n : row[key];\r\n });\r\n return _extRow;\r\n });\r\n\r\n result = [result];\r\n\r\n return result;\r\n })\r\n .catch((e) => console.log(e))\r\n .finally(() => {}));\r\n\r\n return { units, areas, tableData, errors };\r\n};\r\n\r\nconst S2V = {\r\n DOLNOSLASKIE: \"1\",\r\n \"KUJAWSKO-POMORSKIE\": \"2\",\r\n LUBELSKIE: \"3\",\r\n LUBUSKIE: \"4\",\r\n LODZKIE: \"5\",\r\n MALOPOLSKIE: \"6\",\r\n MAZOWIECKIE: \"7\",\r\n OPOLSKIE: \"8\",\r\n PODKARPACKIE: \"9\",\r\n PODLASKIE: \"10\",\r\n POMORSKIE: \"11\",\r\n SLASKIE: \"12\",\r\n SWIETOKRZYSKIE: \"13\",\r\n \"WARMINSKO-MAZURSKIE\": \"14\",\r\n WIELKOPOLSKIE: \"15\",\r\n ZACHODNIOPOMORSKIE: \"16\",\r\n};\r\n\r\nconst subdomainToVoivodship = (SUBDOMAIN = false) => {\r\n SUBDOMAIN = SUBDOMAIN || window.location.hostname.split(\".\").reverse()[2]?.toUpperCase();\r\n const VOIVODSHIP = S2V[SUBDOMAIN] || \"wrong-id\";\r\n\r\n return VOIVODSHIP;\r\n};\r\n\r\nconst decimalCount = (num) => {\r\n const numStr = String(num);\r\n if (numStr.includes(\".\")) {\r\n return numStr.split(\".\")[1].length;\r\n }\r\n return 0;\r\n};\r\n\r\nexport default MainPage;\r\n"],"sourceRoot":""}