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pD,EAAaqD,UAAWpD,EAAgBE,OAAQA,EAChEI,kBAAmBA,EAAmBE,cAAeA,EAAeE,gBAAiBA,IAErG2B,EAAAA,cAACgB,EAAAA,EAAqB,CAACF,OAAQpD,EAAaqD,UAAWpD,EAAgBE,OAAQA,EAC/DI,kBAAmBA,EAAmBE,cAAeA,EAAeE,gBAAiBA,KAMzG2B,EAAAA,cAAAA,EAAAA,SAAA,KACEA,EAAAA,cAACI,EAAAA,GAAM,CAACC,UAAU,qBAAqBY,SAAS,EAAMX,MAAO,CAACC,MAAO,OAAQC,YAAazC,GAAW2C,aAAcA,IAAM1C,EAAY,UAG3I,E,cCnEF,MAAMkD,EAAYnC,SAASoC,eAAe,uBAC1C,GAAID,EAAW,CACb,MAAMzD,EAAOyD,EAAUE,QAAQ3D,MAC/B4D,EAAAA,EAAAA,GAAWH,GAAWI,OAAOtB,EAAAA,cAACuB,EAAAA,WAAU,KAACvB,EAAAA,cAACxC,EAAkB,CAACC,KAAMA,KACrE,C","sources":["webpack://lionwheel/./app/javascript/src/react_components/routes/routes_suggestion/RouteSuggestionBtn.jsx","webpack://lionwheel/./app/javascript/src/react_components/routes/routes_suggestion/index.js"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {i18n} from \"../../../helpers/i18n\";\nimport VehiclesModalComponent from \"./vehicles/ModalComponent\";\nimport DriversModalComponent from \"./drivers/ModalComponent\";\nimport {fetchConfig, selectedIds as selectedIdsHelper} from \"../../../helpers/utils\";\nimport {Button, ConfigProvider, notification} from \"antd\";\nimport {fetchVisitsSummaryAction} from \"../../tasks/actions\";\nimport {isRTL} from \"../../../helpers/locale\";\n\nconst RouteSuggestionBtn = ({mode}) => {\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [config, setConfig] = useState(null)\n const [btnColor, setBtnColor] = useState('#fff')\n const [selectedVisitsIds, setSelectedVisitsIds] = useState([])\n const [visitsSummary, setVisitsSummary] = useState(null)\n const [notificationApi, notificationContext] = notification.useNotification()\n\n const setupConfig = async () => {\n const config = await fetchConfig()\n setConfig({...config})\n }\n\n useEffect(() => {\n setupConfig()\n }, [])\n\n const handleClick = () => {\n const preloader = document.getElementsByClassName('data-preloader d-none')[0]\n preloader.classList.remove('d-none')\n const selectedIds = selectedIdsHelper(window.visitProxyObjects)\n fetchVisitsSummaryAction(selectedIds).then(res => res.json()).then(data => {\n if (data.error) {\n notificationApi.error({message: data.error, placement: 'top'})\n return preloader.classList.add('d-none')\n } else {\n preloader.classList.add('d-none')\n setVisitsSummary(data)\n setIsModalOpen(true)\n setSelectedVisitsIds(selectedIds)\n }\n })\n }\n\n if (config) {\n return (\n \n {notificationContext}\n \n {mode === 'vehicles' ? (\n \n ) : (\n \n )}\n \n )\n } else {\n return (\n <>\n \n >\n )\n }\n}\n\nexport default RouteSuggestionBtn\n","import React, { StrictMode } from 'react'\nimport RouteSuggestionBtn from \"./RouteSuggestionBtn\";\nimport {createRoot} from \"react-dom/client\";\n\nconst container = document.getElementById('r-routes-suggestion')\nif (container) {\n const mode = container.dataset.mode\n createRoot(container).render()\n}\n"],"names":["RouteSuggestionBtn","mode","isModalOpen","setIsModalOpen","useState","config","setConfig","btnColor","setBtnColor","selectedVisitsIds","setSelectedVisitsIds","visitsSummary","setVisitsSummary","notificationApi","notificationContext","notification","useNotification","useEffect","async","fetchConfig","setupConfig","handleClick","preloader","document","getElementsByClassName","classList","remove","selectedIds","selectedIdsHelper","window","visitProxyObjects","fetchVisitsSummaryAction","then","res","json","data","error","message","placement","add","React","ConfigProvider","direction","isRTL","Button","className","style","width","borderColor","onClick","onMouseEnter","i18n","t","VehiclesModalComponent","isOpen","setIsOpen","DriversModalComponent","loading","container","getElementById","dataset","createRoot","render","StrictMode"],"sourceRoot":""}