0 ? consultationRequests[0] : null} />,\n },\n ];\n return (\n \n \n {consultationRequests && consultationRequests.length > 0 && consultationRequests[0].id !== '' && consultationRequests[0].healthPlan && consultationRequests[0].user ? (\n \n \n \n \n \n
\n \n \n \n \n
\n
\n ) : null}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n isAuthenticated: state.authentication.isAuthenticated,\n consultationRequests: state.consultationRequests.data,\n consultationRequestsIsFetching: state.consultationRequests.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getCRequest: (params) => dispatch(fetchConsultationRequest(params)),\n});\n\nUser.defaultProps = {\n consultationRequests: null,\n consultationRequestsIsFetching: null,\n getCRequest: null,\n history: null,\n match: null,\n t: null,\n theme: null,\n};\n\nUser.propTypes = {\n consultationRequests: PropTypes.arrayOf(PropTypes.shape()),\n consultationRequestsIsFetching: PropTypes.bool,\n getCRequest: PropTypes.func,\n history: PropTypes.shape(),\n match: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['console.user', 'enums', 'translation'])(User))));\n","import React from 'react';\n\nimport { Route, Switch, useRouteMatch } from 'react-router-dom';\n\nimport { Authorities } from '../../../enums';\n\nimport { Header } from '../../../components/console';\nimport PrivateRoute from '../../common/PrivateRoute';\nimport Home from '../Home';\nimport Users from '../Users';\nimport User from '../User';\n\nimport './bootstrap.cosmo.min.css';\nimport './App.css';\n\nconst App = () => {\n const { path } = useRouteMatch();\n return (\n \n \n\n \n \n \n \n \n \n \n \n \n\n {/* */}\n \n );\n};\n\nexport default App;\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Accordion as A } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport { OutlineSvg } from '../..';\n\nconst MA = styled(A)(({ theme }) => ({\n boxShadow: theme.shadows.buttonActive,\n outline: 'none',\n width: '100%',\n}));\n\nconst MCollapse = styled(A.Collapse)((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '20px 15px 20px 25px',\n}));\n\nconst MToggle = styled(A.Toggle)((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.WHITE,\n border: 0,\n color: p.theme.colors.GREY1,\n display: 'flex',\n flexDirection: 'row',\n fontFamily: p.theme.fontFamily.sansCaption,\n height: 'auto',\n justifyContent: 'space-between',\n padding: '20px 15px 20px 25px',\n textAlign: 'left',\n width: '100%',\n\n '.description': {\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.medium,\n lineHeight: '24px',\n margin: 0,\n },\n\n '.title': {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.medium,\n flex: '1 1 auto',\n lineHeight: '24px',\n margin: 0,\n },\n}));\n\nconst Accordion = (props) => {\n const {\n className,\n data,\n defaultActiveKey,\n theme,\n } = props;\n\n return (\n \n {data.map((d, i) => (\n \n
\n \n
{d.toggle.title}
\n
{d.toggle.description}
\n
\n\n \n \n\n
\n {d.content.items}
\n \n
\n ))}\n \n );\n};\n\nAccordion.defaultProps = {\n className: null,\n data: [],\n defaultActiveKey: null,\n theme: null,\n};\n\nAccordion.propTypes = {\n className: PropTypes.string,\n data: PropTypes.arrayOf(PropTypes.shape()),\n defaultActiveKey: PropTypes.number,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(Accordion);\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\nimport { withRouter } from 'react-router-dom';\n\nimport { OutlineSvg, Text } from '../..';\nimport { getCompany } from '../../../utils';\n\nconst AgencyContainer = styled.div((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.PRIMARY2,\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n height: 76,\n\n [p.theme.mediaQueries.md]: {\n height: 152,\n },\n\n a: {\n alignItems: 'center',\n display: 'flex',\n textDecoration: 'none',\n },\n}));\n\nconst AgencyContact = (props) => {\n const { textLink, theme } = props;\n const goToContactPage = () => {\n const { history } = props;\n switch (getCompany()) {\n case 'bcc':\n window.open('http://www.bccassicurazioni.com/distributori/ricerca.asp?i_menuID=25369', '_blank').focus();\n break;\n case 'vera':\n window.open('https://www.bancobpm.it/trova-filiali/', '_blank').focus();\n break;\n default:\n history.push('/contactme');\n }\n };\n\n return (\n \n \n \n \n \n );\n};\n\nAgencyContact.propTypes = {\n history: PropTypes.shape(),\n textLink: PropTypes.string,\n theme: PropTypes.shape(),\n};\n\nAgencyContact.defaultProps = {\n history: null,\n textLink: null,\n theme: null,\n};\n\nexport default withRouter(withTheme(AgencyContact));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\nimport { connect } from 'react-redux';\n\nimport { Text, Container } from '../..';\nimport { EventTypeOutlineIcon, EventStatuses } from '../../../enums';\nimport { fetchGroupedEvents } from '../../../reducers/events/actions';\nimport OutlineSvg from '../../common/OutlineSvg';\n\nconst WhiteContainer = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n borderTopRightRadius: '0px',\n borderBottomRightRadius: '0px',\n boxShadow: '0 2px 35px -8px rgba(0, 0, 0, 0.2)',\n display: 'flex',\n justifyContent: 'start',\n height: 312,\n minWidth: 'calc(100% + 20px)',\n margin: '0 0 0 -5px',\n overflowX: 'auto',\n padding: 20,\n\n [p.theme.mediaQueries.md]: {\n borderRadius: '8px',\n marginLeft: 'auto',\n marginRight: 'auto',\n maxWidth: '1140px',\n minWidth: 'auto',\n width: '100%',\n },\n}));\n\nconst StartYearContainer = styled.div((p) => ({\n borderRight: `solid 2px ${p.theme.colors.GREY2}`,\n display: 'flex',\n flexDirection: 'column',\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n },\n}));\n\nconst NextYearContainer = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n },\n}));\n\nconst StartYearMonthsContainer = styled.div({\n display: 'flex',\n});\n\nconst NextYearMonthsContainer = styled.div({\n display: 'flex',\n});\n\nconst MonthViewContainer = styled.div((p) => ({\n backgroundColor: `${p.isCurrentMonth ? p.theme.colors.LIGHTBLUE : 'transparent'}`,\n borderLeft: `1px solid ${p.isStartMonthOfYear ? 'transparent' : p.theme.colors.GREY5}`,\n minHeight: '200px',\n width: 82,\n}));\n\nconst RowIcon = styled.div({\n margin: '5px 0px',\n paddingLeft: '15px',\n textAlign: 'left',\n});\n\nconst MonthView = (props) => {\n const {\n data,\n isCurrentMonth,\n isStartMonthOfYear,\n month,\n theme,\n } = props;\n\n const rows = [];\n\n Object.entries(data).forEach((entry) => {\n const row = (\n \n { EventTypeOutlineIcon[entry[0]] ? : null }\n \n \n );\n rows.push(row);\n });\n\n return (\n \n \n {rows}\n \n );\n};\n\nMonthView.defaultProps = {\n month: '',\n data: {},\n isStartMonthOfYear: false,\n isCurrentMonth: false,\n theme: null,\n};\n\nMonthView.propTypes = {\n month: PropTypes.string,\n data: PropTypes.shape(),\n isStartMonthOfYear: PropTypes.bool,\n isCurrentMonth: PropTypes.bool,\n theme: PropTypes.shape(),\n};\n\nclass AnnualActivityPlanning extends React.Component {\n componentDidMount() {\n const { healthPlanId, getGroupedEvents } = this.props;\n\n getGroupedEvents({\n healthPlanId,\n statuses: `${EventStatuses.PRENOTATO},${EventStatuses.FATTO},${EventStatuses.DRAFT},${EventStatuses.SALTATO}`,\n });\n }\n\n render() {\n const { data, startDate, theme } = this.props;\n\n if (!data) {\n return null;\n }\n\n let i = 0;\n const monthViewsStartYear = [];\n const monthViewsNextYear = [];\n const startYear = startDate.getFullYear();\n const today = new Date();\n const startDateTmp = new Date(startDate);\n // Build the 2 arrays of months (one for each year, startYear and endYear)\n // All the period starts from the month related to the startDate of the healthplan\n do {\n i += 1;\n const month = startDateTmp.getMonth() + 1;\n const year = startDateTmp.getFullYear();\n const monthName = startDateTmp.toLocaleString('it-IT', {\n month: 'short',\n });\n\n const key = `${year}-${`0${month}`.slice(-2)}`;\n const monthData = data && data[key] ? data[key] : {};\n\n const isCurrentMonth = today.getMonth() + 1 === month && today.getFullYear() === year;\n\n const isStartMonthOfYear = i === 1;\n\n const monthView = ;\n\n if (year === startYear) {\n monthViewsStartYear.push(monthView);\n } else {\n monthViewsNextYear.push(monthView);\n }\n\n startDateTmp.setMonth(startDateTmp.getMonth() + 1);\n } while (i < 13);\n const endYear = startDateTmp.getFullYear();\n\n return (\n <>\n \n \n \n \n \n \n {monthViewsStartYear} \n \n\n \n \n {monthViewsNextYear} \n \n \n >\n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n data: state.events.groupedEvents.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getGroupedEvents: (params) => {\n dispatch(fetchGroupedEvents(params));\n },\n});\n\nAnnualActivityPlanning.defaultProps = {\n data: null,\n getGroupedEvents: null,\n theme: null,\n};\n\nAnnualActivityPlanning.propTypes = {\n startDate: PropTypes.instanceOf(Date).isRequired,\n healthPlanId: PropTypes.number.isRequired,\n data: PropTypes.objectOf(PropTypes.object),\n getGroupedEvents: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(AnnualActivityPlanning));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport { Card, Container } from '../..';\n\nconst MC = styled(Container)((p) => ({\n maxWidth: '100%',\n overflowX: 'auto',\n padding: '33px 20px',\n textAlign: 'center',\n whiteSpace: 'nowrap',\n\n [p.theme.mediaQueries.xs]: {\n padding: '33px 30px',\n },\n\n [p.theme.mediaQueries.lg]: {\n padding: 'padding: 33px 15px',\n },\n\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n\n '.card': {\n display: 'inline-block',\n marginRight: '30px',\n\n '&:last-child': {\n margin: 0,\n },\n },\n}));\n\nconst Cards = (props) => {\n const { list } = props;\n return (\n \n {list && list.length > 0 ? list.map((card) => ) : null}\n \n );\n};\n\nCards.defaultProps = {\n list: [],\n};\n\nCards.propTypes = {\n list: PropTypes.arrayOf(PropTypes.shape({})),\n};\n\nexport default Cards;\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Container, Carousel, Text } from '../..';\nimport { getCompany } from '../../../utils';\n\nconst ContainerCustomerServices = styled(Container)((p) => ({\n a: {\n color: p.theme.colors.PRIMARY1,\n },\n}));\n\nconst CustomerServices = (props) => {\n const { t, theme } = props;\n const services = [\n {\n title: 'portale.customerservices:service1.title',\n desc: 'portale.customerservices:service1.desc',\n icon: 'PreventionService',\n },\n {\n title: 'portale.customerservices:service2.title',\n desc: 'portale.customerservices:service2.desc',\n icon: 'DiagnosisService',\n },\n {\n title: 'portale.customerservices:service3.title',\n desc: 'portale.customerservices:service3.desc',\n icon: 'CareService',\n },\n {\n title: 'portale.customerservices:service4.title',\n desc: 'portale.customerservices:service4.desc',\n icon: 'ConvalescenceService',\n },\n ];\n\n return (\n \n \n \n \n\n \n\n {getCompany() === 'bcc'\n ? (\n \n )\n : null}\n\n {getCompany() === 'cattolica'\n ? (\n \n )\n : null}\n\n {getCompany() === 'tua'\n ? (\n \n )\n : null}\n\n {getCompany() === 'vera'\n ? (\n \n )\n : null}\n\n \n );\n};\n\nCustomerServices.defaultProps = {\n t: null,\n theme: null,\n};\n\nCustomerServices.propTypes = {\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.customerservices'])(CustomerServices));\n","import React, { useState } from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Form as F } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { OutlineSvg, Text } from '../../..';\n\nconst ButtonImage = styled.div({\n flex: '0 1 50%',\n\n input: {\n display: 'none',\n },\n});\n\nconst ButtonText = styled.div((p) => ({\n flex: '1 1 100%',\n\n input: {\n display: 'none',\n },\n\n [p.theme.mediaQueries.md]: {\n flex: '0 1 50%',\n },\n}));\n\nconst CheckedImage = styled.span({\n display: 'none',\n height: 34,\n position: 'absolute',\n right: 10,\n top: 10,\n width: 34,\n});\n\nconst CheckedText = styled.span({\n display: 'none',\n height: 34,\n lineHeight: '34px',\n position: 'absolute',\n right: 10,\n top: '50%',\n transform: 'translate(0, -50%)',\n width: 34,\n});\n\nconst Form = styled.form((p) => ({\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n margin: '50px -12px',\n maxWidth: p.type === 'image' ? 352 : 'none',\n\n [p.theme.mediaQueries.md]: {\n margin: '50px auto',\n },\n}));\n\nconst InputContainer = styled.div((p) => ({\n flex: '1 1 100%',\n\n [p.theme.mediaQueries.md]: {\n flex: '0 1 50%',\n },\n\n input: {\n height: 65,\n margin: 12,\n width: 'calc(100% - 24px)',\n },\n}));\n\nconst InputImage = styled.input((p) => ({\n display: 'none',\n\n '&:checked+label': {\n border: `2px solid ${p.theme.colors.PRIMARY2}`,\n\n '.checked': {\n display: 'block',\n },\n },\n}));\n\nconst InputText = styled.input((p) => ({\n display: 'none',\n\n '&:checked+label': {\n border: `2px solid ${p.theme.colors.PRIMARY2}`,\n\n '.checked': {\n display: 'block',\n },\n },\n}));\n\nconst LabelImage = styled.label((p) => ({\n borderRadius: 8,\n boxShadow: p.theme.shadows.card,\n cursor: 'pointer',\n display: 'block',\n flex: '1 1 50%',\n margin: 12,\n maxHeight: 152,\n maxWidth: 152,\n padding: 15,\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n height: 152,\n width: 152,\n },\n}));\n\nconst LabelText = styled.label((p) => ({\n alignItems: 'center',\n borderRadius: 4,\n boxShadow: p.theme.shadows.card,\n cursor: 'pointer',\n display: 'flex',\n flex: '1 1 100%',\n justifyContent: 'center',\n margin: 12,\n minHeight: 65,\n padding: '15px 45px 15px 30px',\n position: 'relative',\n}));\n\nconst Checkbox = (props) => {\n const {\n name,\n onChange,\n options,\n t,\n theme,\n type,\n } = props;\n\n const getSelectedOptions = () => {\n const tmp = [];\n\n options.forEach((e) => {\n if (e.selected) {\n tmp.push(e.value);\n }\n });\n\n return tmp;\n };\n\n const [inputOption, setInputOption] = useState(null);\n const [selectedOptions, setSelectedOptions] = useState(getSelectedOptions());\n\n const handleBlur = (event) => {\n const tmp = selectedOptions;\n const { value } = event.target;\n\n const freeOptionIndex = options.findIndex((a) => a.free);\n const hasPriorityOptionIndex = options.findIndex((a) => a.hasPriority);\n if (value) {\n if (value === inputOption) {\n return;\n }\n\n if (tmp.indexOf(inputOption) !== -1) {\n tmp.splice(tmp.indexOf(inputOption), 1);\n }\n\n if (hasPriorityOptionIndex > -1\n && tmp.indexOf(options[hasPriorityOptionIndex].value) !== -1) {\n tmp.splice(tmp.indexOf(options[hasPriorityOptionIndex].value), 1);\n }\n\n tmp.push(value);\n setInputOption(value);\n } else if (inputOption) {\n tmp.splice(tmp.indexOf(inputOption), 1);\n setInputOption(null);\n } else if (freeOptionIndex > -1 && tmp.indexOf(options[freeOptionIndex].value) !== -1) {\n tmp.splice(tmp.indexOf(options[freeOptionIndex].value), 1);\n setInputOption(null);\n }\n\n setSelectedOptions(tmp);\n\n if (onChange) {\n onChange(tmp);\n }\n };\n\n const handleChange = (event) => {\n let tmp = selectedOptions;\n const { value } = event.target;\n\n const hasPriorityOptionIndex = options.findIndex((a) => a.hasPriority);\n\n if (tmp.indexOf(value) === -1) {\n tmp.push(value);\n } else {\n tmp.splice(tmp.indexOf(value), 1);\n }\n\n if (tmp.length > 0\n && hasPriorityOptionIndex > -1\n && value === options[hasPriorityOptionIndex].value\n ) {\n tmp = [value];\n } else if (hasPriorityOptionIndex > -1) {\n const hasPriorityOptionValueAddedIndex = tmp.findIndex((a) => a === options[hasPriorityOptionIndex].value);\n if (hasPriorityOptionValueAddedIndex > -1) {\n tmp.splice(tmp.indexOf(options[hasPriorityOptionIndex].value), 1);\n }\n }\n\n setSelectedOptions(tmp);\n\n if (onChange) {\n onChange(tmp);\n }\n };\n\n return (\n \n );\n};\n\nCheckbox.defaultProps = {\n name: 'checkbox',\n onChange: null,\n options: [],\n t: null,\n theme: null,\n type: null,\n};\n\nCheckbox.propTypes = {\n name: PropTypes.string,\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape()),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n type: PropTypes.oneOf(['image', 'text']),\n};\n\nexport default withTheme(withTranslation(['portale.questionnaire'])(Checkbox));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport { Row, Col } from 'react-bootstrap';\nimport { Link } from 'react-router-dom';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { getEventInfo } from '../../../utils';\nimport { Text, OutlineSvg } from '../..';\n\nconst ContainerEvents = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '16px 0',\n '.icon-check': {\n borderRight: `1px solid ${p.theme.colors.GREY4}`,\n maxWidth: 48,\n padding: 0,\n },\n '.event-info': {\n padding: 0,\n maxWidth: 'calc(100% - 70px)',\n a: {\n width: 'auto',\n },\n },\n '.row': {\n margin: 0,\n },\n '.m-0.row:last-child': {\n '.event-info p': {\n marginBottom: 0,\n },\n },\n}));\n\nconst IconRight = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY4,\n border: '0px',\n borderRadius: '50%',\n height: 24,\n lineHeight: '24px',\n marginRight: 34,\n marginTop: 0,\n minWidth: 24,\n textAlign: 'center',\n width: 24,\n\n [p.theme.mediaQueries.md]: {\n marginRight: 20,\n },\n\n '&.FATTA, &.FATTO': {\n backgroundColor: p.theme.colors.GREEN,\n },\n\n '&.highlight': {\n position: 'relative',\n\n '&:after': {\n backgroundColor: p.theme.colors.GREEN,\n borderRadius: '50%',\n content: 'close-quote',\n height: 8,\n left: '-12px',\n position: 'absolute',\n top: 'calc(50% - 4px)',\n width: 8,\n },\n },\n}));\n\nconst EventsOfActivity = (props) => {\n const { eventsByActivity, showReadAll, theme } = props;\n\n const { t } = useTranslation();\n\n if (eventsByActivity && eventsByActivity.length > 0) {\n return (\n \n \n \n {eventsByActivity.map((evnt) => (\n \n \n \n \n \n \n \n \n \n \n \n \n
\n ))}\n \n
\n {showReadAll ? (\n \n ) : null}\n \n );\n }\n return null;\n};\n\nEventsOfActivity.defaultProps = {\n showReadAll: false,\n theme: null,\n};\n\nEventsOfActivity.propTypes = {\n eventsByActivity: PropTypes.arrayOf(PropTypes.shape).isRequired,\n showReadAll: PropTypes.bool,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(EventsOfActivity);\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Trans, withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { BrandIcon, Text, Container } from '../..';\nimport { getCompany, getSiteCompanyLink } from '../../../utils';\n\nconst CFooter = styled.footer((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.GREY6,\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n bottom: 0,\n display: 'flex',\n height: '256px',\n padding: p.theme.space,\n position: 'absolute',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n height: '231px',\n },\n}));\n\nconst ExternalContainer = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n\n '.brand-icon': {\n paddingTop: '20px',\n '&.bcc': {\n svg: {\n height: '35px',\n },\n },\n '&.vera': {\n svg: {\n height: '35px',\n },\n },\n '&.cattolica': {\n svg: {\n height: '60px',\n },\n },\n '&.tua': {\n paddingTop: '5px',\n svg: {\n height: '0px',\n },\n },\n },\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n\n '.brand-icon': {\n paddingTop: 0,\n },\n },\n}));\n\nconst LinkContainer = styled.div((p) => ({\n display: 'flex',\n justifyContent: 'center',\n margin: '50px 0',\n\n a: {\n width: 'auto',\n },\n\n [p.theme.mediaQueries.md]: {\n margin: 0,\n justifyContent: 'flex-end',\n },\n}));\n\nconst Footer = (props) => {\n const { theme } = props;\n\n return (\n <>\n {getCompany() !== 'bcc' ? (\n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n ) : null }\n >\n );\n};\n\nFooter.defaultProps = {\n theme: null,\n};\n\nFooter.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.footer'])(Footer));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Button } from 'react-bootstrap';\nimport { connect } from 'react-redux';\nimport { Link, withRouter } from 'react-router-dom';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Logo, UserMenu } from '../../..';\nimport { OutlineSvg } from '../../../..';\n\nimport { setClientSidebarStatus } from '../../../../../reducers/settings/actions';\nimport { fetchCountNotifications } from '../../../../../reducers/notifications/actions';\n\nconst H = styled.header((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.PRIMARY1,\n boxShadow: '0 7px 16px 0 rgba(0,0,0,0.2)',\n display: 'flex',\n height: 80,\n padding: '0px 0px 0px 12px',\n\n [p.theme.mediaQueries.md]: {\n height: 88,\n padding: '0px 24px',\n },\n\n '&.opened.small': {\n '.actions': {\n display: 'none',\n },\n },\n\n '.navbar-toggler': {\n backgroundColor: 'transparent !important',\n border: 'none !important',\n boxShadow: 'none !important',\n marginRight: '16px',\n outline: 'none !important',\n padding: '0 0 0 2px',\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.WHITE,\n textDecoration: 'none',\n },\n },\n}));\n\nconst Circle = styled(Link)((p) => ({\n backgroundColor: p.theme.colors.PRIMARY1,\n border: `1px solid ${p.theme.colors.WHITE}`,\n borderRadius: '50%',\n height: 48,\n lineHeight: '44px',\n margin: '0 10px 0 5px',\n minWidth: 48,\n position: 'relative',\n textAlign: 'center',\n width: 48,\n\n span: {\n backgroundColor: p.theme.colors.SECONDARY2,\n border: `2px solid ${p.theme.colors.PRIMARY1}`,\n borderRadius: '50%',\n display: 'inline-block',\n height: 15,\n left: 0,\n position: 'absolute',\n top: 0,\n width: 15,\n },\n\n svg: {\n pointerEvents: 'none',\n },\n}));\n\nclass ClientHeader extends React.Component {\n constructor(props) {\n super(props);\n\n this.goToDefault = this.goToDefault.bind(this);\n this.onToggleMenu = this.onToggleMenu.bind(this);\n }\n\n componentDidMount() {\n const { getCountNotifications, setClientSidebar, screenSize } = this.props;\n setClientSidebar(screenSize === 'large');\n getCountNotifications();\n }\n\n componentDidUpdate(prevProps) {\n const {\n screenSize,\n setClientSidebar,\n } = this.props;\n\n if (screenSize !== prevProps.screenSize) {\n setClientSidebar(screenSize === 'large');\n }\n }\n\n onToggleMenu() {\n const { sidebarIsOpen, setClientSidebar } = this.props;\n setClientSidebar(!sidebarIsOpen);\n }\n\n goToDefault() {\n const { defaultPage, history } = this.props;\n history.push(defaultPage);\n }\n\n render() {\n const { count, screenSize, theme } = this.props;\n\n return (\n \n \n \n \n\n \n\n \n {count > 0 ? : null}\n \n \n\n \n \n );\n }\n}\nconst mapDispatchToProps = (dispatch) => ({\n getCountNotifications: () => {\n dispatch(fetchCountNotifications());\n },\n setClientSidebar: (params) => {\n dispatch(setClientSidebarStatus(params));\n },\n});\n\nconst mapStateToProps = (state) => ({\n count: state.notifications.countNotifications.count,\n sidebarIsOpen: state.settings.sidebarIsOpen,\n});\n\nClientHeader.defaultProps = {\n count: 0,\n defaultPage: '/',\n getCountNotifications: null,\n history: null,\n screenSize: null,\n setClientSidebar: null,\n sidebarIsOpen: true,\n theme: null,\n};\n\nClientHeader.propTypes = {\n count: PropTypes.number,\n defaultPage: PropTypes.string,\n getCountNotifications: PropTypes.func,\n history: PropTypes.shape(),\n screenSize: PropTypes.string,\n setClientSidebar: PropTypes.func,\n sidebarIsOpen: PropTypes.bool,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTheme(ClientHeader)));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport { withTranslation } from 'react-i18next';\nimport { Link, withRouter } from 'react-router-dom';\nimport { Nav, Navbar } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport { BrandIcon, OutlineSvg } from '../../../..';\nimport { Logo, UserMenu } from '../../..';\nimport { getCompany } from '../../../../../utils';\n\nconst PNavbar = styled(Navbar)((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.PRIMARY1,\n boxShadow: '0 7px 16px 0 rgba(0,0,0,0.2)',\n height: 80,\n padding: 0,\n\n [p.theme.mediaQueries.md]: {\n height: 88,\n paddingLeft: 'calc((100% - 720px)/2)',\n paddingRight: 'calc((100% - 720px)/2)',\n },\n\n [p.theme.mediaQueries.lg]: {\n paddingLeft: 'calc((100% - 960px)/2)',\n paddingRight: 'calc((100% - 960px)/2)',\n },\n\n [p.theme.mediaQueries.xl]: {\n paddingLeft: 'calc((100% - 1140px)/2)',\n paddingRight: 'calc((100% - 1140px)/2)',\n },\n\n '.navbar-brand': {\n alignItems: 'center',\n display: 'flex',\n height: 80,\n paddingLeft: '66px',\n\n [p.theme.mediaQueries.md]: {\n paddingLeft: 0,\n },\n\n '&.without-menu': {\n paddingLeft: '24px',\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.WHITE,\n textDecoration: 'none',\n },\n },\n },\n\n '.navbar-collapse': {\n '&.collapsing': {\n display: 'none',\n },\n\n '&.collapse.show': {\n backgroundColor: p.theme.colors.GREY6,\n height: '100vh',\n position: 'relative',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n backgroundColor: p.theme.colors.PRIMARY1,\n height: 88,\n },\n\n '.brand-icon': {\n bottom: '85px',\n display: 'block',\n position: 'absolute',\n textAlign: 'center',\n width: '100%',\n '&.bcc': {\n svg: {\n height: '30px',\n marginBottom: '10px',\n },\n },\n '&.vera': {\n svg: {\n height: '45px',\n marginBottom: '10px',\n },\n },\n '&.cattolica': {\n svg: {\n height: '55px',\n },\n },\n '&.tua': {\n svg: {\n height: '80px',\n },\n },\n },\n },\n\n '.brand-icon': {\n display: 'none',\n },\n\n '.navbar-nav': {\n alignItems: 'center',\n backgroundColor: p.theme.colors.PRIMARY1,\n borderTop: `1px solid ${p.theme.colors.WHITE}`,\n padding: '10px 0px',\n position: 'absolute',\n width: '100%',\n zIndex: '3',\n\n [p.theme.mediaQueries.md]: {\n borderTop: 'none',\n padding: 0,\n position: 'initial',\n width: 'auto',\n },\n\n '&.no-logged': {\n a: {\n textAlign: 'center',\n\n [p.theme.mediaQueries.md]: {\n width: 172,\n\n '&:last-child': {\n width: 270,\n },\n },\n },\n },\n\n a: {\n color: p.theme.colors.WHITE,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.small,\n fontWeight: p.theme.fontWeights.bold,\n height: 53,\n padding: '0px 15px',\n textTransform: 'uppercase',\n\n [p.theme.mediaQueries.md]: {\n border: '0px !important',\n height: 'auto',\n lineHeight: 'initial',\n padding: '0px 20px 0px 0px',\n width: 'auto',\n },\n },\n },\n },\n\n '.navbar-toggler': {\n border: 0,\n color: p.theme.colors.WHITE,\n left: '24px',\n padding: 0,\n position: 'absolute',\n\n '&:focus': {\n outline: 'none',\n },\n\n '.navbar-toggler-icon': {\n backgroundImage:\n 'url(\\'data:image/svg+xml;charset=utf8,%3Csvg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Cpath stroke=\"rgba(255,255,255, 1)\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" d=\"M4 6h24M4 16h24M4 26h24\"/%3E%3C/svg%3E\\')',\n },\n },\n}));\n\nconst Circle = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '50%',\n cursor: 'pointer',\n height: 48,\n lineHeight: '44px',\n minWidth: 48,\n position: 'relative',\n textAlign: 'center',\n width: 48,\n marginRight: '24px',\n\n [p.theme.mediaQueries.md]: {\n marginRight: 0,\n },\n}));\n\nclass ProspectHeader extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n navExpanded: false,\n };\n\n this.closeNav = this.closeNav.bind(this);\n this.goToDefault = this.goToDefault.bind(this);\n this.goToWelcome = this.goToWelcome.bind(this);\n this.setNavExpanded = this.setNavExpanded.bind(this);\n }\n\n setNavExpanded(expanded) {\n this.setState({ navExpanded: expanded });\n }\n\n goToDefault() {\n const { defaultPage, history } = this.props;\n history.push(defaultPage);\n }\n\n goToWelcome() {\n const { history } = this.props;\n history.push('welcome');\n }\n\n closeNav() {\n this.setState({ navExpanded: false });\n }\n\n render() {\n const {\n notLogged,\n t,\n theme,\n userHasCompleteMenu,\n } = this.props;\n\n const { navExpanded } = this.state;\n\n return (\n <>\n {getCompany() === 'bcc' ? null : (\n \n {notLogged ? (\n <>\n \n \n \n\n \n \n \n \n {t('not logged.item 1')}\n \n \n {t('not logged.item 2')}\n \n \n \n \n\n \n \n \n >\n ) : (\n <>\n {!userHasCompleteMenu ? (\n <>\n \n \n \n\n \n >\n ) : (\n <>\n \n \n \n\n \n \n \n \n {t('prospect.item 1')}\n \n \n {t('prospect.item 2')}\n \n {\n getCompany() !== 'bcc'\n ? (\n <>\n {getCompany() !== 'vera'\n ? (\n \n {t('prospect.item 3')}\n \n )\n : (\n \n {t('prospect.item 3')}\n \n )}\n >\n )\n : null\n }\n\n \n \n \n\n \n >\n )}\n >\n )}\n \n )}\n >\n );\n }\n}\n\nProspectHeader.defaultProps = {\n defaultPage: '/',\n history: null,\n notLogged: null,\n t: null,\n theme: null,\n userHasCompleteMenu: false,\n};\n\nProspectHeader.propTypes = {\n defaultPage: PropTypes.string,\n history: PropTypes.shape(),\n notLogged: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n userHasCompleteMenu: PropTypes.bool,\n};\n\nexport default withRouter(withTheme(withTranslation(['portale.menu'])(ProspectHeader)));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { withTheme } from 'styled-components';\n\nimport { ClientHeader, ProspectHeader } from './Headers';\n\nimport { Authorities } from '../../../enums';\n\nimport { fetchQuestionnaire } from '../../../reducers/questionnaires/actions';\nimport { setUserHasQuestionnaire } from '../../../reducers/settings/actions';\n\nimport { getCodeCompany } from '../../../utils';\n\nclass Header extends React.Component {\n constructor(props) {\n super(props);\n\n this.mediaQuery = `screen and (min-width: ${props.theme.breakpoints.lg})`;\n }\n\n componentDidMount() {\n const {\n account,\n getQuestionnaireByUser,\n isFetchingAccount,\n } = this.props;\n\n if (!isFetchingAccount && account && account.company\n && account.company === getCodeCompany()) {\n getQuestionnaireByUser();\n }\n }\n\n componentDidUpdate() {\n const {\n questionnaire,\n setUserQuestionnaire,\n userHasQuestionnaire,\n } = this.props;\n\n if ((questionnaire && questionnaire.completed) || userHasQuestionnaire) {\n setUserQuestionnaire(true);\n } else {\n setUserQuestionnaire(false);\n }\n }\n\n render() {\n const {\n account,\n isAuthenticated,\n screenSize,\n userHasPreventionPathPrivacy,\n userHasQuestionnaire,\n } = this.props;\n\n const roles = account && account.authorities && account.authorities.length > 0\n ? account.authorities\n : [];\n\n if (!account || !isAuthenticated) {\n return ;\n }\n\n if (userHasQuestionnaire && userHasPreventionPathPrivacy\n && roles.includes(Authorities.PB_HEALTH_CLIENT.role)) {\n return (\n \n );\n }\n\n return (\n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getQuestionnaireByUser: () => dispatch(fetchQuestionnaire()),\n setUserQuestionnaire: (params) => {\n dispatch(setUserHasQuestionnaire(params));\n },\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingAccount: state.authentication.isFetchingAccount,\n loading: state.authentication.isFetchingToken,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n userHasPreventionPathPrivacy: state.settings.userHasPreventionPathPrivacy,\n userHasQuestionnaire: state.settings.userHasQuestionnaire,\n});\n\nHeader.defaultProps = {\n account: null,\n getQuestionnaireByUser: null,\n isAuthenticated: false,\n isFetchingAccount: null,\n questionnaire: null,\n screenSize: null,\n setUserQuestionnaire: null,\n theme: null,\n userHasPreventionPathPrivacy: false,\n userHasQuestionnaire: false,\n};\n\nHeader.propTypes = {\n account: PropTypes.shape(),\n getQuestionnaireByUser: PropTypes.func,\n isAuthenticated: PropTypes.bool,\n isFetchingAccount: PropTypes.bool,\n questionnaire: PropTypes.shape(),\n screenSize: PropTypes.string,\n setUserQuestionnaire: PropTypes.func,\n theme: PropTypes.shape(),\n userHasPreventionPathPrivacy: PropTypes.bool,\n userHasQuestionnaire: PropTypes.bool,\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(Header));\n","import React, { useEffect, useState } from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport { withTranslation } from 'react-i18next';\n\nimport styled from 'styled-components';\n\nimport { MaterialDesignInput } from '../../..';\n\nconst Form = styled.form({\n display: 'block',\n textAlign: 'left',\n maxWidth: '347px',\n margin: '50px auto',\n});\n\nconst MMaterialDesignInput = styled(MaterialDesignInput)((p) => ({\n '.form-control': {\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n height: 103,\n lineHeight: '68px !important',\n textAlign: 'center',\n },\n\n '.form-label': {\n fontSize: p.theme.fontSizes.xxxlarge,\n left: '50% !important',\n transform: 'translate(-50%, -50%)',\n },\n\n '.label-top': {\n '.form-label': {\n fontSize: p.theme.fontSizes.xlarge,\n left: '25px !important',\n top: 25,\n },\n },\n}));\n\nconst InputNumber = (props) => {\n const {\n placeholder,\n name,\n onChange,\n value,\n } = props;\n\n const [mValue, setMValue] = useState(parseFloat(value) || 75);\n\n const handleChange = (event) => {\n setMValue(parseFloat(event.value) || null);\n\n if (event && onChange) {\n onChange(event);\n }\n };\n\n useEffect(() => {\n if (onChange && value) {\n onChange({ value });\n }\n }, [onChange, value]);\n\n return (\n \n );\n};\n\nInputNumber.defaultProps = {\n placeholder: null,\n name: 'input-number',\n onChange: null,\n value: null,\n};\n\nInputNumber.propTypes = {\n placeholder: PropTypes.string,\n name: PropTypes.string,\n onChange: PropTypes.func,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nexport default withTranslation(['portale.questionnaire'])(InputNumber);\n","/* eslint-disable no-shadow */\nimport React, { useEffect, useCallback, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport { debounce } from 'lodash';\nimport { connect } from 'react-redux';\nimport { useJsApiLoader } from '@react-google-maps/api';\n\nimport { withTranslation } from 'react-i18next';\n\nimport { autocompletePlaces } from '../../../../reducers/places/actions';\nimport { setGoogleService } from '../../../../reducers/settings/actions';\nimport { SelectInput } from '../../..';\nimport config from '../../../../config/maps';\n\nconst Form = styled.form({\n display: 'block',\n textAlign: 'left',\n maxWidth: '347px',\n margin: '50px auto',\n});\n\nconst libraries = ['places'];\n\nconst InputSearch = (props) => {\n const {\n // google,\n setGoogle,\n searchPlaces,\n places,\n t,\n value,\n placeholder,\n isClearable,\n name,\n types,\n } = props;\n\n const [loaded, setLoaded] = useState(false);\n\n const { isLoaded, loadError } = useJsApiLoader({\n googleMapsApiKey: config.API_KEY,\n libraries,\n language: 'it',\n });\n\n useEffect(() => {\n if (isLoaded && !loaded) {\n setGoogle(window.google);\n setLoaded(true);\n }\n }, [isLoaded, loaded, setGoogle]);\n\n const handleChange = (event) => {\n const { onChange, isClearable } = props;\n if ((event.target.value && onChange) || (event.target.value === null && isClearable)) {\n onChange(event.target.value);\n }\n };\n\n const handleChangeInput = useCallback(\n (input) => {\n if (input.length > 0) {\n searchPlaces({ input, types });\n }\n },\n [searchPlaces, types],\n );\n\n const hci = debounce((input) => {\n handleChangeInput(input);\n }, 750);\n\n const mappedPlaces = places.map((o) => ({\n data: o,\n label: o.description,\n value: o.description,\n }));\n\n if (loadError) {\n return {t('inputSearch.error')}
;\n }\n\n return (\n \n );\n};\n\nconst mapDispatchToProps = (dispatch) => ({\n searchPlaces: (params) => {\n dispatch(autocompletePlaces(params));\n },\n setGoogle: (params) => {\n dispatch(setGoogleService(params));\n },\n});\n\nconst mapStateToProps = (state) => ({\n places: state.places.places,\n});\n\nInputSearch.defaultProps = {\n google: null,\n isClearable: false,\n name: 'input-search',\n onChange: null,\n placeholder: null,\n places: [],\n searchPlaces: null,\n setGoogle: null,\n t: null,\n types: null,\n value: null,\n};\n\nInputSearch.propTypes = {\n google: PropTypes.shape(),\n isClearable: PropTypes.bool,\n name: PropTypes.string,\n onChange: PropTypes.func,\n placeholder: PropTypes.string,\n places: PropTypes.arrayOf(PropTypes.shape()),\n searchPlaces: PropTypes.func,\n setGoogle: PropTypes.func,\n t: PropTypes.func,\n types: PropTypes.arrayOf(PropTypes.string),\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.questionnaire'])(InputSearch));\n","import React from 'react';\n\nimport { ListGroup as L } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\n\nimport styled, { withTheme } from 'styled-components';\nimport { styledSystem } from '../../../themes';\n\nimport EventsOfActivity from '../EventsOfActivity';\n\nimport { ActivityGroupIcon, ActivityGroup, EventStatuses } from '../../../enums';\nimport { getFrequency } from '../../../utils';\n\nimport {\n Button,\n CartoonSvg,\n OutlineSvg,\n Text,\n} from '../..';\n\nimport { fetchEventsByActivity } from '../../../reducers/events/actions';\n\nconst Back = styled.a((p) => ({\n cursor: 'pointer',\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.bold,\n textTransform: 'uppercase',\n\n [p.theme.mediaQueries.md]: {\n display: 'none',\n },\n}));\n\nconst Container = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n },\n}));\n\nconst ContainerData = styled.div((p) => ({\n alignItems: 'flex-start',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'flex-start',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n\n p: {\n display: 'flex',\n marginBottom: 0,\n width: 'calc(33% - 20px)',\n\n '&:last-child': {\n justifyContent: 'flex-end',\n },\n },\n },\n\n '&.CLIENTE_SALUTE': {\n p: {\n [p.theme.mediaQueries.md]: {\n flex: '1 1 33%',\n maxWidth: 'calc(33% - 28px)',\n },\n },\n },\n\n p: {\n flex: '1 1 100%',\n marginBottom: 8,\n\n '&:last-child': {\n justifyContent: 'flex-end',\n },\n\n span: {\n fontSize: p.theme.fontSizes.small,\n },\n },\n\n svg: {\n minWidth: 24,\n },\n}));\n\nconst ContainerIcon = styled.div({\n margin: '20px auto',\n textAlign: 'center',\n});\n\nconst ContainerLeft = styled.div((p) => ({\n backgroundColor: p.theme.colors.LIGHTGREEN,\n boxShadow: p.theme.shadows.uniform,\n\n [p.theme.mediaQueries.md]: {\n boxShadow: 'none',\n flex: '1 1 33.33%',\n },\n}));\n\nconst ContainerPlus = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n padding: '0 20px',\n },\n}));\n\nconst ContainerRight = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n display: 'block',\n flex: '1 1 66.66%',\n paddingLeft: 20,\n },\n}));\n\nconst IconLeft = styled.div((p) => ({\n backgroundColor: p.bck,\n borderRadius: '50%',\n display: 'flex',\n height: 48,\n marginRight: 20,\n minWidth: 48,\n\n img: {\n height: 'auto',\n margin: 'auto',\n width: 32,\n },\n\n svg: {\n margin: 'auto',\n },\n}));\n\nconst IconRight = styled.div((p) => ({\n border: `4px solid ${p.theme.colors.GREY4}`,\n borderRadius: '50%',\n height: 16,\n marginRight: 34,\n marginTop: 6,\n minWidth: 16,\n width: 16,\n\n [p.theme.mediaQueries.md]: {\n marginRight: 20,\n },\n\n '&.highlight': {\n position: 'relative',\n\n '&:after': {\n backgroundColor: p.theme.colors.GREEN,\n borderRadius: '50%',\n content: 'close-quote',\n height: 8,\n left: '-12px',\n position: 'absolute',\n top: 'calc(50% - 4px)',\n width: 8,\n },\n },\n\n '&.user_CLIENTE_SALUTE': {\n backgroundColor: p.theme.colors.GREY4,\n border: '0px',\n height: 24,\n lineHeight: '24px',\n marginTop: 0,\n minWidth: 24,\n textAlign: 'center',\n width: 24,\n\n '&.FATTA, &.FATTO': {\n backgroundColor: p.theme.colors.GREEN,\n },\n },\n}));\n\nconst MLLeft = styled(L)((p) => ({\n backgroundColor: p.theme.colors.LIGHTGREEN,\n}));\n\nconst MLItem = styled(L.Item)((p) => ({\n alignItems: 'center',\n backgroundColor: 'transparent',\n border: 0,\n borderBottom: `1px solid ${p.theme.colors.MIDGREEN}`,\n borderRadius: '0px !important',\n borderTopWidth: '1px !important',\n cursor: 'pointer',\n display: 'flex',\n flexDirection: 'row',\n minHeight: 88,\n padding: '15px 20px 15px 25px',\n\n '&.active': {\n backgroundColor: 'transparent',\n borderBottom: `1px solid ${p.theme.colors.MIDGREEN}`,\n\n [p.theme.mediaQueries.md]: {\n backgroundColor: p.theme.colors.WHITE,\n border: 0,\n boxShadow: '0px 5px 12px 0px rgba(0,0,0,0.2)',\n },\n },\n\n '.content': {\n marginRight: 'auto',\n },\n\n '.highlight': {\n position: 'relative',\n\n '&:after': {\n backgroundColor: p.theme.colors.GREEN,\n borderRadius: '50%',\n content: 'close-quote',\n height: 8,\n left: '-15px',\n position: 'absolute',\n top: 'calc(50% - 4px)',\n width: 8,\n },\n },\n}));\n\nconst MRItem = styled(L.Item)((p) => ({\n border: 0,\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n borderRadius: '0px !important',\n marginBottom: 0,\n padding: 0,\n\n ':first-child': {\n [p.theme.mediaQueries.md]: {\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n },\n },\n\n '&.highlight': {\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n zIndex: 1,\n },\n\n '.activity-info': {\n padding: 16,\n display: 'flex',\n },\n\n '.content': {\n width: '100%',\n\n button: {\n padding: 0,\n\n '&:focus': {\n boxShadow: 'none',\n },\n\n '&.large': {\n display: 'none',\n\n [p.theme.mediaQueries.md]: {\n display: 'block',\n },\n },\n\n '&.small': {\n display: 'block',\n position: 'absolute',\n right: '24px',\n\n [p.theme.mediaQueries.md]: {\n display: 'none',\n },\n },\n },\n },\n}));\n\nconst MRTitle = styled.div((p) => ({\n borderBottom: `1px solid ${p.theme.colors.GREY5}`,\n margin: '20px 0 0',\n paddingBottom: 12,\n\n [p.theme.mediaQueries.md]: {\n margin: '20px 0',\n },\n\n '.content': {\n alignItems: 'center',\n display: 'flex',\n },\n}));\n\nconst groupActivities = (activities, t) => {\n const a = activities.reduce((obj, activity) => {\n const group = activity.activityGroup.name;\n const tmp = obj;\n\n if (!tmp[group]) {\n tmp[group] = {\n ...activity.activityGroup,\n\n activities: [],\n code: group,\n name: t(`enums:activity group.${activity.activityGroup.name}`),\n };\n }\n\n tmp[group].activities.push(activity);\n\n return tmp;\n }, {});\n\n Object.keys(a).forEach((e) => {\n a[e].activities.sort((j, k) => (j.name < k.name ? -1 : 1));\n });\n\n return a;\n};\n\nconst sortGroups = (groups) => {\n const sorted = [];\n const tmp = [];\n\n Object.keys(groups).forEach((e) => tmp.push({ [e]: groups[e].priority }));\n const tmpSorted = tmp.sort((a, b) => Object.values(a) - Object.values(b));\n\n tmpSorted.forEach((e) => sorted.push(Object.keys(e)[0]));\n\n return sorted;\n};\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass ListGroup extends React.Component {\n constructor(props) {\n super(props);\n\n this.groups = {};\n\n this.mediaQuery = `screen and (min-width: ${props.theme.breakpoints.md})`;\n\n this.state = {\n activityOpened: null,\n groupDetails: false,\n groupSelected: getParams(props.history.location.search).section || null,\n };\n\n this.goBack = this.goBack.bind(this);\n this.openDetailActivity = this.openDetailActivity.bind(this);\n this.screenTest = this.screenTest.bind(this);\n this.throwClickOnGroup = this.throwClickOnGroup.bind(this);\n this.updateEventsByActivity = this.updateEventsByActivity.bind(this);\n }\n\n componentDidMount() {\n const { groupSelected } = this.state;\n this.mq = window.matchMedia(this.mediaQuery);\n this.setState({ screen: this.mq.matches ? 'large' : 'small' });\n\n this.mq.addListener(this.screenTest);\n\n if (groupSelected && Object.keys(ActivityGroup).includes(groupSelected)) {\n this.selectGroup(groupSelected);\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { groupDetails, screen, activityOpened } = this.state;\n\n if (screen !== prevState.screen) {\n this.throwClickOnGroup(groupDetails);\n }\n\n if (activityOpened && activityOpened !== prevState.activityOpened) {\n this.updateEventsByActivity(activityOpened);\n }\n }\n\n componentWillUnmount() {\n this.mq.removeListener(this.screenTest);\n }\n\n updateEventsByActivity(id) {\n const { getEventsByActivity, plan } = this.props;\n getEventsByActivity({\n activityId: id,\n healthPlanId: plan.id,\n page: 0,\n size: 4,\n statuses: `${EventStatuses.PRENOTATO},${EventStatuses.FATTO},${EventStatuses.DRAFT},${EventStatuses.SALTATO}`,\n });\n }\n\n goBack() {\n this.setState({\n groupDetails: false,\n });\n this.throwClickOnGroup(false);\n }\n\n openDetailActivity(id) {\n const { activityOpened } = this.state;\n this.setState({ activityOpened: id === activityOpened ? null : id });\n }\n\n selectGroup(code) {\n this.setState({\n groupDetails: true,\n groupSelected: code,\n plusSelected: false,\n });\n this.throwClickOnGroup(true);\n }\n\n selectPlus() {\n this.setState({\n groupDetails: true,\n groupSelected: 'NULL',\n plusSelected: true,\n });\n this.throwClickOnGroup(true);\n }\n\n screenTest() {\n const { screen } = this.state;\n const match = this.mq.matches ? 'large' : 'small';\n\n if (match !== screen) {\n this.setState({ screen: match });\n }\n }\n\n throwClickOnGroup(showDetails) {\n const { screen } = this.state;\n const { checkOnClickItem } = this.props;\n if (checkOnClickItem) {\n checkOnClickItem(screen, showDetails);\n }\n }\n\n render() {\n const {\n className,\n eventsByActivity,\n eventsByActivityLength,\n isHealthClient,\n plan,\n showPlusControls,\n t,\n theme,\n } = this.props;\n\n const {\n activityOpened,\n groupDetails,\n groupSelected,\n plusSelected,\n screen,\n } = this.state;\n\n const groups = groupActivities(plan.activities, t);\n const groupsSorted = sortGroups(groups);\n const gSelected = groupSelected || groupsSorted[0];\n\n const showDetails = window.matchMedia(this.mediaQuery).matches ? true : groupDetails;\n const showGenerals = window.matchMedia(this.mediaQuery).matches ? true : !groupDetails;\n\n const getIcon = (groupName, width, height) => {\n if (groupName && Object.keys(ActivityGroupIcon).includes(groupName)) {\n return ;\n }\n return null;\n };\n\n return (\n \n {showGenerals ? (\n \n \n {groupsSorted.map((o) => {\n const group = groups[o];\n const highlight = groups[o].activities.filter((e) => e.extraCluster).length > 0;\n return (\n this.selectGroup(group.code)}>\n \n {getIcon(o, 30, 30)}\n \n\n \n \n \n
\n\n \n \n );\n })}\n\n {showPlusControls ? (\n this.selectPlus()}>\n \n \n \n\n \n \n \n
\n\n \n \n ) : null}\n \n \n ) : null}\n\n {showDetails ? (\n \n \n \n {t('translation:go back')}\n \n\n {!plusSelected && screen === 'small' ? (\n \n \n {getIcon(gSelected, 30, 30)} \n \n
\n\n \n \n ) : null}\n\n \n {!plusSelected && groups[gSelected] && groups[gSelected].activities.map((o) => (\n \n \n
\n {isHealthClient ? : null}\n \n\n
\n {isHealthClient\n ? (\n
this.openDetailActivity(o.id)}>\n {activityOpened === o.id\n ? \n : }\n \n )\n : null}\n
\n
\n\n
\n \n \n \n
\n {o.insuranceModules && o.insuranceModules.length > 0 ? (\n \n \n \n
\n ) : (\n
\n )}\n\n {o.frequency && o.frequency.includes('RRULE:') ? (\n \n \n \n
\n ) : null}\n\n {isHealthClient ? (\n this.openDetailActivity(o.id)}>\n {activityOpened === o.id\n ? \n : }\n \n ) : null}\n \n
\n
\n {activityOpened === o.id && eventsByActivity && eventsByActivity.length > 0 && eventsByActivity[0].activityId === activityOpened ? (\n 4} />\n ) : null}\n \n ))}\n\n {plusSelected ? (\n \n {screen === 'small' ? (\n \n \n \n \n \n \n
\n\n \n \n ) : null}\n\n \n \n \n\n \n \n \n\n \n \n \n
\n \n ) : null}\n \n \n ) : null}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n eventsByActivity: state.events.eventsByActivity.data,\n eventsByActivityLength: state.events.eventsByActivity.length,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getEventsByActivity: (params) => {\n dispatch(fetchEventsByActivity(params));\n },\n});\n\nListGroup.defaultProps = {\n checkOnClickItem: null,\n className: null,\n eventsByActivity: [],\n eventsByActivityLength: null,\n getEventsByActivity: null,\n history: null,\n isHealthClient: false,\n plan: {},\n showPlusControls: false,\n t: null,\n theme: null,\n};\n\nListGroup.propTypes = {\n checkOnClickItem: PropTypes.func,\n className: PropTypes.string,\n eventsByActivity: PropTypes.arrayOf(PropTypes.shape({ activityId: PropTypes.number })),\n eventsByActivityLength: PropTypes.number,\n getEventsByActivity: PropTypes.func,\n history: PropTypes.shape(),\n isHealthClient: PropTypes.bool,\n plan: PropTypes.shape(),\n showPlusControls: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['enums', 'portale.components', 'portale.preventionpath', 'portale.recommendedpreventionpath', 'translation'])(styledSystem(ListGroup)))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport { CartoonSvg } from '../..';\n\nconst Container = styled.div({\n cursor: 'pointer',\n marginRight: 'auto',\n});\n\nconst Logo = (props) => {\n const { height, onClick } = props;\n\n return (\n \n \n \n );\n};\n\nLogo.defaultProps = {\n height: 40,\n onClick: null,\n};\n\nLogo.propTypes = {\n height: PropTypes.number,\n onClick: PropTypes.func,\n};\n\nexport default Logo;\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport { withRouter } from 'react-router-dom';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Text, Button } from '../..';\n\nimport medicalConsultationBck from '../../../assets/img/medical-consultation-box.jpg';\nimport wellnessCoachBck from '../../../assets/img/wellness-coach-box.jpg';\n\nconst Gradient = styled.div((p) => ({\n background: p.theme.colors.GRADIENT1,\n borderRadius: '8px',\n height: '100%',\n opacity: 0.73,\n position: 'absolute',\n width: '100%',\n zIndex: 2,\n}));\n\nconst Info = styled.div({\n background: 'transparent',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n justifyContent: 'space-between',\n padding: 30,\n position: 'absolute',\n width: '100%',\n zIndex: 2,\n\n '.line-trim': {\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '6',\n display: ' -webkit-box',\n overflow: 'hidden',\n },\n});\n\nconst MBContainer = styled.div((p) => ({\n backgroundImage: `url(${p.image})`,\n backgroundSize: 'cover',\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n height: '100%',\n minHeight: 295,\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n paddingBottom: 52,\n },\n}));\n\nconst MeetingBox = (props) => {\n const { consultationRequests, history, theme } = props;\n\n const enableCoachBox = consultationRequests && consultationRequests.length > 0;\n const boxKeyTranslate = enableCoachBox ? 'portale.dashboard:meeting box.medical consultation.' : 'portale.dashboard:meeting box.wellness coach.';\n const boximage = enableCoachBox ? medicalConsultationBck : wellnessCoachBck;\n\n const goTo = () => {\n const page = enableCoachBox ? '/medical-consultation' : '/book-consultation';\n history.push(page);\n };\n\n return (\n \n \n \n \n \n\n \n
\n\n \n \n \n );\n};\n\nMeetingBox.defaultProps = {\n consultationRequests: null,\n history: null,\n theme: null,\n};\n\nMeetingBox.propTypes = {\n consultationRequests: PropTypes.arrayOf(PropTypes.shape),\n history: PropTypes.shape(),\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(withTheme(withTranslation(['portale.dashboard'])(MeetingBox)));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport { Col, Row } from 'react-bootstrap';\nimport styled from 'styled-components';\n\nimport { Button, Modal as M } from '../..';\nimport { NotificationTypes } from '../../../enums';\n\nconst Content = styled.div({\n textAlign: 'center',\n});\n\nconst Modal = styled(M)({\n '.modal-title .subtitle': {\n fontSize: '16px !important',\n },\n\n '.modal-title .title': {\n fontSize: '20px !important',\n },\n});\n\nconst ModalQuestionnaire = (props) => {\n const {\n notification,\n onClick,\n onPostpone,\n show,\n t,\n } = props;\n\n const handleClick = () => {\n if (onClick) {\n onClick(notification);\n }\n };\n\n const handlePostpone = () => {\n if (onPostpone) {\n onPostpone(notification);\n }\n };\n\n if (!show) {\n return null;\n }\n\n const text = notification.notificationType === NotificationTypes.QUESTIONNAIRE_EXPIRED ? t('questionnaire.expired text') : t('questionnaire.update text');\n\n return (\n \n \n \n \n \n \n\n \n \n \n
\n \n \n );\n};\n\nModalQuestionnaire.defaultProps = {\n notification: null,\n onClick: null,\n onPostpone: null,\n show: null,\n t: null,\n};\n\nModalQuestionnaire.propTypes = {\n notification: PropTypes.shape(),\n onClick: PropTypes.func,\n onPostpone: PropTypes.func,\n show: PropTypes.bool,\n t: PropTypes.func,\n};\n\nexport default withTranslation(['portale.dashboard'])(ModalQuestionnaire);\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport { Col, Row } from 'react-bootstrap';\nimport styled from 'styled-components';\n\nimport { Button, Modal as M } from '../..';\n\nconst Content = styled.div({\n textAlign: 'center',\n});\n\nconst Modal = styled(M)({\n '.modal-title .subtitle': {\n fontSize: '16px !important',\n },\n\n '.modal-title .title': {\n fontSize: '20px !important',\n },\n});\n\nconst ModalWellnessCoach = (props) => {\n const {\n days,\n expired,\n onCancel,\n onProceed,\n onUpdate,\n show,\n t,\n } = props;\n\n const handleCancel = () => {\n if (onCancel) {\n onCancel();\n }\n };\n\n const handleProceed = () => {\n if (onProceed) {\n onProceed();\n }\n };\n const handleUpdate = () => {\n if (onUpdate) {\n onUpdate();\n }\n };\n\n if (!show) {\n return null;\n }\n\n return (\n \n \n {expired ? (\n \n \n \n \n\n \n \n \n
\n ) : (\n \n \n \n \n\n \n \n \n
\n )}\n \n \n );\n};\n\nModalWellnessCoach.defaultProps = {\n days: null,\n expired: null,\n onCancel: null,\n onProceed: null,\n onUpdate: null,\n show: null,\n t: null,\n};\n\nModalWellnessCoach.propTypes = {\n days: PropTypes.number,\n expired: PropTypes.bool,\n onCancel: PropTypes.func,\n onProceed: PropTypes.func,\n onUpdate: PropTypes.func,\n show: PropTypes.bool,\n t: PropTypes.func,\n};\n\nexport default withTranslation(['portale.wellnesscoach'])(ModalWellnessCoach);\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { styledSystem } from '../../../themes';\n\nimport { Button, OutlineSvg, Text } from '../..';\n\nimport { EventTypeOutlineIcon, EventStatuses, EventTypes } from '../../../enums';\n\nconst HR = styled.div((p) => ({\n borderTop: `1px solid ${p.theme.colors.GREY5}`,\n margin: '16px 0px',\n}));\n\nconst IconContainer = styled.div((p) => ({\n backgroundColor: p.bkg,\n borderRadius: '50%',\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n}));\n\nconst NAContainer = styledSystem('div', {\n scale: 'nextActivity',\n});\n\nconst NextActivity = (props) => {\n const {\n history,\n nextActivity,\n t,\n theme,\n themeVariant,\n title,\n } = props;\n\n const goToBooking = () => {\n if (nextActivity.type === EventTypes.SCREENING || nextActivity.type === EventTypes.DIAGNOSTIC) {\n history.push(`/event/${nextActivity.idParent}/edit?startDate=${nextActivity.startDate}&type=booking`);\n } else {\n history.push('/');\n }\n };\n\n const goDetailEvent = () => {\n history.push(`/event/${nextActivity.idParent}?startDate=${nextActivity.startDate}`);\n };\n\n if (nextActivity && (nextActivity.status === EventStatuses.DRAFT || nextActivity.status === EventStatuses.PRENOTATO)) {\n const showReminder = nextActivity.status === EventStatuses.DRAFT && (nextActivity.type === EventTypes.VIDEO_CONFERENCE || nextActivity.type === EventTypes.SCREENING || nextActivity.type === EventTypes.DIAGNOSTIC);\n\n const userCreated = nextActivity.activityId === null && nextActivity.activityGroupId === null;\n const iconsColor = userCreated ? theme.colors.GRAPH3 : theme.colors.PRIMARY2;\n const startDate = new Date(nextActivity.startDate);\n const endDate = new Date(nextActivity.endDate);\n\n return (\n \n {title && title !== '' ? (\n \n ) : null}\n \n \n {EventTypeOutlineIcon[nextActivity.type] ? : null}\n \n \n
\n \n {showReminder ? (\n \n \n \n
\n ) : (\n \n
\n \n {startDate && !Number.isNaN(startDate.getTime()) ? (\n \n {`${startDate.getDate()}\n ${t(`nextActivity.months.${startDate.getMonth()}`)}\n ${startDate.getFullYear()}`}\n \n ) : null}\n
\n
\n \n {startDate && !Number.isNaN(startDate.getTime()) && endDate && !Number.isNaN(endDate.getTime()) ? (\n \n {`${startDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })} -\n ${endDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`}\n \n ) : null}\n
\n
\n \n {nextActivity.location} \n
\n
\n )}\n \n );\n }\n return null;\n};\n\nNextActivity.defaultProps = {\n history: null,\n nextActivity: null,\n t: null,\n theme: null,\n themeVariant: 'default',\n title: null,\n};\n\nNextActivity.propTypes = {\n history: PropTypes.shape(),\n nextActivity: PropTypes.shape({\n activityGroupId: PropTypes.number,\n activityId: PropTypes.number,\n description: PropTypes.string,\n endDate: PropTypes.string,\n firstVideoConference: PropTypes.bool,\n idParent: PropTypes.number,\n link: PropTypes.string,\n location: PropTypes.string,\n startDate: PropTypes.string,\n status: PropTypes.string,\n title: PropTypes.string,\n type: PropTypes.string,\n }),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n themeVariant: PropTypes.string,\n title: PropTypes.string,\n};\n\nexport default withRouter(withTheme(withTranslation(['portale.components'])(NextActivity)));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchNextEvents } from '../../../reducers/events/actions';\n\nimport NextActivity from '../NextActivity';\n\nimport Button from '../../common/Button';\nimport Container from '../../common/Container';\nimport OutlineSvg from '../../common/OutlineSvg';\nimport Text from '../../common/Text';\n\nconst MC = styled(Container)((p) => ({\n padding: 0,\n\n '.scrollable-container': {\n display: 'flex',\n flexDirection: 'row',\n margin: '0 0 0 -15px',\n minWidth: 'calc(100% + 30px)',\n overflowX: 'auto',\n padding: 10,\n scrollbarWidth: 'none',\n\n [p.theme.mediaQueries.md]: {\n display: 'flex',\n flexDirection: 'row',\n margin: '-10px',\n maxWidth: 'calc(100% + 20px)',\n minWidth: 'auto',\n overflowX: 'auto',\n pointerEvents: 'none',\n },\n\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n\n '.next-activity': {\n pointerEvents: 'auto',\n display: 'inline-block',\n height: 'auto !important',\n marginLeft: '20px',\n minWidth: '240px !important',\n\n '&:first-child': {\n margin: 0,\n },\n\n [p.theme.mediaQueries.md]: {\n minWidth: 'calc(33% - 11px) !important',\n },\n\n [p.theme.mediaQueries.lg]: {\n minWidth: 'calc(33% - 11px) !important',\n },\n\n [p.theme.mediaQueries.xl]: {\n minWidth: 'calc(25% - 15px) !important',\n },\n },\n },\n}));\n\nconst Header = styled.div({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginBottom: 20,\n});\n\nclass NextActivitiesSlider extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n disableNextBtn: false,\n dynamicList: [],\n page: 0,\n pagerIndex: 1,\n readedActivities: 0,\n size: 100,\n totalPages: null,\n };\n\n this.checkDisableNextBtn = this.checkDisableNextBtn.bind(this);\n this.checkMediaQuery = this.checkMediaQuery.bind(this);\n this.getActivities = this.getActivities.bind(this);\n this.handleResize = this.handleResize.bind(this);\n this.handleScroll = this.handleScroll.bind(this);\n this.scrollActivities = this.scrollActivities.bind(this);\n this.setScrollableContainer = this.setScrollableContainer.bind(this);\n this.updateList = this.updateList.bind(this);\n\n this.debouncedResizeListener = this.debounce(() => {\n this.checkMediaQuery();\n this.handleResize();\n }, 300);\n }\n\n componentDidMount() {\n const { planID } = this.props;\n const { page } = this.state;\n\n window.addEventListener('resize', this.debouncedResizeListener);\n\n if (planID) {\n this.getActivities(page);\n }\n this.checkMediaQuery();\n }\n\n componentDidUpdate(prevProps, prevState) {\n const {\n isFetching,\n length,\n nextEvents,\n sidebarIsOpen,\n } = this.props;\n const { dynamicList, readedActivities } = this.state;\n\n if (JSON.stringify(prevProps.nextEvents) !== JSON.stringify(nextEvents) && nextEvents.length > 0 && !isFetching) {\n this.updateList();\n }\n\n if (sidebarIsOpen !== prevProps.sidebarIsOpen) {\n this.handleResize();\n }\n\n if (dynamicList !== prevState.dynamicList || readedActivities !== prevState.readedActivities || length !== prevProps.length) {\n if (this.scrollableContainer.scrollWidth === 0) {\n setTimeout(() => {\n this.checkDisableNextBtn();\n }, 200);\n } else {\n this.checkDisableNextBtn();\n }\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.debouncedResizeListener);\n }\n\n getActivities(page) {\n const { getNextEvents, planID } = this.props;\n const { size } = this.state;\n getNextEvents({\n healthPlanId: planID,\n page,\n size,\n });\n }\n\n setScrollableContainer(sc) {\n this.scrollableContainer = sc;\n }\n\n getVisibleActivitiesForPage() {\n const { childElementCount, offsetWidth, scrollWidth } = this.scrollableContainer;\n\n return Math.round(offsetWidth / (scrollWidth / childElementCount));\n }\n\n checkDisableNextBtn() {\n const { length } = this.props;\n const { dynamicList, readedActivities, screen } = this.state;\n const { childElementCount } = this.scrollableContainer;\n\n if (screen === 'desktop') {\n this.setState({\n disableNextBtn: dynamicList.length === length && childElementCount <= readedActivities + this.getVisibleActivitiesForPage(),\n });\n }\n }\n\n checkMediaQuery() {\n this.setState({\n screen: window.innerWidth < 768 ? 'mobile' : 'desktop',\n });\n }\n\n calculateOffset() {\n const { pagerIndex } = this.state;\n const { offsetWidth } = this.scrollableContainer;\n\n const visibleElementsForPage = this.getVisibleActivitiesForPage();\n const differenceForOddElements = pagerIndex % 6 ? offsetWidth : offsetWidth + 1;\n\n return visibleElementsForPage % 3 ? offsetWidth : differenceForOddElements;\n }\n\n scrollActivities(direction) {\n const { pagerIndex, readedActivities } = this.state;\n const { childElementCount, scrollLeft, scrollWidth } = this.scrollableContainer;\n\n switch (direction) {\n case 'prev':\n if (this.scrollableContainer !== undefined && scrollLeft > 0) {\n const readed = readedActivities - this.getVisibleActivitiesForPage();\n this.scrollableContainer.scrollLeft = (scrollWidth / childElementCount) * readed + 5;\n this.setState({\n pagerIndex: pagerIndex - 1,\n readedActivities: readed,\n });\n }\n break;\n case 'next':\n if (this.scrollableContainer !== undefined) {\n const readed = (readedActivities < 0 ? 0 : readedActivities) + this.getVisibleActivitiesForPage();\n this.scrollableContainer.scrollLeft = (scrollWidth / childElementCount) * readed + 5;\n this.setState({\n pagerIndex: pagerIndex + 1,\n readedActivities: readed,\n });\n }\n break;\n default:\n break;\n }\n }\n\n debounce(fn, ms, ...args) {\n let timer;\n return () => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n timer = null;\n fn.apply(this, args);\n }, ms);\n };\n }\n\n handleResize() {\n const { readedActivities, screen, prevScrollLeft } = this.state;\n if (this.scrollableContainer) {\n if (screen === 'desktop') {\n const {\n childElementCount,\n offsetWidth,\n scrollLeft,\n scrollWidth,\n } = this.scrollableContainer;\n\n const multipleOfWidth = scrollLeft % offsetWidth;\n\n if (readedActivities !== 0 && multipleOfWidth !== 0) {\n const newScrollPosition = (scrollWidth / childElementCount) * readedActivities + 5;\n this.scrollableContainer.scrollLeft = newScrollPosition;\n }\n } else {\n this.scrollableContainer.scrollLeft = prevScrollLeft;\n }\n }\n }\n\n handleScroll(e) {\n const { totalPages, page, prevScrollLeft } = this.state;\n const { isFetching, sidebarIsOpen } = this.props;\n const { scrollLeft, scrollWidth } = e.target;\n\n if (scrollLeft > (scrollWidth * 3) / 4 && !isFetching && page !== totalPages) {\n // Request for other activities\n this.setState({\n page: page + 1,\n });\n this.getActivities(page + 1);\n } else {\n this.setState({\n prevScrollLeft: !sidebarIsOpen ? scrollLeft : prevScrollLeft,\n });\n }\n }\n\n updateList() {\n const { dynamicList, size } = this.state;\n const { nextEvents, length } = this.props;\n this.setState({\n dynamicList: [...dynamicList, ...nextEvents],\n totalPages: Math.floor(length / size),\n });\n }\n\n render() {\n const { theme } = this.props;\n const {\n disableNextBtn,\n dynamicList,\n readedActivities,\n screen,\n } = this.state;\n\n return (\n \n \n\n this.setScrollableContainer(s)}>\n {dynamicList && dynamicList.length > 0\n ? dynamicList.map((na) => )\n : null}\n
\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n isFetching: state.events.nextEvents.isFetching,\n length: state.events.nextEvents.length,\n nextEvents: state.events.nextEvents.data,\n sidebarIsOpen: state.settings.sidebarIsOpen,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getNextEvents: (params) => {\n dispatch(fetchNextEvents(params));\n },\n});\n\nNextActivitiesSlider.defaultProps = {\n getNextEvents: null,\n isFetching: false,\n length: null,\n nextEvents: [],\n planID: null,\n sidebarIsOpen: null,\n theme: null,\n};\n\nNextActivitiesSlider.propTypes = {\n getNextEvents: PropTypes.func,\n isFetching: PropTypes.bool,\n length: PropTypes.number,\n nextEvents: PropTypes.arrayOf(PropTypes.shape),\n planID: PropTypes.number,\n sidebarIsOpen: PropTypes.bool,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(NextActivitiesSlider));\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { withTranslation } from 'react-i18next';\nimport { findIndex } from 'lodash';\nimport { connect } from 'react-redux';\nimport { withRouter, Link } from 'react-router-dom';\n\nimport moment from 'moment';\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n OutlineSvg,\n Text,\n} from '../..';\nimport { deleteNotifications, skipNotifications } from '../../../reducers/notifications/actions';\nimport { assignCoupon } from '../../../reducers/rewarding/actions';\nimport { setUpdateQuestionnaire } from '../../../reducers/settings/actions';\n\nimport { NotificationTypes, EventTypeOutlineIcon, EventStatuses } from '../../../enums';\nimport { getFormDataGatheringLink } from '../../../utils';\n\nconst CButton = styled.div((p) => ({\n display: 'flex',\n justifyContent: 'space-between',\n marginTop: p.theme.verticalSpacing.p16,\n width: '100%',\n\n button: {\n fontSize: p.theme.fontSizes.small,\n\n [p.theme.mediaQueries.md]: {\n fontSize: p.theme.fontSizes.medium,\n },\n },\n\n [p.theme.mediaQueries.md]: {\n marginTop: 0,\n minWidth: '260px',\n width: '260px',\n },\n}));\n\nconst MNotification = styled.div((p) => ({\n backgroundColor: p.typeBckNotifRight,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n color: p.theme.colors.GREY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n marginBottom: p.visibleOnDashboard ? 0 : p.theme.verticalSpacing.p16,\n opacity: 0.99,\n width: '100%',\n\n '.notification': {\n display: 'flex',\n\n '&.aggregated': {\n '.info': {\n display: 'block',\n paddingTop: 16,\n\n '.container-checkboxes': {\n padding: `${p.theme.verticalSpacing.p24} 0 0`,\n },\n },\n },\n\n '&.yellow': {\n backgroundColor: '#fcefdc',\n },\n\n '.icon': {\n alignItems: 'center',\n backgroundColor: p.typeBckNotifLeft,\n borderRadius: '8px 0 0 8px',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n minHeight: p.visibleOnDashboard ? 64 : 80,\n minWidth: p.visibleOnDashboard ? 64 : 80,\n\n '&.highlighted': {\n backgroundColor: '#edf8f8',\n },\n },\n\n '.container-actions': {\n clear: 'both',\n margin: '16px 0px',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n textAlign: 'right',\n width: '100%',\n '&.w-auto': {\n width: 'auto',\n },\n },\n\n button: {\n fontSize: p.theme.fontSizes.small,\n width: '100%',\n marginTop: '10px',\n\n [p.theme.mediaQueries.md]: {\n fontSize: p.theme.fontSizes.medium,\n marginLeft: 15,\n width: 250,\n },\n },\n },\n\n '.info': {\n fontSize: p.theme.fontSizes.small,\n padding: '16px 10px',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n padding: '16px',\n },\n\n '&:not(.no-flex)': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n fontSize: p.theme.fontSizes.large,\n },\n },\n\n a: {\n paddingLeft: '5px 0 0 0',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n paddingLeft: 10,\n textAlign: 'right',\n width: 'auto',\n },\n },\n\n p: {\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n width: 'auto',\n },\n\n b: {\n color: p.visibleOnDashboard ? p.theme.colors.SECONDARY2 : p.theme.colors.GREY1,\n },\n },\n\n button: {\n '&:not(.btn-primary):not(.btn-secondary):hover': {\n color: p.theme.colors.PRIMARY1,\n textDecoration: 'underline',\n },\n '&.arrowIcon': {\n padding: '0 10px',\n },\n },\n },\n\n '.message': {\n padding: '20px 10px',\n\n 'span, a': {\n display: 'inline',\n width: 'auto',\n },\n\n [p.theme.mediaQueries.md]: {\n padding: 25,\n },\n },\n\n '.closeIcon': {\n margin: '5px 0',\n\n [p.theme.mediaQueries.md]: {\n margin: 10,\n },\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.PRIMARY1,\n },\n },\n\n '.btn:focus': {\n boxShadow: 'none',\n },\n },\n}));\n\nclass Notification extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n collapsed: props.type === 'AGGREGATE_NOTIFICATIONS' ? false : null,\n };\n\n this.collapse = this.collapse.bind(this);\n this.deleteNot = this.deleteNot.bind(this);\n this.onClickConfirm = this.onClickConfirm.bind(this);\n this.onClickCancel = this.onClickCancel.bind(this);\n this.onClickPPUpdate = this.onClickPPUpdate.bind(this);\n this.goToFamilyForm = this.goToFamilyForm.bind(this);\n this.goToRewardingRegulation = this.goToRewardingRegulation.bind(this);\n this.sendFitprimeCode = this.sendFitprimeCode.bind(this);\n this.updateQuestionnaire = this.updateQuestionnaire.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n const {\n notificationIdCouponAssigned,\n notificationIdCouponError,\n couponAssignedIsFetching,\n notification,\n showError,\n } = this.props;\n\n if (!couponAssignedIsFetching && notificationIdCouponAssigned && notificationIdCouponAssigned !== prevProps.notificationIdCouponAssigned && (notification && notificationIdCouponAssigned === notification.id)) {\n // cancella notifica e ricarica\n this.deleteNot();\n }\n\n if (!couponAssignedIsFetching && notificationIdCouponError && notificationIdCouponError !== prevProps.notificationIdCouponError && (notification && notificationIdCouponError === notification.id)) {\n // mostra una modale di errore\n if (showError) {\n showError(true);\n }\n }\n }\n\n onClickConfirm(event) {\n const { onConfirm } = this.props;\n\n if (onConfirm) {\n onConfirm(event);\n }\n }\n\n onClickCancel(event) {\n const { onCancel } = this.props;\n\n if (onCancel) {\n onCancel(event);\n }\n }\n\n onClickPPUpdate() {\n const { history } = this.props;\n\n this.deleteNot();\n history.push('/preventionpath');\n }\n\n goToFamilyForm() {\n window.open(getFormDataGatheringLink(), '_blank').focus();\n this.deleteNot();\n }\n\n goToRewardingRegulation() {\n const { history } = this.props;\n this.deleteNot(true);\n history.push('/rewarding-policy');\n }\n\n sendFitprimeCode(fitprimeType) {\n const { assignCouponRequest, notification } = this.props;\n assignCouponRequest({ type: fitprimeType, notificationId: notification.id });\n }\n\n updateQuestionnaire() {\n const {\n history,\n notification,\n setUpdate,\n skipNotification,\n } = this.props;\n\n const updateType = notification.notificationType === NotificationTypes.QUESTIONNAIRE_EXPIRED ? 'expired' : 'update';\n\n skipNotification(notification.id).then(() => {\n setUpdate(updateType);\n history.push('/consenses');\n });\n }\n\n deleteNot(noPageRefresh) {\n const { notification, deleteNotification, history } = this.props;\n\n if (notification && notification.id) {\n deleteNotification(notification.id).then(() => {\n if (!noPageRefresh) {\n history.go();\n }\n });\n }\n }\n\n collapse() {\n const { onAggregateNotification } = this.props;\n const { collapsed } = this.state;\n this.setState({ collapsed: !collapsed });\n if (onAggregateNotification) {\n onAggregateNotification(!collapsed);\n }\n }\n\n render() {\n const {\n count,\n notification,\n onChangeMoreEvents,\n showAggregateDropdownIcon,\n t,\n type,\n visibleOnDashboard,\n theme,\n } = this.props;\n\n const { collapsed } = this.state;\n\n const getAggregateTemplate = () => (\n \n
\n \n
\n
\n
\n {t('enums:notifications templates.AGGREGATE_NOTIFICATIONS_info1')}\n {count} \n {count > 1 ? t('enums:notifications templates.AGGREGATE_NOTIFICATIONS_info2') : t('enums:notifications templates.AGGREGATE_NOTIFICATION_info2')}\n \n
\n \n\n {showAggregateDropdownIcon ? (\n this.collapse()}>\n \n \n ) : null}\n
\n
\n
\n );\n\n const getChangeStatusAggregatedTemplate = () => {\n let selectedValues = notification.notifications.map((n) => `${n.id}`);\n const dataCheckboxes = notification.notifications.map((n) => {\n const date = new Date(n.notificationTime).toLocaleDateString('it', { month: 'long', day: 'numeric' });\n const time = new Date(n.notificationTime).toLocaleTimeString('it', { hour: '2-digit', minute: '2-digit' });\n return {\n label: `${date} ${t('portale.notifications:hour')} ${time}`,\n value: `${n.id}`,\n };\n });\n\n const onChange = (values) => {\n selectedValues = values;\n };\n\n const changeEvents = (skippedAll) => {\n const eventsToChange = [];\n if (skippedAll) {\n notification.notifications.forEach((element) => {\n const event = {\n ...element.event,\n status: EventStatuses.SALTATO,\n };\n eventsToChange.push(event);\n });\n } else {\n selectedValues.forEach((element) => {\n const index = findIndex(notification.notifications, (n) => `${n.id}` === element);\n if (index !== -1) {\n const event = {\n ...notification.notifications[index].event,\n status: EventStatuses.FATTO,\n };\n eventsToChange.push(event);\n }\n });\n }\n\n if (onChangeMoreEvents) {\n onChangeMoreEvents(eventsToChange);\n }\n };\n\n if (notification.notifications && notification.notifications.length > 0) {\n return (\n \n
\n {EventTypeOutlineIcon[notification.notifications[0].event.type] ? (\n \n ) : null}\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n\n
\n
\n {t('enums:notifications templates.CHANGE_STATUS_aggregated_info1', { count: notification.notifications.length })}\n {`${notification.notifications[0].event.title}`} \n {t('enums:notifications templates.CHANGE_STATUS_aggregated_info2')}\n \n\n
\n onChange(values)}\n selectedValues={selectedValues}\n isLayoutVertical\n />\n
\n\n
\n changeEvents(false)}\n small\n text={t('enums:notifications templates.CHANGE_STATUS_done all')}\n variant=\"primary\"\n width=\"calc(50% - 5px)\"\n />\n changeEvents(true)}\n small\n text={t('enums:notifications templates.CHANGE_STATUS_skip all')}\n variant=\"secondary\"\n width=\"calc(50% - 5px)\"\n />\n
\n
\n
\n );\n }\n return null;\n };\n\n const getChangeStatusTemplate = (csNotification) => {\n if (csNotification && csNotification.event && csNotification.event.type) {\n return (\n \n
\n {EventTypeOutlineIcon[csNotification.event.type] ? (\n \n ) : null}\n \n {new Date(csNotification.event.startDate).toLocaleDateString()}\n \n
\n\n
\n \n {t('enums:notifications templates.CHANGE_STATUS_info1')}\n {csNotification.event.title} \n {csNotification.event.activityGroupId && csNotification.event.activityId\n ? t('enums:notifications templates.CHANGE_STATUS_info2')\n : t('enums:notifications templates.CHANGE_STATUS_info2_personal')}\n {new Date(csNotification.event.startDate).toLocaleDateString()}\n {t('enums:notifications templates.CHANGE_STATUS_info3')}\n {new Date(csNotification.event.startDate).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}\n ?\n \n\n \n this.onClickConfirm(csNotification.event)}\n small\n text={t('enums:notifications templates.CHANGE_STATUS_si')}\n variant=\"primary\"\n width=\"calc(50% - 5px)\"\n />\n this.onClickCancel(csNotification.event)}\n small\n text={t('enums:notifications templates.CHANGE_STATUS_no')}\n variant=\"secondary\"\n width=\"calc(50% - 5px)\"\n />\n \n
\n
\n );\n }\n return null;\n };\n\n const getConsultationRequestTemplate = (cancelled) => (\n \n
\n \n\n {!visibleOnDashboard ? (\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n ) : null}\n
\n\n
\n {cancelled ? (\n <>\n \n \n \n this.deleteNot()}\n text={t('enums:notifications templates.CONSULTATION_REQUEST_DECLINED_info4')}\n textDecoration=\"underline\"\n to=\"/wellness-coach\"\n type=\"a\"\n />\n \n >\n ) : (\n <>\n \n this.deleteNot()}\n text={t('enums:notifications templates.CONSULTATION_REQUEST_INFO_info2')}\n textDecoration=\"underline\"\n to=\"/wellness-coach\"\n type=\"a\"\n />\n >\n )}\n
\n
\n );\n\n const getDetailsTemplate = () => {\n const start = moment(notification.event.startDate);\n let time;\n\n if (start.isBefore(moment(), 'day')) {\n time = t('enums:notifications templates.TIME', { date: start.format('D/M/YYYY'), time: start.format('HH:mm') });\n } else {\n time = start.calendar();\n }\n\n return (\n \n
\n {EventTypeOutlineIcon[notification.event.type] ? (\n \n ) : null}\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n
\n \n {t('enums:notifications templates.DETAILS_info', { time })}\n {notification.event.title} \n \n\n \n \n \n
\n
\n );\n };\n\n const getFormulaFamilyTemplate = () => (\n \n
\n \n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n\n
\n
\n\n
\n this.goToFamilyForm()}\n small\n text={t('enums:notifications templates.FORMULA_FAMILY_INFO_cta_form')}\n variant=\"primary\"\n width={{ _: '100%', md: 'auto!important' }}\n />\n
\n
\n
this.deleteNot()}>\n \n \n
\n );\n\n const getHealthPlanConfirmedTemplate = () => (\n \n
\n \n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n\n
\n {t('enums:notifications templates.HEALTH_PLAN_CONFIRMED')} \n\n this.onClickPPUpdate()}\n text={t('enums:notifications templates.SEE')}\n textDecoration=\"underline\"\n />\n
\n
\n );\n\n const getHealthPlanUpdateTemplate = () => (\n \n
\n \n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n\n
\n {t('enums:notifications templates.HEALTH_PLAN_UPDATE')} \n\n this.onClickPPUpdate()}\n text={t('enums:notifications templates.SEE')}\n textDecoration=\"underline\"\n />\n
\n
\n );\n\n const getInsertHealthRecordTemplate = () => (\n \n
\n \n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n
\n\n
\n \n {t('enums:notifications templates.HEALTH_RECORD_REQUEST')}\n {t(`enums:health type.${notification.healthRecordType} name`)} \n \n\n \n \n \n
\n
\n );\n\n const getInsertReservationTemplate = () => (\n \n
\n {EventTypeOutlineIcon[notification.event.type] ? (\n \n ) : null}\n \n {new Date(notification.event.startDate).toLocaleDateString()}\n \n
\n\n
\n \n {t('enums:notifications templates.INSERT_RESERVATION_info')}\n {notification.event.title} \n \n\n \n \n \n
\n
\n );\n\n const getQuestionnaireExpiredTemplate = () => (\n \n
\n \n\n {!visibleOnDashboard ? (\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n ) : null}\n
\n\n
\n {t('enums:notifications templates.QUESTIONNAIRE_EXPIRED')} \n\n \n
\n
\n );\n\n const getQuestionnaireUpdateTemplate = () => (\n \n
\n \n\n {!visibleOnDashboard ? (\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n ) : null}\n
\n\n
\n {t('enums:notifications templates.QUESTIONNAIRE_UPDATE')} \n\n \n
\n
\n );\n\n // const getSharemedTemplate = () => (\n // \n //
\n // \n // {!visibleOnDashboard ? (\n // \n // {new Date(notification.notificationTime).toLocaleDateString()}\n // \n // ) : null}\n //
\n\n //
\n // <>\n // \n // this.deleteNot()}\n // text={t('enums:notifications templates.SHAREMED_INFO_info2')}\n // textDecoration=\"underline\"\n // to=\"/sharemed\"\n // type=\"a\"\n // />\n // >\n //
\n //
\n // );\n\n const getWelionAppWelcomeTemplate = () => (\n \n
\n \n\n {!visibleOnDashboard ? (\n \n {new Date(notification.notificationTime).toLocaleDateString()}\n \n ) : null}\n
\n\n
\n \n
\n
\n );\n\n const getTemplate = (template) => {\n switch (template) {\n case NotificationTypes.AGGREGATE_NOTIFICATIONS:\n return getAggregateTemplate();\n\n case NotificationTypes.CHANGE_STATUS:\n return getChangeStatusTemplate(notification);\n\n case NotificationTypes.CONSULTATION_REQUEST_DECLINED:\n return getConsultationRequestTemplate(true);\n\n case NotificationTypes.CONSULTATION_REQUEST_INFO:\n return getConsultationRequestTemplate(false);\n\n case NotificationTypes.DETAILS:\n return getDetailsTemplate();\n\n case NotificationTypes.HEALTH_PLAN_CONFIRMED:\n return getHealthPlanConfirmedTemplate();\n\n case NotificationTypes.HEALTH_PLAN_UPDATED:\n return getHealthPlanUpdateTemplate();\n\n case NotificationTypes.HEALTH_RECORD_REQUEST:\n return getInsertHealthRecordTemplate();\n\n case NotificationTypes.INSERT_RESERVATION:\n return getInsertReservationTemplate();\n\n // case NotificationTypes.FITPRIME_MONTH_REQUEST:\n // return getFitprimeTemplate('month');\n\n // case NotificationTypes.FITPRIME_MONTH_SENT:\n // return getFitprimeSentTemplate();\n\n // case NotificationTypes.FITPRIME_YEAR_REQUEST:\n // return getFitprimeTemplate('year');\n\n // case NotificationTypes.FITPRIME_YEAR_REMINDER:\n // return getFitprimeTemplate('reminder');\n\n // case NotificationTypes.FITPRIME_YEAR_SENT:\n // return getFitprimeSentTemplate();\n\n case NotificationTypes.FORMULA_FAMILY_INFO:\n return getFormulaFamilyTemplate();\n\n case NotificationTypes.QUESTIONNAIRE_EXPIRED:\n return getQuestionnaireExpiredTemplate();\n\n case NotificationTypes.QUESTIONNAIRE_UPDATE:\n return getQuestionnaireUpdateTemplate();\n\n // case NotificationTypes.SHAREMED_INFO:\n // return getSharemedTemplate();\n\n case NotificationTypes.WELION_APP_WELCOME:\n return getWelionAppWelcomeTemplate();\n default:\n return null;\n }\n };\n\n const getAggregatedNotificationsTemplate = (aggregatedNotifications) => {\n if (aggregatedNotifications.notifications.length === 1) {\n return getChangeStatusTemplate(aggregatedNotifications.notifications[0]);\n }\n return getChangeStatusAggregatedTemplate();\n };\n\n const getNotification = () => {\n if (type && type !== '') {\n return getTemplate(type);\n }\n\n if (notification && notification.notificationType) {\n return getTemplate(notification.notificationType);\n }\n\n if (notification.groupedNotifications && (notification.activityId !== null || notification.eventGroupId !== null) && notification.notifications && notification.notifications.length > 0) {\n return getAggregatedNotificationsTemplate(notification);\n }\n return null;\n };\n\n const sectionBckNotifRight = visibleOnDashboard ? theme.colors.OTHER1 : theme.colors.WHITE;\n const typeBckNotifRight = (type && type.includes('FITPRIME') && !type.includes('REMINDER') && !type.includes('SENT'))\n || (notification && notification.notificationType && notification.notificationType.includes('FITPRIME') && !notification.notificationType.includes('REMINDER') && !notification.notificationType.includes('SENT'))\n ? '#F7F0D9'\n : sectionBckNotifRight;\n\n const sectionBckNotifLeft = visibleOnDashboard ? '#edf8f8' : theme.colors.GREY6;\n const typeBckNotifLeft = (type && type.includes('FITPRIME') && !type.includes('REMINDER') && !type.includes('SENT'))\n || (notification && notification.notificationType && notification.notificationType.includes('FITPRIME') && !notification.notificationType.includes('REMINDER') && !notification.notificationType.includes('SENT'))\n ? '#F6F1e3'\n : sectionBckNotifLeft;\n\n return (\n \n {getNotification()}\n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n deleteNotification: (id) => dispatch(deleteNotifications(id)),\n assignCouponRequest: (params) => dispatch(assignCoupon(params)),\n setUpdate: (value) => dispatch(setUpdateQuestionnaire(value)),\n skipNotification: (id) => dispatch(skipNotifications(id)),\n});\n\nconst mapStateToProps = (state) => ({\n notificationIdCouponAssigned: state.rewarding.assignCoupon.data,\n notificationIdCouponError: state.rewarding.assignCoupon.error,\n couponAssignedIsFetching: state.rewarding.assignCoupon.isFetching,\n});\n\nNotification.defaultProps = {\n assignCouponRequest: null,\n count: 0,\n couponAssignedIsFetching: null,\n deleteNotification: null,\n history: null,\n notification: null,\n notificationIdCouponAssigned: null,\n notificationIdCouponError: null,\n onAggregateNotification: null,\n onCancel: null,\n onChangeMoreEvents: null,\n onConfirm: null,\n showAggregateDropdownIcon: null,\n showError: null,\n skipNotification: null,\n setUpdate: null,\n t: null,\n theme: null,\n type: null,\n visibleOnDashboard: false,\n};\n\nNotification.propTypes = {\n assignCouponRequest: PropTypes.func,\n count: PropTypes.number,\n couponAssignedIsFetching: PropTypes.bool,\n deleteNotification: PropTypes.func,\n history: PropTypes.shape(),\n notification: PropTypes.shape(),\n notificationIdCouponAssigned: PropTypes.number,\n notificationIdCouponError: PropTypes.number,\n onAggregateNotification: PropTypes.func,\n onCancel: PropTypes.func,\n onChangeMoreEvents: PropTypes.func,\n onConfirm: PropTypes.func,\n showAggregateDropdownIcon: PropTypes.bool,\n showError: PropTypes.func,\n skipNotification: PropTypes.func,\n setUpdate: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n type: PropTypes.string,\n visibleOnDashboard: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['enums', 'portale.notifications'])(Notification))));\n","import React, { useCallback, useEffect, useState } from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\n\nimport { CartoonSvg, OutlineSvg, Text } from '../../..';\n\nconst ButtonImage = styled.div({\n flex: '0 1 50%',\n\n input: {\n display: 'none',\n },\n});\n\nconst ButtonText = styled.div((p) => ({\n flex: '1 1 100%',\n\n input: {\n display: 'none',\n },\n\n [p.theme.mediaQueries.md]: {\n flex: '0 1 50%',\n },\n}));\n\nconst CheckedImage = styled.span({\n display: 'none',\n height: 34,\n position: 'absolute',\n right: 10,\n top: 10,\n width: 34,\n});\n\nconst CheckedText = styled.span({\n display: 'none',\n height: 34,\n lineHeight: '34px',\n position: 'absolute',\n right: 10,\n top: '50%',\n transform: 'translate(0, -50%)',\n width: 34,\n});\n\nconst Form = styled.form((p) => ({\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n margin: '50px -12px',\n maxWidth: p.type === 'image' ? 352 : 'none',\n\n [p.theme.mediaQueries.md]: {\n margin: '50px auto',\n },\n}));\n\nconst IconContainer = styled.div({\n flex: '1 1 100%',\n margin: '20px auto',\n});\n\nconst Input = styled.input((p) => ({\n display: 'none',\n\n '&:checked+label': {\n border: `2px solid ${p.theme.colors.PRIMARY2}`,\n\n '.checked': {\n display: 'block',\n },\n },\n}));\n\nconst LabelImage = styled.label((p) => ({\n borderRadius: 8,\n boxShadow: p.theme.shadows.card,\n cursor: 'pointer',\n display: 'block',\n flex: '1 1 50%',\n margin: 12,\n maxHeight: 152,\n maxWidth: 152,\n padding: 15,\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n height: 152,\n width: 152,\n },\n}));\n\nconst LabelIcon = styled.label((p) => ({\n alignItems: 'center',\n borderRadius: 4,\n boxShadow: p.theme.shadows.card,\n cursor: 'pointer',\n display: 'flex',\n flex: '1 1 100%',\n justifyContent: 'flex-start',\n margin: 12,\n minHeight: 65,\n padding: '15px 45px 15px 30px',\n position: 'relative',\n}));\n\nconst LabelText = styled.label((p) => ({\n alignItems: 'center',\n borderRadius: 4,\n boxShadow: p.theme.shadows.card,\n cursor: 'pointer',\n display: 'flex',\n flex: '1 1 100%',\n justifyContent: 'center',\n margin: 12,\n minHeight: 65,\n padding: '15px 45px 15px 30px',\n position: 'relative',\n}));\n\nconst RadioButton = (props) => {\n const {\n icon,\n name,\n onChange,\n options,\n theme,\n type,\n } = props;\n\n const getIcon = useCallback(() => {\n const selected = options.find((e) => e.selected === true);\n return selected ? selected.icon : icon;\n }, [icon, options]);\n\n const [IconTop, setIconTop] = useState(() => (type === 'icon-top' ? getIcon() : null));\n\n const handleChange = (event) => {\n const i = options.find((e) => e.value === event.target.value).icon;\n\n if (type === 'icon-top') {\n setIconTop(() => i);\n }\n\n if (onChange) {\n onChange(event.target.value);\n }\n };\n\n useEffect(() => {\n setIconTop(() => (type === 'icon-top' ? getIcon() : null));\n }, [getIcon, type]);\n\n return (\n \n );\n};\n\nRadioButton.defaultProps = {\n icon: null,\n name: 'radio-button',\n onChange: null,\n options: [],\n theme: null,\n type: null,\n};\n\nRadioButton.propTypes = {\n icon: PropTypes.string,\n name: PropTypes.string,\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape()),\n theme: PropTypes.shape(),\n type: PropTypes.oneOf(['icon', 'icon-top', 'image', 'text']),\n};\n\nexport default withTheme(RadioButton);\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Nav } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport { Link, withRouter } from 'react-router-dom';\nimport styled from 'styled-components';\n\nimport { OutlineSvg } from '../..';\nimport { getCompany } from '../../../utils';\n\nconst CSidebar = styled.div((p) => ({\n background: p.theme.colors.WHITE,\n color: p.theme.colors.PRIMARY1,\n height: '100vh',\n left: 0,\n position: 'fixed',\n top: '80px',\n width: 260,\n zIndex: '999',\n\n [p.theme.mediaQueries.md]: {\n top: '88px',\n },\n\n '.nav': {\n display: 'block',\n height: 'calc(100% - 80px)',\n maxHeight: '100vh',\n overflowY: 'scroll',\n scrollbarWidth: 'none',\n\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n\n '.nav-link': {\n borderLeft: `6px solid ${p.theme.colors.WHITE}`,\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.small,\n lineHeight: '72px',\n padding: '0px 0px 0px 18px',\n\n '&.active': {\n borderColor: p.theme.colors.PRIMARY1,\n fontWeight: p.theme.fontWeights.bold,\n\n svg: {\n fill: p.theme.colors.PRIMARY1,\n },\n },\n\n '&:last-child': {\n padding: '0px 0px 25px 18px',\n },\n\n svg: {\n fill: p.theme.colors.PRIMARY2,\n margin: '0 16px 4px 0',\n },\n },\n },\n}));\n\nconst Sidebar = (props) => {\n const { location, t } = props;\n const hclientMenu = [\n {\n label: t('health client.dashboard'),\n icon: 'Dashboard',\n to: '/dashboard',\n },\n {\n label: t('health client.prevention path'),\n icon: 'Hearth',\n to: '/preventionpath',\n },\n {\n label: t('health client.wellness coach'),\n icon: 'MedicalRecords',\n to: '/wellness-coach',\n },\n {\n label: t('health client.calendar'),\n icon: 'Calendar',\n to: '/calendar',\n },\n {\n label: t('health client.medical folder'),\n icon: 'Folder',\n to: '/medical-records',\n },\n {\n label: t('health client.medical consultation'),\n icon: 'MedicalConsultation',\n to: '/medical-consultation',\n },\n {\n label: t('health client.access health network'),\n icon: 'HealthNetwork',\n to: '/health-network',\n },\n {\n label: t('health client.drugs'),\n icon: 'Drug',\n to: '/drugs',\n },\n {\n label: t('health client.claims management'),\n icon: 'Refund',\n to: '/claims-management',\n },\n {\n label: t('health client.video pills'),\n icon: 'Videos',\n to: '/video-pills',\n },\n {\n label: t('health client.contacts'),\n icon: 'Contact',\n to: '/contacts',\n },\n ];\n return (\n \n );\n};\n\nSidebar.defaultProps = {\n location: null,\n t: null,\n};\n\nSidebar.propTypes = {\n location: PropTypes.shape(),\n t: PropTypes.func,\n};\n\nexport default withRouter(withTranslation(['portale.menu'])(Sidebar));\n","var _style, _filter, _title, _desc, _g, _circle;\nconst _excluded = [\"svgRef\", \"title\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }\nimport React from \"react\";\nconst SvgSliderIcon = _ref => {\n let {\n svgRef,\n title\n } = _ref,\n props = _objectWithoutProperties(_ref, _excluded);\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n id: \"Livello_1\",\n x: \"0px\",\n y: \"0px\",\n viewBox: \"0 0 60 61\",\n style: {\n enableBackground: \"new 0 0 60 61\"\n },\n xmlSpace: \"preserve\",\n ref: svgRef\n }, props), _style || (_style = /*#__PURE__*/React.createElement(\"style\", {\n type: \"text/css\"\n }, \"\\n\\t.st0{filter:url(#filter-2);}\\n\\t.st1{fill:#FFFFFF;}\\n\\t.st2{fill:url(#Oval_2_);}\\n\")), _filter || (_filter = /*#__PURE__*/React.createElement(\"filter\", {\n filterUnits: \"objectBoundingBox\",\n height: \"126.9%\",\n id: \"filter-2\",\n width: \"126.9%\",\n x: \"-13.5%\",\n y: \"-9.6%\"\n }, /*#__PURE__*/React.createElement(\"feOffset\", {\n dx: 0,\n dy: 2,\n in: \"SourceAlpha\",\n result: \"shadowOffsetOuter1\"\n }), /*#__PURE__*/React.createElement(\"feGaussianBlur\", {\n in: \"shadowOffsetOuter1\",\n result: \"shadowBlurOuter1\",\n stdDeviation: 2\n }), /*#__PURE__*/React.createElement(\"feColorMatrix\", {\n in: \"shadowBlurOuter1\",\n type: \"matrix\",\n values: \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.199683129 0\"\n }))), title === undefined ? _title || (_title = /*#__PURE__*/React.createElement(\"title\", null, \"F1FDC809-F754-424C-8140-3C1C15326271\")) : title ? /*#__PURE__*/React.createElement(\"title\", null, title) : null, _desc || (_desc = /*#__PURE__*/React.createElement(\"desc\", null, \"Created with sketchtool.\")), /*#__PURE__*/React.createElement(\"g\", {\n id: \"questionario\"\n }, /*#__PURE__*/React.createElement(\"g\", {\n id: \"Questionario_chisei_2\",\n transform: \"translate(-210.000000, -450.000000)\"\n }, /*#__PURE__*/React.createElement(\"g\", {\n id: \"Group\",\n transform: \"translate(241.771761, 481.862470) rotate(-219.000000) translate(-241.771761, -481.862470) translate(215.771761, 455.862470)\"\n }, _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n id: \"Oval\"\n }, /*#__PURE__*/React.createElement(\"g\", {\n className: \"st0\"\n }, /*#__PURE__*/React.createElement(\"circle\", {\n id: \"path-1_2_\",\n cx: 26.9,\n cy: 28,\n r: 26\n })), /*#__PURE__*/React.createElement(\"g\", null, /*#__PURE__*/React.createElement(\"circle\", {\n id: \"path-1_1_\",\n className: \"st1\",\n cx: 26.9,\n cy: 28,\n r: 26\n })))), /*#__PURE__*/React.createElement(\"linearGradient\", {\n id: \"Oval_2_\",\n gradientUnits: \"userSpaceOnUse\",\n x1: 528.7575,\n y1: -122.4392,\n x2: 528.7575,\n y2: -121.4392,\n gradientTransform: \"matrix(-31.0859 -25.1728 -25.1728 31.0859 13381.665 17124.4688)\"\n }, /*#__PURE__*/React.createElement(\"stop\", {\n offset: 0,\n style: {\n stopColor: \"#E6E6E6\"\n }\n }), /*#__PURE__*/React.createElement(\"stop\", {\n offset: 1,\n style: {\n stopColor: \"#FFFFFF\"\n }\n })), _circle || (_circle = /*#__PURE__*/React.createElement(\"circle\", {\n id: \"Oval_1_\",\n className: \"st2\",\n cx: 26.9,\n cy: 28,\n r: 20\n }))))));\n};\nconst ForwardRef = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(SvgSliderIcon, _extends({\n svgRef: ref\n}, props)));\nexport default __webpack_public_path__ + \"static/media/slider-icon.07f82f8a.svg\";\nexport { ForwardRef as ReactComponent };","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\n\nimport CircularSlider from '@fseehawer/react-circular-slider';\n\nimport { ReactComponent as SliderIcon } from '../../../../assets/icons/slider-icon.svg';\n\nconst Form = styled.form((p) => ({\n margin: '50px 0',\n\n code: {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '60px',\n },\n\n svg: {\n filter: 'drop-shadow(7px 7px 16px rgba(0,0,0,.2))',\n },\n}));\n\nconst SliderCircular = (props) => {\n const {\n label,\n max,\n min,\n name,\n onChange,\n theme,\n value,\n } = props;\n\n // eslint-disable-next-line prefer-spread\n const data = Array.apply(null, { length: max + 1 - min }).map((_, index) => index + min);\n\n const handleChange = (v) => {\n if (onChange) {\n onChange(v);\n }\n };\n\n return (\n \n );\n};\n\nSliderCircular.defaultProps = {\n label: 'anni',\n max: 99,\n min: 18,\n name: 'slider-circular',\n onChange: null,\n theme: null,\n value: null,\n};\n\nSliderCircular.propTypes = {\n label: PropTypes.string,\n max: PropTypes.number,\n min: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n theme: PropTypes.shape(),\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nexport default withTheme(SliderCircular);\n","import React, { useEffect, useState } from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\n\nimport Slider from 'rc-slider';\nimport 'rc-slider/assets/index.css';\n\nimport SliderIcon from '../../../../assets/icons/slider-icon.svg';\nimport { CartoonSvg } from '../../..';\n\nconst IconContainer = styled.div({\n margin: '20px auto',\n});\n\nconst Form = styled.form((p) => ({\n alignItems: 'stretch',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flex-start',\n margin: '50px 0 0',\n paddingBottom: p.scale ? 100 : 0,\n position: 'relative',\n\n '.rc-slider': {\n borderRadius: 12,\n height: 24,\n margin: '0 20px',\n padding: 0,\n width: 'calc(100% - 40px)',\n },\n\n '.rc-slider-mark': {\n margin: '0 10px',\n top: 36,\n width: 'calc(100% - 20px)',\n },\n\n '.rc-slider-mark-text': {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.normal,\n lineHeight: '24px',\n width: 120,\n\n '&:before': {\n border: `1.5px solid ${p.theme.colors.PRIMARY1}`,\n borderRadius: 12,\n content: p.discrete === 'true' ? '' : '\" \"',\n height: 12,\n display: 'block',\n margin: '0 auto 5px',\n width: 3,\n },\n },\n\n '.rc-slider-step': {\n margin: '0 10px',\n top: '50%',\n transform: 'translate(0, -50%)',\n width: 'calc(100% - 20px)',\n },\n\n code: {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '60px',\n },\n\n svg: {\n filter: 'drop-shadow(7px 7px 16px rgba(0,0,0,.2))',\n },\n}));\n\nconst Value = styled.span((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '60px',\n margin: '0 10px',\n}));\n\nconst ValueContainer = styled.div((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n lineHeight: '24px',\n margin: '20px auto',\n}));\n\nconst SliderHorizontal = (props) => {\n const {\n append,\n dots,\n highlight,\n max,\n min,\n name,\n onChange,\n options,\n prepend,\n scale,\n theme,\n type,\n value,\n } = props;\n\n const discrete = options && options.length > 0;\n\n const mMax = discrete ? options.length - 1 : max;\n const mMin = discrete ? 0 : min;\n\n const calculateValue = () => {\n if (value) {\n if (discrete) {\n return options.findIndex((e) => e.value === value);\n }\n return value;\n }\n\n return discrete ? 0 : mMin;\n };\n\n const [mValue, setMValue] = useState(calculateValue());\n\n const generateMarks = () => {\n const marks = {};\n\n if (discrete) {\n options.forEach((o, i, a) => {\n const style = { display: scale ? 'inline' : 'none' };\n\n if ((highlight === 'all' || highlight === 'ends') && (i === 0 || i === a.length - 1)) {\n style.fontSize = theme.fontSizes.large;\n }\n\n if ((highlight === 'all' || highlight === 'selected') && mValue === i) {\n style.fontWeight = theme.fontWeights.bold;\n }\n\n marks[i] = {\n ...o,\n\n label: o.value,\n style,\n };\n });\n } else {\n for (let i = mMin; i <= mMax; i += 1) {\n const style = { display: 'none' };\n\n if ((highlight === 'all' || highlight === 'ends') && (i === 0 || i === mMax)) {\n style.fontSize = theme.fontSizes.large;\n }\n\n if ((highlight === 'all' || highlight === 'selected') && mValue === i) {\n style.fontWeight = theme.fontWeights.bold;\n }\n\n if (scale && (i === mMin || i === mMax || i % 10 === 0)) {\n style.display = 'inline';\n }\n\n marks[i] = {\n label: i,\n style,\n value: i,\n };\n }\n }\n\n return marks;\n };\n\n const marks = generateMarks();\n\n const handleChange = (v) => {\n setMValue(v);\n\n if (onChange) {\n onChange(marks[v].value);\n }\n };\n\n useEffect(() => {\n if (onChange && value) {\n onChange(value);\n }\n }, [onChange, value]);\n\n return (\n \n );\n};\n\nSliderHorizontal.defaultProps = {\n append: null,\n dots: false,\n highlight: null,\n max: 100,\n min: 0,\n name: 'slider-horizontal',\n onChange: null,\n options: null,\n prepend: null,\n scale: false,\n theme: null,\n type: 'simple',\n value: null,\n};\n\nSliderHorizontal.propTypes = {\n append: PropTypes.string,\n dots: PropTypes.bool,\n highlight: PropTypes.oneOf(['all', 'ends', 'selected']),\n max: PropTypes.number,\n min: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape),\n prepend: PropTypes.string,\n scale: PropTypes.bool,\n theme: PropTypes.shape(),\n type: PropTypes.oneOf(['image', 'simple', 'value']),\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nexport default withTheme(SliderHorizontal);\n","import React, { useEffect, useState } from 'react';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\nimport Slider from 'rc-slider';\nimport 'rc-slider/assets/index.css';\n\nimport SliderIcon from '../../../../assets/icons/slider-icon.svg';\nimport { CartoonSvg } from '../../..';\n\nconst IconContainer = styled.div((p) => ({\n flex: '1 1 50%',\n textAlign: 'left',\n\n [p.theme.mediaQueries.md]: {\n textAlign: 'right',\n },\n}));\n\nconst Form = styled.form((p) => ({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n margin: '50px -24px',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n margin: '50px auto',\n },\n\n '.rc-slider': {\n borderRadius: 12,\n marginLeft: p.type === 'simple' ? 'calc(25% - 12px)' : '-12px',\n padding: 0,\n width: 24,\n\n [p.theme.mediaQueries.md]: {\n marginLeft: p.type === 'simple' ? 'calc(45% - 12px)' : '-12px',\n },\n },\n\n '.rc-slider-mark': {\n left: p.type === 'value' ? -78 : 36,\n },\n\n '.rc-slider-mark-text': {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.normal,\n lineHeight: '24px',\n textAlign: 'left',\n width: p.type === 'simple' ? 180 : 120,\n\n '&:after': {\n border: `1.5px solid ${p.theme.colors.PRIMARY1}`,\n borderRadius: 12,\n content: p.discrete === 'true' ? '' : '\" \"',\n height: 3,\n display: p.type === 'value' ? 'inline-block' : 'none',\n margin: '0 0 2px 5px',\n width: 12,\n },\n\n '&:before': {\n border: `1.5px solid ${p.theme.colors.PRIMARY1}`,\n borderRadius: 12,\n content: p.discrete === 'true' ? '' : '\" \"',\n height: 3,\n display: p.type === 'value' ? 'none' : 'inline-block',\n margin: '0 5px 2px 0',\n width: 12,\n },\n },\n\n '.rc-slider-step': {\n display: p.discrete === 'true' && p.dots === 'true' ? 'block' : 'none',\n height: 'calc(100% - 20px)',\n left: '50%',\n top: 10,\n transform: 'translate(-50%, 0)',\n },\n\n '.rc-slider-vertical': {\n '.rc-slider-handle': {\n marginLeft: -13,\n zIndex: 1,\n },\n\n '.rc-slider-track': {\n left: 0,\n },\n },\n\n code: {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '60px',\n },\n\n svg: {\n filter: 'drop-shadow(7px 7px 16px rgba(0,0,0,.2))',\n maxHeight: '100%',\n maxWidth: 'calc(100% - 12px)',\n },\n}));\n\nconst SliderContainer = styled.div((p) => ({\n flex: '1 1 50%',\n height: 228,\n\n [p.theme.mediaQueries.md]: {\n flex: p.type === 'value' ? '1 1 35%' : '1 1 50%',\n },\n}));\n\nconst Value = styled.span((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.xxxxlarge,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '60px',\n margin: '0 10px',\n}));\n\nconst ValueContainer = styled.div((p) => ({\n color: p.theme.colors.PRIMARY1,\n flex: '1 1 50%',\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n lineHeight: '24px',\n marginLeft: '12.5%',\n paddingRight: 106,\n textAlign: 'left',\n\n [p.theme.mediaQueries.md]: {\n marginLeft: 0,\n textAlign: 'right',\n },\n}));\n\nconst SliderVertical = (props) => {\n const {\n append,\n dots,\n highlight,\n max,\n min,\n name,\n onChange,\n options,\n prepend,\n scale,\n theme,\n type,\n value,\n } = props;\n\n const discrete = !max && !min && options && options.length > 0;\n\n const mMax = discrete ? options.length - 1 : max;\n const mMin = discrete ? 0 : min;\n\n const calculateValue = () => {\n if (value) {\n if (discrete) {\n return options.findIndex((e) => e.value === value);\n }\n return value;\n }\n\n return discrete ? 0 : mMin;\n };\n\n const [mValue, setMValue] = useState(calculateValue());\n\n const generateMarks = () => {\n const marks = {};\n if (discrete) {\n options.forEach((o, i, a) => {\n const style = { display: scale ? 'inline' : 'none' };\n\n if ((highlight === 'all' || highlight === 'ends') && (i === 0 || i === a.length - 1)) {\n style.fontSize = theme.fontSizes.large;\n }\n\n if ((highlight === 'all' || highlight === 'selected') && (mValue === i)) {\n style.fontWeight = theme.fontWeights.bold;\n }\n\n marks[i] = {\n ...o,\n\n label: o.value,\n style,\n };\n });\n } else {\n for (let i = mMin; i <= mMax; i += 1) {\n const style = { display: 'none' };\n\n if ((highlight === 'all' || highlight === 'ends') && (i === 0 || i === mMax)) {\n style.fontSize = theme.fontSizes.large;\n }\n\n if ((highlight === 'all' || highlight === 'selected') && (mValue === i)) {\n style.fontWeight = theme.fontWeights.bold;\n }\n\n if (scale && (i === mMin || i === mMax || i % 10 === 0)) {\n style.display = 'inline';\n }\n\n marks[i] = {\n label: i,\n style,\n value: i,\n };\n }\n }\n\n return marks;\n };\n\n const marks = generateMarks();\n\n const handleChange = (v) => {\n setMValue(v);\n\n if (onChange) {\n onChange(marks[v].value);\n }\n };\n\n useEffect(() => {\n if (onChange && value) {\n onChange(value);\n }\n }, [onChange, value]);\n\n return (\n \n );\n};\n\nSliderVertical.defaultProps = {\n append: null,\n dots: false,\n highlight: null,\n max: null,\n min: null,\n name: 'slider-vertical',\n onChange: null,\n options: null,\n prepend: null,\n scale: false,\n theme: null,\n type: 'simple',\n value: null,\n};\n\nSliderVertical.propTypes = {\n append: PropTypes.string,\n dots: PropTypes.bool,\n highlight: PropTypes.oneOf(['all', 'ends', 'selected']),\n max: PropTypes.number,\n min: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape),\n prepend: PropTypes.string,\n scale: PropTypes.bool,\n theme: PropTypes.shape(),\n type: PropTypes.oneOf(['image', 'simple', 'value']),\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nexport default withTheme(SliderVertical);\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport moment from 'moment';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport A from '../Accordion';\nimport Button from '../../common/Button';\nimport CartoonSvg from '../../common/CartoonSvg';\nimport Chart from '../../common/Chart';\nimport OutlineSvg from '../../common/OutlineSvg';\nimport Text from '../../common/Text';\n\nconst Accordion = styled(A)((p) => ({\n '.item': {\n '.title': {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.medium,\n lineHeight: '24px',\n },\n\n '.value': {\n color: p.theme.colors.PRIMARY2,\n },\n\n ul: {\n li: {\n marginBottom: 10,\n\n '&:before': {\n color: p.theme.colors.PRIMARY2,\n content: '\"•\"',\n marginRight: p.theme.space,\n width: p.theme.space,\n },\n },\n },\n },\n\n '.value': {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontWeight: p.theme.fontWeights.bold,\n },\n}));\n\nconst ButtonContainer = styled.div({\n padding: '30px 0 15px',\n textAlign: 'center',\n});\n\nconst Container = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n padding: 20,\n}));\n\nconst ChartContainer = styled.div({\n padding: '20px 0',\n});\n\nconst IconContainer = styled.div((p) => ({\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n marginRight: p.theme.space,\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n}));\n\nconst Title = styled.div({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n});\n\nconst Trend = (props) => {\n const {\n average,\n data,\n from,\n icon,\n label,\n name,\n onClick,\n onUpdate,\n small,\n t,\n theme,\n to,\n } = props;\n\n const sorted = data.sort((a, b) => moment(a.instant).valueOf() - moment(b.instant).valueOf());\n const tmp = sorted ? sorted.map((o) => ({ name: moment(o.instant).format('MMM YYYY'), value: o.value })) : [];\n\n const generateData = () => [\n {\n content: {\n items: [\n \n
\n {t('tab trend.measurement from to', {\n from: moment(from).format('DD/MM/YYYY'),\n to: moment(to).format('DD/MM/YYYY'),\n })}\n
\n
\n {sorted\n .slice()\n .reverse()\n .map((o) => (\n \n \n {o.value}\n {' '}\n {o.unity}\n \n \n {t('tab trend.done at')}\n {moment(o.instant).format('D MMMM YYYY')}\n \n ))}\n \n
,\n ],\n },\n id: 1,\n toggle: {\n description:\n sorted.length > 0 ? (\n \n \n {sorted[sorted.length - 1].value}\n {' '}\n {sorted[sorted.length - 1].unity}\n \n \n {t('tab trend.done at')}\n {moment(sorted[sorted.length - 1].instant).format('D MMMM YYYY')}\n \n ) : (\n {t('tab trend.no data')} \n ),\n title: t('tab trend.last measurement'),\n },\n },\n ];\n\n const handleClickContainer = () => {\n if (onClick && small) {\n onClick();\n }\n };\n\n const handleClickUpdate = (event) => {\n event.stopPropagation();\n\n if (onUpdate) {\n onUpdate();\n }\n };\n\n return (\n handleClickContainer()}>\n \n \n {icon ? : null}\n \n\n \n\n {small && }\n \n\n {!small && (\n \n
\n \n \n \n\n
\n\n
\n handleClickUpdate(e)} text=\"portale.medicalreports:tab trend.update button\" variant=\"primary\" width={308} />\n \n
\n )}\n \n );\n};\n\nTrend.defaultProps = {\n average: null,\n data: [],\n from: null,\n icon: null,\n label: null,\n name: null,\n onClick: null,\n onUpdate: null,\n small: false,\n t: null,\n theme: null,\n to: null,\n};\n\nTrend.propTypes = {\n average: PropTypes.number,\n data: PropTypes.arrayOf(PropTypes.shape),\n label: PropTypes.string,\n from: PropTypes.string,\n icon: PropTypes.string,\n name: PropTypes.string,\n onClick: PropTypes.func,\n onUpdate: PropTypes.func,\n small: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n to: PropTypes.string,\n};\n\nexport default withTheme(withTranslation(['portale.medicalreports', 'enums'])(Trend));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { Dropdown } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport { OutlineSvg } from '../..';\nimport { revokeToken } from '../../../reducers/authentication/actions';\nimport { Authorities } from '../../../enums';\n\nconst UM = styled(Dropdown)((p) => ({\n height: 48,\n marginRight: '24px',\n width: 48,\n\n [p.theme.mediaQueries.md]: {\n marginRight: 0,\n },\n\n '.dropdown-menu': {\n border: 'none',\n borderRadius: 0,\n boxShadow: '0 8px 30px -8px rgba(0,0,0,0.5)',\n margin: 0,\n position: 'fixed !important',\n top: '80px !important',\n transform: 'none !important',\n width: '100% !important',\n\n [p.theme.mediaQueries.md]: {\n left: 'auto !important',\n position: 'absolute !important',\n right: '0 !important',\n top: '68px !important',\n transform: 'none !important',\n width: 'auto !important',\n },\n\n '.dropdown-item': {\n backgroundColor: 'transparent !important',\n borderBottom: '1px solid #C0D4DC',\n color: `${p.theme.colors.PRIMARY1} !important`,\n fontSize: p.theme.fontSizes.medium,\n lineHeight: '68px',\n textTransform: 'uppercase',\n\n '&:last-child': {\n borderBottom: 'none !important',\n },\n\n i: {\n marginRight: 16,\n },\n },\n },\n\n '.dropdown-toggle::after': {\n display: 'none',\n },\n\n button: {\n backgroundColor: 'transparent !important',\n border: '0px !important',\n boxShadow: 'none !important',\n outline: 'none !important',\n padding: 0,\n },\n}));\n\nconst Circle = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '50%',\n height: 48,\n lineHeight: '44px',\n minWidth: 48,\n position: 'relative',\n textAlign: 'center',\n width: 48,\n}));\n\nconst UserMenu = (props) => {\n const {\n account,\n className,\n history,\n logout,\n onOpen,\n t,\n theme,\n userHasCompleteMenu,\n } = props;\n\n const goto = (url) => {\n history.push(`/${url}`);\n };\n\n const goSettings = () => {\n if (account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role)) {\n goto('customer-settings');\n } else {\n goto('account-settings');\n }\n };\n\n return (\n \n \n \n \n \n \n\n \n {userHasCompleteMenu ? (\n <>\n {account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role) ? null : (\n goto('edit-profile')}>\n \n \n \n {t('user actions.item 1')}\n \n )}\n\n goSettings()}>\n \n \n \n {t('user actions.item 2')}\n \n >\n ) : null}\n\n logout()}>\n \n \n \n {t('user actions.item 3')}\n \n \n \n );\n};\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n logout: () => {\n dispatch(revokeToken({}));\n },\n});\n\nUserMenu.defaultProps = {\n account: null,\n className: null,\n history: null,\n logout: null,\n onOpen: null,\n t: null,\n theme: null,\n userHasCompleteMenu: null,\n};\n\nUserMenu.propTypes = {\n account: PropTypes.shape(),\n className: PropTypes.string,\n history: PropTypes.shape(),\n logout: PropTypes.func,\n onOpen: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n userHasCompleteMenu: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['portale.menu'])(UserMenu))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Trans, withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport PDFBCC from '../../../assets/docs/dichiarazione-di-accessibilita-bcc.pdf';\nimport PDFCattolica from '../../../assets/docs/dichiarazione-di-accessibilita-cattolica.pdf';\nimport PDFTua from '../../../assets/docs/dichiarazione-di-accessibilita-tua.pdf';\nimport PDFVera from '../../../assets/docs/dichiarazione-di-accessibilita-vera.pdf';\n\nimport { Container, Text } from '../../../components';\nimport { getCompany } from '../../../utils';\n\nconst DownloadText = styled.div({\n display: 'flex',\n flexDirection: 'row',\n marginTop: '3em',\n\n p: {\n whiteSpace: 'nowrap',\n },\n});\n\nconst DownloadTextCattolica = styled.div({\n display: 'flex',\n flexDirection: 'row',\n marginTop: '1em',\n p: {\n whiteSpace: 'nowrap',\n },\n});\n\nconst MenuStyled = styled.ul({\n listStyle: 'inside',\n});\n\nconst Accessibility = (props) => {\n const { theme } = props;\n\n const pdf = {\n bcc: PDFBCC,\n cattolica: PDFCattolica,\n tua: PDFTua,\n vera: PDFVera,\n };\n\n return (\n \n\n {getCompany() === 'cattolica'\n ? (\n <>\n \n\n \n \n\n \n \n \n \n \n \n \n \n\n \n \n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:h2_title_3_content_1_list.1\" parent=\"li\" />\n \n \n \n \n \n \n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:privacy_content\" parent=\"p\" />\n\n \n \n \n \n \n >\n )\n : (\n <>\n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:intro\" parent=\"p\" />\n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:1 content\" parent=\"p\" />\n\n \n \n\n \n \n\n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:6 content\" parent=\"p\" />\n\n \n \n \n \n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:6 content 2\" parent=\"p\" />\n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.accessibility:7 content\" parent=\"p\" />\n\n \n\n \n \n \n \n \n\n \n\n \n \n \n \n\n \n\n \n \n \n \n >\n )}\n\n \n );\n};\n\nAccessibility.defaultProps = {\n theme: null,\n};\n\nAccessibility.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.accessibility'])(withTheme(Accessibility));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { Trans, withTranslation } from 'react-i18next';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n CheckboxInputGroup,\n OutlineSvg,\n Text,\n} from '../../../components';\n\nimport { EgoSvg } from '../../../components/common/Svg';\nimport { getEgoOriginEnvironment } from '../../../utils';\n\nconst Card = styled.div((p) => ({\n borderRadius: '8px',\n boxShadow: '0 5px 12px 0 rgba(0,0,0,0.22)',\n display: 'flex',\n flexDirection: 'column',\n marginTop: p.theme.verticalSpacing.p40,\n padding: '40px 30px',\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n },\n\n '.info': {\n padding: '40px 0 0 0',\n\n p: {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.xlarge,\n margin: 0,\n },\n\n [p.theme.mediaQueries.md]: {\n padding: '0 0 0 34px',\n },\n },\n\n svg: {\n width: 'auto',\n },\n}));\n\nconst Rect = styled.div((p) => ({\n boxShadow: '0 5px 12px 0 rgba(0,0,0,0.22)',\n marginTop: 16,\n padding: '15px 10px',\n cursor: 'pointer',\n\n [p.theme.mediaQueries.md]: {\n padding: '25px 20px',\n },\n\n 'div, label, p': {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n margin: 0,\n },\n\n '&.flex': {\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n\n [p.theme.mediaQueries.sm]: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n\n '&.flex-row': {\n alignItems: 'center',\n flexDirection: 'row',\n\n div: {\n width: 'calc(100% - 30px)',\n },\n\n p: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n },\n },\n\n '.container-radioinputgroup': {\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginTop: 15,\n\n [p.theme.mediaQueries.sm]: {\n marginTop: 0,\n },\n },\n },\n\n '.consent-label': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n\n p: {\n paddingRight: 10,\n\n span: {\n paddingRight: 10,\n },\n },\n\n svg: {\n minWidth: 20,\n },\n },\n\n '.consent-options': {\n paddingRight: 15,\n width: 160,\n },\n}));\n\nconst AccountSettings = (props) => {\n const {\n account,\n history,\n t,\n theme,\n } = props;\n\n return (\n \n \n\n \n \n \n \n \n \n \n \n
\n \n \n
\n\n \n \n \n\n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n
\n\n window.open(`${getEgoOriginEnvironment()}/credentials/recovery`, '_blank').focus()}>\n \n \n \n
\n \n \n\n window.open(`${getEgoOriginEnvironment()}/credentials/recovery`, '_blank').focus()}>\n \n \n \n
\n \n \n\n \n\n \n history.push({ pathname: 'consenses', state: { disabled: true } })}\n selectedValues={['privacy']}\n />\n \n \n
\n \n );\n};\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n});\n\nAccountSettings.defaultProps = {\n account: null,\n history: null,\n t: null,\n theme: null,\n};\n\nAccountSettings.propTypes = {\n account: PropTypes.shape(),\n history: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, null)(withTheme(withTranslation(['portale.accountsettings'])(AccountSettings))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { debounce } from 'lodash';\n\nimport {\n Button,\n Container,\n List,\n Map,\n OutlineSvg,\n SelectInput,\n Text,\n} from '../../../components';\n\nimport { defaultCoordinates, fetchAgencies, fetchAgenciesByCoordinates } from '../../../reducers/agencies/actions';\nimport { autocompletePlaces } from '../../../reducers/places/actions';\nimport { setGoogleService } from '../../../reducers/settings/actions';\nimport { setContactMe } from '../../../reducers/preferences/actions';\n\nconst Address = styled.p((p) => ({\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.small,\n textTransform: 'capitalize',\n margin: 0,\n}));\n\nconst ColP0 = styled(Col)({\n padding: 0,\n});\n\nconst MapContainer = styled.div((p) => ({\n height: '75vh',\n marginTop: p.theme.space,\n position: 'relative',\n width: '100%',\n}));\n\nconst ML = styled(List)((p) => ({\n left: 0,\n marginTop: '30px',\n maxHeight: 'calc(75vh - 15px)',\n overflow: 'auto',\n position: 'absolute',\n width: '100%',\n zIndex: 9,\n\n [p.theme.mediaQueries.md]: {\n left: 'auto',\n transform: 'translate(-146.5px, 0)',\n width: '375px',\n },\n}));\n\nconst MSInput = styled.div({\n minWidth: 'calc(100% - 150px)',\n});\n\nconst Title = styled.p((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.large,\n fontWeight: p.theme.fontWeights.bold,\n lineHeight: '24px',\n margin: 0,\n}));\n\nconst generateTemplate = (item, theme) => (\n \n
\n
{item.name} \n
{`${item.address.toLocaleLowerCase()}, ${item.streetNumber} - ${item.postCode} - ${item.city.toLocaleLowerCase()}`} \n
\n
\n \n
\n
\n);\n\nclass Agency extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n geolocation: {},\n geolocationDefault: {\n latitude: defaultCoordinates.latitude,\n longitude: defaultCoordinates.longitude,\n },\n showList: false,\n zoom: 12,\n };\n\n this.buildAgenciesList = this.buildAgenciesList.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.handleChangeInput = this.handleChangeInput.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.initService = this.initService.bind(this);\n this.toggleList = this.toggleList.bind(this);\n this.onZoomChanged = this.onZoomChanged.bind(this);\n }\n\n componentDidMount() {\n const { getAgenciesByCoordinates } = this.props;\n\n if ('geolocation' in navigator) {\n navigator.geolocation.getCurrentPosition((position) => {\n const coordinates = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n };\n\n this.setState({\n geolocation: coordinates,\n });\n\n getAgenciesByCoordinates(coordinates);\n });\n }\n }\n\n handleChange(place) {\n if (place.target.value && place.target.label) {\n const { getAgencies } = this.props;\n const { map, zoom } = this.state;\n\n getAgencies({ map, placeId: place.target.value });\n map.setZoom(zoom);\n }\n }\n\n handleChangeInput(input) {\n if (input.length > 0) {\n const { searchPlaces } = this.props;\n searchPlaces({ input });\n }\n }\n\n handleClick(agency) {\n const { history, setPreferenceAgency, contactMePreference } = this.props;\n\n setPreferenceAgency({ ...contactMePreference, agency });\n history.push('/contactme');\n }\n\n initService(props, map) {\n const { setGoogle } = this.props;\n const { google } = props;\n\n setGoogle(google);\n\n this.setState({ map });\n }\n\n toggleList(value) {\n const { showList } = this.state;\n\n if (showList !== value) {\n this.setState({ showList: value });\n }\n }\n\n buildAgenciesList(list) {\n const { theme } = this.props;\n const { map } = this.state;\n\n if (list && list.length > 0) {\n const agenciesBylocation = [];\n\n const bounds = map.getBounds();\n if (bounds) {\n const ne = bounds.getNorthEast();\n const sw = bounds.getSouthWest();\n\n for (let i = 0; i < list.length; i += 1) {\n const lat = parseFloat(list[i].lat);\n const lon = parseFloat(list[i].lon);\n if (lat <= ne.lat() && lat >= sw.lat() && lon <= ne.lng() && lon >= sw.lng()) {\n agenciesBylocation.push(list[i]);\n }\n }\n }\n\n if (agenciesBylocation.length > 0) {\n return generateTemplate(i, theme)} />;\n }\n return generateTemplate(i, theme)} />;\n }\n return null;\n }\n\n onZoomChanged() {\n this.setState({ showList: false });\n }\n\n render() {\n const {\n agencies,\n place,\n places,\n t,\n theme,\n } = this.props;\n\n const {\n geolocation,\n geolocationDefault,\n showList,\n zoom,\n } = this.state;\n\n let a = [];\n if (agencies && agencies.length > 0) {\n a = agencies.map((o) => ({\n ...o,\n onClick: (event) => this.handleClick(event),\n }));\n }\n\n const hci = debounce((input) => {\n this.handleChangeInput(input);\n }, 500);\n\n const latitude = place && place.location ? place.location.lat() : geolocation.latitude || geolocationDefault.latitude;\n\n const longitude = place && place.location ? place.location.lng() : geolocation.longitude || geolocationDefault.longitude;\n\n const mappedPlaces = places.map((o) => ({\n data: o,\n label: o.description,\n value: o.place_id,\n }));\n\n return (\n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n\n
\n \n \n \n \n \n\n this.toggleList(false)}\n rounded\n variant={showList ? 'iconRoundedSecondary' : 'iconRoundedPrimary'}\n >\n \n \n\n \n this.toggleList(true)}\n rounded\n variant={showList ? 'iconRoundedPrimary' : 'iconRoundedSecondary'}\n >\n \n \n\n {showList ? this.buildAgenciesList(a) : null}\n
\n \n
\n \n \n \n \n \n \n
\n \n
\n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getAgencies: (params) => {\n dispatch(fetchAgencies(params));\n },\n getAgenciesByCoordinates: (params) => {\n dispatch(fetchAgenciesByCoordinates(params));\n },\n searchPlaces: (params) => {\n dispatch(autocompletePlaces(params));\n },\n setGoogle: (params) => {\n dispatch(setGoogleService(params));\n },\n setPreferenceAgency: (preferences) => {\n dispatch(setContactMe(preferences));\n },\n});\n\nconst mapStateToProps = (state) => ({\n agencies: state.agencies.agencies,\n contactMePreference: state.preferences.contactMePreference,\n google: state.settings.google,\n place: state.places.place,\n places: state.places.places,\n});\n\nAgency.defaultProps = {\n agencies: [],\n contactMePreference: null,\n getAgencies: null,\n getAgenciesByCoordinates: null,\n history: null,\n place: null,\n places: [],\n searchPlaces: null,\n setGoogle: null,\n setPreferenceAgency: null,\n t: null,\n theme: null,\n};\n\nAgency.propTypes = {\n agencies: PropTypes.arrayOf(PropTypes.shape()),\n contactMePreference: PropTypes.shape(),\n getAgencies: PropTypes.func,\n getAgenciesByCoordinates: PropTypes.func,\n history: PropTypes.shape(),\n place: PropTypes.shape(),\n places: PropTypes.arrayOf(PropTypes.shape()),\n searchPlaces: PropTypes.func,\n setGoogle: PropTypes.func,\n setPreferenceAgency: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['portale.agency'])(Agency))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport { Loading } from '../../../components';\nimport { Authorities } from '../../../enums';\nimport { createToken, getSession } from '../../../reducers/authentication/actions';\nimport { getTokens } from '../../../utils';\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass Auth extends React.Component {\n componentDidMount() {\n const { getAuthTokens, history, isFetchingToken } = this.props;\n\n const codeParam = getParams(history.location.search).code || null;\n if (codeParam && !isFetchingToken && !getTokens()) {\n getAuthTokens(codeParam);\n }\n }\n\n componentDidUpdate(prevProps) {\n const {\n account,\n getAccount,\n history,\n isAuthenticated,\n isFetchingAccount,\n isFetchingToken,\n } = this.props;\n\n if (!isFetchingToken && !isFetchingAccount && isAuthenticated) {\n getAccount();\n }\n\n if (!isFetchingToken && !isFetchingAccount && isAuthenticated && account && account !== prevProps.account) {\n if (account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role)) {\n history.push(Authorities.PB_HEALTH_CLIENT.defaultPage);\n } else if (account.authorities.includes(Authorities.PB_PROSPECT.role)) {\n history.push(Authorities.PB_PROSPECT.defaultPage);\n } else {\n history.push('/welcome');\n }\n }\n }\n\n render() {\n return ;\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingAccount: state.authentication.isFetchingAccount,\n isFetchingToken: state.authentication.isFetchingToken,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getAccount: () => {\n dispatch(getSession());\n },\n getAuthTokens: (code) => {\n dispatch(createToken(code));\n },\n});\n\nAuth.defaultProps = {\n account: null,\n getAccount: null,\n getAuthTokens: null,\n history: null,\n isAuthenticated: null,\n isFetchingAccount: null,\n isFetchingToken: null,\n};\n\nAuth.propTypes = {\n account: PropTypes.shape({\n authorities: PropTypes.arrayOf(PropTypes.string),\n }),\n getAuthTokens: PropTypes.func,\n getAccount: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetchingAccount: PropTypes.bool,\n isFetchingToken: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(Auth));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n Container,\n GoBack,\n Loading,\n MaterialDesignInput,\n SelectInput,\n Text,\n} from '../../../components';\n\nimport { Consenses } from '../../../enums';\n\nimport { createConsultationRequest, fetchConsultationRequest } from '../../../reducers/consultationRequests/actions';\nimport { fetchUserPlan } from '../../../reducers/users/actions';\nimport { getConsensesObject, getConsensesObjectSet } from '../../../utils';\nimport { setPrivacy as setPrivacyAction } from '../../../reducers/privacy/actions';\n\nconst CBookConsultationId = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 64px',\n },\n\n '.bg-white': {\n borderRadius: '8px',\n margin: '0 0 32px',\n padding: '34px 15px',\n\n [p.theme.mediaQueries.md]: {\n marginBottom: 32,\n padding: '64px 0',\n },\n },\n}));\n\nconst ContainerPConsent = styled.div((p) => ({\n marginTop: '16px',\n textAlign: 'left',\n\n a: {\n color: `${p.theme.colors.PRIMARY1} !important`,\n },\n\n label: {\n fontWeight: p.theme.fontWeights.bold,\n },\n\n '.container-CheckboxInputGroup': {\n '>div': {\n margin: 0,\n },\n },\n}));\n\nconst ContainerForm = styled.div((p) => ({\n marginTop: 20,\n\n '.inputs': {\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n width: '100%',\n\n '>div': {\n marginBottom: 15,\n maxWidth: '100%',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n marginBottom: 0,\n maxWidth: '45%',\n width: '45%',\n },\n },\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n flexDirection: 'row',\n },\n },\n}));\n\nconst ContainerButton = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flex-end',\n marginTop: 20,\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n marginBottom: 20,\n },\n}));\n\nclass BookConsultation extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n bookingDataForm: {},\n disabled: true,\n };\n\n this.goBack = this.goBack.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleChangeBookingData = this.handleChangeBookingData.bind(this);\n this.handlePrivacyConsent = this.handlePrivacyConsent.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n isAuthenticated,\n getCRequest,\n getUserPlan,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId).then((response) => {\n if (response.data && response.data.length > 0 && response.data[0].id) {\n getCRequest({\n healthPlanId: response.data[0].id,\n statuses: ['PENDING', 'PROCESSED'],\n });\n }\n });\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const hasbookingDataForm = nextState.bookingDataForm && Object.keys(nextState.bookingDataForm).filter((x) => x !== null).length === 2;\n let selectedPrivacy = null;\n\n if (nextProps.privacy && nextProps.privacy.length > 0) {\n nextProps.privacy.forEach((element) => {\n if (element.answers && element.answers.length > 0) {\n const answer = element.answers.find((a) => a.questionCode === 'WAS_2' && a.answer === 'Y');\n if (answer) {\n selectedPrivacy = ['privacy'];\n }\n }\n });\n }\n return {\n ...nextState,\n disabled: !(hasbookingDataForm && nextState.privacyConsent && nextState.privacyConsent.includes('privacy')),\n privacyConsent: nextState.privacyConsent === null || nextState.privacyConsent === undefined\n ? selectedPrivacy\n : nextState.privacyConsent,\n };\n }\n\n handlePrivacyConsent(values) {\n this.setState({\n privacyConsent: values,\n });\n }\n\n handleChangeBookingData(e) {\n const { bookingDataForm } = this.state;\n\n if (e.target) {\n const { name, value } = e.target;\n\n if (value && value !== '') {\n this.setState({\n bookingDataForm: {\n ...bookingDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpbookingDataForm = { ...bookingDataForm };\n delete tmpbookingDataForm[name];\n\n this.setState({\n bookingDataForm: { ...tmpbookingDataForm },\n });\n }\n } else {\n const { name, value } = e;\n\n if (value && value !== '') {\n this.setState({\n bookingDataForm: {\n ...bookingDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpbookingDataForm = { ...bookingDataForm };\n delete tmpbookingDataForm[name];\n\n this.setState({\n bookingDataForm: { ...tmpbookingDataForm },\n });\n }\n }\n }\n\n handleCancel() {\n this.goBack();\n }\n\n handleSubmit() {\n const {\n account,\n createCRequest,\n history,\n plan,\n privacy,\n setPrivacy,\n } = this.props;\n\n const { bookingDataForm } = this.state;\n\n const timeSlots = bookingDataForm.healthServiceType.split('-');\n const consultationrequest = {\n healthPlan: {\n id: plan.id,\n },\n timeSlotStart: timeSlots[0],\n timeSlotEnd: timeSlots[1],\n phone: bookingDataForm.phone,\n };\n\n createCRequest(consultationrequest).then(() => {\n setPrivacy(\n [...privacy, getConsensesObjectSet(account, 'WAS_2', Consenses.QUESTIONNAIRE.code)],\n getConsensesObject(account),\n ).then(() => history.go());\n });\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n render() {\n const {\n consultationRequests,\n consultationRequestsIsFetching,\n planIsFetching,\n privacyIsFetching,\n t,\n theme,\n } = this.props;\n\n const { disabled, privacyConsent } = this.state;\n\n const timeSlotsOptions = [\n { label: '09.00-12.00', value: '09:00:00-12:00:00' },\n { label: '12.00-14.00', value: '12:00:00-14:00:00' },\n { label: '14-00-18.00', value: '14:00:00-18:00:00' },\n ];\n\n return (\n <>\n {planIsFetching || consultationRequestsIsFetching || privacyIsFetching ? null : (\n \n \n \n {consultationRequests && consultationRequests.length > 0 ? (\n \n \n \n \n
\n ) : (\n <>\n \n \n \n \n \n\n \n \n \n \n
\n\n \n\n \n this.handlePrivacyConsent(values)}\n selectedValues={privacyConsent}\n />\n \n \n \n
\n\n \n \n \n \n \n \n \n\n \n \n \n
\n >\n )}\n \n \n )}\n >\n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n createCRequest: (params) => dispatch(createConsultationRequest(params)),\n getCRequest: (params) => { dispatch(fetchConsultationRequest(params)); },\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n setPrivacy: (dataSet, dataGet) => dispatch(setPrivacyAction({ dataSet, dataGet })),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n consultationRequests: state.consultationRequests.data,\n consultationRequestsIsFetching: state.consultationRequests.isFetching,\n isAuthenticated: state.authentication.isAuthenticated,\n plan: state.users.fetchUserPlan.data,\n planIsFetching: state.users.fetchUserPlan.isFetching,\n privacy: state.privacy.privacy,\n privacyIsFetching: state.privacy.isFetching,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nBookConsultation.defaultProps = {\n account: null,\n consultationRequests: null,\n consultationRequestsIsFetching: null,\n createCRequest: null,\n getCRequest: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: false,\n plan: null,\n planIsFetching: null,\n privacy: null,\n privacyIsFetching: null,\n questionnaire: null,\n setPrivacy: null,\n t: null,\n theme: null,\n};\n\nBookConsultation.propTypes = {\n account: PropTypes.shape(),\n consultationRequests: PropTypes.arrayOf(PropTypes.shape({})) || PropTypes.shape({}),\n consultationRequestsIsFetching: PropTypes.bool,\n createCRequest: PropTypes.func,\n getCRequest: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n plan: PropTypes.shape(),\n planIsFetching: PropTypes.bool,\n privacy: PropTypes.arrayOf(PropTypes.shape()),\n privacyIsFetching: PropTypes.bool,\n questionnaire: PropTypes.shape(),\n setPrivacy: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.bookconsultation', 'translation'])(BookConsultation))));\n","import React from 'react';\n\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchUserPlan } from '../../../reducers/users/actions';\nimport { fetchAllEvents } from '../../../reducers/events/actions';\nimport { EventStatuses } from '../../../enums';\n\nimport {\n Button,\n Calendar as ClientCalendar,\n Container,\n Modal,\n OutlineSvg,\n Text,\n} from '../../../components';\n\nimport {\n AnnualActivityPlanning,\n NextActivitiesSlider,\n} from '../../../components/portale';\n\nconst CCalendar = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 64px',\n },\n}));\n\nconst CC = styled(Container)((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderTopLeftRadius: '8px',\n borderTopRightRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n marginTop: '104px',\n minWidth: '100%',\n padding: '74px 0px 0px',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n borderRadius: '8px',\n minWidth: 'auto',\n padding: '24px 32px 30px',\n },\n\n '.add-events-button': {\n left: '16px',\n padding: 0,\n position: 'absolute',\n top: '20px',\n zIndex: 1,\n\n [p.theme.mediaQueries.md]: {\n left: '0px',\n top: '-72px',\n },\n },\n}));\n\nconst AddEvents = styled.div((p) => ({\n '.event-type': {\n float: 'left',\n textAlign: 'center',\n width: '50%',\n\n '&:last-child': {\n width: '100%',\n },\n\n button: {\n '.container-icon': {\n backgroundColor: `${p.theme.colors.GRAPH3} !important`,\n },\n },\n },\n}));\n\nclass Calendar extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n defaultDateOfNewEvent: new Date(),\n showAddEventsModal: false,\n showNextActivities: false,\n };\n\n this.getEvents = this.getEvents.bind(this);\n this.goToAddEvent = this.goToAddEvent.bind(this);\n this.onCloseModal = this.onCloseModal.bind(this);\n this.onSelectEvent = this.onSelectEvent.bind(this);\n this.onSelectSlot = this.onSelectSlot.bind(this);\n this.showModal = this.showModal.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (isAuthenticated && account && account.id) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n calendarEvents:\n nextProps.allEvents.length === 0\n ? null\n : nextProps.allEvents.map((event) => ({\n ...event,\n start: new Date(event.startDate),\n end: new Date(event.endDate),\n })),\n showNextActivities: nextProps.isAuthenticated && nextProps.plan && nextProps.plan.activities.length > 0,\n };\n }\n\n componentDidUpdate(prevProps) {\n const { plan } = this.props;\n if (plan && plan !== prevProps.plan) {\n this.getEvents();\n }\n }\n\n onSelectSlot(slot) {\n this.setState({\n defaultDateOfNewEvent: slot.start,\n });\n this.showModal(true);\n }\n\n onSelectEvent(event) {\n const { history } = this.props;\n history.push(`/event/${event.idParent}?startDate=${event.startDate}`);\n }\n\n onCloseModal() {\n this.setState({ showAddEventsModal: false });\n }\n\n getEvents() {\n const { getAllEvents, plan } = this.props;\n getAllEvents({\n healthPlanId: plan.id,\n statuses: `${EventStatuses.PRENOTATO},${EventStatuses.FATTO},${EventStatuses.DRAFT},${EventStatuses.SALTATO}`,\n });\n }\n\n goToAddEvent(type) {\n const { history } = this.props;\n const { defaultDateOfNewEvent } = this.state;\n history.push(`/customevent?type=${type}&startDate=${defaultDateOfNewEvent.toISOString()}`);\n }\n\n showModal(value) {\n this.setState({\n showAddEventsModal: value,\n });\n }\n\n render() {\n const {\n account,\n allEvents,\n isFetching,\n isFetchingAllEvents,\n plan,\n t,\n theme,\n } = this.props;\n\n const { calendarEvents, showAddEventsModal, showNextActivities } = this.state;\n\n if (!account || isFetching) {\n return null;\n }\n\n const addEvents = [\n {\n type: 'DIAGNOSTIC',\n icon: 'Diagnostic',\n },\n {\n type: 'DRUG',\n icon: 'Drug',\n },\n {\n type: 'LIFESTYLE',\n icon: 'LifeStyle',\n },\n ];\n\n return (\n \n \n \n \n \n\n {showNextActivities ? : null}\n\n {plan ? : null}\n\n {!isFetchingAllEvents && allEvents.length > 0 && calendarEvents ? (\n \n \n \n {addEvents.map((newEvent) => (\n \n this.goToAddEvent(newEvent.type)} rounded variant=\"iconRoundedSecondary\">\n {newEvent.icon ? : null }\n \n \n
\n ))}\n \n \n\n this.showModal(true)} rounded variant=\"iconRoundedSecondary\">\n \n \n this.onSelectEvent(event)}\n onSelectSlot={(slot) => this.onSelectSlot(slot)}\n />\n \n ) : null}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n allEvents: state.events.allEvents.data,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n isFetchingAllEvents: state.events.allEvents.isFetching,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getAllEvents: (params) => dispatch(fetchAllEvents(params)),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nCalendar.defaultProps = {\n account: null,\n allEvents: [],\n getAllEvents: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: false,\n isFetching: null,\n isFetchingAllEvents: false,\n plan: null,\n questionnaire: null,\n t: null,\n theme: null,\n};\n\nCalendar.propTypes = {\n account: PropTypes.shape({\n id: PropTypes.string,\n }),\n allEvents: PropTypes.arrayOf(PropTypes.shape()),\n getAllEvents: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape({\n push: PropTypes.func,\n }),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n isFetchingAllEvents: PropTypes.bool,\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['portale.calendar', 'enums'])(Calendar))));\n","import React from 'react';\n\nimport { Col, Row } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport moment from 'moment';\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n CartoonSvg,\n Container,\n FileDownload,\n GoBack,\n Loading,\n OutlineSvg,\n Text,\n} from '../../../components';\n\nimport {\n ClaimsIcon,\n ClaimsStatusColor,\n ClaimsStatusPerformance,\n ClaimsStatusRefund,\n} from '../../../enums';\n\nimport { fetchClaimDetails, fetchFnolDetails, fetchFnolDocument } from '../../../reducers/claims/actions';\n\nconst Amount = styled.div((p) => ({\n display: 'inline-block',\n marginRight: p.theme.space,\n}));\n\nconst Banner = styled.div((p) => ({\n backgroundColor: `${p.theme.colors[p.color]}40`,\n border: 0,\n borderRadius: 8,\n marginBottom: 32,\n padding: p.theme.space,\n}));\n\nconst Bullet = styled.div((p) => ({\n backgroundColor: p.theme.colors.PRIMARY2,\n borderRadius: '50%',\n height: 20,\n marginRight: p.theme.space,\n opacity: 0.5,\n width: 20,\n}));\n\nconst CContainer = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 64px',\n },\n}));\n\nconst CFileDownload = styled.div((p) => ({\n '> div': {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n\n '> div': {\n flex: '1 1 48%',\n\n [p.theme.mediaQueries.md]: {\n flexGrow: 0,\n },\n },\n },\n}));\n\nconst CIcon = styled.div({\n flex: '0 0 48px',\n padding: '8px 0',\n});\n\nconst CInfo = styled.div((p) => ({\n backgroundColor: p.theme.colors.LIGHTGREEN,\n border: 0,\n borderRadius: 8,\n boxShadow: p.theme.shadows.card,\n marginBottom: 32,\n}));\n\nconst CInfo1 = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n border: 0,\n borderRadius: 8,\n boxShadow: p.theme.shadows.card,\n padding: p.theme.space,\n}));\n\nconst CInfo2 = styled.div({\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n padding: '16px 32px',\n});\n\nconst CState = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n marginTop: p.theme.space,\n}));\n\nconst Circle = styled.div((p) => ({\n border: `4px solid ${p.theme.colors.PRIMARY2}`,\n borderRadius: '50%',\n margin: '3px 5px 0',\n height: 15,\n width: 15,\n}));\n\nconst Field = styled.div((p) => ({\n borderBottom: p.last ? `1px solid ${p.theme.colors.GREY4}` : 0,\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n padding: `${p.theme.space} 0`,\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass ClaimsDetails extends React.Component {\n constructor(props) {\n super(props);\n\n this.handleClickDocument = this.handleClickDocument.bind(this);\n\n this.getColor = this.getColor.bind(this);\n this.getStatus = this.getStatus.bind(this);\n this.getType = this.getType.bind(this);\n\n this.combineClaim = this.combineClaim.bind(this);\n this.goBack = this.goBack.bind(this);\n\n this.state = {\n files: [],\n };\n }\n\n componentDidMount() {\n const {\n account,\n getFnolDetails,\n isAuthenticated,\n history,\n } = this.props;\n\n const { id } = getParams(history.location.search);\n\n if (isAuthenticated && account && account.id) {\n getFnolDetails({ fnolId: id });\n }\n }\n\n componentDidUpdate(prev) {\n const { getClaimDetails, fnol } = this.props;\n\n if (fnol && prev.fnol && fnol.claimId === prev.fnol.claimId) return;\n\n if (fnol && fnol.claimId) {\n getClaimDetails({ claimNumber: fnol.claimId });\n }\n }\n\n handleClickDocument(file) {\n const { fnol } = this.props;\n const { getDocument } = this.props;\n\n getDocument({ fileId: file.fileId, fnolId: fnol.fnolId });\n }\n\n // eslint-disable-next-line class-methods-use-this\n getColor(claim) {\n if (claim.stato) {\n return ClaimsStatusColor[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusColor[5];\n }\n\n return ClaimsStatusColor[0];\n }\n\n // eslint-disable-next-line class-methods-use-this\n getType(type) {\n const performances = ['checkup', 'specialist', 'diagnostics', 'recovery', 'major_surgeries', 'dental', 'physiotherapy'];\n\n if (performances.some((p) => type.includes(p))) {\n return 'performance';\n }\n\n if (type.indexOf('generic') > -1) {\n return 'refund';\n }\n\n return null;\n }\n\n // eslint-disable-next-line class-methods-use-this\n getStatus(claim) {\n if (claim.specificType === 'performance') {\n if (claim.stato) {\n return ClaimsStatusPerformance[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusPerformance[5];\n }\n return ClaimsStatusPerformance[0];\n }\n\n if (claim.specificType === 'refund') {\n if (claim.stato) {\n return ClaimsStatusRefund[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusRefund[5];\n }\n return ClaimsStatusRefund[0];\n }\n\n return null;\n }\n\n // eslint-disable-next-line class-methods-use-this\n combineClaim(claim, fnol) {\n const f = { ...fnol };\n\n f.liquidated = claim && claim.partiteDanno[0].pagamentiDTO ? claim.partiteDanno[0].pagamentiDTO[0] : null;\n f.stato = claim ? claim.stato : null;\n f.specificType = this.getType(f.specificType);\n\n return f;\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n render() {\n const {\n claim,\n fnol,\n isFetching,\n t,\n theme,\n } = this.props;\n\n const { files } = this.state;\n\n if (isFetching) return ;\n\n let claimC = null;\n if (fnol && fnol.claimId) {\n claimC = this.combineClaim(claim, fnol);\n } else if (fnol) {\n claimC = this.combineClaim(null, fnol);\n }\n\n return (\n \n \n \n\n \n\n {claimC && (\n \n \n \n )}\n\n {claimC && (\n \n \n \n \n \n \n \n {claimC.specificType && (\n \n )}\n \n \n \n \n\n \n \n \n \n \n \n
\n \n\n \n \n \n \n \n \n\n {claimC.specificType === 'performance' && (\n \n \n \n \n \n )}\n\n {claimC.specificType === 'refund' && (\n \n \n \n \n \n )}\n\n \n \n \n \n \n\n \n \n \n \n \n \n
\n \n\n {claimC.specificType === 'refund' && (\n \n \n \n \n \n \n \n \n \n \n )}\n \n )}\n\n \n\n {claimC && (\n \n \n \n )}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n claim: state.claims.claim,\n fnol: state.claims.fnol,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.claims.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getClaimDetails: (params) => dispatch(fetchClaimDetails(params)),\n getDocument: (params) => dispatch(fetchFnolDocument(params)),\n getFnolDetails: (params) => dispatch(fetchFnolDetails(params)),\n});\n\nClaimsDetails.defaultProps = {\n account: null,\n claim: null,\n fnol: null,\n getClaimDetails: null,\n getDocument: null,\n getFnolDetails: null,\n history: null,\n isAuthenticated: false,\n isFetching: false,\n t: null,\n theme: null,\n};\n\nClaimsDetails.propTypes = {\n account: PropTypes.shape(),\n claim: PropTypes.shape(),\n fnol: PropTypes.shape(),\n getClaimDetails: PropTypes.func,\n getDocument: PropTypes.func,\n getFnolDetails: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTheme(withTranslation(['enums', 'portale.claimsdetails'])(ClaimsDetails))));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { Trans, withTranslation } from 'react-i18next';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n DateInput,\n FileDownload,\n FileUpload,\n Loading,\n MaterialDesignInput,\n Modal,\n SelectInput,\n Text,\n} from '../../../../components';\n\nimport { createClaim } from '../../../../reducers/claims/actions';\n\nimport { getCodeCompany, getPrivacyPDF } from '../../../../utils';\n\nconst CPerformaceData = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n '.pr-md-0': {\n paddingRight: 0,\n },\n\n '.pl-md-0': {\n paddingLeft: 0,\n },\n },\n}));\n\nconst PerformaceData = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '30px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '30px 15px',\n },\n\n '.row': {\n '.col-md-6.col-sm-12.col-12 > div': {\n marginBottom: p.theme.verticalSpacing.p16,\n },\n },\n}));\n\nconst CTrans = styled(Trans)((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.small,\n lineHeight: '20px',\n\n a: {\n textDecoration: 'underline',\n },\n}));\n\nconst ContainerPConsent = styled.div((p) => ({\n marginTop: '16px',\n textAlign: 'left',\n\n a: {\n color: `${p.theme.colors.PRIMARY1} !important`,\n },\n\n label: {\n fontWeight: p.theme.fontWeights.bold,\n textDecoration: 'underline',\n },\n}));\n\nclass TabPerformance extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n enableSubmit: false,\n files: [],\n performanceDataForm: {\n firstName: props.account.firstName || '',\n fiscalCode: props.account.fiscalCode || '',\n insuranceNumber: props.account.insuranceNumber || '',\n lastName: props.account.lastName || '',\n },\n privacyConsent: false,\n };\n\n this.checkFiscalCode = this.checkFiscalCode.bind(this);\n this.handleChangeFile = this.handleChangeFile.bind(this);\n this.handleChangePerformaceData = this.handleChangePerformaceData.bind(this);\n this.handleCloseResponse = this.handleCloseResponse.bind(this);\n this.handleDeleteFile = this.handleDeleteFile.bind(this);\n this.handlePrivacyConsent = this.handlePrivacyConsent.bind(this);\n this.handleSubmitPerformaceData = this.handleSubmitPerformaceData.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const hasPerformanceDataForm = nextState.performanceDataForm && Object.keys(nextState.performanceDataForm).filter((x) => x !== null).length === 7;\n\n return {\n ...nextState,\n enableSubmit: hasPerformanceDataForm && nextState.cfValidated && nextState.privacyConsent && nextState.files && nextState.files.length >= 1,\n };\n }\n\n checkFiscalCode(value) {\n const fiscalCode = /^(?:[A-Z][AEIOU][AEIOUX]|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]$/i;\n const vatCode = /^[0-7]{1}\\d{6}(0{2}[1-9]{1}|0{1}[1-9]{1}\\d{1}|100|120|121|888|999)\\d{1}$/i;\n\n this.setState({\n cfValidated: fiscalCode.test(value) || vatCode.test(value),\n });\n }\n\n handlePrivacyConsent(values) {\n this.setState({ privacyConsent: values && values.length > 0 && values.includes('privacy') });\n }\n\n handleChangeFile(file) {\n const { files } = this.state;\n\n const types = ['image/jpeg', 'image/png', 'application/pdf'];\n const tmp = [];\n\n let fileError = false;\n Object.keys(file).forEach((key) => {\n if (!files.find((f) => f.name === file[key].name)) {\n if (file[key].size < 5000000 && types.includes(file[key].type)) {\n tmp.push(file[key]);\n } else {\n fileError = true;\n }\n }\n });\n this.setState({ files: [...files, ...tmp], fileError });\n }\n\n handleDeleteFile(d) {\n const { files } = this.state;\n this.setState({ files: files.filter((e) => e.name !== d.name) });\n }\n\n handleChangePerformaceData(e) {\n const { performanceDataForm } = this.state;\n if (e.target) {\n const { name, value } = e.target;\n if (value && value !== '') {\n this.setState({\n performanceDataForm: {\n ...performanceDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpperformanceDataForm = { ...performanceDataForm };\n delete tmpperformanceDataForm[name];\n this.setState({\n performanceDataForm: { ...tmpperformanceDataForm },\n });\n }\n } else {\n const { name, value } = e;\n if (name && name.includes('doctor')) {\n this.setState({\n optionalDoctor: value,\n });\n } else if (value && value !== '') {\n if (name === 'fiscalCode' || name.includes('fiscalCode')) {\n this.checkFiscalCode(value);\n }\n\n this.setState({\n performanceDataForm: {\n ...performanceDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpperformanceDataForm = { ...performanceDataForm };\n delete tmpperformanceDataForm[name];\n this.setState({\n performanceDataForm: { ...tmpperformanceDataForm },\n });\n }\n }\n }\n\n handleSubmitPerformaceData() {\n const { performanceDataForm, files, optionalDoctor } = this.state;\n const { createNewPerformace, account } = this.props;\n\n const performanceData = {\n channel: 'welion',\n companyCodeAnia: getCodeCompany(),\n creatorFirstName: performanceDataForm.firstName,\n creatorLastName: performanceDataForm.lastName,\n customerId: account.fiscalCode,\n documents: [],\n eventDate: moment(performanceDataForm.bookingDate).hour(12).toISOString(),\n insuranceNumber: performanceDataForm.insuranceNumber,\n involvedParties: [\n {\n email: account.email,\n firstAid: {\n structure: `${performanceDataForm.affiliatedStructure}${optionalDoctor ? ` | ${optionalDoctor}` : ''}`,\n },\n fiscalCodeOrVATNumber: performanceDataForm.fiscalCode,\n name: performanceDataForm.firstName,\n ownerFlag: true,\n roles: [9],\n surnameOrBusinessName: performanceDataForm.lastName,\n telephoneNumber: account.phone ? account.phone : '',\n },\n ],\n specificType: performanceDataForm.healthServiceType,\n type: 'health',\n };\n\n if (account.authorities && account.authorities.length > 0 && account.authorities.includes('ROLE_CONTRACTOR')) {\n performanceData.involvedParties[0].roles.push(4);\n }\n\n files.forEach((file) => {\n performanceData.documents.push({\n name: file.name,\n fileType: file.type,\n type: '11',\n });\n });\n createNewPerformace(performanceData, files).then((data) => {\n if (data.data && data.data.id) {\n this.setState({\n showSuccessResponse: true,\n });\n } else if (data.error) {\n this.setState({\n showErrorResponse: true,\n });\n }\n });\n }\n\n handleCloseResponse() {\n this.setState({\n showErrorResponse: false,\n showSuccessResponse: false,\n });\n }\n\n render() {\n const { createIsFetching, t, theme } = this.props;\n\n const {\n cfValidated,\n enableSubmit,\n fileError,\n files,\n performanceDataForm,\n showErrorResponse,\n showSuccessResponse,\n } = this.state;\n\n const healthServiceTypeOptions = [\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 1'), value: 'health.illness.checkup.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 2'), value: 'health.illness.specialist.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 3'), value: 'health.illness.diagnostics.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 4'), value: 'health.illness.recovery.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 5'), value: 'health.illness.major_surgeries.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 6'), value: 'health.illness.dental.refund' },\n { label: t('portale.claimsmanagement:tab performance.healthServiceType opt 7'), value: 'health.illness.physiotherapy.refund' },\n ];\n return (\n \n \n <>\n {showSuccessResponse ? (\n <>\n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.claimsmanagement:modal.cta success\" parent=\"p\" />\n >\n ) : null}\n\n {showErrorResponse ? (\n <>\n \n \n >\n ) : null}\n >\n \n\n {createIsFetching ? (\n \n ) : null}\n\n \n \n \n \n\n \n\n \n {cfValidated === false ? (\n \n ) : null}\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n window.open(getPrivacyPDF()) },\n value: 'privacy',\n },\n ]}\n name=\"group1\"\n onChange={(values) => this.handlePrivacyConsent(values)}\n />\n \n \n
\n \n \n \n \n
\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n createIsFetching: state.claims.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n createNewPerformace: (data, documents) => dispatch(createClaim({ data, documents })),\n});\n\nTabPerformance.defaultProps = {\n account: null,\n createIsFetching: null,\n createNewPerformace: null,\n t: null,\n theme: null,\n};\n\nTabPerformance.propTypes = {\n account: PropTypes.shape(),\n createIsFetching: PropTypes.bool,\n createNewPerformace: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.claimsmanagement'])(withTheme(TabPerformance)));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport moment from 'moment';\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CartoonSvg,\n FilterControls,\n FilterToggle,\n Loading,\n Text,\n} from '../../../../components';\n\nimport {\n ClaimsIcon,\n ClaimsStatusColor,\n ClaimsStatusPerformance,\n ClaimsStatusRefund,\n} from '../../../../enums';\n\nimport { fetchClaimList, fetchFnolList } from '../../../../reducers/claims/actions';\n\nconst Bullet = styled.div((p) => ({\n backgroundColor: p.theme.colors[p.color],\n borderRadius: '50%',\n height: 12,\n width: 12,\n}));\n\nconst CBullet = styled.div({\n alignItems: 'center',\n display: 'flex',\n flex: '0 0 20px',\n flexDirection: 'row',\n justifyContent: 'center',\n});\n\nconst CData = styled.div((p) => ({\n flexGrow: 1,\n marginRight: p.theme.space,\n padding: '30px 0',\n}));\n\nconst CInfo = styled.div({\n display: 'flex',\n flexBasis: '60%',\n});\n\nconst CInfoText = styled.p({\n margin: '0 10px 0 0',\n});\n\nconst CIcon = styled.div((p) => ({\n flex: '0 0 48px',\n marginRight: p.theme.space,\n padding: '30px 0',\n}));\n\nconst CState = styled.div((p) => ({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginRight: p.theme.space,\n\n button: {\n cursor: 'default !important',\n },\n}));\n\nconst CToggle = styled.div(() => ({\n marginLeft: 'auto',\n width: '125px',\n}));\n\nconst Divider = styled.div((p) => ({\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n marginTop: 30,\n}));\n\nconst Practices = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '30px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: 30,\n },\n}));\n\nconst Practice = styled.div((p) => ({\n boxShadow: p.theme.shadows.carousel,\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'space-between',\n marginTop: 30,\n paddingLeft: 30,\n paddingRight: 30,\n}));\n\nclass TabPractices extends React.Component {\n constructor(props) {\n super(props);\n\n this.handleFilterSubmit = this.handleFilterSubmit.bind(this);\n this.handleFilterToggle = this.handleFilterToggle.bind(this);\n\n this.getColor = this.getColor.bind(this);\n this.getFilters = this.getFilters.bind(this);\n this.getStatus = this.getStatus.bind(this);\n this.getType = this.getType.bind(this);\n\n this.combineClaims = this.combineClaims.bind(this);\n this.filterClaims = this.filterClaims.bind(this);\n this.goToDetails = this.goToDetails.bind(this);\n\n this.state = {\n filters: {},\n openFilter: true,\n };\n }\n\n componentDidMount() {\n const {\n account,\n isAuthenticated,\n getClaimList,\n getFnolList,\n } = this.props;\n\n if (isAuthenticated && account && account.id) {\n getClaimList({ insuranceNumber: account.insuranceNumber });\n getFnolList({ insuranceNumber: account.insuranceNumber });\n }\n }\n\n handleFilterSubmit(filters) {\n this.setState({ filters });\n }\n\n handleFilterToggle(openFilter) {\n this.setState({ openFilter });\n }\n\n // eslint-disable-next-line class-methods-use-this\n getColor(claim) {\n if (claim.stato) {\n return ClaimsStatusColor[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusColor[5];\n }\n\n return ClaimsStatusColor[0];\n }\n\n getFilters() {\n const { t } = this.props;\n const { filters } = this.state;\n\n const states = [\n {\n label: 'DA LAVORARE',\n type: null,\n value: '0',\n },\n {\n label: 'APERTO',\n type: null,\n value: 1,\n },\n {\n label: 'LIQUIDATO',\n type: 'refund',\n value: 2,\n },\n {\n label: 'AUTORIZZATA',\n type: 'performance',\n value: 2,\n },\n {\n label: 'CHIUSO SENZA SEGUITO',\n type: 'refund',\n value: 3,\n },\n {\n label: 'NON AUTORIZZATA',\n type: 'performance',\n value: 3,\n },\n {\n label: 'IN VALUTAZIONE',\n type: null,\n value: 4,\n },\n {\n label: 'SCARTATO',\n type: null,\n value: 5,\n },\n ];\n\n const types = [\n {\n label: t('enums:claims.performance'),\n value: 'performance',\n },\n {\n label: t('enums:claims.refund'),\n value: 'refund',\n },\n ];\n\n // eslint-disable-next-line no-unused-vars\n let stateDS = [];\n let typeDS = [];\n\n if (filters.type) {\n stateDS = states.filter((e) => e.type === filters.type || !e.type);\n } else {\n stateDS = states;\n }\n\n if (filters.status) {\n typeDS = types.filter((e) => e.value === filters.status.type || !filters.status.type);\n } else {\n typeDS = types;\n }\n\n return [\n {\n clearable: true,\n datasource: typeDS,\n key: 'type',\n label: t('portale.claimsmanagement:tab practices.type'),\n placeholder: t('portale.claimsmanagement:tab practices.type'),\n themeVariant: 'pb',\n type: 'select',\n },\n // {\n // clearable: true,\n // datasource: stateDS,\n // key: 'status',\n // label: t('portale.claimsmanagement:tab practices.status'),\n // placeholder: t('portale.claimsmanagement:tab practices.status'),\n // searchable: true,\n // themeVariant: 'pb',\n // type: 'select',\n // },\n {\n key: 'dataAvvenimento',\n label: t('portale.claimsmanagement:tab practices.date'),\n placeholder: t('portale.claimsmanagement:tab practices.date'),\n showIcon: true,\n showYear: true,\n themeVariant: 'pb',\n type: 'date',\n },\n ];\n }\n\n // eslint-disable-next-line class-methods-use-this\n getStatus(claim) {\n if (claim.specificTypeE === 'performance') {\n if (claim.stato) {\n return ClaimsStatusPerformance[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusPerformance[5];\n }\n return ClaimsStatusPerformance[0];\n }\n\n if (claim.specificTypeE === 'refund') {\n if (claim.stato) {\n return ClaimsStatusRefund[claim.stato.chiave];\n }\n\n if (claim.state === 'cancelled') {\n return ClaimsStatusRefund[5];\n }\n return ClaimsStatusRefund[0];\n }\n\n return null;\n }\n\n // eslint-disable-next-line class-methods-use-this\n getType(type) {\n const performances = ['checkup', 'specialist', 'diagnostics', 'recovery', 'major_surgeries', 'dental', 'physiotherapy'];\n\n if (performances.some((p) => type.includes(p))) {\n return 'performance';\n }\n\n if (type.indexOf('generic') > -1) {\n return 'refund';\n }\n\n return null;\n }\n\n // eslint-disable-next-line class-methods-use-this\n combineClaims(claims, fnols) {\n const c = claims.reduce((o, e) => {\n const tmp = o;\n\n tmp[e.numero] = e;\n return tmp;\n }, {});\n\n fnols.forEach((fnol) => {\n const f = fnol;\n\n f.specificTypeE = this.getType(f.specificType);\n f.stato = c[f.claimId] ? c[f.claimId].stato : null;\n });\n\n return fnols;\n }\n\n filterClaims(claims) {\n const { account } = this.props;\n const { filters } = this.state;\n\n const claimsT = claims.filter((e) => (e.customerId && e.customerId === account.fiscalCode) || !e.customerId);\n\n return claimsT.filter((e) => {\n let tmp = true;\n\n if (filters.dataAvvenimento && e.eventDate && !moment(filters.dataAvvenimento).isSame(moment(e.eventDate), 'day')) {\n tmp = false;\n }\n\n if (filters.status) {\n if (parseInt(filters.status, 10) === 0) {\n if (e.state === 'cancelled' || e.stato) {\n tmp = false;\n }\n } else if (parseInt(filters.status, 10) === 5) {\n if (e.state === 'pending' || e.stato) {\n tmp = false;\n }\n } else if (!e.stato || parseInt(filters.status, 10) !== parseInt(e.stato.chiave, 10)) {\n tmp = false;\n }\n }\n\n if (filters.type && filters.type !== e.specificTypeE) {\n tmp = false;\n }\n\n return tmp;\n });\n }\n\n goToDetails(id) {\n const { history } = this.props;\n if (id) history.push(`/claims-details?id=${id}`);\n }\n\n render() {\n const {\n claims,\n fnols,\n isFetching,\n language,\n theme,\n t,\n } = this.props;\n\n const { openFilter } = this.state;\n\n if (isFetching) return ;\n\n const claimsC = claims && fnols ? this.combineClaims(claims, fnols) : [];\n const claimsF = claimsC ? this.filterClaims(claimsC) : [];\n\n return (\n \n \n \n \n\n {openFilter && (\n <>\n \n\n \n >\n )}\n\n {claimsF && claimsF.length > 0 ? (\n claimsF.map((c) => (\n this.goToDetails(c.fnolId)}>\n \n {c.specificTypeE && (\n \n )}\n \n\n \n \n\n \n \n \n \n \n\n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n\n \n \n \n \n ))\n ) : (\n \n )}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n claims: state.claims.claims,\n fnols: state.claims.fnols,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.claims.isFetching,\n language: state.settings.lang,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getClaimList: (params) => dispatch(fetchClaimList(params)),\n getFnolList: (params) => dispatch(fetchFnolList(params)),\n});\n\nTabPractices.defaultProps = {\n account: null,\n claims: [],\n fnols: [],\n getClaimList: null,\n getFnolList: null,\n history: false,\n isAuthenticated: false,\n isFetching: false,\n language: null,\n t: null,\n theme: null,\n};\n\nTabPractices.propTypes = {\n account: PropTypes.shape(),\n claims: PropTypes.arrayOf(PropTypes.shape()),\n fnols: PropTypes.arrayOf(PropTypes.shape()),\n getClaimList: PropTypes.func,\n getFnolList: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n language: PropTypes.string,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTheme(withTranslation(['enums', 'portale.claimsmanagement'])(TabPractices))));\n","import React from 'react';\n\nimport { Trans, withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\n\nimport moment from 'moment';\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n DateInput,\n FileDownload,\n FileUpload,\n Loading,\n MaterialDesignInput,\n Modal,\n RadioInputGroup,\n Text,\n} from '../../../../components';\n\nimport { createClaim } from '../../../../reducers/claims/actions';\n\nimport { getCodeCompany, getPrivacyPDF } from '../../../../utils';\n\nconst CRefundData = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n '.pr-md-0': {\n paddingRight: 0,\n },\n\n '.pl-md-0': {\n paddingLeft: 0,\n },\n },\n}));\n\nconst CTrans = styled(Trans)((p) => ({\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.small,\n lineHeight: '20px',\n\n a: {\n textDecoration: 'underline',\n },\n}));\n\nconst RefundsData = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '30px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '30px 15px',\n },\n\n '.row': {\n '.col-md-6.col-sm-12.col-12 > div': {\n marginBottom: p.theme.verticalSpacing.p16,\n },\n\n '.recovery-options': {\n width: 150,\n },\n },\n}));\n\nconst ContainerPConsent = styled.div((p) => ({\n marginTop: '16px',\n textAlign: 'left',\n\n a: {\n color: `${p.theme.colors.PRIMARY1} !important`,\n },\n\n label: {\n fontWeight: p.theme.fontWeights.bold,\n textDecoration: 'underline',\n },\n}));\n\nclass TabRefunds extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n enableSubmit: false,\n files: [],\n hasRecovery: 'no',\n privacyConsent: false,\n refundsDataForm: {\n complaintDate: new Date(),\n firstName: props.account.firstName || '',\n fiscalCode: props.account.fiscalCode || '',\n insuranceNumber: props.account.insuranceNumber || '',\n lastName: props.account.lastName || '',\n },\n };\n\n this.checkFiscalCode = this.checkFiscalCode.bind(this);\n this.checkIbanValidation = this.checkIbanValidation.bind(this);\n this.handleChangeFile = this.handleChangeFile.bind(this);\n this.handleChangeRecoveryOptions = this.handleChangeRecoveryOptions.bind(this);\n this.handleChangeRefundsData = this.handleChangeRefundsData.bind(this);\n this.handleCloseResponse = this.handleCloseResponse.bind(this);\n this.handleDeleteFile = this.handleDeleteFile.bind(this);\n this.handlePrivacyConsent = this.handlePrivacyConsent.bind(this);\n this.handleSubmitRefundsData = this.handleSubmitRefundsData.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n let hasRefundsDataForm;\n if (nextState.hasRecovery && nextState.hasRecovery === 'si') {\n hasRefundsDataForm = nextState.refundsDataForm\n && nextState.refundsDataForm.completeNameHolder\n && nextState.refundsDataForm.firstName\n && nextState.refundsDataForm.fiscalCode\n && nextState.refundsDataForm.ibanHolder\n && nextState.refundsDataForm.idProviderInvoices\n && nextState.refundsDataForm.lastName;\n } else {\n hasRefundsDataForm = nextState.refundsDataForm && Object.keys(nextState.refundsDataForm).filter((x) => x !== null).length === 11;\n }\n\n return {\n ...nextState,\n enableSubmit:\n hasRefundsDataForm\n && nextState.cfValidated\n && nextState.cfvatValidated\n && nextState.ibanValidated\n && nextState.privacyConsent\n && nextState.files\n && nextState.files.length >= 1,\n };\n }\n\n handlePrivacyConsent(values) {\n this.setState({\n privacyConsent: values && values.length > 0 && values.includes('privacy'),\n });\n }\n\n handleChangeFile(file) {\n const { files } = this.state;\n\n const types = ['image/jpeg', 'image/png', 'application/pdf'];\n const tmp = [];\n\n let fileError = false;\n Object.keys(file).forEach((key) => {\n if (!files.find((f) => f.name === file[key].name)) {\n if (file[key].size < 5000000 && types.includes(file[key].type)) {\n tmp.push(file[key]);\n } else {\n fileError = true;\n }\n }\n });\n this.setState({ files: [...files, ...tmp], fileError });\n }\n\n handleDeleteFile(d) {\n const { files } = this.state;\n this.setState({ files: files.filter((e) => e.name !== d.name) });\n }\n\n handleChangeRefundsData(e) {\n const { refundsDataForm } = this.state;\n if (e.target) {\n const { name, value } = e.target;\n if (value && value !== '') {\n this.setState({\n refundsDataForm: {\n ...refundsDataForm,\n [name]: value,\n },\n });\n } else {\n const tmprefundsDataForm = { ...refundsDataForm };\n delete tmprefundsDataForm[name];\n this.setState({\n refundsDataForm: { ...tmprefundsDataForm },\n });\n }\n } else {\n const { name, value } = e;\n if (value && value !== '') {\n if (name === 'fiscalCode' || name.includes('fiscalCode')) {\n this.checkFiscalCode('cfValidated', value);\n }\n\n if (name === 'idProviderInvoices' || name.includes('idProviderInvoices')) {\n this.checkFiscalCode('cfvatValidated', value);\n }\n\n if (name === 'ibanHolder' || name.includes('ibanHolder')) {\n this.checkIbanValidation(value);\n }\n\n this.setState({\n refundsDataForm: {\n ...refundsDataForm,\n [name]: value,\n },\n });\n } else {\n const tmprefundsDataForm = { ...refundsDataForm };\n delete tmprefundsDataForm[name];\n this.setState({\n refundsDataForm: { ...tmprefundsDataForm },\n });\n }\n }\n }\n\n handleSubmitRefundsData() {\n const { refundsDataForm, files } = this.state;\n const { createNewRefund, account } = this.props;\n\n const refundsData = {\n channel: 'welion',\n companyCodeAnia: getCodeCompany(),\n customerId: account.fiscalCode,\n creatorFirstName: refundsDataForm.firstName,\n creatorLastName: refundsDataForm.lastName,\n documents: [],\n eventDate: moment(refundsDataForm.complaintDate).hour(12).toISOString(),\n insuranceNumber: refundsDataForm.insuranceNumber,\n invoices: [\n {\n amount: parseFloat(refundsDataForm.amountInvoices),\n date: refundsDataForm.occurrenceDate ? refundsDataForm.occurrenceDate.toISOString() : undefined,\n id: refundsDataForm.idInvoices,\n provider: refundsDataForm.idProviderInvoices,\n },\n ],\n involvedParties: [\n {\n email: account.email,\n fiscalCodeOrVATNumber: refundsDataForm.fiscalCode,\n iban: refundsDataForm.ibanHolder,\n ibanHolder: refundsDataForm.completeNameHolder,\n name: refundsDataForm.firstName,\n ownerFlag: true,\n roles: [9],\n surnameOrBusinessName: refundsDataForm.lastName,\n telephoneNumber: account.phone ? account.phone : '',\n },\n ],\n specificType: 'health.illness.generic.refund',\n type: 'health',\n };\n\n if (account.authorities && account.authorities.length > 0 && account.authorities.includes('ROLE_CONTRACTOR')) {\n refundsData.involvedParties[0].roles.push(4);\n }\n\n files.forEach((file) => {\n refundsData.documents.push({\n name: file.name,\n fileType: file.type,\n type: '11',\n });\n });\n\n createNewRefund(refundsData, files).then((data) => {\n if (data.data && data.data.id) {\n this.setState({\n showSuccessResponse: true,\n });\n } else if (data.error) {\n this.setState({\n showErrorResponse: true,\n });\n }\n });\n }\n\n handleCloseResponse() {\n this.setState({\n showErrorResponse: false,\n showSuccessResponse: false,\n });\n }\n\n handleChangeRecoveryOptions(changedValue) {\n this.setState({\n hasRecovery: changedValue.target.value,\n });\n }\n\n checkFiscalCode(type, value) {\n const fiscalCode = /^(?:[A-Z][AEIOU][AEIOUX]|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]$/i;\n const vatCode = /^[0-7]{1}\\d{6}(0{2}[1-9]{1}|0{1}[1-9]{1}\\d{1}|100|120|121|888|999)\\d{1}$/i;\n\n this.setState({\n [type]: fiscalCode.test(value) || vatCode.test(value),\n });\n }\n\n checkIbanValidation(value) {\n const iban = /^(?:((?:IT)\\d{2}[A-Z]{1}.{22}))$/i;\n this.setState({ ibanValidated: iban.test(value) });\n }\n\n render() {\n const { createIsFetching, t, theme } = this.props;\n const {\n cfValidated,\n cfvatValidated,\n enableSubmit,\n fileError,\n files,\n hasRecovery,\n ibanValidated,\n refundsDataForm,\n showErrorResponse,\n showSuccessResponse,\n } = this.state;\n\n return (\n \n \n <>\n {showSuccessResponse ? (\n <>\n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.claimsmanagement:modal.cta success\" parent=\"p\" />\n >\n ) : null}\n\n {showErrorResponse ? (\n <>\n \n \n >\n ) : null}\n >\n \n\n {createIsFetching ? : null}\n\n \n \n \n \n\n \n\n \n {cfValidated === false ? (\n \n ) : null}\n\n \n\n \n \n \n
\n\n {hasRecovery === 'si' ? (\n \n ) : null}\n\n \n\n \n\n \n\n \n\n \n\n {cfvatValidated === false ? (\n \n ) : null}\n\n \n\n \n\n {ibanValidated === false ? (\n \n ) : null}\n\n \n\n \n\n \n\n \n\n \n window.open(getPrivacyPDF()) },\n value: 'privacy',\n },\n ]}\n name=\"group1\"\n onChange={(values) => this.handlePrivacyConsent(values)}\n />\n \n \n
\n\n \n \n \n \n
\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n createIsFetching: state.claims.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n createNewRefund: (data, documents) => dispatch(createClaim({ data, documents })),\n});\n\nTabRefunds.defaultProps = {\n account: null,\n createIsFetching: null,\n createNewRefund: null,\n t: null,\n theme: null,\n};\n\nTabRefunds.propTypes = {\n account: PropTypes.shape(),\n createIsFetching: PropTypes.bool,\n createNewRefund: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['portale.claimsmanagement'])(TabRefunds)));\n","import React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { Trans, withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { Button, Container, Text } from '../../../components';\nimport { getCompany } from '../../../utils';\n\nimport TabPerformance from './TabPerformance';\nimport TabPractices from './TabPractices';\nimport TabRefunds from './TabRefunds';\n\nconst MButton = styled(Button)((p) => ({\n backgroundColor: p.active ? p.theme.colors.PRIMARY1 : p.theme.colors.WHITE,\n boxShadow: p.theme.shadows.buttonClicked,\n color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n flex: '1 1 25%',\n fontSize: p.theme.fontSizes.small,\n textTransform: 'uppercase',\n\n '&:hover': {\n color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n },\n}));\n\nconst ContainerCM = styled.div(({ theme }) => ({\n backgroundColor: getCompany() !== 'bcc' && getCompany() !== 'vera' ? theme.colors.GREY6 : theme.colors.WHITE,\n padding: '25px 0px 30px',\n\n [theme.mediaQueries.md]: {\n padding: '40px 20px 30px',\n },\n}));\n\nconst Tabs = styled.div(({ theme }) => ({\n alignItems: 'stretch',\n borderRadius: 8,\n boxShadow: theme.shadows.buttonClicked,\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n margin: '40px 0 30px',\n overflow: 'hidden',\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass ClaimsManagement extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {};\n\n this.getActiveTab = this.getActiveTab.bind(this);\n this.setActiveTab = this.setActiveTab.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n return {\n tab: nextState.tab || getParams(nextProps.history.location.search).tab,\n };\n }\n\n getActiveTab() {\n const { tab } = this.state;\n\n switch (tab) {\n case 'performance':\n return ;\n case 'practices':\n return ;\n case 'refunds':\n return ;\n default:\n return ;\n }\n }\n\n setActiveTab(tab) {\n const { history } = this.props;\n\n history.replace(`/claims-management?tab=${tab}&noscroll=`, null);\n this.setState({ tab });\n }\n\n render() {\n const { t, theme } = this.props;\n const { tab } = this.state;\n\n return (\n \n \n \n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.claimsmanagement:description\" />\n {getCompany() !== 'tua' && getCompany() !== 'vera' ? (\n <>\n , li: }} i18nKey=\"portale.claimsmanagement:items\" />\n , li: }} i18nKey=\"portale.claimsmanagement:items_2\" />\n >\n ) : (null)}\n \n\n {getCompany() !== 'cattolica' && getCompany() !== 'bcc' && getCompany() !== 'vera' && (\n \n this.setActiveTab('refunds')}>\n {t('tab.refunds')}\n \n this.setActiveTab('performance')}>\n {t('tab.performance')}\n \n this.setActiveTab('practices')}>\n {t('tab.practices')}\n \n \n )}\n\n {getCompany() !== 'cattolica' && getCompany() !== 'bcc' && getCompany() !== 'vera' && (\n this.getActiveTab()\n )}\n \n \n );\n }\n}\n\nClaimsManagement.defaultProps = {\n history: null,\n t: null,\n theme: null,\n};\n\nClaimsManagement.propTypes = {\n history: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(withTheme(withTranslation(['portale.claimsmanagement'])(ClaimsManagement)));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport firstImage from '../../../assets/img/collaborations-01.png';\nimport secondImage from '../../../assets/img/medical-consultation-box.jpg';\n\nimport { Container, Text } from '../../../components';\n\nimport {\n getCompany,\n} from '../../../utils';\n\nconst CCollaborations = styled.div((p) => ({\n '.container-description': {\n textAlign: 'center',\n\n [p.theme.mediaQueries.md]: {\n textAlign: 'left',\n },\n },\n\n '.container-image': {\n margin: '0',\n justifyContent: 'center',\n\n [p.theme.mediaQueries.md]: {\n justifyContent: 'flex-end',\n margin: '120px 0px 24px',\n },\n\n '.custom-rounded': {\n backgroundImage: `url(${secondImage})`,\n backgroundPosition: '30%',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '152%',\n borderRadius: '50%',\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n height: '150px',\n margin: '40px 0px',\n width: '150px',\n\n [p.theme.mediaQueries.md]: {\n height: '235px',\n margin: 0,\n minHeight: '235px',\n minWidth: '235px',\n width: '235px',\n },\n },\n },\n\n '.triangle': {\n backgroundImage: p.theme.colors.GRADIENTBG,\n backgroundPositionY: 'bottom',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '123% 123%',\n padding: 0,\n },\n}));\n\nconst SeparatorV = styled.div((p) => ({\n borderLeft: `1px solid ${p.theme.colors.PRIMARY2}`,\n bottom: '-16px',\n height: 53,\n left: '50%',\n margin: '0 auto',\n position: 'absolute',\n width: 1,\n\n [p.theme.mediaQueries.md]: {\n height: 64,\n },\n}));\n\nconst Collaborations = (props) => {\n const { theme } = props;\n\n return (\n \n \n \n \n \n \n \n \n
\n \n \n \n \n\n \n \n \n \n \n\n \n\n \n \n\n \n
\n \n
\n \n \n );\n};\n\nCollaborations.defaultProps = {\n theme: null,\n};\n\nCollaborations.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.collaborations'])(withTheme(Collaborations));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n MaterialDesignInput,\n Switch,\n Text,\n} from '../../../components';\n\nimport { setContactMe } from '../../../reducers/preferences/actions';\n\nconst CTimePreferences = styled.div({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n margin: '0 auto 36px',\n maxWidth: '347px',\n paddingLeft: '16px',\n});\n\nconst AgencyInfoContent = styled.div((p) => ({\n alignItems: 'center',\n border: `1px solid ${p.theme.colors.GREY5}`,\n borderRadius: '4px',\n margin: '24px auto 0',\n maxWidth: '347px',\n padding: '25px',\n}));\n\nclass ContactMe extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n userPreferences: props.contactMePreference,\n };\n\n this.goAgencyPage = this.goAgencyPage.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.onToggle = this.onToggle.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n }\n\n handleChange(input) {\n const { userPreferences } = this.state;\n if (input.value === '') {\n userPreferences[input.name] = null;\n } else {\n userPreferences[input.name] = input.value;\n }\n this.setState({ userPreferences });\n }\n\n onToggle(timeName, value) {\n const { userPreferences } = this.state;\n userPreferences[timeName] = value;\n this.setState({ userPreferences });\n }\n\n goAgencyPage() {\n const { history, setPreferences } = this.props;\n const { userPreferences } = this.state;\n\n setPreferences(userPreferences);\n history.push('/agency');\n }\n\n sendMessage() {\n const { userPreferences } = this.state;\n const { account, t } = this.props;\n\n const amPreference = userPreferences.amtimepreference ? `${t('am')}${userPreferences.pmtimepreference ? ' / ' : ''}` : '';\n const pmPreference = userPreferences.pmtimepreference ? t('pm') : '';\n const message = t('msg body request', {\n fullname: `${account.firstName} ${account.lastName}`,\n phone: `${userPreferences.phonenumber}`,\n times: `${amPreference}${pmPreference}`,\n });\n window.location.href = `mailto:${userPreferences.agency.mail}?subject=${t('msg subject request')}&body=${message}`;\n }\n\n render() {\n const {\n account,\n t,\n theme,\n } = this.props;\n const { userPreferences } = this.state;\n\n return (\n \n \n \n \n \n \n \n \n \n this.onToggle('amtimepreference', value)}\n />\n \n \n \n this.onToggle('pmtimepreference', value)}\n />\n \n {userPreferences.agency && userPreferences.agency.key ? (\n \n
\n
\n \n {userPreferences.agency.name}\n \n\n \n {`${userPreferences.agency.address.toLocaleLowerCase()}, ${userPreferences.agency.streetNumber} ${\n userPreferences.agency.postCode\n } - ${userPreferences.agency.city.toLocaleLowerCase()}`}\n \n\n \n {`Tel. ${userPreferences.agency.phone}`}\n \n\n \n \n
\n ) : null}\n {userPreferences.agency && userPreferences.agency.key ? (\n \n ) : (\n \n )}\n \n
\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n contactMePreference: state.preferences.contactMePreference,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n setPreferences: (preferences) => {\n dispatch(setContactMe(preferences));\n },\n});\n\nContactMe.defaultProps = {\n account: {},\n contactMePreference: null,\n history: null,\n setPreferences: null,\n t: null,\n theme: null,\n};\n\nContactMe.propTypes = {\n account: PropTypes.shape({\n firstName: PropTypes.string,\n lastName: PropTypes.string,\n }),\n contactMePreference: PropTypes.shape(),\n history: PropTypes.shape({\n push: PropTypes.func,\n }),\n setPreferences: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(withTranslation(['portale.contactme'])(ContactMe))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport { Row, Col } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Container, OutlineSvg, Text } from '../../../components';\nimport { getCompany } from '../../../utils';\n\nconst CContacts = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 50px',\n },\n\n '.container-description': {\n [p.theme.mediaQueries.md]: {\n padding: '0px 30px 0px 15px',\n },\n },\n\n '.container-image': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'center',\n margin: '0',\n\n '.custom-rounded': {\n alignItems: 'center',\n background: p.theme.colors.WHITE,\n borderRadius: '50%',\n display: 'flex',\n height: '280px',\n justifyContent: 'center',\n minHeight: '280px',\n minWidth: '280px',\n width: '280px',\n\n [p.theme.mediaQueries.md]: {\n height: '380px',\n minHeight: '380px',\n minWidth: '380px',\n width: '380px',\n },\n },\n },\n\n '.first-section': {\n margin: '50px 0 0',\n\n [p.theme.mediaQueries.md]: {\n margin: '90px 0 0',\n },\n },\n}));\n\nconst Card = styled.div((p) => ({\n background: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n marginBottom: 32,\n\n '.bottom-section': {\n marginLeft: 0,\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'start',\n marginLeft: 64,\n\n button: {\n marginRight: 40,\n },\n },\n },\n\n '.first-column': {\n padding: 32,\n\n '.desc-section': {\n paddingLeft: 64,\n },\n\n '.top-section': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'start',\n marginBottom: 16,\n\n '.container-icon': {\n alignItems: 'center',\n background: p.theme.colors.PRIMARY2,\n borderRadius: '50%',\n display: 'flex',\n height: 40,\n justifyContent: 'center',\n minHeight: 40,\n minWidth: 40,\n width: 40,\n },\n },\n },\n\n '.second-column': {\n backgroundColor: p.theme.colors.LIGHTGREEN,\n borderBottomLeftRadius: '8px',\n borderBottomRightRadius: '8px',\n borderTopRightRadius: '0px',\n padding: '50px 60px',\n\n [p.theme.mediaQueries.md]: {\n borderBottomLeftRadius: '0px',\n borderBottomRightRadius: '8px',\n borderTopRightRadius: '8px',\n padding: 50,\n },\n },\n}));\n\nconst Contacts = (props) => {\n const { t, theme } = props;\n\n const cards = [\n {\n key: 1,\n icon: 'Periodicity',\n },\n {\n key: 2,\n icon: 'Assistance',\n },\n {\n key: 3,\n icon: 'InformaticSupport',\n },\n ];\n\n return (\n \n \n \n \n \n\n {cards.map((c) => (\n \n \n \n \n {c.icon ? (\n
\n \n
\n ) : null}\n\n
\n
\n\n \n
\n\n {c.key === 1 ? (\n <>\n
\n
\n
\n >\n ) : null}\n\n {c.key !== 1 ? (\n <>\n {c.key === 3 || getCompany() === 'bcc' || getCompany() === 'vera'\n ? (\n
\n
\n
\n {c.key === 2 && (getCompany() === 'bcc' || getCompany() === 'vera')\n ? (\n \n )\n : (\n <>\n \n \n \n >\n )}\n\n
\n
\n )\n : null}\n >\n ) : null}\n\n
\n
\n \n\n \n \n \n {c.key === 3 ? (\n \n ) : null}\n \n \n \n
\n \n ))}\n \n
\n \n \n );\n};\n\nContacts.defaultProps = {\n t: null,\n theme: null,\n};\n\nContacts.propTypes = {\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.contacts'])(withTheme(Contacts));\n","import React, { useEffect } from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Trans, withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Container, Text } from '../../../components';\n\nconst MenuStyled = styled.ul({\n listStyle: 'inside',\n marginBottom: 0,\n});\n\nconst CookiePolicy = (props) => {\n const { theme } = props;\n\n useEffect(() => {\n const sec = document.getElementById('ot-sdk-cookie-policy');\n if (sec && window.OneTrust) {\n window.OneTrust.initializeCookiePolicyHtml();\n setTimeout(() => {\n const toggleDisplay = document.getElementsByClassName('ot-sdk-show-settings');\n for (let i = 0; i < toggleDisplay.length; i += 1) {\n toggleDisplay[i].onclick = (event) => {\n event.stopImmediatePropagation();\n window.OneTrust.ToggleInfoDisplay();\n };\n }\n }, 1000);\n }\n });\n\n return (\n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:0 content\" parent=\"p\" />\n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:1 content\" parent=\"p\" />\n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:2 content.1\" parent=\"p\" />\n\n \n \n \n \n \n \n\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:2 content.2\" parent=\"p\" />\n\n
\n\n \n \n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:7 list.1\" parent=\"li\" />\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:7 list.2\" parent=\"li\" />\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:7 list.3\" parent=\"li\" />\n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.cookiepolicy:7 list.4\" parent=\"li\" />\n \n\n \n \n );\n};\n\nCookiePolicy.defaultProps = {\n theme: null,\n};\n\nCookiePolicy.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.cookiepolicy'])(withTheme(CookiePolicy));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport moment from 'moment';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Col, Row } from 'react-bootstrap';\n\nimport {\n createEvent,\n createRecurrentEvents,\n editRecurrentEvents,\n fetchEvent,\n} from '../../../reducers/events/actions';\nimport { fetchUserPlan } from '../../../reducers/users/actions';\nimport { fetchCountNotifications } from '../../../reducers/notifications/actions';\n\nimport { computeRRule } from '../../../utils';\n\nimport {\n ActivitiesDays,\n ActivitiesRepeat,\n ActivitiesFrequency,\n ActivitiesFrequencyInputTimeMap,\n DaysOfWeek,\n} from '../../../enums';\n\nimport {\n Button,\n DateInput,\n DayOfWeekSelector,\n GoBack,\n MaterialDesignInput,\n MaterialDesignTextarea,\n RadioInputGroup,\n SelectInput,\n Text,\n TimeInput,\n} from '../../../components';\n\nimport { InputSearch } from '../../../components/portale';\n\nconst Container = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: 20,\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n paddingTop: 40,\n },\n}));\n\nconst ContainerButton = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flex-end',\n marginTop: 20,\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n marginBottom: 20,\n },\n}));\n\nconst ContainerInput = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n margin: '20px 0',\n\n '.dpcontainer:first-child': {\n marginBottom: 20,\n },\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n\n '.dpcontainer': {\n width: 'calc(50% - 15px)',\n marginBottom: '0px !important',\n },\n },\n}));\n\nconst ContainerLocation = styled.div({\n form: {\n margin: '20px 0 0',\n maxWidth: '100%',\n width: '100%',\n },\n});\n\nconst ContainerText = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: 20,\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 0',\n },\n}));\n\nconst Content = styled.div((p) => ({\n margin: 'auto',\n\n [p.theme.mediaQueries.md]: {\n width: '60%',\n },\n\n '.col-md-6': {\n padding: '20px 10px 0',\n },\n '.row': {\n margin: '0 -10px !important',\n },\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n\n return tmp;\n }, {});\n};\n\nclass CustomEvent extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n description: null,\n disabled: false,\n note: null,\n startDate: null,\n status: 'DRAFT',\n rrule: {\n days: null,\n duration: null,\n frequency: null,\n ndays: null,\n start: null,\n },\n selectedWeekDays: {\n [DaysOfWeek.MONDAY]: false,\n [DaysOfWeek.TUESDAY]: false,\n [DaysOfWeek.WEDNESDAY]: false,\n [DaysOfWeek.THURSDAY]: false,\n [DaysOfWeek.FRIDAY]: false,\n [DaysOfWeek.SATURDAY]: false,\n [DaysOfWeek.SUNDAY]: false,\n },\n timeIntervals: [],\n isCreatingEvent: false,\n isCreatingRecurrentEvents: false,\n isEditingRecurrentEvents: false,\n };\n\n this.getDataSource = this.getDataSource.bind(this);\n this.getRrule = this.getRrule.bind(this);\n this.goBack = this.goBack.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleChangeDate = this.handleChangeDate.bind(this);\n this.handleChangeEventTitle = this.handleChangeEventTitle.bind(this);\n this.handleChangeIsReminder = this.handleChangeIsReminder.bind(this);\n this.handleChangeLocation = this.handleChangeLocation.bind(this);\n this.handleChangeRrule = this.handleChangeRrule.bind(this);\n this.handleChangeTextarea = this.handleChangeTextarea.bind(this);\n this.handleChangeTime = this.handleChangeTime.bind(this);\n this.handleChangeTimeInterval = this.handleChangeTimeInterval.bind(this);\n this.handleChangeWeekDays = this.handleChangeWeekDays.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.validate = this.validate.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getUserPlan,\n getEvent,\n isAuthenticated,\n location,\n match,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n\n const { id } = match.params;\n if (id) {\n getEvent(id, getParams(location.search));\n }\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const queryParams = getParams(nextProps.location.search);\n const defaultDate = new Date(queryParams.startDate) < new Date() ? new Date(new Date().setHours(new Date().getHours() + 1)) : new Date(queryParams.startDate);\n\n const startDate = !nextState.startDate && nextProps.location && nextProps.location.search && queryParams.startDate\n ? defaultDate\n : new Date(nextState.startDate);\n\n const type = nextProps.location && nextProps.location.search && queryParams.type ? queryParams.type : '';\n\n return {\n editEvent: nextProps.match && nextProps.match.params && nextProps.match.params.id,\n startDate,\n type,\n };\n }\n\n componentDidUpdate() {\n const {\n createdEvent,\n createdRecurrentEvents,\n editedRecurrentEvents,\n getCountNotifications,\n history,\n isFetchingCreatedEvent,\n isFetchingCreatedRecurrentEvents,\n isFetchingEditedRecurrentEvents,\n } = this.props;\n\n const {\n isCreatingEvent,\n isCreatingRecurrentEvents,\n isEditingRecurrentEvents,\n } = this.state;\n\n if (!isFetchingCreatedEvent && createdEvent && isCreatingEvent) {\n // success edit, go calendar\n getCountNotifications();\n history.goBack();\n }\n\n if (!isFetchingCreatedRecurrentEvents && createdRecurrentEvents && isCreatingRecurrentEvents) {\n // success edit, go calendar\n getCountNotifications();\n history.goBack();\n }\n\n if (!isFetchingEditedRecurrentEvents && editedRecurrentEvents && isEditingRecurrentEvents) {\n // success edit, go calendar\n getCountNotifications();\n history.goBack();\n }\n\n this.validate();\n }\n\n getDataSource(enumType, localeKey, excludedValues) {\n const { t } = this.props;\n const datasource = [];\n\n Object.keys(enumType).forEach((e) => {\n if (!excludedValues || excludedValues.length === 0 || !excludedValues.includes(e)) {\n datasource.push({\n label: t(`${localeKey}.${e}`),\n value: enumType[e],\n });\n }\n });\n\n return datasource;\n }\n\n getDateByTime(date, h, m, s) {\n const { startDate } = this.state;\n if (date === null) {\n return new Date(startDate).setHours(h, m, s);\n }\n return new Date(date).setHours(h, m, s);\n }\n\n getRrule() {\n const {\n rrule,\n selectedWeekDays,\n startDate,\n timeIntervals,\n } = this.state;\n\n let datesWithTime = '';\n let rruleStr = '';\n\n const initialRRule = {\n repeat: {\n frequency: rrule.days,\n },\n duration: {\n mode: rrule.duration,\n nDays: rrule.ndays,\n },\n };\n\n const dateIntervals = [];\n\n if (rrule.days === ActivitiesDays.WEEKLY) {\n initialRRule.repeat = {\n ...initialRRule.repeat,\n weekly: {\n days: selectedWeekDays,\n },\n };\n }\n\n for (let i = 0; i < timeIntervals.length; i += 1) {\n const currentHours = timeIntervals[i].getHours();\n const currentMinutes = timeIntervals[i].getMinutes();\n const currentSeconds = timeIntervals[i].getSeconds();\n\n if (timeIntervals.length > 1 && i !== 0 && dateIntervals.length > 0) {\n const currentDateWithTime = new Date(\n this.getDateByTime(startDate, currentHours, currentMinutes, currentSeconds),\n );\n\n if (dateIntervals[i - 1] > currentDateWithTime) {\n dateIntervals.push(\n new Date(currentDateWithTime.setDate(currentDateWithTime.getDate() + 1)),\n );\n } else {\n dateIntervals.push(\n new Date(\n this.getDateByTime(\n dateIntervals[i - 1],\n currentHours,\n currentMinutes,\n currentSeconds,\n ),\n ),\n );\n }\n } else {\n // first interval\n dateIntervals.push(\n new Date(this.getDateByTime(startDate, currentHours, currentMinutes, currentSeconds)),\n );\n }\n }\n\n for (let i = 0; i < dateIntervals.length; i += 1) {\n initialRRule.start = dateIntervals[i];\n rruleStr = computeRRule(initialRRule);\n datesWithTime = `${datesWithTime}${i !== 0 ? ',' : ''}${rruleStr.substr(0, (rruleStr.indexOf('RRULE') - 1)).split(':')[1]}`;\n }\n\n return `DTSTART:${datesWithTime}|${rruleStr.substr(rruleStr.indexOf('RRULE'), rruleStr.length)}`;\n }\n\n validate() {\n const {\n disabled,\n title,\n startDate,\n rrule,\n location,\n selectedWeekDays,\n timeIntervals,\n type,\n noTime,\n noDate,\n status,\n } = this.state;\n\n let eventIsValid = false;\n\n const startValid = startDate !== null && !noDate && !noTime;\n\n if (type === 'DIAGNOSTIC') {\n eventIsValid = title && title !== '' && (status === 'DRAFT' || (status !== 'DRAFT' && location && location !== ''));\n\n if (disabled !== (!eventIsValid || !startValid)) {\n this.setState({ disabled: !eventIsValid || !startValid });\n }\n } else {\n eventIsValid = title && title !== '';\n\n const durationValid = rrule.duration !== null && (rrule.duration !== ActivitiesRepeat.NUMBEROFDAYS\n || (rrule.duration === ActivitiesRepeat.NUMBEROFDAYS && rrule.ndays !== null && rrule.ndays !== ''));\n\n const daysValid = rrule.days !== null && (rrule.days !== ActivitiesDays.WEEKLY\n || (rrule.days === ActivitiesDays.WEEKLY && Object.values(selectedWeekDays).includes(true)));\n\n const frequencyValid = rrule.frequency !== undefined\n && rrule.frequency !== null\n && rrule.frequency.timeIntervals === timeIntervals.length\n && !timeIntervals.includes(null);\n\n const rruleNotValid = startValid && durationValid && daysValid && frequencyValid;\n\n if (disabled !== (!eventIsValid || !rruleNotValid)) {\n this.setState({ disabled: !eventIsValid || !rruleNotValid });\n }\n }\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n handleChangeRrule(e) {\n const { rrule } = this.state;\n let { timeIntervals } = this.state;\n\n if (e.target && e.target.value === '') {\n this.setState({\n rrule: {\n ...rrule,\n [e.target.name]: null,\n },\n });\n } else {\n const name = e.target ? e.target.name : e.name[0];\n let value = e.target ? e.target.value : e.value;\n\n if (name === 'frequency') {\n timeIntervals = [];\n }\n\n value = name === 'frequency' ? ActivitiesFrequencyInputTimeMap[value] : value;\n\n this.setState({\n rrule: {\n ...rrule,\n [name]: value,\n },\n timeIntervals,\n });\n }\n }\n\n handleChangeWeekDays(event) {\n const item = event.target.name;\n const isChecked = event.target.checked;\n\n const { selectedWeekDays } = this.state;\n selectedWeekDays[item] = isChecked;\n\n this.setState({ selectedWeekDays });\n }\n\n handleChangeEventTitle(input) {\n this.setState({ title: input.value });\n }\n\n handleChangeLocation(location) {\n this.setState({ location });\n }\n\n handleChangeIsReminder(changedValue) {\n this.setState({\n status: changedValue.target.value,\n });\n }\n\n handleCancel() {\n this.goBack();\n }\n\n handleChangeDate(event) {\n const { startDate } = this.state;\n if (event.target && event.target.value) {\n const value = moment(event.target.value);\n startDate.setFullYear(value.get('year'));\n startDate.setMonth(value.get('month'));\n startDate.setDate(value.get('date'));\n\n this.setState({\n startDate,\n noDate: false,\n });\n } else {\n this.setState({ noDate: true });\n }\n }\n\n handleChangeTime(event) {\n const { startDate } = this.state;\n if (event.target && event.target.value) {\n const value = moment(event.target.value);\n startDate.setHours(value.get('hour'));\n startDate.setMinutes(value.get('minute'));\n startDate.setSeconds(value.get('second'));\n startDate.setMilliseconds(value.get('millisecond'));\n\n this.setState({\n startDate,\n noTime: false,\n });\n } else {\n this.setState({ noTime: true });\n }\n }\n\n handleChangeTextarea(textarea) {\n this.setState({ [textarea.name[0]]: textarea.value });\n }\n\n handleSubmit() {\n const {\n editEvent,\n location,\n note,\n description,\n startDate,\n status,\n title,\n type,\n } = this.state;\n\n const {\n account,\n createNewEvent,\n createNewRecurrentEvents,\n editCustomRecurrentEvents,\n event,\n plan,\n } = this.props;\n\n let tmpEvent = {\n allDay: false,\n owner: account.id,\n description,\n healthPlanId: plan.id,\n title,\n type,\n startDate: startDate.toISOString(),\n status,\n firstVideoConference: false,\n };\n\n if (plan) {\n if (type === 'DIAGNOSTIC') {\n const endDate = moment(startDate).add(1, 'hours').toDate();\n tmpEvent = {\n ...tmpEvent,\n endDate: endDate.toISOString(),\n location: status !== 'DRAFT' ? location : null,\n note,\n recurring: false,\n };\n this.setState({ isCreatingEvent: true });\n createNewEvent(tmpEvent);\n } else if (!editEvent) {\n tmpEvent = {\n ...tmpEvent,\n recurring: true,\n location: 'Self',\n rrule: this.getRrule(),\n };\n this.setState({ isCreatingRecurrentEvents: true });\n createNewRecurrentEvents(tmpEvent);\n } else {\n tmpEvent = {\n ...event,\n recurring: true,\n location: 'Self',\n rrule: this.getRrule(),\n };\n this.setState({ isEditingRecurrentEvents: true });\n editCustomRecurrentEvents(tmpEvent);\n }\n }\n }\n\n handleChangeTimeInterval(e, changeNexts, interval) {\n const { name, value } = e.target;\n const { timeIntervals } = this.state;\n const itemIndexToChange = name.split('.')[1];\n\n timeIntervals[itemIndexToChange] = value;\n\n if (changeNexts && timeIntervals[0]) {\n for (let i = 1; i < timeIntervals.length; i += 1) {\n const hourPrevItem = timeIntervals[i - 1].getHours();\n const minutesPrevItem = timeIntervals[i - 1].getMinutes();\n timeIntervals[i].setHours(hourPrevItem + interval, minutesPrevItem);\n }\n }\n\n this.setState({ timeIntervals: [...timeIntervals] });\n }\n\n buildTimeInputs() {\n const { rrule, timeIntervals } = this.state;\n const { t } = this.props;\n const { frequency } = rrule;\n\n const listTimeInput = [];\n const startHour = 8;\n const defaultDate = new Date();\n const range = frequency && frequency.dateRange ? frequency.dateRange : 24;\n if (frequency && frequency.timeIntervals) {\n let i;\n for (i = 0; i < frequency.timeIntervals; i += 1) {\n const hour = startHour + Math.round(range / frequency.timeIntervals) * i;\n const defaultTime = timeIntervals[i] !== undefined ? timeIntervals[i] : new Date(defaultDate.setHours(hour, 0, 0));\n const changeNexts = frequency.intervalsBlocked && i === 0;\n const intervalToIncrement = Math.round(range / frequency.timeIntervals) * 1;\n const timeLabel = t('portale.customevent:at time', { item: i + 1 });\n\n listTimeInput.push(\n \n this.handleChangeTimeInterval(e, changeNexts, intervalToIncrement)}\n selected={defaultTime}\n showIcon\n label={timeLabel}\n placeholder={timeLabel}\n themeVariant=\"pb\"\n />\n ,\n );\n\n timeIntervals[i] = defaultTime;\n }\n }\n\n return listTimeInput;\n }\n\n render() {\n const { event } = this.props;\n const {\n disabled,\n editEvent,\n location,\n rrule,\n selectedWeekDays,\n startDate,\n status,\n type,\n } = this.state;\n\n const { t, theme } = this.props;\n\n if (!type || (type !== 'DIAGNOSTIC' && type !== 'DRUG' && type !== 'LIFESTYLE') || (editEvent && !event)) {\n return null;\n }\n\n const now = moment();\n const minTime = startDate.getDate() === new Date().getDate()\n ? now.hours(new Date().getHours() + 1).minutes(new Date().getMinutes()).toDate()\n : null;\n\n const maxTime = startDate.getDate() === new Date().getDate()\n ? now.hours(23).minutes(45).toDate()\n : null;\n\n return (\n \n \n\n \n \n {!editEvent ? (\n \n ) : null}\n\n \n\n \n\n {type === 'DIAGNOSTIC' ? (\n <>\n \n {status === 'PRENOTATO' ? (\n \n \n \n ) : null}\n \n \n\n \n\n \n\n {/* {status === 'DRAFT' ? (\n \n \n \n \n ) : null} */}\n >\n ) : (\n <>\n \n \n \n \n \n \n \n
\n\n \n {rrule.duration != null && rrule.duration === ActivitiesRepeat.NUMBEROFDAYS && (\n \n \n \n )}\n \n \n \n {rrule.days != null && rrule.days === ActivitiesDays.WEEKLY && (\n \n \n \n \n )}\n \n \n \n\n {this.buildTimeInputs()}\n
\n >\n )}\n \n \n\n \n \n\n \n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n createdEvent: state.events.createEvent.event,\n createdRecurrentEvents: state.events.createRecurrentEvents.events,\n editedRecurrentEvents: state.events.editRecurrentEvents.events,\n event: state.events.event.event,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingCreatedEvent: state.events.createEvent.isFetching,\n isFetchingCreatedRecurrentEvents: state.events.createRecurrentEvents.isFetching,\n isFetchingEditedRecurrentEvents: state.events.editRecurrentEvents.isFetching,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n createNewEvent: (event) => dispatch(createEvent(event)),\n createNewRecurrentEvents: (event) => dispatch(createRecurrentEvents(event)),\n editCustomRecurrentEvents: (event) => dispatch(editRecurrentEvents(event)),\n getCountNotifications: () => dispatch(fetchCountNotifications()),\n getEvent: (id, params) => dispatch(fetchEvent({ id, ...params })),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nCustomEvent.defaultProps = {\n account: null,\n createdEvent: null,\n createdRecurrentEvents: null,\n createNewEvent: null,\n createNewRecurrentEvents: null,\n editCustomRecurrentEvents: null,\n editedRecurrentEvents: null,\n event: null,\n getCountNotifications: null,\n getEvent: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: null,\n isFetchingCreatedEvent: false,\n isFetchingCreatedRecurrentEvents: false,\n isFetchingEditedRecurrentEvents: false,\n location: null,\n match: null,\n plan: null,\n questionnaire: null,\n t: null,\n theme: null,\n};\n\nCustomEvent.propTypes = {\n account: PropTypes.shape(),\n createdEvent: PropTypes.shape(),\n createdRecurrentEvents: PropTypes.arrayOf(PropTypes.shape()),\n createNewEvent: PropTypes.func,\n createNewRecurrentEvents: PropTypes.func,\n editCustomRecurrentEvents: PropTypes.func,\n editedRecurrentEvents: PropTypes.arrayOf(PropTypes.shape()),\n event: PropTypes.shape(),\n getCountNotifications: PropTypes.func,\n getEvent: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetchingCreatedEvent: PropTypes.bool,\n isFetchingCreatedRecurrentEvents: PropTypes.bool,\n isFetchingEditedRecurrentEvents: PropTypes.bool,\n location: PropTypes.shape(),\n match: PropTypes.shape(),\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTheme(withTranslation(['portale.customevent', 'portale.event', 'enums'])(CustomEvent))));\n","import React from 'react';\n\nimport { Trans, withTranslation } from 'react-i18next';\nimport { withRouter } from 'react-router-dom';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport { Col, Row } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\nimport image from '../../../../assets/img/story-01.png';\n\nimport {\n Button,\n CheckboxInputGroup,\n Loading,\n Modal,\n OutlineSvg,\n Text,\n} from '../../../../components';\n\nimport { EgoSvg } from '../../../../components/common/Svg';\nimport { deleteDocuments as deleteDocumentsAction } from '../../../../reducers/documents/actions';\nimport { fetchPrivacy, setPrivacy as setPrivacyAction } from '../../../../reducers/privacy/actions';\n\nimport { Consenses } from '../../../../enums';\nimport {\n checkConsenses,\n getCompany,\n getEgoOriginEnvironment,\n getFormDataGatheringLink,\n getConsensesObject,\n getConsensesObjectSet,\n} from '../../../../utils';\n\nconst Content = styled.div({\n textAlign: 'center',\n});\n\nconst CTabProfile = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n '.pl-md-0': {\n paddingLeft: 0,\n },\n\n '.pr-md-0': {\n paddingRight: 0,\n },\n },\n\n '.container-personal-info, .container-privacy-info': {\n '.col-md-6': {\n '&:first-child': {\n padding: 0,\n\n [p.theme.mediaQueries.md]: {\n paddingRight: 15,\n },\n },\n\n '&:last-child': {\n padding: 0,\n\n [p.theme.mediaQueries.md]: {\n paddingLeft: 15,\n },\n },\n },\n },\n '.container-privacy-rewarding': {\n '.container-CheckboxInputGroup': {\n label: {\n p: {\n marginBottom: 0,\n },\n },\n '.rewarding-policy-link': {\n textDecoration: 'none',\n color: p.theme.colors.GREY1,\n span: {\n textDecoration: 'underline',\n },\n '&:hover': {\n textDecoration: 'none',\n color: p.theme.colors.GREY1,\n span: {\n color: p.theme.colors.PRIMARY1,\n },\n },\n },\n },\n },\n}));\n\nconst CData = styled.div((p) => ({\n padding: '20px 0',\n background: p.theme.colors.WHITE,\n borderRadius: '8px',\n\n '.col-md-6:last-child': {\n padding: 0,\n\n [p.theme.mediaQueries.md]: {\n borderLeft: `1px solid ${p.theme.colors.GREY5}`,\n },\n },\n}));\n\nconst Card = styled.div((p) => ({\n background: p.theme.colors.WHITE,\n borderRadius: '8px',\n display: 'flex',\n flexDirection: 'column',\n padding: '40px 30px',\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n flexDirection: 'row',\n },\n\n p: {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.xlarge,\n margin: 0,\n padding: '30px 0',\n\n [p.theme.mediaQueries.md]: {\n padding: '0 30px',\n },\n },\n\n svg: {\n width: 'auto',\n },\n}));\n\nconst CardWithoutBck = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n padding: '40px 30px',\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n flexDirection: 'row',\n padding: '40px 30px 40px 0px',\n },\n\n '.image': {\n backgroundImage: `url(${image})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n borderRadius: '50%',\n height: 82,\n margin: '0 auto',\n minWidth: 82,\n width: 82,\n },\n\n p: {\n margin: 0,\n padding: '20px 0',\n\n [p.theme.mediaQueries.md]: {\n padding: '0 50px',\n },\n },\n}));\n\nconst Rect = styled.div((p) => ({\n background: p.theme.colors.WHITE,\n boxShadow: '0 5px 12px 0 rgba(0,0,0,0.22)',\n cursor: 'pointer',\n marginTop: 16,\n padding: '15px 10px',\n\n [p.theme.mediaQueries.md]: {\n padding: '25px 20px',\n },\n\n '&.flex': {\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n\n [p.theme.mediaQueries.sm]: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n\n '&.flex-row': {\n alignItems: 'center',\n flexDirection: 'row',\n\n div: {\n width: 'calc(100% - 30px)',\n },\n\n p: {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n },\n\n '.container-radioinputgroup': {\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginTop: 15,\n\n [p.theme.mediaQueries.sm]: {\n marginTop: 0,\n },\n },\n },\n\n '.consent-options': {\n minWidth: 130,\n paddingRight: 5,\n },\n\n '.consent-label': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n\n p: {\n paddingRight: 10,\n\n span: {\n paddingRight: 10,\n },\n },\n\n svg: {\n minWidth: 20,\n },\n },\n\n 'div, label, p': {\n color: p.theme.colors.GREY3,\n fontFamily: p.theme.fontFamily.sans,\n fontSize: p.theme.fontSizes.medium,\n margin: 0,\n },\n}));\n\nclass TabProfile extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showModal: false,\n };\n\n this.getSelectedValues = this.getSelectedValues.bind(this);\n this.handleMedicalModal = this.handleMedicalModal.bind(this);\n this.setCheckboxes = this.setCheckboxes.bind(this);\n this.setCheckboxesMedical = this.setCheckboxesMedical.bind(this);\n this.submit = this.submit.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getPrivacy,\n privacyIsFetching,\n privacy,\n } = this.props;\n\n if ((!privacy || privacy.length === 0) && !privacyIsFetching) {\n getPrivacy(getConsensesObject(account));\n }\n\n const medicalRecordsValue = checkConsenses(privacy, Consenses.MEDICAL_RECORDS.code);\n this.setState({ consensesMedical: medicalRecordsValue ? Consenses.MEDICAL_RECORDS.code : null });\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n disableRewardingConsenses: nextProps.privacy && nextProps.privacy.length > 0 ? checkConsenses(nextProps.privacy, Consenses.REWARDING.code) : false,\n };\n }\n\n handleMedicalModal() {\n const { account, deleteDocuments, setPrivacy } = this.props;\n\n setPrivacy([getConsensesObjectSet(account, 'WAS_DS', Consenses.MEDICAL_RECORDS.code, 'N')], getConsensesObject(account)).then(() => {\n deleteDocuments();\n });\n\n this.setState({ showModal: false });\n }\n\n getSelectedValues() {\n const { privacy } = this.props;\n if (privacy && privacy.length > 0 && checkConsenses(privacy, Consenses.REWARDING.code)) {\n return ['readed', Consenses.REWARDING.code];\n }\n return [];\n }\n\n setCheckboxes(values) {\n const { consenses } = this.state;\n if (!values.includes('readed') && consenses && consenses.includes(Consenses.REWARDING.code)) {\n // Se viene tolta l'accettazione del regolamento a premi e precedentemente\n // si era aggiunta l'aggiunta al trattamento dei dati sanitari, viene eliminato\n // il consenso\n const index = values.indexOf(Consenses.REWARDING.code);\n if (index > -1) {\n values.splice(index, 1);\n }\n }\n this.setState({ consenses: values });\n }\n\n setCheckboxesMedical(values) {\n const { account, setPrivacy } = this.props;\n\n if (values.length > 0) {\n setPrivacy([getConsensesObjectSet(account, 'WAS_DS', Consenses.MEDICAL_RECORDS.code)], getConsensesObject(account));\n this.setState({ consensesMedical: values[0] });\n } else {\n this.setState({ consensesMedical: undefined, showModal: true });\n }\n }\n\n submit() {\n const {\n account,\n history,\n privacy,\n setPrivacy,\n } = this.props;\n const { consenses } = this.state;\n\n const consensesToSend = [];\n if (consenses.includes(Consenses.REWARDING.code)) {\n consensesToSend.push(getConsensesObjectSet(account, 'WAS_2', Consenses.REWARDING.code));\n }\n if (consensesToSend.length > 0) {\n setPrivacy(privacy.concat(consensesToSend), getConsensesObject(account)).then(() => history.go());\n }\n }\n\n render() {\n const {\n account,\n history,\n privacyIsFetching,\n t,\n theme,\n } = this.props;\n\n const {\n consensesMedical,\n showModal,\n } = this.state;\n\n const company = getCompany();\n\n return (\n \n \n\n \n \n \n \n \n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n \n
\n \n \n \n ) : null}\n\n \n\n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n\n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n
\n \n\n \n \n window.open(`${getEgoOriginEnvironment()}/credentials/recovery`, '_blank').focus()}>\n \n \n \n
\n \n \n \n \n window.open(`${getEgoOriginEnvironment()}/credentials/recovery`, '_blank').focus()}>\n \n \n \n
\n \n \n \n
\n\n \n\n \n \n \n history.push({ pathname: 'consenses', state: { disabled: true } })}\n selectedValues={['privacy']}\n />\n \n \n
\n\n \n \n \n\n ,\n value: Consenses.MEDICAL_RECORDS.code,\n },\n ]}\n key={consensesMedical}\n name=\"medicalRecords\"\n onChange={this.setCheckboxesMedical}\n selectedValues={[consensesMedical]}\n />\n \n
\n\n \n \n \n \n \n \n\n \n this.setState({ consensesMedical: Consenses.MEDICAL_RECORDS.code, showModal: false })} marginTop=\"15px\" small text=\"Annulla\" variant=\"secondary\" width=\"100%\" />\n \n
\n \n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n privacy: state.privacy.privacy,\n privacyIsFetching: state.privacy.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n deleteDocuments: () => dispatch(deleteDocumentsAction()),\n getPrivacy: (params) => dispatch(fetchPrivacy(params)),\n setPrivacy: (dataSet, dataGet) => dispatch(setPrivacyAction({ dataSet, dataGet })),\n});\n\nTabProfile.defaultProps = {\n account: null,\n deleteDocuments: null,\n getPrivacy: null,\n history: null,\n privacy: null,\n privacyIsFetching: null,\n setPrivacy: null,\n t: null,\n theme: null,\n};\n\nTabProfile.propTypes = {\n account: PropTypes.shape(),\n deleteDocuments: PropTypes.func,\n getPrivacy: PropTypes.func,\n history: PropTypes.shape(),\n privacy: PropTypes.arrayOf(PropTypes.shape()),\n privacyIsFetching: PropTypes.bool,\n setPrivacy: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.customersettings', 'portale.privacy'])(TabProfile))));\n","import React from 'react';\n\nimport styled from 'styled-components';\n\nconst CTabAlerts = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n '.pl-md-0': {\n paddingLeft: 0,\n },\n\n '.pr-md-0': {\n paddingRight: 0,\n },\n },\n}));\n\nconst TabAlerts = () => ;\n\nexport default TabAlerts;\n","import React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { Container, Text } from '../../../components';\n\nimport TabProfile from './TabProfile';\nimport TabAlerts from './TabAlerts';\n\n// const MButton = styled(Button)((p) => ({\n// backgroundColor: (props) => props.active ? p.theme.colors.PRIMARY1 : p.theme.colors.WHITE,\n// boxShadow: p.theme.shadows.buttonClicked,\n// color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n// flex: '1 1 25%',\n// fontSize: p.theme.fontSizes.small,\n// textTransform: 'uppercase',\n\n// '&:hover': {\n// color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n// },\n// }));\n\nconst ContainerCS = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 30px',\n\n [p.theme.mediaQueries.md]: {\n padding: '30px 20px 30px',\n },\n}));\n\n// const Tabs = styled.div((p) => ({\n// alignItems: 'stretch',\n// borderRadius: 8,\n// boxShadow: p.theme.shadows.buttonClicked,\n// display: 'flex',\n// flexDirection: 'row',\n// justifyContent: 'center',\n// margin: '30px 0',\n// overflow: 'hidden',\n// }));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass CustomerSettings extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {};\n\n this.getActiveTab = this.getActiveTab.bind(this);\n this.setActiveTab = this.setActiveTab.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n return {\n tab: nextState.tab || getParams(nextProps.history.location.search).tab,\n };\n }\n\n getActiveTab() {\n const { tab } = this.state;\n\n switch (tab) {\n case 'profile':\n return ;\n case 'alerts':\n return ;\n default:\n return ;\n }\n }\n\n setActiveTab(tab) {\n const { history } = this.props;\n history.replace(`/customer-settings?tab=${tab}`, null);\n this.setState({ tab });\n }\n\n render() {\n const { theme } = this.props;\n // const { tab } = this.state;\n\n return (\n \n \n \n \n\n {/* \n this.setActiveTab('profile')}>\n {t('tab.profile')}\n \n this.setActiveTab('alerts')}>\n {t('tab.alerts')}\n \n */}\n\n {this.getActiveTab()}\n \n \n );\n }\n}\n\nCustomerSettings.defaultProps = {\n history: null,\n // t: null,\n theme: null,\n};\n\nCustomerSettings.propTypes = {\n history: PropTypes.shape(),\n // t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(withTranslation(['portale.customersettings'])(withTheme(CustomerSettings)));\n","import React, { useState } from 'react';\n\nimport { Trans, withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CartoonSvg,\n MaterialDesignInput,\n Modal,\n Text,\n} from '../../../../../components';\n\nconst Content = styled.div({\n textAlign: 'center',\n});\n\nconst IconContainer = styled.div({\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n});\n\nconst ModalTrend = (props) => {\n const {\n onClick,\n onClose,\n onPostpone,\n show,\n t,\n theme,\n trend,\n visibleOnDashboard,\n } = props;\n\n const [data, setData] = useState(null);\n\n const handleClick = () => {\n if (onClick && data && data.value && data.value !== '') {\n onClick(data);\n }\n };\n\n const handleClose = () => {\n if (onClose) {\n onClose(trend);\n }\n };\n\n const handlePostpone = () => {\n if (onPostpone) {\n onPostpone(trend);\n }\n };\n\n if (!show) {\n return null;\n }\n\n return (\n \n \n \n {trend.icon ? : null}\n \n\n \n \n \n \n\n setData(e)}\n placeholder={t('modal.add placeholder', { type: t(`enums:health type.${trend.label}`), unity: trend.unity })}\n type=\"number\"\n />\n\n \n\n {visibleOnDashboard ? (\n \n ) : null}\n \n \n );\n};\n\nModalTrend.defaultProps = {\n onClick: null,\n onClose: null,\n onPostpone: null,\n show: null,\n t: null,\n theme: null,\n trend: null,\n visibleOnDashboard: false,\n};\n\nModalTrend.propTypes = {\n onClick: PropTypes.func,\n onClose: PropTypes.func,\n onPostpone: PropTypes.func,\n show: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n trend: PropTypes.shape(),\n visibleOnDashboard: PropTypes.bool,\n};\n\nexport default withTranslation(['portale.medicalreports', 'enums'])(withTheme(ModalTrend));\n","import React from 'react';\n\nimport { withRouter } from 'react-router-dom';\n\nimport { connect } from 'react-redux';\nimport { withTranslation } from 'react-i18next';\nimport { Card as C, Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\nimport { groupBy } from 'lodash';\n\nimport { fetchHealthPlanScoreReport, fetchUserPlan } from '../../../reducers/users/actions';\nimport { fetchConsultationRequest } from '../../../reducers/consultationRequests/actions';\nimport { fetchNextEvents, fetchEventsByFilters } from '../../../reducers/events/actions';\nimport { deleteNotifications, fetchAllNotifications, skipNotifications } from '../../../reducers/notifications/actions';\nimport { createRecord, fetchTrends } from '../../../reducers/trends/actions';\nimport { fetchQuestionnaireSummary } from '../../../reducers/questionnaires/actions';\nimport { fetchUserPersonalData } from '../../../reducers/medicalRecords/actions';\nimport { medicalPdfGenerate, fetchDocumentsByUser } from '../../../reducers/documents/actions';\nimport { setUpdateQuestionnaire } from '../../../reducers/settings/actions';\n\nimport {\n calculateGroupReportsProgress,\n getCompany,\n getEventInfo,\n getMedicalTemplatePDF,\n getNotificationsBySpecificType,\n getNotificationsWithoutSpecificTypes,\n hasReadedHealthRecordNotification,\n mapTrends,\n setReadedHealthRecordNotification,\n showNotification,\n} from '../../../utils';\n\nimport {\n Button,\n CartoonSvg,\n Container,\n FileDownload,\n OutlineSvg,\n Score,\n Text,\n} from '../../../components';\nimport { MeetingBox, ModalQuestionnaire, Notification } from '../../../components/portale';\nimport ModalTrend from '../MedicalRecords/TabTrend/ModalTrend';\n\nimport { styledSystem } from '../../../themes';\n\nimport image from '../../../assets/img/landing-01.jpg';\n\nimport {\n ActivityGroupIcon,\n EventStatuses,\n EventTypeOutlineIcon,\n EventTypes,\n NotificationTypes,\n} from '../../../enums';\n\nconst MC = styled(C)((p) => ({\n alignItems: 'center',\n backgroundColor: p.theme.colors.WHITE,\n border: 0,\n borderRadius: 8,\n boxShadow: '0 2px 35px -8px rgba(0,0,0,0.2)',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n margin: '0 0 20px 0',\n minWidth: 245,\n\n [p.theme.mediaQueries.md]: {\n display: 'block',\n margin: 10,\n },\n\n '.card-header, .card-link': {\n background: 'transparent',\n borderBottom: 0,\n borderRadius: 0,\n height: 'auto',\n padding: '24px 0px 24px 24px',\n position: 'relative',\n whiteSpace: 'normal',\n width: '50%',\n\n [p.theme.mediaQueries.md]: {\n width: 'auto',\n padding: 24,\n },\n\n '.ga-cards': {\n alignItems: 'center',\n display: 'flex',\n height: 36,\n\n [p.theme.mediaQueries.md]: {\n display: 'block',\n },\n },\n\n 'a:hover': {\n textDecoration: 'none',\n },\n\n '.title': {\n color: p.theme.colors.PRIMARY1,\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: 'bold',\n margin: 0,\n overflow: 'inherit',\n paddingLeft: 10,\n textAlign: 'left',\n textOverflow: 'initial',\n whiteSpace: 'unset',\n\n [p.theme.mediaQueries.md]: {\n fontFamily: p.theme.fontFamily.sansCaption,\n fontSize: p.theme.fontSizes.large,\n lineHeight: '20px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n width: 'calc(100% - 48px)',\n },\n },\n\n '.container-icon': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '50%',\n display: 'inline-block',\n height: 40,\n width: 40,\n },\n\n '.container-score-label': {\n display: 'block',\n paddingRight: '16px',\n textAlign: 'right',\n width: '60%',\n\n [p.theme.mediaQueries.md]: {\n display: 'none',\n },\n\n p: {\n justifyContent: 'flex-end',\n '&> span:first-child': {\n display: 'none',\n },\n },\n small: {\n paddingRight: 30,\n },\n },\n },\n\n '.card-body': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n minWidth: '130px',\n padding: '0',\n\n '.container-score': {\n 'p > span:first-child': {\n display: 'none',\n },\n },\n\n [p.theme.mediaQueries.md]: {\n justifyContent: 'center',\n minWidth: 'auto',\n padding: '0 25px 25px',\n },\n },\n\n '&.link': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: '0 2px 35px -8px rgba(0,0,0,0.2)',\n minWidth: 'auto',\n cursor: 'pointer',\n\n '.title': {\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '2',\n display: '-webkit-box',\n fontSize: 16,\n paddingLeft: 16,\n whiteSpace: 'normal',\n width: 'calc(100% - 50px)',\n },\n\n '.card-header, .card-link': {\n alignItems: 'center',\n borderBottom: 0,\n display: 'flex',\n justifyContent: 'center',\n width: '100%',\n },\n },\n}));\n\nconst CDashboard = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 45px',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n padding: `${p.theme.verticalSpacing.p32} 20px 65px`,\n },\n\n '.bullet': {\n backgroundColor: 'transparent !important',\n border: `1px solid ${p.theme.colors.BULLET} !important`,\n margin: '5px 3px 0 !important',\n\n '&.active': {\n backgroundColor: `${p.theme.colors.BULLET} !important`,\n },\n },\n\n '.notifications': {\n margin: 0,\n },\n\n '.intro': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n margin: `${p.theme.verticalSpacing.p16} 0 0 0`,\n padding: '30px 15px',\n opacity: 0.99,\n },\n\n '.claims': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n margin: `${p.theme.verticalSpacing.p32} 0 0 0`,\n padding: '30px 15px',\n\n '.container-links': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n\n '.link': {\n cursor: 'pointer',\n width: '100%',\n\n '&:first-child': {\n margin: '0px 0px 8px',\n },\n\n '&:last-child': {\n margin: '8px 0px 0px',\n },\n },\n },\n },\n\n '.container-ga-cards': {\n display: 'block',\n margin: '16px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n display: 'flex',\n margin: '32px -10px !important',\n },\n\n '.col': {\n padding: 0,\n },\n },\n\n '.container-medical-records': {\n '.b-bottom': {\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n },\n\n '.medical-records': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n\n '.container-value': {\n width: 100,\n textAlign: 'center',\n padding: '20px 10px',\n },\n\n '.progress-pie': {\n padding: '20px 0 20px 10px',\n },\n },\n },\n\n '.container-pp-na': {\n margin: 0,\n\n '.container-prevention-path': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n margin: 0,\n padding: '30px 20px',\n\n '.container-detail': {\n [p.theme.mediaQueries.md]: {\n paddingTop: 20,\n },\n },\n\n '.container-progress': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n marginTop: 40,\n\n [p.theme.mediaQueries.md]: {\n marginTop: 0,\n },\n\n '&:last-child': {\n marginLeft: 0,\n\n [p.theme.mediaQueries.md]: {\n borderLeft: `1px solid ${p.theme.colors.LIGHTBLUE}`,\n padding: '0 15px 0 20px',\n },\n },\n\n '.inside': {\n backgroundColor: p.theme.colors.LIGHTBLUE,\n\n '.score': {\n 'span:first-child': {\n color: p.theme.colors.PRIMARY1,\n },\n 'span:last-child': {\n color: p.theme.colors.PRIMARY2,\n },\n },\n\n '.vote': {\n display: 'none',\n },\n },\n },\n\n h3: {\n whiteSpace: 'nowrap',\n },\n },\n\n '.container-meeting-box': {\n marginTop: 30,\n padding: 0,\n\n [p.theme.mediaQueries.md]: {\n margin: 0,\n paddingLeft: 30,\n },\n },\n },\n\n '.n-margin': {\n margin: '0 -15px !important',\n },\n\n '.container-white-padding': {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n marginTop: p.theme.verticalSpacing.p32,\n padding: '30px 20px',\n\n [p.theme.mediaQueries.md]: {\n marginTop: p.theme.verticalSpacing.p48,\n height: 'calc(100% - 48px)',\n },\n },\n\n '.container-link': {\n margin: '32px 0 0 !important',\n\n [p.theme.mediaQueries.md]: {\n margin: '32px -10px 0 !important',\n },\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.PRIMARY1,\n },\n },\n}));\n\nconst ScoreContainer = styledSystem('div');\n\nconst BckImage = styled(Container)({\n backgroundImage: `url(${image})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '125%',\n height: 267,\n left: 0,\n padding: 0,\n position: 'absolute',\n top: 0,\n});\n\nconst Gradient = styled.div((p) => ({\n background: p.theme.colors.GRADIENT1,\n height: 267,\n opacity: 0.73,\n}));\n\nconst IconContainer = styled.div({\n backgroundColor: (props) => props.bkg,\n borderRadius: '50%',\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n});\n\nconst NA = styled.div((p) => ({\n alignItems: 'center',\n boxShadow: '0 5px 12px 0 rgba(0,0,0,0.2)',\n display: 'flex',\n flexDirection: 'row',\n marginTop: p.theme.verticalSpacing.p16,\n padding: '20px 30px',\n\n '.info': {\n display: 'flex',\n flexDirection: 'column',\n paddingLeft: 16,\n },\n}));\n\nconst LabelInsidePiePrevPath = styled.p((p) => ({\n fontFamily: p.theme.fontFamily.sansCaption,\n height: '100%',\n lineHeight: '100px',\n margin: 0,\n paddingRight: 10,\n textAlign: 'center',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n lineHeight: '150px',\n },\n\n '.max': {\n color: p.theme.colors.PRIMARY2,\n fontSize: p.theme.fontSizes.large,\n fontWeight: p.theme.fontWeights.bold,\n\n [p.theme.mediaQueries.md]: {\n fontSize: p.theme.fontSizes.xxxlarge,\n },\n\n i: {\n color: p.theme.colors.PRIMARY1,\n },\n },\n\n '.now': {\n color: p.theme.colors.PRIMARY1,\n fontSize: p.theme.fontSizes.large,\n fontWeight: p.theme.fontWeights.bold,\n\n [p.theme.mediaQueries.md]: {\n fontSize: p.theme.fontSizes.xxxlarge,\n },\n },\n}));\n\nconst DashboardNotification = styled.div({\n marginBottom: 16,\n width: '100%',\n});\n\nclass Dashboard extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n notificationQuestionnaire: null,\n notificationTrendActive: null,\n showConsultationRequestInfo: false,\n showDetailNotification: true,\n showModalQuestionnaire: false,\n showQuestionnaireExpired: false,\n showQuestionnaireUpdate: false,\n showSharemedInfo: false,\n showWelionAppWelcomeInfo: false,\n };\n\n this.aggregateNotification = this.aggregateNotification.bind(this);\n this.checkHealthRecordTypeNotifications = this.checkHealthRecordTypeNotifications.bind(this);\n this.checkQuestionnaireNotifications = this.checkQuestionnaireNotifications.bind(this);\n this.filterActivitiesWithNotes = this.filterActivitiesWithNotes.bind(this);\n this.handleClickDocument = this.handleClickDocument.bind(this);\n this.handleModalClose = this.handleModalClose.bind(this);\n this.handleModalPostpone = this.handleModalPostpone.bind(this);\n this.handleModalQuestionnairePostpone = this.handleModalQuestionnairePostpone.bind(this);\n this.handleModalSave = this.handleModalSave.bind(this);\n this.handleModalQuestionnaireSave = this.handleModalQuestionnaireSave.bind(this);\n this.showDataCompletationPercentage = this.showDataCompletationPercentage.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getDocuments,\n getEventsByFilters,\n getQuestionnaireSummaryByUser,\n getTrends,\n getUserPersonalDataByUser,\n getUserPlan,\n history,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (isAuthenticated && account && account.id && questionnaire) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n getTrends(account.id);\n getQuestionnaireSummaryByUser(account.id);\n getUserPersonalDataByUser(account.id);\n getDocuments({ userId: account.id });\n getEventsByFilters({\n owner: account.id,\n status: EventStatuses.FATTO,\n type: `${EventTypes.DIAGNOSTIC},${EventTypes.SCREENING}`,\n });\n } else {\n history.push('/consenses');\n }\n }\n\n componentDidUpdate(prevProps) {\n const {\n account,\n getAllNotifications,\n getCRequest,\n getNextEvents,\n getHealthPlanScoreReport,\n isAuthenticated,\n notifications,\n plan,\n trends,\n } = this.props;\n\n const { notificationsWithHealthRecordType } = this.state;\n\n if (isAuthenticated && plan && plan !== prevProps.plan) {\n getNextEvents({\n healthPlanId: plan.id,\n page: 0,\n size: 5,\n });\n getAllNotifications(account.id);\n getCRequest({\n healthPlanId: plan.id,\n statuses: ['PENDING', 'PROCESSED'],\n });\n getHealthPlanScoreReport(plan.id);\n }\n\n if (notifications !== prevProps.notifications) {\n this.checkQuestionnaireNotifications();\n }\n\n if ((trends !== prevProps.trends || notifications !== prevProps.notifications)\n && notificationsWithHealthRecordType && notificationsWithHealthRecordType.length > 0) {\n this.checkHealthRecordTypeNotifications();\n }\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n notificationQuestionnaire: getNotificationsBySpecificType(nextProps.notifications, [NotificationTypes.QUESTIONNAIRE_EXPIRED, NotificationTypes.QUESTIONNAIRE_UPDATE]),\n notificationsWithoutHealthRecordType: getNotificationsWithoutSpecificTypes(nextProps.notifications, [\n NotificationTypes.HEALTH_RECORD_REQUEST,\n NotificationTypes.SHAREMED_INFO,\n ]),\n notificationsWithHealthRecordType: getNotificationsBySpecificType(nextProps.notifications, NotificationTypes.HEALTH_RECORD_REQUEST),\n showConsultationRequestInfo: showNotification(nextProps.notifications, [\n NotificationTypes.CONSULTATION_REQUEST_INFO,\n NotificationTypes.CONSULTATION_REQUEST_DECLINED,\n ]),\n /* showFitprimeMonthInfo: showNotification(nextProps.notifications, [\n NotificationTypes.FITPRIME_MONTH_REQUEST,\n ]),\n showFitprimeYearInfo: showNotification(nextProps.notifications, [\n NotificationTypes.FITPRIME_YEAR_REQUEST,\n ]),\n */\n showQuestionnaireExpired: showNotification(nextProps.notifications, [\n NotificationTypes.QUESTIONNAIRE_EXPIRED,\n ]),\n showQuestionnaireUpdate: showNotification(nextProps.notifications, [\n NotificationTypes.QUESTIONNAIRE_UPDATE,\n ]),\n showSharemedInfo: false,\n showWelionAppWelcomeInfo: showNotification(nextProps.notifications, [\n NotificationTypes.WELION_APP_WELCOME,\n ]),\n };\n }\n\n handleModalPostpone(trend) {\n setReadedHealthRecordNotification(trend.key);\n this.setState({ showModal: false });\n this.checkHealthRecordTypeNotifications();\n }\n\n handleModalClose(trend) {\n const { notificationTrendActive } = this.state;\n const { account, deleteNotification, getAllNotifications } = this.props;\n if (notificationTrendActive && notificationTrendActive.healthRecordType === trend.key) {\n deleteNotification(notificationTrendActive.id).then(() => {\n this.setState({\n showModal: false,\n notificationTrendActive: null,\n });\n getAllNotifications(account.id);\n });\n }\n }\n\n handleModalSave(data) {\n const {\n account,\n addRecord,\n deleteNotification,\n getAllNotifications,\n } = this.props;\n const { notificationTrendActive } = this.state;\n\n addRecord(new Date().toISOString(), data.name[0], account.id, data.value).then(() => {\n if (notificationTrendActive && notificationTrendActive.healthRecordType === data.name[0]) {\n deleteNotification(notificationTrendActive.id).then(() => {\n this.setState({\n showModal: false,\n notificationTrendActive: null,\n });\n getAllNotifications(account.id);\n });\n }\n });\n }\n\n handleModalQuestionnairePostpone(data) {\n const { history, skipNotification } = this.props;\n\n skipNotification(data.id).then(() => {\n if (data.skip < 2) {\n localStorage.setItem('questionnaire-notification', new Date().toISOString());\n this.setState({ showModalQuestionnaire: false });\n } else {\n history.go();\n }\n });\n }\n\n handleModalQuestionnaireSave(data) {\n const { history, skipNotification, setUpdate } = this.props;\n\n const updateType = data.notificationType === NotificationTypes.QUESTIONNAIRE_EXPIRED ? 'expired' : 'update';\n skipNotification(data.id).then(() => {\n setUpdate(updateType);\n\n localStorage.setItem('questionnaire-notification', new Date().toISOString());\n this.setState({ showModalQuestionnaire: false });\n\n history.push('/consenses');\n });\n }\n\n handleClickDocument() {\n const { questionaireSummary, userPersonalData, medicalPdfCreate } = this.props;\n medicalPdfCreate({\n data: {\n ...userPersonalData,\n ...questionaireSummary,\n },\n templateId: getMedicalTemplatePDF(),\n });\n }\n\n getActivitiesCardsList(groupReportsProgress) {\n const { account, t, plan } = this.props;\n const cardsList = [];\n if (account && plan && groupReportsProgress) {\n const groupedActivitiesByGroupName = groupBy(plan.activities, 'activityGroup.priority');\n\n Object.keys(groupedActivitiesByGroupName).forEach((key) => {\n const label = t(`enums:activity group.${groupedActivitiesByGroupName[key][0].activityGroup.name}`);\n const area = groupReportsProgress[label];\n cardsList.push({\n title: label,\n score: area ? : null,\n icon: ActivityGroupIcon[groupedActivitiesByGroupName[key][0].activityGroup.name],\n });\n });\n }\n return cardsList;\n }\n\n getLinksList() {\n const { t } = this.props;\n return [\n {\n icon: 'MedicalConsultation',\n label: t('links.item 1'),\n link: '/medical-consultation',\n },\n {\n icon: 'PurchaseDeliveryDrugs',\n label: t('links.item 2'),\n link: '/drugs',\n },\n {\n icon: 'AccessHealthNetwork',\n label: t('links.item 3'),\n link: '/health-network',\n },\n ];\n }\n\n checkHealthRecordTypeNotifications() {\n const { trends } = this.props;\n const { notificationsWithHealthRecordType } = this.state;\n if (notificationsWithHealthRecordType && notificationsWithHealthRecordType.length > 0) {\n const trendsMap = mapTrends(trends);\n notificationsWithHealthRecordType.forEach((nht) => {\n if (!hasReadedHealthRecordNotification(nht.healthRecordType)) {\n this.setState({\n addTrend: trendsMap[nht.healthRecordType],\n notificationTrendActive: nht,\n showModal: true,\n });\n }\n });\n }\n }\n\n checkQuestionnaireNotifications() {\n const { notificationQuestionnaire } = this.state;\n\n const alreadySkipped = localStorage.getItem('questionnaire-notification');\n if (notificationQuestionnaire && notificationQuestionnaire.length > 0 && !alreadySkipped) {\n this.setState({ showModalQuestionnaire: true });\n }\n }\n\n showDataCompletationPercentage() {\n const {\n questionaireSummary,\n userPersonalData,\n t,\n theme,\n } = this.props;\n const totalData = questionaireSummary && userPersonalData ? Object.values(questionaireSummary).length + Object.values(userPersonalData).length : 19;\n\n let countNullableQS = 0;\n let countNullableUD = 0;\n\n if (questionaireSummary) {\n Object.values(questionaireSummary).forEach((elem) => {\n if (!elem) {\n countNullableQS += 1;\n }\n });\n } else {\n countNullableQS = 10;\n }\n\n if (userPersonalData) {\n Object.values(userPersonalData).forEach((elem) => {\n if (!elem) {\n countNullableUD += 1;\n }\n });\n } else {\n countNullableUD = 9;\n }\n\n const percentage = ((totalData - (countNullableQS + countNullableUD)) / totalData) * 100;\n\n const renderCustomizedLabel = () => (\n \n \n \n \n \n );\n\n return (\n \n \n \n \n );\n }\n\n filterActivitiesWithNotes() {\n const { eventsByFilters } = this.props;\n let countNotes = 0;\n\n for (let index = 0; index < eventsByFilters.length; index += 1) {\n if (eventsByFilters[index].note && eventsByFilters[index].note !== '') {\n countNotes += 1;\n }\n }\n\n return `${countNotes}`;\n }\n\n aggregateNotification(value) {\n this.setState({\n showDetailNotification: !value,\n });\n }\n\n render() {\n const {\n account,\n consultationRequests,\n consultationRequestsIsFetching,\n healthPlanScoreReport,\n history,\n isFetching,\n isFetchingDeleteNotification,\n isFetchingDocuments,\n isFetchingEventsByFilters,\n isFetchingHealthPlanScoreReport,\n isFetchingNotifications,\n nextEvents,\n plan,\n questionaireSummaryIsFetching,\n t,\n theme,\n totalUserDocuments,\n userPersonalDataIsFetching,\n } = this.props;\n\n const {\n addTrend,\n notificationQuestionnaire,\n notificationsWithoutHealthRecordType,\n showConsultationRequestInfo,\n showDetailNotification,\n showModal,\n showModalQuestionnaire,\n showQuestionnaireExpired,\n showQuestionnaireUpdate,\n showSharemedInfo,\n showWelionAppWelcomeInfo,\n } = this.state;\n\n if (!account || isFetching || !plan || isFetchingNotifications || isFetchingDeleteNotification || isFetchingHealthPlanScoreReport) {\n return null;\n }\n\n const groupReportsProgress = plan && healthPlanScoreReport && healthPlanScoreReport.groupReports ? calculateGroupReportsProgress(plan, healthPlanScoreReport.groupReports, t) : null;\n\n const groupActivitiesCards = this.getActivitiesCardsList(groupReportsProgress);\n const linksCards = this.getLinksList();\n\n const renderCustomizedLabel = (now, max) => (\n \n \n \n {now} \n \n / \n {max}\n \n \n \n \n );\n\n return (\n \n \n \n \n\n \n \n\n \n\n {!isFetchingNotifications && notificationsWithoutHealthRecordType && notificationsWithoutHealthRecordType.length > 0 ? (\n \n\n \n this.aggregateNotification(value)}\n showAggregateDropdownIcon={showWelionAppWelcomeInfo || showConsultationRequestInfo || showSharemedInfo}\n />\n \n\n {showDetailNotification ? (\n <>\n {showQuestionnaireExpired ? (\n \n \n \n ) : null}\n\n {showQuestionnaireUpdate ? (\n \n \n \n ) : null}\n\n {showWelionAppWelcomeInfo ? (\n \n \n \n ) : null}\n\n {showConsultationRequestInfo ? (\n \n \n \n ) : null}\n\n {showSharemedInfo ? (\n \n \n \n ) : null}\n >\n ) : null}\n
\n ) : null}\n\n \n \n \n\n \n\n {healthPlanScoreReport && healthPlanScoreReport.cluster ? (\n \n \n\n \n
\n ) : null}\n \n\n \n {healthPlanScoreReport && healthPlanScoreReport.cluster && healthPlanScoreReport.score\n ? (\n \n \n \n )\n : null}\n\n \n
\n\n \n {groupActivitiesCards && groupActivitiesCards.length > 0\n ? groupActivitiesCards.map((ga) => (\n \n \n \n \n {ga.icon ? : null}\n {ga.title} \n
\n \n \n {ga.score}
\n \n \n \n ))\n : null}\n
\n\n \n \n \n \n \n \n\n \n \n \n\n {(showQuestionnaireExpired || showQuestionnaireUpdate) && (\n \n this.handleModalQuestionnaireSave(notificationQuestionnaire ? notificationQuestionnaire[0] : null)}\n small\n text={t('enums:notifications templates.QUESTIONNAIRE_cta')}\n variant=\"primary\"\n width={{ _: '100%', md: 'auto!important' }}\n />\n \n )}\n
\n\n \n \n {groupReportsProgress ? : null}\n \n {healthPlanScoreReport && healthPlanScoreReport.activitiesCount > 0 ? (\n <>\n \n renderCustomizedLabel(healthPlanScoreReport.activitiesDone, healthPlanScoreReport.activitiesCount)}\n type=\"progress-pie\"\n />\n renderCustomizedLabel(healthPlanScoreReport.activitiesDone, healthPlanScoreReport.activitiesCount)}\n type=\"progress-pie\"\n />\n \n \n \n renderCustomizedLabel(healthPlanScoreReport.activitiesOngoing, healthPlanScoreReport.activitiesCount)}\n type=\"progress-pie\"\n />\n renderCustomizedLabel(healthPlanScoreReport.activitiesOngoing, healthPlanScoreReport.activitiesCount)}\n type=\"progress-pie\"\n />\n \n \n >\n ) : null}\n
\n\n \n \n \n \n\n {(showQuestionnaireExpired || showQuestionnaireUpdate) && (\n \n this.handleModalQuestionnaireSave(notificationQuestionnaire ? notificationQuestionnaire[0] : null)}\n small\n text={t('enums:notifications templates.QUESTIONNAIRE_cta')}\n variant=\"primary\"\n width={{ _: '100%', md: 'auto!important' }}\n />\n \n )}\n
\n \n\n {!consultationRequestsIsFetching && consultationRequests ? (\n \n \n \n ) : null}\n
\n\n \n \n \n
\n \n \n \n \n \n \n
\n
\n \n {nextEvents && nextEvents.length > 0\n ? nextEvents.map((na) => {\n const iconsColor = na.activityId === null && na.activityGroupId === null ? theme.colors.GRAPH3 : theme.colors.PRIMARY2;\n const startDate = new Date(na.startDate);\n const time = startDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n const status = getEventInfo(na, t, false);\n\n return (\n \n \n {EventTypeOutlineIcon[na.type] ? (\n \n ) : null}\n \n \n \n \n
\n \n );\n })\n : null}\n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n \n \n \n \n \n \n
\n
\n\n
{!questionaireSummaryIsFetching && !userPersonalDataIsFetching ? this.showDataCompletationPercentage() : null}
\n\n
\n\n {!isFetchingEventsByFilters ? (\n <>\n
\n \n \n \n \n
\n \n
\n
\n >\n ) : null}\n {!isFetchingDocuments ? (\n <>\n
\n \n \n \n \n
\n \n
\n
\n >\n ) : null}\n
\n \n \n \n
\n\n
\n \n \n \n
\n
\n \n
\n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' && (\n \n \n \n\n \n \n\n \n \n history.push('/claims-management?tab=refunds')}>\n \n {t('claims.item 1')} \n \n \n \n history.push('/claims-management?tab=performance')}>\n \n {t('claims.item 2')} \n \n \n \n
\n )}\n\n \n {linksCards && linksCards.length > 0\n ? linksCards.map((l) => (\n \n \n history.push(l.link)}>\n {l.icon ? : null}\n {l.label} \n \n \n \n ))\n : null}\n
\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n consultationRequests: state.consultationRequests.data,\n consultationRequestsIsFetching: state.consultationRequests.isFetching,\n eventsByFilters: state.events.eventsByFilters.data,\n healthPlanScoreReport: state.users.fetchHealthPlanScoreReport.data,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n isFetchingDeleteNotification: state.notifications.deleteNotifications.isFetching,\n isFetchingDocuments: state.documents.documentByUser.isFetching,\n isFetchingEventsByFilters: state.events.eventsByFilters.isFetching,\n isFetchingHealthPlanScoreReport: state.users.fetchHealthPlanScoreReport.isFetching,\n isFetchingNotifications: state.notifications.allNotifications.isFetching,\n nextEvents: state.events.nextEvents.data,\n notifications: state.notifications.allNotifications.data,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n questionaireSummary: state.questionnaires.fetchQuestionnaireSummary.data,\n questionaireSummaryIsFetching: state.questionnaires.fetchQuestionnaireSummary.isFetching,\n totalUserDocuments: state.documents.documentByUser.length,\n trends: state.trends.fetchTrends.data,\n userPersonalData: state.medicalRecords.fetchUserPersonalData.data,\n userPersonalDataIsFetching: state.medicalRecords.fetchUserPersonalData.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n addRecord: (instant, recordType, userId, value) => dispatch(\n createRecord({\n instant,\n recordType,\n userId,\n value,\n }),\n ),\n deleteNotification: (id) => dispatch(deleteNotifications(id)),\n getAllNotifications: (id) => dispatch(fetchAllNotifications(id)),\n getCRequest: (params) => dispatch(fetchConsultationRequest(params)),\n getDocuments: (params) => dispatch(fetchDocumentsByUser(params)),\n getEventsByFilters: (params) => dispatch(fetchEventsByFilters(params)),\n getHealthPlanScoreReport: (id) => dispatch(fetchHealthPlanScoreReport(id)),\n getNextEvents: (params) => dispatch(fetchNextEvents(params)),\n getQuestionnaireSummaryByUser: (userId) => dispatch(fetchQuestionnaireSummary({ userId })),\n getTrends: (userId, type) => dispatch(fetchTrends({ type, userId })),\n getUserPersonalDataByUser: (userId) => dispatch(fetchUserPersonalData({ userId })),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n medicalPdfCreate: (request) => dispatch(medicalPdfGenerate(request)),\n setUpdate: (value) => dispatch(setUpdateQuestionnaire(value)),\n skipNotification: (id) => dispatch(skipNotifications(id)),\n});\n\nDashboard.defaultProps = {\n account: null,\n addRecord: null,\n consultationRequests: null,\n consultationRequestsIsFetching: null,\n deleteNotification: null,\n eventsByFilters: null,\n getAllNotifications: null,\n getCRequest: null,\n getDocuments: null,\n getEventsByFilters: null,\n getHealthPlanScoreReport: null,\n getNextEvents: null,\n getQuestionnaireSummaryByUser: null,\n getTrends: null,\n getUserPersonalDataByUser: null,\n getUserPlan: null,\n healthPlanScoreReport: null,\n history: null,\n isAuthenticated: false,\n isFetching: null,\n isFetchingDeleteNotification: null,\n isFetchingDocuments: true,\n isFetchingEventsByFilters: true,\n isFetchingHealthPlanScoreReport: null,\n isFetchingNotifications: null,\n medicalPdfCreate: null,\n nextEvents: null,\n notifications: [],\n plan: null,\n questionnaire: null,\n questionaireSummary: null,\n questionaireSummaryIsFetching: true,\n skipNotification: null,\n setUpdate: null,\n t: null,\n theme: null,\n totalUserDocuments: 0,\n trends: null,\n userPersonalData: null,\n userPersonalDataIsFetching: true,\n};\n\nDashboard.propTypes = {\n account: PropTypes.shape(),\n addRecord: PropTypes.func,\n consultationRequests: PropTypes.arrayOf(PropTypes.shape()),\n consultationRequestsIsFetching: PropTypes.bool,\n deleteNotification: PropTypes.func,\n eventsByFilters: PropTypes.arrayOf(PropTypes.shape()),\n getAllNotifications: PropTypes.func,\n getCRequest: PropTypes.func,\n getDocuments: PropTypes.func,\n getEventsByFilters: PropTypes.func,\n getHealthPlanScoreReport: PropTypes.func,\n getNextEvents: PropTypes.func,\n getQuestionnaireSummaryByUser: PropTypes.func,\n getTrends: PropTypes.func,\n getUserPersonalDataByUser: PropTypes.func,\n getUserPlan: PropTypes.func,\n healthPlanScoreReport: PropTypes.shape(),\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n isFetchingDeleteNotification: PropTypes.bool,\n isFetchingDocuments: PropTypes.bool,\n isFetchingEventsByFilters: PropTypes.bool,\n isFetchingHealthPlanScoreReport: PropTypes.bool,\n isFetchingNotifications: PropTypes.bool,\n medicalPdfCreate: PropTypes.func,\n nextEvents: PropTypes.arrayOf(PropTypes.shape()),\n notifications: PropTypes.arrayOf(PropTypes.shape()),\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n questionaireSummary: PropTypes.shape(),\n questionaireSummaryIsFetching: PropTypes.bool,\n skipNotification: PropTypes.func,\n setUpdate: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n totalUserDocuments: PropTypes.number,\n trends: PropTypes.arrayOf(PropTypes.shape()),\n userPersonalData: PropTypes.shape(),\n userPersonalDataIsFetching: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.dashboard', 'enums', 'portale.components', 'portale.preventionpath'])(withTheme(Dashboard))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport icon from '../../../assets/img/wellion-pc-icon.png';\nimport termsOfUseDoc from '../../../assets/docs/TermsOfUse-Drugs.pdf';\n\nimport {\n Button, CartoonSvg, Container, Text,\n} from '../../../components';\n\nimport { getPharmapLink, getCompany } from '../../../utils';\n\nconst CDrugs = styled.div((p) => ({\n '.first-section': {\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 50px',\n },\n\n '.container-description': {\n [p.theme.mediaQueries.md]: {\n padding: '0px 30px 0px 15px',\n },\n },\n\n '.container-image': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'center',\n margin: '0',\n\n '.custom-rounded': {\n alignItems: 'center',\n background: p.theme.colors.LIGHTBLUE,\n borderRadius: '50%',\n display: 'flex',\n height: '280px',\n justifyContent: 'center',\n minHeight: '280px',\n minWidth: '280px',\n width: '280px',\n\n [p.theme.mediaQueries.md]: {\n height: '360px',\n minHeight: '360px',\n minWidth: '360px',\n width: '360px',\n },\n\n '.icon': {\n backgroundImage: `url(${icon})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 'calc(100% - 90px)',\n width: '100%',\n },\n svg: {\n width: '60%',\n },\n },\n },\n },\n\n '.second-section': {\n padding: '0px 0px 50px',\n textAlign: 'center',\n\n [p.theme.mediaQueries.md]: {\n padding: '0px 20px 100px',\n },\n\n '.container-button': {\n padding: '60px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '80px 0px 70px',\n },\n },\n },\n}));\n\nconst Drugs = (props) => {\n const { theme } = props;\n\n return (\n \n \n
\n \n \n \n \n
\n \n \n \n \n \n \n \n {getCompany() === 'bcc' || getCompany() === 'vera' ?
:
}\n
\n \n
\n \n
\n\n \n \n \n \n \n \n \n \n
\n \n
\n \n );\n};\n\nDrugs.defaultProps = {\n theme: null,\n};\n\nDrugs.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.drugs', 'translation'])(withTheme(Drugs));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { isEmpty } from 'lodash';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n Loading,\n MaterialDesignInput,\n Modal,\n SelectInput,\n Text,\n} from '../../../components';\n\nimport { editQuestionnaire, fetchQuestionnaire } from '../../../reducers/questionnaires/actions';\n\nconst QuestionnaireData = styled.div((p) => ({\n padding: '24px 0',\n '.row': {\n '.col-md-6.col-12 > div': {\n marginBottom: p.theme.verticalSpacing.p32,\n },\n },\n}));\n\nclass EditProfile extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n disableSubmit: true,\n questionnaireDataForm: {},\n questionnaireOriginalData: {},\n showError: false,\n showModal: false,\n };\n\n this.handleChangeQuestionnaireData = this.handleChangeQuestionnaireData.bind(this);\n this.handleSubmitAdditionalData = this.handleSubmitAdditionalData.bind(this);\n this.handleShowModal = this.handleShowModal.bind(this);\n this.handleShowError = this.handleShowError.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getQuestionnaireByUser,\n isAuthenticated,\n questionnaire,\n questionnaireIsFetching,\n } = this.props;\n\n if (account && account.id && isAuthenticated && !questionnaireIsFetching\n && (questionnaire === null || questionnaire === undefined)) {\n getQuestionnaireByUser();\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const hasAllData = nextState.questionnaireDataForm && Object.keys(nextState.questionnaireDataForm).filter((x) => x !== null).length === 5;\n let hasDifferentValues = false;\n let originalData = {};\n\n const getOptionObjFromQuestionnaire = (codeQuestion) => {\n const { questionnaire } = nextProps;\n const question = questionnaire.questions.find((q) => q.code === codeQuestion);\n const selectedAnswer = question.answers.find((a) => a.selected);\n return selectedAnswer.code;\n };\n\n const getValueFromQuestionnaire = (codeQuestion) => {\n const { questionnaire } = nextProps;\n const question = questionnaire.questions.find((q) => q.code === codeQuestion);\n const selectedAnswer = question.answers.find((a) => a.selected);\n return selectedAnswer.value;\n };\n\n Object.keys(nextState.questionnaireDataForm).forEach((field) => {\n if (nextState.questionnaireDataForm[field] !== nextState.questionnaireOriginalData[field]) {\n hasDifferentValues = true;\n }\n });\n\n if ((!nextProps.questionnaireIsFetching && nextProps.questionnaire)\n && (Object.entries(nextState.questionnaireDataForm).length === 0\n || Object.entries(nextState.questionnaireOriginalData).length === 0)\n ) {\n originalData = {\n birthDate: getValueFromQuestionnaire('T1D2'),\n gender: getOptionObjFromQuestionnaire('T1D1'),\n height: getValueFromQuestionnaire('T2D2'),\n sport: getOptionObjFromQuestionnaire('T4D1'),\n weight: getValueFromQuestionnaire('T2D1'),\n };\n }\n\n return {\n disableSubmit: !hasAllData || !hasDifferentValues,\n questionnaireDataForm: Object.entries(nextState.questionnaireDataForm).length === 0 ? { ...originalData } : { ...nextState.questionnaireDataForm },\n questionnaireOriginalData: Object.entries(nextState.questionnaireOriginalData).length === 0 ? { ...originalData } : { ...nextState.questionnaireOriginalData },\n };\n }\n\n handleChangeQuestionnaireData(e) {\n const { questionnaireDataForm } = this.state;\n let name;\n let value;\n\n if (e.target) {\n name = e.target.name;\n value = e.target.value;\n } else {\n name = e.name;\n value = e.value;\n }\n\n if (value && value !== '') {\n questionnaireDataForm[name] = value;\n } else {\n delete questionnaireDataForm[name];\n }\n\n this.setState({ questionnaireDataForm: { ...questionnaireDataForm } });\n }\n\n handleSubmitAdditionalData() {\n const { questionnaireDataForm } = this.state;\n const { saveExistingQuestionnaire, history } = this.props;\n let modifiedQuestionnaire;\n Object.keys(questionnaireDataForm).forEach((field) => {\n switch (field) {\n case 'birthDate':\n modifiedQuestionnaire = this.setValueFromQuestionnaire('T1D2', questionnaireDataForm.birthDate);\n break;\n case 'gender':\n modifiedQuestionnaire = this.setOptionObjFromQuestionnaire('T1D1', questionnaireDataForm.gender);\n break;\n case 'height':\n modifiedQuestionnaire = this.setValueFromQuestionnaire('T2D2', questionnaireDataForm.height);\n break;\n case 'sport':\n modifiedQuestionnaire = this.setOptionObjFromQuestionnaire('T4D1', questionnaireDataForm.sport);\n break;\n case 'weight':\n modifiedQuestionnaire = this.setValueFromQuestionnaire('T2D1', questionnaireDataForm.weight);\n break;\n default:\n break;\n }\n });\n\n this.handleShowModal(false);\n saveExistingQuestionnaire(modifiedQuestionnaire).then((response) => {\n if (response.error) {\n this.handleShowError(true);\n } else {\n history.push('/home');\n }\n });\n }\n\n handleShowModal(value) {\n this.setState({\n showModal: value,\n });\n }\n\n handleShowError(value) {\n this.setState({\n showError: value,\n });\n }\n\n setOptionObjFromQuestionnaire(codeQuestion, codeAnswer) {\n const { questionnaire } = this.props;\n\n const question = questionnaire.questions.find((q) => q.code === codeQuestion);\n question.answers.forEach((answer) => {\n answer.selected = false;\n });\n\n const selectedAnswer = question.answers.find((a) => a.code === codeAnswer);\n selectedAnswer.selected = true;\n return { ...questionnaire };\n }\n\n setValueFromQuestionnaire(codeQuestion, value) {\n const { questionnaire } = this.props;\n\n const question = questionnaire.questions.find((q) => q.code === codeQuestion);\n const selectedAnswer = question.answers.find((a) => a.selected);\n selectedAnswer.value = value;\n return { ...questionnaire };\n }\n\n render() {\n const {\n questionnaireIsFetching,\n sendingCreateQuestionnaire,\n t,\n theme,\n } = this.props;\n\n const {\n disableSubmit,\n questionnaireDataForm,\n questionnaireOriginalData,\n showError,\n showModal,\n } = this.state;\n\n const genderOptions = [\n {\n label: t('portale.editprofile:form.gender male'),\n value: 'R2',\n },\n {\n label: t('portale.editprofile:form.gender female'),\n value: 'R1',\n },\n ];\n\n const sportOptions = [\n {\n label: t('portale.questionnaire:questions.SECTION4_Q1 0034'),\n value: 'R1',\n },\n {\n label: t('portale.questionnaire:questions.SECTION4_Q1 0035'),\n value: 'R2',\n },\n {\n label: t('portale.questionnaire:questions.SECTION4_Q1 0036'),\n value: 'R3',\n },\n {\n label: t('portale.questionnaire:questions.SECTION4_Q1 0037'),\n value: 'R4',\n },\n ];\n\n const getOptionObj = (value, options) => options.find((o) => o.value === value);\n\n if (questionnaireIsFetching || isEmpty(questionnaireOriginalData) || sendingCreateQuestionnaire) {\n return (\n \n );\n }\n\n return (\n \n this.handleShowError(false)}\n show={showError}\n showModalFooter={false}\n size=\"md\"\n subtitle=\"portale.editprofile:error modal.subtitle\"\n title=\"portale.editprofile:error modal.title\"\n variant=\"pb\"\n />\n\n this.handleShowModal(false)}\n onSave={this.handleSubmitAdditionalData}\n saveButtonLabel=\"portale.editprofile:confirm modal.save button\"\n show={showModal}\n showModalFooter\n size=\"md\"\n subtitle={null}\n title={null}\n variant=\"pb\"\n >\n <>\n \n \n >\n \n\n \n \n \n \n
\n \n \n \n \n \n
\n\n {questionnaireOriginalData && (\n \n \n \n \n\n \n\n \n\n \n\n \n \n
\n \n \n this.handleShowModal(true)}\n text={t('portale.editprofile:form.button')}\n variant=\"primary\"\n width={{ _: '100%', md: 'calc(50% - 15px)' }}\n />\n \n
\n \n )}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n questionnaireIsFetching: state.questionnaires.fetchQuestionnaire.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getQuestionnaireByUser: () => dispatch(fetchQuestionnaire()),\n saveExistingQuestionnaire: (request) => dispatch(editQuestionnaire(request)),\n});\n\nEditProfile.defaultProps = {\n account: null,\n getQuestionnaireByUser: null,\n history: null,\n isAuthenticated: null,\n questionnaire: null,\n questionnaireIsFetching: true,\n saveExistingQuestionnaire: null,\n sendingCreateQuestionnaire: null,\n t: null,\n theme: null,\n};\n\nEditProfile.propTypes = {\n account: PropTypes.shape(),\n getQuestionnaireByUser: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n questionnaire: PropTypes.shape(),\n questionnaireIsFetching: PropTypes.bool,\n saveExistingQuestionnaire: PropTypes.func,\n sendingCreateQuestionnaire: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.editprofile', 'portale.questionnaire'])(withTheme(EditProfile))));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\n\nimport moment from 'moment';\nimport styled, { withTheme } from 'styled-components';\n\nimport { editEvent as editEventR, fetchEvent } from '../../../reducers/events/actions';\n\nimport {\n Button,\n DateInput,\n GoBack,\n Loading,\n MaterialDesignInput,\n MaterialDesignTextarea,\n Text,\n TimeInput,\n} from '../../../components';\n\nimport InputSearch from '../../../components/portale/Questionnaire/InputSearch';\n\nimport { EventEditTypes, EventStatuses, EventTypes } from '../../../enums';\n\nconst Container = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: 20,\n\n [p.theme.mediaQueries.md]: {\n paddingTop: 40,\n },\n}));\n\nconst ContainerButton = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flex-end',\n marginTop: 20,\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n marginBottom: 20,\n },\n}));\n\nconst CInputSearch = styled.div({\n Form: {\n margin: 0,\n maxWidth: '1000px',\n width: 'auto',\n },\n});\n\nconst ContainerText = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: 20,\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 0',\n },\n}));\n\nconst Content = styled.div((p) => ({\n margin: 'auto',\n\n [p.theme.mediaQueries.md]: {\n width: '50%',\n },\n}));\n\nconst Divider = styled.div((p) => ({\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n margin: '40px 0',\n width: '100%',\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n\n return tmp;\n }, {});\n};\n\nclass EventEdit extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n date: null,\n disabled: false,\n maxTime: null,\n minTime: null,\n };\n\n this.goBack = this.goBack.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleChangeDate = this.handleChangeDate.bind(this);\n this.handleChangeComment = this.handleChangeComment.bind(this);\n this.handleChangeEventTitle = this.handleChangeEventTitle.bind(this);\n this.handleChangeEventDesc = this.handleChangeEventDesc.bind(this);\n this.handleChangeTime = this.handleChangeTime.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.onChangeInputSearch = this.onChangeInputSearch.bind(this);\n }\n\n componentDidMount() {\n const { getEvent, location, match } = this.props;\n\n const { id } = match.params;\n if (id) {\n getEvent(id, getParams(location.search));\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const queryParams = getParams(nextProps.location.search);\n const defaultDate = new Date(queryParams.startDate) < new Date()\n ? new Date(new Date().setHours(new Date().getHours() + 1))\n : new Date(queryParams.startDate);\n\n const date = !nextProps.isFetchingEvent && !nextState.date && nextProps.location\n && nextProps.location.search && queryParams.startDate\n ? defaultDate\n : new Date(nextState.date);\n\n const now = moment();\n const minTime = date.getDate() === new Date().getDate()\n ? now.hours(new Date().getHours() + 1).minutes(new Date().getMinutes()).toDate()\n : null;\n const maxTime = date.getDate() === new Date().getDate()\n ? now.hours(23).minutes(45).toDate()\n : null;\n\n let comment;\n let eventLocation;\n let title;\n let description;\n\n if (!nextProps.isFetchingEvent && nextProps.event\n && queryParams.startDate === nextProps.event.startDate) {\n comment = !nextState.comment ? nextProps.event.comment : nextState.comment;\n eventLocation = !nextState.eventLocation ? nextProps.event.location : nextState.eventLocation;\n title = !nextState.title ? nextProps.event.title : nextState.title;\n description = !nextState.description ? nextProps.event.description : nextState.description;\n }\n\n const booking = getParams(nextProps.location.search).type === EventEditTypes.booking;\n const reminder = getParams(nextProps.location.search).type === EventEditTypes.reminder;\n const disabledBooking = !nextProps.isFetchingEvent && booking\n && (!eventLocation || !title || !date)\n ? true\n : nextState.disabled;\n const disabledReminder = !nextProps.isFetchingEvent && reminder\n && (!title || !date)\n ? true\n : nextState.disabled;\n\n const disabled = booking ? disabledBooking : disabledReminder;\n\n return {\n comment,\n date,\n description,\n disabled,\n eventLocation,\n maxTime,\n minTime,\n title,\n };\n }\n\n handleChangeDate(event) {\n const { date } = this.state;\n\n if (event.target && event.target.value) {\n const value = moment(event.target.value);\n const now = moment();\n const minTime = value.get('date') === now.get('date')\n ? now.hours(new Date().getHours() + 1).minutes(new Date().getMinutes()).toDate()\n : null;\n const maxTime = value.get('date') === now.get('date')\n ? now.hours(23).minutes(45).toDate()\n : null;\n\n date.setFullYear(value.get('year'));\n date.setMonth(value.get('month'));\n date.setDate(value.get('date'));\n if (minTime) {\n date.setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds());\n }\n\n this.setState({\n date,\n disabled: false,\n maxTime,\n minTime,\n });\n } else {\n this.setState({ disabled: true });\n }\n }\n\n handleChangeTime(event) {\n const { date, minTime } = this.state;\n if (event.target && event.target.value) {\n const value = moment(event.target.value);\n\n date.setHours(value.get('hour'));\n date.setMinutes(value.get('minute'));\n date.setSeconds(value.get('second'));\n date.setMilliseconds(value.get('millisecond'));\n\n if (date < minTime) {\n this.setState({ date, disabled: true });\n } else {\n this.setState({ date, disabled: false });\n }\n } else {\n this.setState({ disabled: true });\n }\n }\n\n handleChangeComment(event) {\n if (event) {\n this.setState({ comment: event.value, disabled: false });\n }\n }\n\n handleChangeEventTitle(input) {\n if (input && input.value !== '') {\n this.setState({ title: input.value, disabled: false });\n } else {\n this.setState({ disabled: true });\n }\n }\n\n handleChangeEventDesc(input) {\n if (input) {\n this.setState({ description: input.value });\n }\n }\n\n handleCancel() {\n this.goBack();\n }\n\n handleSubmit() {\n const {\n editEvent,\n event,\n history,\n location,\n } = this.props;\n\n const {\n comment,\n date,\n description,\n eventLocation,\n title,\n } = this.state;\n\n const booking = getParams(location.search).type === EventEditTypes.booking;\n const duration = moment(event.endDate).diff(moment(event.startDate));\n const locationSearch = location && location.search;\n\n const startDate = date;\n const endDate = moment(date)\n .add(duration, 'ms')\n .toDate();\n\n const tmp = {\n ...event,\n\n allDay: false, // booking ? false : all,\n title,\n description,\n endDate,\n comment,\n location: eventLocation,\n startDate,\n status: booking ? EventStatuses.PRENOTATO : event.status,\n };\n\n editEvent(event.idParent, getParams(locationSearch), tmp).then((response) => {\n const editedEventResponse = response.event;\n history.push(`/event/${editedEventResponse.idParent}?startDate=${editedEventResponse.startDate}`);\n });\n }\n\n onChangeInputSearch(event) {\n if (event) {\n this.setState({\n eventLocation: event,\n disabled: false,\n });\n } else {\n this.setState({ disabled: true });\n }\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n render() {\n const {\n comment,\n date,\n description,\n disabled,\n eventLocation,\n maxTime,\n minTime,\n title,\n } = this.state;\n\n const {\n event,\n isFetchingEvent,\n location,\n t,\n theme,\n } = this.props;\n\n const booking = getParams(location.search).type === EventEditTypes.booking;\n const reminder = getParams(location.search).type === EventEditTypes.reminder;\n\n if (event === null || event === undefined) {\n return null;\n }\n\n const editReminderPersonalEvent = event.type === EventTypes.DIAGNOSTIC\n && event.activityId === null && event.activityGroupId === null;\n\n return (\n \n \n \n\n {!isFetchingEvent ? (\n \n \n {editReminderPersonalEvent ? (\n <>\n \n \n >\n ) : (\n <>\n \n \n >\n )}\n\n \n\n \n\n {booking && (\n \n \n \n )}\n\n {date ? (\n \n \n \n \n \n \n \n
\n ) : null}\n\n {!editReminderPersonalEvent && (\n \n )}\n \n \n ) : null}\n\n \n \n\n \n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n event: state.events.event.event,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n editEvent: (id, params, event) => dispatch(editEventR({ id, ...params, event })),\n getEvent: (id, params) => dispatch(fetchEvent({ id, ...params })),\n});\n\nEventEdit.defaultProps = {\n editEvent: null,\n event: null,\n getEvent: null,\n history: null,\n isFetchingEvent: false,\n location: null,\n match: null,\n t: null,\n theme: null,\n};\n\nEventEdit.propTypes = {\n editEvent: PropTypes.func,\n event: PropTypes.shape(),\n getEvent: PropTypes.func,\n history: PropTypes.shape(),\n isFetchingEvent: PropTypes.bool,\n location: PropTypes.shape(),\n match: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTranslation(['portale.event', 'enums'])(withTheme(EventEdit))));\n","import React from 'react';\n\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { findIndex } from 'lodash';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchEventsByActivity } from '../../../reducers/events/actions';\nimport { fetchUserPlan } from '../../../reducers/users/actions';\n\nimport {\n Container,\n Text,\n Pagination,\n GoBack,\n} from '../../../components';\nimport { EventsOfActivity } from '../../../components/portale';\nimport { EventStatuses } from '../../../enums';\n\nconst CEventsByActivity = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 92px',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 102px',\n },\n\n '.pagination': {\n bottom: 10,\n left: 0,\n margin: 0,\n padding: '32px 0px 20px 16px',\n position: 'absolute',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n justifyContent: 'center',\n },\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.PRIMARY1,\n },\n },\n}));\n\nclass EventsByActivity extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n page: 0,\n };\n\n this.getEvents = this.getEvents.bind(this);\n this.goBack = this.goBack.bind(this);\n this.handlePageSelect = this.handlePageSelect.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { plan } = this.props;\n const { page } = this.state;\n if ((plan && plan !== prevProps.plan) || page !== prevState.page) {\n this.getEvents();\n }\n }\n\n getEvents() {\n const {\n getEventsByActivity,\n limit,\n match,\n plan,\n } = this.props;\n const { page } = this.state;\n\n if (match && match.params && match.params.activityId) {\n const params = {\n activityId: match.params.activityId,\n healthPlanId: plan.id,\n page,\n size: limit,\n statuses: `${EventStatuses.PRENOTATO},${EventStatuses.FATTO},${EventStatuses.DRAFT},${EventStatuses.SALTATO}`,\n };\n\n getEventsByActivity(params);\n }\n }\n\n handlePageSelect(page) {\n this.setState({ page });\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n render() {\n const {\n eventsByActivity,\n eventsByActivityLength,\n isFetching,\n limit,\n match,\n plan,\n t,\n theme,\n } = this.props;\n\n const { page } = this.state;\n\n if (isFetching || !plan || !eventsByActivity || eventsByActivity.length === 0) {\n return null;\n }\n\n const activityIndex = findIndex(plan.activities, (a) => `${a.id}` === match.params.activityId);\n\n return (\n \n \n \n \n \n\n \n \n \n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n eventsByActivity: state.events.eventsByActivity.data,\n eventsByActivityLength: state.events.eventsByActivity.length,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n limit: state.settings.limit,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getEventsByActivity: (params) => dispatch(fetchEventsByActivity(params)),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nEventsByActivity.defaultProps = {\n account: null,\n eventsByActivity: [],\n eventsByActivityLength: null,\n getEventsByActivity: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: null,\n isFetching: null,\n limit: 24,\n match: null,\n plan: null,\n questionnaire: null,\n t: null,\n theme: null,\n};\n\nEventsByActivity.propTypes = {\n account: PropTypes.shape(),\n eventsByActivity: PropTypes.arrayOf(PropTypes.shape()),\n eventsByActivityLength: PropTypes.number,\n getEventsByActivity: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n limit: PropTypes.number,\n match: PropTypes.shape(),\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['translation', 'portale.components', 'portale.preventionpath'])(EventsByActivity))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { Row, Col } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport { Container, Text, CartoonSvg } from '../../../components';\nimport { AgencyContact, CustomerServices } from '../../../components/portale';\n\nimport { fetchUserPlan } from '../../../reducers/users/actions';\n\nimport { getCompany } from '../../../utils';\n\nconst CHealthCoach = styled.div((p) => ({\n paddingTop: 30,\n '.container-benefits': {\n '.b-description': {\n clear: 'both',\n },\n\n '.b-title': {\n img: {\n [p.theme.mediaQueries.md]: {\n minWidth: 50,\n width: 50,\n },\n },\n },\n\n '.icon': {\n minWidth: 64,\n },\n },\n '.carousel-inner': {\n minHeight: 300,\n },\n}));\n\nconst RowMarginTop = styled(Row)({\n marginTop: '50px',\n position: 'relative',\n});\n\nconst SeparatorV = styled.div((p) => ({\n borderLeft: `1px solid ${p.theme.colors.PRIMARY1}`,\n bottom: '-17px',\n height: 48,\n left: '50%',\n margin: '0 auto',\n position: 'absolute',\n width: 1,\n\n [p.theme.mediaQueries.md]: {\n height: 64,\n },\n}));\n\nconst generateBenefits = () => {\n const benefits = [\n {\n title: 'portale.healthCoach:benefits.wellness coach title',\n description: 'portale.healthCoach:benefits.wellness coach description',\n icon: 'WellnessCoach',\n },\n {\n title: 'portale.healthCoach:benefits.health calendar title',\n description: 'portale.healthCoach:benefits.health calendar description',\n icon: 'HealthCalendar',\n },\n {\n title: 'portale.healthCoach:benefits.medical records title',\n description: 'portale.healthCoach:benefits.medical records description',\n icon: 'MedicalRecords',\n },\n {\n title: 'portale.healthCoach:benefits.medical consultation title',\n description: 'portale.healthCoach:benefits.medical consultation description',\n icon: 'MedicalConsultation',\n },\n {\n title: 'portale.healthCoach:benefits.access health network title',\n description: 'portale.healthCoach:benefits.access health network description',\n icon: 'AccessHealthNetwork',\n },\n {\n title: 'portale.healthCoach:benefits.purchase delivery drugs title',\n description: 'portale.healthCoach:benefits.purchase delivery drugs description',\n icon: 'PurchaseDeliveryDrugs',\n },\n {\n title: 'portale.healthCoach:benefits.24h assistance title',\n description: 'portale.healthCoach:benefits.24h assistance description',\n icon: 'Assistance',\n },\n ];\n\n if (getCompany() !== 'bcc' && getCompany() !== 'vera') {\n benefits.splice(benefits.length - 1, 0, {\n title: 'portale.healthCoach:benefits.claims management title',\n description: 'portale.healthCoach:benefits.claims management description',\n icon: 'ClaimsRefund',\n });\n }\n\n return benefits;\n};\nclass HealthCoach extends React.Component {\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n render() {\n const {\n isFetching,\n plan,\n t,\n theme,\n } = this.props;\n\n if (isFetching || !plan) {\n return null;\n }\n\n if (plan.activities && plan.activities.length > 0) {\n plan.activities.forEach((e) => {\n e.activityGroup.code = e.activityGroup.name;\n e.activityGroup.name = t(`enums:activity group.${e.activityGroup.name}`);\n });\n }\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n {generateBenefits().map((benefit) => (\n \n \n {benefit.icon ? (\n
\n \n
\n ) : null}\n
\n
\n \n ))}\n
\n \n
\n \n \n\n \n\n \n \n \n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nHealthCoach.defaultProps = {\n account: null,\n getUserPlan: null,\n isAuthenticated: null,\n isFetching: null,\n plan: null,\n questionnaire: null,\n t: null,\n theme: null,\n};\n\nHealthCoach.propTypes = {\n account: PropTypes.shape(),\n getUserPlan: PropTypes.func,\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.healthCoach', 'enums'])(withTheme(HealthCoach)));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { Trans, withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport icon from '../../../assets/img/wellion-app-icon.png';\nimport termsOfUseDoc from '../../../assets/docs/TermsOfUse-HealthNetwork.pdf';\n\nimport {\n Button,\n CartoonSvg,\n Container,\n Text,\n} from '../../../components';\n\nimport { getCompany } from '../../../utils';\n\nconst CHealthNetwork = styled.div((p) => ({\n '.first-section': {\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 50px',\n },\n\n '.container-description': {\n [p.theme.mediaQueries.md]: {\n padding: '0px 30px 0px 15px',\n },\n },\n\n '.container-image': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'center',\n margin: '0',\n\n '.custom-rounded': {\n alignItems: 'center',\n background: p.theme.colors.LIGHTBLUE,\n borderRadius: '50%',\n display: 'flex',\n height: '280px',\n justifyContent: 'center',\n minHeight: '280px',\n minWidth: '280px',\n width: '280px',\n\n [p.theme.mediaQueries.md]: {\n height: '360px',\n minHeight: '360px',\n minWidth: '360px',\n width: '360px',\n },\n\n '.icon': {\n backgroundImage: `url(${icon})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 'calc(100% - 90px)',\n width: '50%',\n },\n svg: {\n width: '60%',\n },\n },\n },\n },\n\n '.second-section': {\n padding: '60px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '80px 20px 100px',\n },\n\n '.container-button': {\n padding: '0px 15px 50px',\n textAlign: 'center',\n\n [p.theme.mediaQueries.md]: {\n padding: '0px 15px 70px',\n },\n },\n },\n}));\n\nconst HealthNetwork = (props) => {\n const { theme } = props;\n\n return (\n \n \n
\n \n \n \n \n
\n \n \n \n \n \n \n \n {getCompany() === 'bcc' || getCompany() === 'vera' ?
:
}\n
\n \n
\n \n
\n\n \n \n {(getCompany() === 'bcc' || getCompany() === 'vera') && (\n \n \n \n\n {(getCompany() === 'bcc' || getCompany() === 'vera') && (\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.healthnetwork:section2.info0\" />\n \n )}\n \n
\n )}\n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n \n \n \n \n \n \n \n \n \n
\n ) : (\n \n \n \n \n \n
\n )}\n \n
\n \n );\n};\n\nHealthNetwork.defaultProps = {\n theme: null,\n};\n\nHealthNetwork.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.healthnetwork', 'translation'])(HealthNetwork));\n","import React from 'react';\n\nimport { connect } from 'react-redux';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\nimport styled, { withTheme } from 'styled-components';\nimport { groupBy, orderBy } from 'lodash';\n\nimport { fetchHealthPlanScoreReport, fetchUserPlan } from '../../../reducers/users/actions';\n\nimport { ActivityGroupIcon } from '../../../enums';\n\nimport {\n CartoonSvg,\n Container,\n Score,\n Text,\n} from '../../../components';\nimport { Cards, AgencyContact, CustomerServices } from '../../../components/portale';\n\nimport { styledSystem } from '../../../themes';\n\nconst CHome = styled.div((p) => ({\n paddingTop: 30,\n\n [p.theme.mediaQueries.md]: {\n paddingTop: 150,\n },\n}));\n\nconst RowMarginTop = styled(Row)({\n marginTop: '50px',\n position: 'relative',\n});\n\nconst ScoreContainer = styledSystem('div');\n\nconst SeparatorH = (p) => {\n const { hideOnMobile, small, theme } = p;\n\n const Separator = styled.div({\n borderTop: hideOnMobile ? 0 : `1px solid ${theme.colors.GREY5}`,\n margin: small ? '45px auto' : '50px auto',\n width: small ? '50%' : '100%',\n\n [theme.mediaQueries.md]: {\n borderTop: `1px solid ${theme.colors.GREY5}`,\n },\n });\n\n return ;\n};\n\nconst SeparatorV = styled.div((p) => ({\n borderLeft: `1px solid ${p.theme.colors.PRIMARY1}`,\n bottom: '-17px',\n height: 48,\n left: '50%',\n margin: '0 auto',\n position: 'absolute',\n width: 1,\n\n [p.theme.mediaQueries.md]: {\n height: 64,\n },\n}));\n\nclass Home extends React.Component {\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (isAuthenticated && account && account.id) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n componentDidUpdate(prevProps) {\n const { getHealthPlanScoreReport, isAuthenticated, plan } = this.props;\n\n if (isAuthenticated && plan && plan !== prevProps.plan) {\n getHealthPlanScoreReport(plan.id);\n }\n }\n\n getActivitiesCardsList() {\n const { account, t, plan } = this.props;\n const cardsList = [];\n if (account && plan && plan.activities.length > 0) {\n const groupedActivitiesByGroupName = groupBy(plan.activities, 'activityGroup.priority');\n Object.keys(groupedActivitiesByGroupName).forEach((key) => {\n const activitiesOrdered = orderBy(groupedActivitiesByGroupName[key], 'name', 'asc').map((activity) => activity.name);\n cardsList.push({\n title: t(`enums:activity group.${groupedActivitiesByGroupName[key][0].activityGroup.name}`),\n icon: ActivityGroupIcon[groupedActivitiesByGroupName[key][0].activityGroup.name],\n link: `/recommended-plan?section=${groupedActivitiesByGroupName[key][0].activityGroup.name}`,\n list: activitiesOrdered.length > 3 ? activitiesOrdered.splice(0, 3) : activitiesOrdered,\n });\n });\n }\n return cardsList;\n }\n\n render() {\n const {\n account,\n healthPlanScoreReport,\n isFetching,\n isFetchingHealthPlanScoreReport,\n plan,\n t,\n theme,\n } = this.props;\n\n if (!account || isFetching || !plan || isFetchingHealthPlanScoreReport) {\n return null;\n }\n\n return (\n \n \n \n \n \n \n \n {healthPlanScoreReport && healthPlanScoreReport.cluster ? (\n <>\n \n\n \n\n \n \n \n >\n ) : null}\n \n
\n \n\n \n \n \n {healthPlanScoreReport && healthPlanScoreReport.cluster ? (\n <>\n \n \n \n \n >\n ) : null}\n \n
\n \n
\n\n \n \n \n \n
\n\n \n \n \n \n
\n\n \n \n \n \n \n \n \n\n \n \n \n \n\n \n \n
\n \n \n \n \n \n \n
\n \n\n \n\n \n \n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n healthPlanScoreReport: state.users.fetchHealthPlanScoreReport.data,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n isFetchingHealthPlanScoreReport: state.users.fetchHealthPlanScoreReport.isFetching,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getHealthPlanScoreReport: (id) => dispatch(fetchHealthPlanScoreReport(id)),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nHome.defaultProps = {\n account: null,\n getHealthPlanScoreReport: null,\n getUserPlan: null,\n healthPlanScoreReport: null,\n isAuthenticated: false,\n isFetching: null,\n isFetchingHealthPlanScoreReport: null,\n plan: null,\n questionnaire: PropTypes.shape(),\n t: null,\n theme: null,\n};\n\nHome.propTypes = {\n account: PropTypes.shape(),\n getHealthPlanScoreReport: PropTypes.func,\n getUserPlan: PropTypes.func,\n healthPlanScoreReport: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n isFetchingHealthPlanScoreReport: PropTypes.bool,\n plan: PropTypes.shape(),\n questionnaire: null,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.home', 'enums'])(withTheme(Home)));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { isEmpty } from 'lodash';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n Switch,\n Text,\n} from '../../../components';\n\nimport { fetchUserPlan } from '../../../reducers/users/actions';\nimport { fetchActivePolls, editActivePolls } from '../../../reducers/medicalRecords/actions';\n\nconst ContainerMT = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 64px',\n },\n}));\n\nconst ContainerSwitch = styled.div({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n margin: '20px 0',\n});\n\nclass ManageTrends extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {};\n\n this.getSwitches = this.getSwitches.bind(this);\n this.goTrend = this.goTrend.bind(this);\n this.handleSubmitActivePolls = this.handleSubmitActivePolls.bind(this);\n this.handleToggleSwitch = this.handleToggleSwitch.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n componentDidUpdate(props) {\n const { account, plan, getActivePollsByUser } = this.props;\n\n if (plan && plan !== props.plan) {\n getActivePollsByUser(account.id);\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const disableSubmit = isEmpty(nextState.userActivePollsData) || JSON.stringify(nextState.userActivePollsData) === JSON.stringify(nextProps.userActivePolls);\n const userActivePollsData = nextProps.userActivePolls !== nextState.userActivePollsData && nextProps.userActivePolls !== null && isEmpty(nextState.userActivePollsData)\n ? { ...nextProps.userActivePolls }\n : { ...nextState.userActivePollsData };\n\n return { disableSubmit, userActivePollsData };\n }\n\n getSwitches(types, swithes) {\n const { t, theme } = this.props;\n\n return types.map((type, key) => {\n if (swithes[type] !== null) {\n return (\n \n this.handleToggleSwitch(type, value)} />\n \n \n );\n }\n return null;\n });\n }\n\n goTrend() {\n const { history } = this.props;\n history.push('/medical-records?tab=trend');\n }\n\n handleSubmitActivePolls() {\n const { userActivePollsData } = this.state;\n const { history, updateActivePolls } = this.props;\n\n updateActivePolls(userActivePollsData).then(() => history.go());\n }\n\n handleToggleSwitch(type, value) {\n const { userActivePollsData } = this.state;\n this.setState({\n userActivePollsData: {\n ...userActivePollsData,\n [type]: value,\n },\n });\n }\n\n render() {\n const { t, theme, userActivePollsIsFetching } = this.props;\n\n const { userActivePollsData, disableSubmit } = this.state;\n\n return (\n \n \n \n\n {/* */}\n\n {userActivePollsData && !userActivePollsIsFetching && (\n <>\n \n \n \n {this.getSwitches(['weightPoll', 'footStepsPoll', 'averageGymDaysPoll', 'averageLitersWaterPool', 'numberCigarettesPoll'], userActivePollsData)}\n \n \n \n {this.getSwitches(['basalHeartRatePool', 'maximumHeartRatePool', 'minPressure', 'maxPressure', 'glycemicIndex'], userActivePollsData)}\n \n
\n \n \n \n \n \n
\n >\n )}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n userActivePolls: state.medicalRecords.fetchActivePolls.data,\n userActivePollsIsFetching: state.medicalRecords.fetchActivePolls.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getActivePollsByUser: (userId) => dispatch(fetchActivePolls({ userId })),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n updateActivePolls: (request) => dispatch(editActivePolls(request)),\n});\n\nManageTrends.defaultProps = {\n account: null,\n getActivePollsByUser: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: null,\n plan: null,\n questionnaire: null,\n t: null,\n theme: null,\n updateActivePolls: null,\n userActivePolls: null,\n userActivePollsIsFetching: null,\n};\n\nManageTrends.propTypes = {\n account: PropTypes.shape(),\n getActivePollsByUser: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n updateActivePolls: PropTypes.func,\n userActivePolls: PropTypes.shape(),\n userActivePollsIsFetching: PropTypes.bool,\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.medicalreports'])(ManageTrends))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport icon from '../../../assets/img/wellion-app-icon.png';\nimport termsOfUseDoc from '../../../assets/docs/TermsOfUse-MedicalConsultation.pdf';\n\nimport {\n CartoonSvg, Container, Text,\n} from '../../../components';\n\nimport { getCompany } from '../../../utils';\n\nconst CMedicalConsultation = styled.div((p) => ({\n '.first-section': {\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 50px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 50px',\n },\n\n '.container-description': {\n [p.theme.mediaQueries.md]: {\n padding: '0px 30px 0px 15px',\n },\n },\n\n '.container-image': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'center',\n margin: '0',\n\n '.custom-rounded': {\n alignItems: 'center',\n background: p.theme.colors.LIGHTBLUE,\n borderRadius: '50%',\n display: 'flex',\n height: '280px',\n justifyContent: 'center',\n minHeight: '280px',\n minWidth: '280px',\n width: '280px',\n\n [p.theme.mediaQueries.md]: {\n height: '360px',\n minHeight: '360px',\n minWidth: '360px',\n width: '360px',\n },\n\n '.icon': {\n backgroundImage: `url(${icon})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 'calc(100% - 90px)',\n width: '50%',\n },\n svg: {\n width: '60%',\n },\n },\n },\n },\n\n '.second-section': {\n padding: '50px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '100px 20px',\n },\n },\n}));\n\nconst MedicalConsultation = (props) => {\n const { theme } = props;\n\n return (\n \n \n
\n \n \n \n \n
\n \n \n \n \n \n \n \n \n {getCompany() === 'bcc' || getCompany() === 'vera' ?
:
}\n
\n \n
\n \n
\n\n \n \n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n \n \n \n \n \n \n \n \n \n \n
\n )\n : (\n \n \n \n \n \n \n
\n )}\n \n
\n \n );\n};\n\nMedicalConsultation.defaultProps = {\n theme: null,\n};\n\nMedicalConsultation.propTypes = {\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['portale.medicalconsultation', 'translation'])(withTheme(MedicalConsultation));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport moment from 'moment';\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchEventsByFilters } from '../../../../reducers/events/actions';\n\nimport {\n FilterControls,\n FilterToggle,\n Loading,\n OutlineSvg,\n Pagination,\n Text,\n} from '../../../../components';\n\nimport {\n ActivityHistory,\n ActivityTypeHistory,\n EventStatuses,\n EventTypeOutlineIcon,\n EventTypes,\n} from '../../../../enums';\n\nconst CActivities = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '20px 0',\n\n [p.theme.mediaQueries.md]: {\n padding: 20,\n },\n}));\n\nconst Activity = styled.div((p) => ({\n alignItems: 'center',\n boxShadow: p.theme.shadows.buttonActive,\n cursor: 'pointer',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n margin: `${p.theme.space} 0`,\n padding: '30px 20px',\n\n [p.theme.mediaQueries.md]: {\n flexWrap: 'nowrap',\n },\n}));\n\nconst Attachment = styled.div((p) => ({\n flex: '1 0 auto',\n marginLeft: 25,\n order: 3,\n\n [p.theme.mediaQueries.md]: {\n order: 0,\n },\n}));\n\nconst Divider = styled.div((p) => ({\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n margin: '30px 0',\n}));\n\nconst IconContainer = styled.div((p) => ({\n backgroundColor: p.bkg,\n borderRadius: '50%',\n display: 'flex',\n flex: '0 0 auto',\n height: 40,\n order: 1,\n width: 40,\n\n [p.theme.mediaQueries.md]: {\n order: 0,\n },\n\n svg: {\n margin: 'auto',\n },\n}));\n\nconst Note = styled.div((p) => ({\n flex: '1 0 auto',\n marginLeft: 25,\n order: 2,\n\n [p.theme.mediaQueries.md]: {\n order: 0,\n },\n}));\n\nconst TextContainer = styled.div((p) => ({\n flex: '1 1 100%',\n margin: `0 0 ${p.theme.space}`,\n order: 0,\n\n [p.theme.mediaQueries.md]: {\n margin: `0 ${p.theme.space}`,\n },\n}));\n\nclass TabActivities extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n filters: {},\n openFilter: true,\n page: 0,\n };\n\n this.seeActivity = this.seeActivity.bind(this);\n this.handleFilterToggle = this.handleFilterToggle.bind(this);\n this.handleFiltersSubmit = this.handleFiltersSubmit.bind(this);\n this.handlePageSelect = this.handlePageSelect.bind(this);\n this.searchEvents = this.searchEvents.bind(this);\n }\n\n componentDidMount() {\n const { account, isAuthenticated } = this.props;\n\n if (account && isAuthenticated) {\n this.searchEvents();\n }\n }\n\n componentDidUpdate(props, states) {\n const { filters, page } = this.state;\n\n if (filters !== states.filters || page !== states.page) {\n this.searchEvents();\n }\n }\n\n getFilters() {\n const { t } = this.props;\n\n const activityHistoryDataSource = [];\n const activityTypeHistoryDataSource = [];\n\n Object.keys(ActivityHistory).forEach((e) => {\n activityHistoryDataSource.push({\n label: t(`enums:activity history.${e}`),\n value: e,\n });\n });\n\n Object.keys(ActivityTypeHistory).forEach((p) => {\n activityTypeHistoryDataSource.push({\n label: t(`enums:activity type history.${p}`),\n value: p,\n });\n });\n\n return [\n {\n clearable: true,\n datasource: activityHistoryDataSource,\n key: 'source',\n label: t('portale.medicalreports:filters.type'),\n placeholder: t('portale.medicalreports:filters.type'),\n searchable: true,\n themeVariant: 'pb',\n type: 'select',\n },\n {\n clearable: true,\n datasource: activityTypeHistoryDataSource,\n key: 'type',\n label: t('portale.medicalreports:filters.activity'),\n placeholder: t('portale.medicalreports:filters.activity'),\n searchable: true,\n themeVariant: 'pb',\n type: 'select',\n },\n {\n key: 'startDateLB',\n label: t('portale.medicalreports:filters.date'),\n placeholder: t('portale.medicalreports:filters.date'),\n showIcon: true,\n showYear: true,\n themeVariant: 'pb',\n type: 'date',\n },\n ];\n }\n\n searchEvents() {\n const { getEventsByFilters, limit, account } = this.props;\n const { filters, page } = this.state;\n\n const params = {\n owner: account.id,\n page,\n size: limit,\n status: EventStatuses.FATTO,\n };\n\n if (filters.type && filters.type === ActivityTypeHistory.DIAGNOSTIC) {\n params.type = `${filters.type},${EventTypes.SCREENING}`;\n } else if (filters.type && filters.type === ActivityTypeHistory.ALL) {\n params.type = null;\n } else {\n params.type = filters.type;\n }\n\n params.source = filters.source && filters.source !== ActivityHistory.ALLACTIVITIES ? filters.source : null;\n\n params.startDateLB = filters.startDateLB;\n getEventsByFilters(params);\n }\n\n seeActivity(id, startDate) {\n const { history } = this.props;\n history.push(`event/${id}?startDate=${startDate}`);\n }\n\n handleFilterToggle(openFilter) {\n this.setState({ openFilter });\n }\n\n handleFiltersSubmit(filters) {\n this.setState({ page: 0, filters });\n }\n\n handlePageSelect(page) {\n this.setState({ page });\n }\n\n render() {\n const {\n eventsByFilters,\n language,\n length,\n limit,\n isFetchingEventsByFilters,\n t,\n theme,\n } = this.props;\n\n const { openFilter, page } = this.state;\n\n return (\n \n \n \n\n {openFilter && (\n \n )}\n
\n \n\n {!eventsByFilters || isFetchingEventsByFilters ? (\n \n ) : (\n <>\n \n {eventsByFilters.map((a) => {\n const userCreated = a.activityId === null && a.activityGroupId === null;\n const iconsColor = userCreated ? theme.colors.GRAPH3 : theme.colors.PRIMARY2;\n\n return (\n
this.seeActivity(a.idParent, a.startDate)}>\n \n {EventTypeOutlineIcon[a.type] ? (\n \n ) : null}\n \n\n \n \n \n \n\n \n \n \n \n\n \n \n 0 ? `${a.documents.length}` : '0'}\n type=\"span\"\n />\n \n \n \n );\n })}\n
\n \n >\n )}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n eventsByFilters: state.events.eventsByFilters.data,\n isFetchingEventsByFilters: state.events.eventsByFilters.isFetching,\n isAuthenticated: state.authentication.isAuthenticated,\n language: state.settings.lang,\n length: state.events.eventsByFilters.length,\n limit: state.settings.limit,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getEventsByFilters: (params) => dispatch(fetchEventsByFilters(params)),\n});\n\nTabActivities.defaultProps = {\n account: null,\n eventsByFilters: null,\n getEventsByFilters: null,\n history: null,\n isAuthenticated: null,\n isFetchingEventsByFilters: true,\n language: null,\n length: 0,\n limit: 24,\n t: null,\n theme: null,\n};\n\nTabActivities.propTypes = {\n account: PropTypes.shape(),\n eventsByFilters: PropTypes.arrayOf(PropTypes.shape({})),\n getEventsByFilters: PropTypes.func,\n history: PropTypes.shape(),\n isFetchingEventsByFilters: PropTypes.bool,\n isAuthenticated: PropTypes.bool,\n language: PropTypes.string,\n length: PropTypes.number,\n limit: PropTypes.number,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.medicalreports', 'enums'])(TabActivities))));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { isEmpty } from 'lodash';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n // CartoonSvg,\n FileDownload,\n Loading,\n MaterialDesignInput,\n OutlineSvg,\n SelectInput,\n Text,\n} from '../../../../components';\n\nimport { createUserPersonalData, editUserPersonalData, fetchUserPersonalData } from '../../../../reducers/medicalRecords/actions';\nimport { fetchQuestionnaireSummary } from '../../../../reducers/questionnaires/actions';\nimport { medicalPdfGenerate } from '../../../../reducers/documents/actions';\nimport { fetchUsermed, usermedDocumentDownload } from '../../../../reducers/sharemed/actions';\n\nimport { getMedicalTemplatePDF } from '../../../../utils';\n\nconst CPersonalData = styled.div((p) => ({\n [p.theme.mediaQueries.md]: {\n '.pl-md-0': {\n paddingLeft: 0,\n },\n\n '.pr-md-0': {\n paddingRight: 0,\n },\n },\n}));\n\nconst QuestionnaireData = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '20px 0',\n\n [p.theme.mediaQueries.md]: {\n padding: '52px 20px 20px 20px',\n\n '.first-column': {\n borderRight: `1px solid ${p.theme.colors.GREY4}`,\n paddingRight: 16,\n },\n\n '.second-column': {\n paddingLeft: '6%',\n },\n },\n}));\n\nconst AdditionalData = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '30px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '30px 15px',\n },\n\n '.row': {\n '.col-md-6.col-sm-12.col-12 > div': {\n marginBottom: p.theme.verticalSpacing.p16,\n },\n },\n}));\n\nconst QuestionnaireInfo = styled.div((p) => ({\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginBottom: p.theme.verticalSpacing.p32,\n\n '.label-info': {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n width: '53%',\n\n p: {\n margin: '0 0 0 30px',\n width: 'calc(100% - 54px)',\n\n [p.theme.mediaQueries.md]: {\n textTransform: 'uppercase',\n },\n },\n\n svg: {\n minWidth: 25,\n },\n },\n\n '.value-info': {\n width: '47%',\n\n p: {\n margin: 0,\n paddingLeft: 20,\n width: '100%',\n },\n },\n}));\n\n// const SharemedInfo = styled.div((p) => ({\n// backgroundColor: p.theme.colors.WHITE,\n// borderRadius: 8,\n// boxShadow: p.theme.shadows.uniform,\n// padding: 20,\n// display: 'flex',\n// flexDirection: 'column',\n\n// [p.theme.mediaQueries.md]: {\n// alignItems: 'center',\n// flexDirection: 'row',\n// padding: 30,\n// },\n\n// '.image': {\n// margin: '0 auto',\n// minWidth: 82,\n// width: 82,\n// },\n\n// p: {\n// margin: 0,\n// padding: '16px 0',\n\n// [p.theme.mediaQueries.md]: {\n// padding: '0 30px 16px',\n// },\n// },\n// }));\n\nclass TabData extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {};\n this.handleChangeAdditionalData = this.handleChangeAdditionalData.bind(this);\n this.handleSubmitAdditionalData = this.handleSubmitAdditionalData.bind(this);\n this.handleClickDocument = this.handleClickDocument.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n isAuthenticated,\n // checkEnrolled,\n getQuestionnaireSummaryByUser,\n getUsermed,\n getUserPersonalDataByUser,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getQuestionnaireSummaryByUser(account.id);\n getUserPersonalDataByUser(account.id);\n // checkEnrolled();\n getUsermed();\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const disableSubmit = isEmpty(nextState.additionalDataForm) || JSON.stringify(nextState.additionalDataForm) === JSON.stringify(nextProps.userPersonalData);\n const additionalDataForm = nextProps.userPersonalData !== nextState.additionalDataForm && nextProps.userPersonalData !== null && isEmpty(nextState.additionalDataForm)\n ? { ...nextProps.userPersonalData }\n : { ...nextState.additionalDataForm };\n\n return {\n additionalDataForm,\n disableSubmit,\n };\n }\n\n handleChangeAdditionalData(e) {\n const { additionalDataForm } = this.state;\n if (e.target) {\n const { name, value } = e.target;\n if (value && value !== '') {\n this.setState({\n additionalDataForm: {\n ...additionalDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpAdditionalDataForm = { ...additionalDataForm };\n delete tmpAdditionalDataForm[name];\n this.setState({\n additionalDataForm: { ...tmpAdditionalDataForm },\n });\n }\n } else {\n const { name, value } = e;\n if (value && value !== '') {\n this.setState({\n additionalDataForm: {\n ...additionalDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpAdditionalDataForm = { ...additionalDataForm };\n delete tmpAdditionalDataForm[name];\n this.setState({\n additionalDataForm: { ...tmpAdditionalDataForm },\n });\n }\n }\n }\n\n handleSubmitAdditionalData() {\n const { additionalDataForm } = this.state;\n const {\n account,\n history,\n saveUserPersonalData,\n updateUserPersonalData,\n userPersonalData,\n } = this.props;\n\n const userAdditionalData = {\n ...additionalDataForm,\n userId: account.id,\n };\n\n if (!userPersonalData) {\n saveUserPersonalData(userAdditionalData).then(() => history.go());\n } else {\n updateUserPersonalData(userAdditionalData).then(() => history.go());\n }\n }\n\n handleClickDocument(document) {\n const { additionalDataForm } = this.state;\n const {\n getDocument,\n medicalPdfCreate,\n questionaireSummary,\n t,\n } = this.props;\n\n switch (document) {\n case 'personal-data':\n medicalPdfCreate({\n data: {\n ...additionalDataForm,\n ...questionaireSummary,\n },\n templateId: getMedicalTemplatePDF(),\n });\n break;\n case 'dss':\n getDocument({ name: t('portale.medicalreports:tab personal data.dataset document name'), document });\n break;\n case 'eds':\n getDocument({ name: t('portale.medicalreports:tab personal data.emergency document name'), document });\n break;\n default:\n break;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n getOptionObj(value, options) {\n return options.find((o) => o.value === value);\n }\n\n getQuestionnaireInfo(questionaireSummary, types) {\n const { t, theme } = this.props;\n\n const InfoTypeOutlineIcon = {\n age: 'Age',\n domicile: 'Domicile',\n feeding: 'Feeding',\n gender: 'Gender',\n glasses: 'Glasses',\n height: 'Height',\n occupation: 'Occupation',\n pathologies: 'Drug',\n smoker: 'Smoker',\n weight: 'Weight',\n };\n\n return types.map((type) => {\n const valueType = type === 'age' || type === 'weight' || type === 'height' ? t(`portale.medicalreports:tab personal data.${type} value type`) : '';\n\n return (\n \n \n {InfoTypeOutlineIcon[type] ? : null}\n \n
\n \n \n
\n \n );\n });\n }\n\n render() {\n const {\n // history,\n // enrollmentIsFetching,\n // isEnrolled,\n questionaireSummary,\n questionaireSummaryIsFetching,\n t,\n theme,\n usermed,\n usermedIsFetching,\n userPersonalData,\n userPersonalDataIsFetching,\n } = this.props;\n\n const { additionalDataForm, disableSubmit } = this.state;\n\n const trueFalseOptions = [\n { label: t('portale.medicalreports:tab personal data.true option'), value: 'SI' },\n { label: t('portale.medicalreports:tab personal data.false option'), value: 'NO' },\n ];\n const bloodDonorOptions = [\n { label: t('portale.medicalreports:tab personal data.bloodDonor A Rh positivo'), value: 'A+' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor A Rh negativo'), value: 'A-' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor B Rh positivo'), value: 'B+' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor B Rh negativo'), value: 'B-' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor 0 Rh positivo'), value: '0+' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor 0 Rh negativo'), value: '0-' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor AB Rh positivo'), value: 'AB+' },\n { label: t('portale.medicalreports:tab personal data.bloodDonor AB Rh negativo'), value: 'AB-' },\n ];\n\n const personalDataPdf = { name: t('portale.medicalreports:tab personal data.medical pdf name') };\n const datasetPdf = { name: t('portale.medicalreports:tab personal data.dataset pdf name') };\n const emergencyPdf = { name: t('portale.medicalreports:tab personal data.emergency pdf name') };\n const getOptionObj = (value, options) => options.find((o) => o.value === value);\n\n if (questionaireSummaryIsFetching || userPersonalDataIsFetching) {\n return (\n \n );\n }\n\n return (\n \n {questionaireSummary && (\n \n \n \n {this.getQuestionnaireInfo(questionaireSummary, ['gender', 'age', 'domicile', 'weight', 'height'])}\n \n\n \n {this.getQuestionnaireInfo(questionaireSummary, ['occupation', 'smoker', 'feeding', 'glasses', 'pathologies'])}\n \n
\n \n )}\n\n \n\n {additionalDataForm && (\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n
\n \n \n \n \n
\n \n )}\n\n {/* PDFs */}\n \n \n this.handleClickDocument('personal-data')} />\n \n {!usermedIsFetching && usermed && usermed.id && usermed.dssDocument\n ? (\n \n this.handleClickDocument('dss')} />\n \n )\n : null}\n {!usermedIsFetching && usermed && usermed.id && usermed.edsDocument\n ? (\n \n this.handleClickDocument('eds')} />\n \n )\n : null}\n
\n\n {/* \n \n {isEnrolled ? (\n \n ) : (\n history.push('sharemed')}\n minWidth={{ _: '100%', md: '200px' }}\n text={t('portale.medicalreports:tab personal data.sharemed check cta')}\n variant=\"primary\"\n />\n )}\n */}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n // enrollmentIsFetching: state.sharemed.fetchCheckEnrolled.isFetching,\n isAuthenticated: state.authentication.isAuthenticated,\n // isEnrolled: state.sharemed.fetchCheckEnrolled.data,\n questionaireSummary: state.questionnaires.fetchQuestionnaireSummary.data,\n questionaireSummaryIsFetching: state.questionnaires.fetchQuestionnaireSummary.isFetching,\n usermed: state.sharemed.fetchUsermed.data,\n usermedIsFetching: state.sharemed.fetchUsermed.isFetching,\n userPersonalData: state.medicalRecords.fetchUserPersonalData.data,\n userPersonalDataIsFetching: state.medicalRecords.fetchUserPersonalData.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n // checkEnrolled: () => dispatch(fetchCheckEnrolled()),\n getDocument: (params) => dispatch(usermedDocumentDownload(params)),\n getQuestionnaireSummaryByUser: (userId) => dispatch(fetchQuestionnaireSummary({ userId })),\n getUsermed: () => dispatch(fetchUsermed()),\n getUserPersonalDataByUser: (userId) => dispatch(fetchUserPersonalData({ userId })),\n medicalPdfCreate: (request) => dispatch(medicalPdfGenerate(request)),\n saveUserPersonalData: (request) => dispatch(createUserPersonalData(request)),\n updateUserPersonalData: (request) => dispatch(editUserPersonalData(request)),\n});\n\nTabData.defaultProps = {\n account: null,\n // checkEnrolled: null,\n // enrollmentIsFetching: null,\n getDocument: null,\n getQuestionnaireSummaryByUser: null,\n getUsermed: null,\n getUserPersonalDataByUser: null,\n history: null,\n isAuthenticated: null,\n // isEnrolled: null,\n medicalPdfCreate: null,\n questionaireSummary: null,\n questionaireSummaryIsFetching: true,\n saveUserPersonalData: null,\n t: null,\n theme: null,\n updateUserPersonalData: null,\n usermed: null,\n usermedIsFetching: null,\n userPersonalData: null,\n userPersonalDataIsFetching: true,\n};\n\nTabData.propTypes = {\n account: PropTypes.shape(),\n // checkEnrolled: PropTypes.func,\n // enrollmentIsFetching: PropTypes.bool,\n getDocument: PropTypes.func,\n getQuestionnaireSummaryByUser: PropTypes.func,\n getUsermed: PropTypes.func,\n getUserPersonalDataByUser: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n // isEnrolled: PropTypes.bool,\n medicalPdfCreate: PropTypes.func,\n questionaireSummary: PropTypes.shape(),\n questionaireSummaryIsFetching: PropTypes.bool,\n saveUserPersonalData: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n usermed: PropTypes.shape(),\n usermedIsFetching: PropTypes.bool,\n updateUserPersonalData: PropTypes.func,\n userPersonalData: PropTypes.shape(),\n userPersonalDataIsFetching: PropTypes.bool,\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.medicalreports'])(TabData))));\n","import React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\n\nimport styled from 'styled-components';\n\nimport {\n FileDownload,\n FileUpload,\n Loading,\n Pagination,\n Search,\n SelectInput,\n} from '../../../../components';\n\nimport {\n deleteDocument,\n downloadDocument,\n fetchDocumentsByUser,\n uploadDocument,\n} from '../../../../reducers/documents/actions';\n\nconst CReports = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: '20px 0',\n\n [p.theme.mediaQueries.md]: {\n padding: 20,\n },\n\n '.container-filters': {\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n display: 'flex',\n flexDirection: 'column',\n padding: `${p.theme.verticalSpacing.p16} ${p.theme.verticalSpacing.p16} ${p.theme.verticalSpacing.p32}`,\n paddingBottom: p.theme.verticalSpacing.p32,\n\n '> form': {\n marginBottom: `${p.theme.verticalSpacing.p16}`,\n },\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: `0 0 ${p.theme.verticalSpacing.p32} 0`,\n\n '> div': {\n width: 'calc(30% - 16px)',\n },\n\n '> form': {\n margin: 0,\n width: 'calc(70% - 16px)',\n },\n },\n },\n\n '.container-documents': {\n margin: `${p.theme.verticalSpacing.p32} 0`,\n },\n\n '.pagination': {\n paddingLeft: 16,\n\n [p.theme.mediaQueries.md]: {\n paddingLeft: 0,\n },\n },\n}));\n\nclass TabReports extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n files: [],\n page: 0,\n sort: 'createdOn,desc',\n };\n this.getDocuments = this.getDocuments.bind(this);\n this.handleChangeFile = this.handleChangeFile.bind(this);\n this.handleChangeSort = this.handleChangeSort.bind(this);\n this.handleClickDocument = this.handleClickDocument.bind(this);\n this.handlePageSelect = this.handlePageSelect.bind(this);\n this.handleClickOnOption = this.handleClickOnOption.bind(this);\n this.handleSearch = this.handleSearch.bind(this);\n }\n\n componentDidMount() {\n const { account, isAuthenticated } = this.props;\n\n if (account && account.id && isAuthenticated) {\n this.getDocuments();\n }\n }\n\n componentDidUpdate(props, states) {\n const { page, sort, name } = this.state;\n\n if (page !== states.page || name !== states.name || sort !== states.sort) {\n this.getDocuments();\n }\n }\n\n getDocuments() {\n const { getDocuments, limit, account } = this.props;\n const { page, sort, name } = this.state;\n\n const params = {\n userId: account.id,\n name: name || null,\n size: limit,\n page,\n sort,\n };\n\n getDocuments(params);\n }\n\n handleSearch(query) {\n this.setState({ page: 0, name: query });\n }\n\n handleChangeSort(e) {\n const { value } = e.target;\n this.setState({ page: 0, sort: value || 'createdOn,desc' });\n }\n\n handlePageSelect(page) {\n this.setState({ page });\n }\n\n handleClickDocument(file) {\n const { getDocument } = this.props;\n getDocument(file);\n }\n\n handleChangeFile(file) {\n const { uploadDoc, account } = this.props;\n const { files } = this.state;\n const tmp = [];\n\n Object.keys(file).forEach((key) => {\n if (!files.find((f) => f.name === file[key].name)) {\n // Check file size\n if (file[key].size < 5000000) {\n tmp.push(file[key]);\n }\n }\n });\n\n this.setState({ files: tmp });\n uploadDoc(account.id, tmp).then(() => this.getDocuments());\n }\n\n handleClickOnOption(document, option) {\n const { history, deleteDoc } = this.props;\n switch (option) {\n case 'SHOW_ACTIVITY':\n if (document && document.event && document.event.idParent) {\n history.push(`/event/${document.event.idParent}?startDate=${document.event.startDate}`);\n }\n break;\n case 'DELETE_DOCUMENT':\n if (document && document.id) {\n deleteDoc(document.id).then(() => this.getDocuments());\n }\n break;\n default:\n break;\n }\n }\n\n render() {\n const {\n documents,\n isFetchingDocuments,\n isFetchingUploadDoc,\n length,\n limit,\n t,\n } = this.props;\n const { page } = this.state;\n\n const sortbyValues = [\n {\n label: t('portale.medicalreports:tab reports.sortbyValues title a-z'),\n value: 'name,asc',\n },\n {\n label: t('portale.medicalreports:tab reports.sortbyValues title z-a'),\n value: 'name,desc',\n },\n {\n label: t('portale.medicalreports:tab reports.sortbyValues descending date'),\n value: 'createdOn,desc',\n },\n {\n label: t('portale.medicalreports:tab reports.sortbyValues ascending date'),\n value: 'createdOn,asc',\n },\n ];\n\n return (\n \n \n \n \n
\n \n \n\n {!documents || isFetchingDocuments || isFetchingUploadDoc ? (\n \n ) : (\n <>\n \n >\n )}\n
\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n limit: state.settings.limit,\n length: state.documents.documentByUser.length,\n documents: state.documents.documentByUser.data,\n isFetchingDocuments: state.documents.documentByUser.isFetching,\n isFetchingUploadDoc: state.documents.uploadDocument.isFetchingUploadDoc,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n deleteDoc: (id) => dispatch(deleteDocument(id)),\n getDocument: (id) => dispatch(downloadDocument(id)),\n getDocuments: (params) => {\n dispatch(fetchDocumentsByUser(params));\n },\n uploadDoc: (userId, files) => dispatch(uploadDocument({ userId, files })),\n});\n\nTabReports.defaultProps = {\n account: null,\n deleteDoc: null,\n documents: null,\n getDocument: null,\n getDocuments: null,\n history: null,\n isAuthenticated: null,\n isFetchingDocuments: true,\n length: 0,\n limit: 24,\n t: null,\n uploadDoc: null,\n isFetchingUploadDoc: false,\n};\n\nTabReports.propTypes = {\n account: PropTypes.shape(),\n deleteDoc: PropTypes.func,\n documents: PropTypes.arrayOf(PropTypes.shape()),\n getDocument: PropTypes.func,\n getDocuments: PropTypes.func,\n isAuthenticated: PropTypes.bool,\n isFetchingDocuments: PropTypes.bool,\n history: PropTypes.shape({\n push: PropTypes.func,\n }),\n length: PropTypes.number,\n limit: PropTypes.number,\n t: PropTypes.func,\n uploadDoc: PropTypes.func,\n isFetchingUploadDoc: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.medicalreports'])(TabReports)));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { HealthTypes } from '../../../../enums';\n\nimport { fetchActivePolls } from '../../../../reducers/medicalRecords/actions';\nimport { createRecord, fetchTrends } from '../../../../reducers/trends/actions';\n\nimport { mapTrends } from '../../../../utils';\n\nimport { GoBack, Loading, Text } from '../../../../components';\nimport { Trend } from '../../../../components/portale';\nimport ModalTrend from './ModalTrend';\n\nconst Content = styled.div((p) => ({\n alignItems: 'flex-start',\n display: 'flex',\n flexAlign: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n margin: `0 -${p.theme.space}`,\n}));\n\nconst ContentB = styled.div((p) => ({\n margin: `0 ${p.theme.space}`,\n}));\n\nconst ContentD = styled.div((p) => ({\n margin: `0 -${p.theme.space}`,\n}));\n\nconst Head = styled.div((p) => ({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginTop: p.theme.space,\n a: {\n '&:hover': {\n color: p.theme.colors.PRIMARY1,\n },\n },\n}));\n\nconst TrendContainer = styled.div((p) => ({\n flex: p.small ? '1 1 100%' : '0 1 49%',\n margin: `${p.theme.space} 0`,\n padding: `0 ${p.theme.space}`,\n}));\n\nclass TabTrend extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n activeTrend: null,\n addTrend: null,\n showModal: false,\n small: window.innerWidth < 992,\n };\n\n this.handleBack = this.handleBack.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.handleClickUpdate = this.handleClickUpdate.bind(this);\n this.handleModalClose = this.handleModalClose.bind(this);\n this.handleModalSave = this.handleModalSave.bind(this);\n this.handleResizeScreen = this.handleResizeScreen.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getPolls,\n getTrends,\n isAuthenticated,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getPolls(account.id);\n getTrends(account.id);\n }\n\n window.addEventListener('resize', this.handleResizeScreen);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResizeScreen);\n }\n\n handleBack() {\n this.setState({ activeTrend: null });\n }\n\n handleClick(trend) {\n this.setState({ activeTrend: trend });\n }\n\n handleClickUpdate(trend) {\n this.setState({ addTrend: trend, showModal: true });\n }\n\n handleModalClose() {\n this.setState({ addTrend: null, showModal: false });\n }\n\n handleModalSave(data) {\n const { addRecord, getTrends, account } = this.props;\n const { addTrend } = this.state;\n\n addRecord(new Date().toISOString(), addTrend.key, account.id, data.value).then(() => {\n getTrends(account.id);\n });\n\n this.setState({ addTrend: null, showModal: false, activeTrend: null });\n }\n\n handleResizeScreen() {\n const { small } = this.state;\n const s = window.innerWidth < 992;\n\n if (small !== s) {\n this.setState({ activeTrend: null, small: s });\n }\n }\n\n showActivitiesLabel() {\n const { polls } = this.props;\n return polls && (polls.weightPoll || polls.footStepsPoll || polls.averageGymDaysPoll || polls.averageLitersWaterPool || polls.numberCigarettesPoll);\n }\n\n showMeasurementLabel() {\n const { polls } = this.props;\n return polls && (polls.basalHeartRatePool || polls.maximumHeartRatePool || polls.minPressure || polls.maxPressure || polls.glycemicIndex);\n }\n\n render() {\n const {\n polls,\n pollCreating,\n pollsFetching,\n t,\n theme,\n trends,\n trendsFetching,\n } = this.props;\n\n const {\n activeTrend,\n addTrend,\n showModal,\n small,\n } = this.state;\n\n if (pollCreating || pollsFetching || trendsFetching) {\n return (\n \n );\n }\n\n const from = new Date(new Date().getFullYear(), 0, 1).toISOString();\n const to = new Date(new Date().getFullYear(), 11, 31).toISOString();\n\n const trendsMap = mapTrends(trends);\n\n const trendsActivities = [HealthTypes.WEIGHT, HealthTypes.STEPS, HealthTypes.GYM, HealthTypes.WATER_DRUNKED, HealthTypes.CIGARETTES_SMOKED];\n\n const trendsMeasurement = [\n HealthTypes.RESTING_HEART_RATE,\n HealthTypes.MAXIMUM_HEART_RATE,\n HealthTypes.MINIMUM_BLOOD_PRESSURE,\n HealthTypes.MAXIMUM_BLOOD_PRESSURE,\n HealthTypes.GLYCEMIC_INDEX,\n ];\n\n return (\n \n {!activeTrend && (\n
\n \n \n \n \n\n \n {polls && trendsMap && trendsActivities.map((trend) => {\n if (!polls[trend.keyActive] || !trendsMap[trend.key]) {\n return null;\n }\n\n return (\n \n this.handleClick(trendsMap[trend.key])}\n onUpdate={() => this.handleClickUpdate(trendsMap[trend.key])}\n name={t(`enums:health type.${trendsMap[trend.key].name}`)}\n small={small}\n to={to}\n />\n \n );\n })}\n \n\n \n \n \n\n \n {polls && trendsMap && trendsMeasurement.map((trend) => {\n if (!polls[trend.keyActive] || !trendsMap[trend.key]) {\n return null;\n }\n\n return (\n \n this.handleClick(trendsMap[trend.key])}\n onUpdate={() => this.handleClickUpdate(trendsMap[trend.key])}\n small={small}\n to={to}\n />\n \n );\n })}\n \n
\n )}\n\n {activeTrend && (\n
\n \n \n \n \n this.handleClickUpdate(activeTrend)}\n to={to}\n />\n \n \n )}\n\n
\n
\n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n addRecord: (instant, recordType, userId, value) => dispatch(\n createRecord({\n instant,\n recordType,\n userId,\n value,\n }),\n ),\n getPolls: (userId) => dispatch(fetchActivePolls({ userId })),\n getTrends: (userId, type) => dispatch(fetchTrends({ type, userId })),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n pollCreating: state.trends.createRecord.isFetching,\n polls: state.medicalRecords.fetchActivePolls.data,\n pollsFetching: state.medicalRecords.fetchActivePolls.isFetching,\n trends: state.trends.fetchTrends.data,\n trendsFetching: state.trends.fetchTrends.isFetching,\n});\n\nTabTrend.defaultProps = {\n account: null,\n addRecord: null,\n isAuthenticated: null,\n getPolls: null,\n getTrends: null,\n pollCreating: null,\n polls: null,\n pollsFetching: null,\n t: null,\n theme: null,\n trends: null,\n trendsFetching: null,\n};\n\nTabTrend.propTypes = {\n account: PropTypes.shape(),\n addRecord: PropTypes.func,\n isAuthenticated: PropTypes.bool,\n getPolls: PropTypes.func,\n getTrends: PropTypes.func,\n pollCreating: PropTypes.bool,\n polls: PropTypes.shape(),\n pollsFetching: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n trends: PropTypes.arrayOf(PropTypes.shape()),\n trendsFetching: PropTypes.bool,\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.medicalreports', 'enums'])(TabTrend))));\n","import React from 'react';\n\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n Container,\n Loading,\n Text,\n} from '../../../components';\nimport { Consenses } from '../../../enums';\nimport { checkConsenses, getConsensesObject, getConsensesObjectSet } from '../../../utils';\n\nimport { fetchPrivacy, setPrivacy as setPrivacyAction } from '../../../reducers/privacy/actions';\n\nimport TabActivities from './TabActivities';\nimport TabData from './TabData';\nimport TabReports from './TabReports';\nimport TabTrend from './TabTrend';\n\nconst Card = styled.div((p) => ({\n alignItems: 'flex-start',\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: p.theme.shadows.uniform,\n display: 'flex',\n flexDirection: 'column',\n margin: `${p.theme.verticalSpacing.p16} 0 0 0`,\n padding: '30px 15px',\n}));\n\nconst ContainerMR = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 30px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 30px',\n },\n}));\n\nconst MButton = styled(Button)((p) => ({\n backgroundColor: p.active ? p.theme.colors.PRIMARY1 : p.theme.colors.WHITE,\n boxShadow: p.theme.shadows.buttonClicked,\n color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n flex: '1 1 25%',\n fontSize: p.theme.fontSizes.small,\n textTransform: 'uppercase',\n\n '&:hover': {\n color: p.active ? p.theme.colors.WHITE : p.theme.colors.PRIMARY1,\n },\n}));\n\nconst Tabs = styled.div((p) => ({\n alignItems: 'stretch',\n borderRadius: 8,\n boxShadow: p.theme.shadows.buttonClicked,\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginBottom: 30,\n overflow: 'hidden',\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass MedicalRecords extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n consenses: [],\n showMedicalRecords: false,\n };\n\n this.getActiveTab = this.getActiveTab.bind(this);\n this.setActiveTab = this.setActiveTab.bind(this);\n this.setCheckboxes = this.setCheckboxes.bind(this);\n this.showTab = this.showTab.bind(this);\n this.submit = this.submit.bind(this);\n }\n\n componentDidMount() {\n const { privacy } = this.props;\n\n if (checkConsenses(privacy, Consenses.MEDICAL_RECORDS.code)) {\n this.showTab();\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n return {\n tab: nextState.tab || getParams(nextProps.history.location.search).tab,\n };\n }\n\n getActiveTab() {\n const { tab } = this.state;\n\n switch (tab) {\n case 'data':\n return ;\n case 'trend':\n return ;\n case 'activities':\n return ;\n case 'reports':\n return ;\n default:\n return ;\n }\n }\n\n setActiveTab(tab) {\n const { history } = this.props;\n history.replace(`/medical-records?tab=${tab}`, null);\n this.setState({ tab });\n }\n\n setCheckboxes(values) {\n this.setState({ consenses: values });\n }\n\n showTab() {\n this.setState({ showMedicalRecords: true });\n }\n\n submit() {\n const { account, setPrivacy } = this.props;\n const { consenses } = this.state;\n\n if (consenses.length > 0) {\n setPrivacy([getConsensesObjectSet(account, 'WAS_DS', Consenses.MEDICAL_RECORDS.code)], getConsensesObject(account));\n }\n }\n\n render() {\n const {\n isLoading,\n result,\n t,\n theme,\n } = this.props;\n const { consenses, showMedicalRecords, tab } = this.state;\n\n return isLoading ? (\n \n ) : (\n \n \n \n\n {showMedicalRecords || result ? (\n <>\n \n this.setActiveTab('data')}>\n {t('tab.data')}\n \n this.setActiveTab('trend')}>\n {t('tab.trend')}\n \n this.setActiveTab('activities')}>\n {t('tab.activities')}\n \n this.setActiveTab('reports')}>\n {t('tab.reports')}\n \n \n\n {this.getActiveTab()}\n >\n ) : (\n \n ,\n value: Consenses.MEDICAL_RECORDS.code,\n },\n ]}\n isLayoutVertical\n name=\"rewarding\"\n onChange={this.setCheckboxes}\n />\n\n \n \n )}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isLoading: state.privacy.isFetching,\n isLoadingAccount: state.authentication.isFetchingAccount,\n privacy: state.privacy.privacy,\n result: state.privacy.result,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getPrivacy: (params) => dispatch(fetchPrivacy(params)),\n setPrivacy: (dataSet, dataGet) => dispatch(setPrivacyAction({ dataSet, dataGet })),\n});\n\nMedicalRecords.defaultProps = {\n account: null,\n history: null,\n isLoading: null,\n privacy: null,\n result: null,\n setPrivacy: null,\n t: null,\n theme: null,\n};\n\nMedicalRecords.propTypes = {\n account: PropTypes.shape(),\n history: PropTypes.shape(),\n isLoading: PropTypes.bool,\n privacy: PropTypes.arrayOf(PropTypes.shape()),\n result: PropTypes.arrayOf(PropTypes.shape()),\n setPrivacy: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.medicalreports', 'portale.privacy'])(MedicalRecords))));\n","/* eslint-disable max-len */\nimport React from 'react';\n\nimport { connect } from 'react-redux';\nimport { withTranslation } from 'react-i18next';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport { groupBy, findIndex, orderBy } from 'lodash';\nimport moment from 'moment';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchAllNotifications } from '../../../reducers/notifications/actions';\nimport { editEvent as editEventR, deleteEvent, editEvents } from '../../../reducers/events/actions';\n\nimport {\n Button,\n Container,\n Modal,\n Text,\n} from '../../../components';\nimport { Notification } from '../../../components/portale';\nimport {\n EventEditTypes,\n EventStatuses,\n EventTypes,\n ImportantNotificationOrder,\n NotificationTypes,\n} from '../../../enums';\n\nimport { getNotificationsWithoutSpecificTypes, getNotificationsBySpecificAttributeValue } from '../../../utils';\n\nconst CNotifications = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 92px',\n position: 'relative',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 102px',\n },\n\n '.heading': {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n hr: {\n margin: 0,\n border: `1px solid ${p.theme.colors.GREY5}`,\n width: 'calc(50% - 120px)',\n\n [p.theme.mediaQueries.md]: {\n width: 'calc(50% - 140px)',\n },\n },\n },\n}));\n\nclass Notifications extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showConfirmModal: false,\n showErrorModal: false,\n event: null,\n };\n this.getGroupedYourActivitiesNotifications = this.getGroupedYourActivitiesNotifications.bind(this);\n this.onClickConfirm = this.onClickConfirm.bind(this);\n this.showError = this.showError.bind(this);\n this.buildConfirmModal = this.buildConfirmModal.bind(this);\n this.buildErrorModal = this.buildErrorModal.bind(this);\n this.onChangeMoreEvents = this.onChangeMoreEvents.bind(this);\n }\n\n componentDidMount() {\n const { account, isAuthenticated, getAllNotifications } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getAllNotifications(account.id);\n }\n }\n\n componentDidUpdate() {\n const { deleteResponse, history, isFetchingDeleteEvent } = this.props;\n\n if (!isFetchingDeleteEvent && deleteResponse && deleteResponse === 204) {\n history.go();\n }\n }\n\n static getDerivedStateFromProps(nextProps) {\n const importantNotifications = getNotificationsBySpecificAttributeValue(nextProps.notifications, 'importantCommunication', true);\n const importantNotificationsWithOrder = !importantNotifications\n ? null\n : importantNotifications.map((n) => ({\n ...n,\n order: ImportantNotificationOrder[n.notificationType],\n }));\n\n return {\n notificationsWithoutHealthRecordType: getNotificationsWithoutSpecificTypes(nextProps.notifications, [\n NotificationTypes.HEALTH_RECORD_REQUEST,\n NotificationTypes.SHAREMED_INFO,\n ]),\n importantNotifications: importantNotificationsWithOrder,\n };\n }\n\n onChangeMoreEvents(events) {\n const { editEventsStatus, history } = this.props;\n\n editEventsStatus(events).then(() => history.go());\n }\n\n onClickConfirm(event) {\n const { editEventsStatus, history } = this.props;\n\n const tmp = {\n ...event,\n status: EventStatuses.FATTO,\n };\n\n editEventsStatus([tmp]).then(() => {\n history.push(`/event/${event.idParent}?startDate=${event.startDate}`);\n });\n }\n\n onClickCancel(event) {\n const { editEventsStatus, history } = this.props;\n if ((event.type === EventTypes.DRUG || event.type === EventTypes.LIFESTYLE) && event.status === EventStatuses.DRAFT) {\n const tmp = {\n ...event,\n status: EventStatuses.SALTATO,\n };\n editEventsStatus([tmp]).then(() => {\n history.push(`/event/${event.idParent}?startDate=${event.startDate}`);\n });\n } else {\n this.setState({ event, showConfirmModal: true });\n }\n }\n\n getGroupedYourActivitiesNotifications() {\n const { notificationsWithoutHealthRecordType } = this.state;\n const yourActivities = getNotificationsBySpecificAttributeValue(notificationsWithoutHealthRecordType, 'importantCommunication', false);\n if (yourActivities) {\n const notificationsByNotificationType = groupBy(yourActivities, 'notificationType');\n\n const changeStatusNotificationsByEventGroupId = groupBy(notificationsByNotificationType.CHANGE_STATUS, 'event.eventGroupId');\n const changeStatusNotificationsByActivityId = groupBy(notificationsByNotificationType.CHANGE_STATUS, 'event.activityId');\n\n const replaceIndividualNotifications = (groupedNotfications, key, personalEvent) => {\n if (key !== 'null' && groupedNotfications[key] && groupedNotfications[key].length > 0) {\n groupedNotfications[key].forEach((element) => {\n const notificationIndex = findIndex(yourActivities, (n) => n.id === element.id);\n yourActivities.splice(notificationIndex, 1);\n });\n yourActivities.push({\n activityId: personalEvent ? key : null,\n eventGroupId: !personalEvent ? key : null,\n event: {\n startDate: new Date().toISOString(),\n },\n groupedNotifications: true,\n notifications: groupedNotfications[key],\n notificationTime: groupedNotfications[key][0].notificationTime,\n });\n }\n };\n\n if (Object.keys(changeStatusNotificationsByEventGroupId).length > 0 || Object.keys(changeStatusNotificationsByActivityId).length > 0) {\n Object.keys(changeStatusNotificationsByEventGroupId).forEach((k) => {\n replaceIndividualNotifications(changeStatusNotificationsByEventGroupId, k, false);\n });\n Object.keys(changeStatusNotificationsByActivityId).forEach((k) => {\n replaceIndividualNotifications(changeStatusNotificationsByActivityId, k, true);\n });\n return yourActivities;\n }\n return yourActivities;\n }\n return [];\n }\n\n showError(value) {\n this.setState({ showErrorModal: value });\n }\n\n buildErrorModal() {\n const { history } = this.props;\n return (\n history.go()}\n show\n showModalFooter={false}\n size=\"md\"\n subtitle=\"portale.notifications:error modal.subtitle\"\n title=\"portale.notifications:error modal.title\"\n variant=\"pb\"\n />\n );\n }\n\n buildConfirmModal() {\n const {\n deleteCustomEvent,\n editEvent,\n history,\n t,\n theme,\n } = this.props;\n const { showConfirmModal, event } = this.state;\n\n const currentDate = new Date();\n const eventDate = new Date(event.startDate);\n\n const resheduleE = () => {\n const tomorrow = moment(new Date()).add(1, 'days');\n const resheduleStartDate = eventDate > currentDate ? event.startDate : tomorrow.toDate().toISOString();\n const resheduleEndDate = eventDate > currentDate\n ? event.endDate\n : tomorrow\n .add(1, 'hours')\n .toDate()\n .toISOString();\n\n const tmp = {\n ...event,\n startDate: resheduleStartDate,\n endDate: resheduleEndDate,\n status: EventStatuses.DRAFT,\n };\n this.setState({\n showConfirmModal: false,\n });\n editEvent(event.idParent, { startDate: event.startDate }, tmp).then(() => history.push(`/event/${event.idParent}?startDate=${tmp.startDate}`));\n };\n\n const onCloseModal = () => {\n this.setState({ showConfirmModal: false });\n };\n\n const deleteE = () => {\n this.setState({\n showConfirmModal: false,\n });\n deleteCustomEvent(event.idParent);\n };\n\n const goToEditBooking = () => {\n this.setState({ showConfirmModal: false });\n if (event.idParent) {\n history.push(`event/${event.idParent}/edit?startDate=${event.startDate}&type=${EventEditTypes.booking}`);\n }\n };\n\n const EventConfirmModal = {\n DIAGNOSTIC_PRENOTATO_past: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO_past title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO_past message', {\n event: event.title,\n }),\n onSaveAction: () => resheduleE(),\n },\n SCREENING_PRENOTATO_past: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO_past title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO_past message', {\n event: event.title,\n }),\n onSaveAction: () => resheduleE(),\n },\n DIAGNOSTIC_PRENOTATO_past_personal: {\n title: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal message', {\n event: event.title,\n }),\n hideCancelButton: true,\n closeButton: true,\n saveButtonLabel: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal delete button'),\n actions: (\n \n {t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal reschedule button')}\n \n ),\n onSaveAction: () => deleteE(),\n },\n };\n const personalEvent = event && !event.activityGroupId && !event.activityId;\n const statusAndDate = event.status === EventStatuses.PRENOTATO ? `${eventDate < currentDate ? 'PRENOTATO_past' : 'PRENOTATO_future'}` : event.status;\n const type = event.type === EventTypes.DRUG || event.type === EventTypes.LIFESTYLE ? 'DRUG_or_LIFESTYLE' : event.type;\n\n const confirmModalEnumKey = `${type}_${statusAndDate}${`${personalEvent ? '_personal' : ''}`}`;\n if (EventConfirmModal[confirmModalEnumKey]) {\n return (\n onCloseModal()}\n otherActions={EventConfirmModal[confirmModalEnumKey].actions}\n hideCancelButton={EventConfirmModal[confirmModalEnumKey].hideCancelButton || false}\n >\n \n \n );\n }\n return null;\n }\n\n render() {\n const {\n isFetchingNotifications,\n notifications,\n t,\n theme,\n } = this.props;\n\n const {\n importantNotifications,\n notificationsWithoutHealthRecordType,\n showConfirmModal,\n showErrorModal,\n } = this.state;\n\n if (isFetchingNotifications) {\n return null;\n }\n\n const groupedNotifications = notifications && notifications.length > 0 ? this.getGroupedYourActivitiesNotifications() : [];\n\n return (\n \n {showConfirmModal && this.buildConfirmModal()}\n {showErrorModal && this.buildErrorModal()}\n\n \n \n\n {notificationsWithoutHealthRecordType && notificationsWithoutHealthRecordType.length > 0 ? (\n <>\n \n {notificationsWithoutHealthRecordType.length > 1\n ? t('portale.notifications:x notifications to read', { x: notificationsWithoutHealthRecordType.length })\n : t('portale.notifications:one notification to read')}\n \n\n {importantNotifications && importantNotifications.length > 0 ? (\n <>\n \n
\n {/* Comunicazioni importanti */}\n \n \n \n \n {orderBy(importantNotifications, 'order', 'asc').map((n) => (\n this.onClickConfirm(event)}\n onCancel={(event) => this.onClickCancel(event)}\n onChangeMoreEvents={(events) => this.onChangeMoreEvents(events)}\n showError={(value) => this.showError(value)}\n />\n ))}\n
\n >\n ) : null}\n\n {groupedNotifications && groupedNotifications.length > 0 ? (\n <>\n \n
\n {/* Le tue attività */}\n \n \n \n\n \n {orderBy(groupedNotifications, 'notificationTime', 'desc').map((n) => (\n this.onClickConfirm(event)}\n onCancel={(event) => this.onClickCancel(event)}\n onChangeMoreEvents={(events) => this.onChangeMoreEvents(events)}\n showError={(value) => this.showError(value)}\n />\n ))}\n
\n >\n ) : null}\n >\n ) : (\n \n )}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n deleteResponse: state.events.deleteEvent.response,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingDeleteEvent: state.events.deleteEvent.isFetching,\n isFetchingNotifications: state.notifications.allNotifications.isFetching,\n notifications: state.notifications.allNotifications.data,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n deleteCustomEvent: (id) => dispatch(deleteEvent(id)),\n editEvent: (id, params, event) => dispatch(editEventR({ id, ...params, event })),\n editEventsStatus: (events) => dispatch(editEvents(events)),\n getAllNotifications: (id) => {\n dispatch(fetchAllNotifications(id));\n },\n});\n\nNotifications.defaultProps = {\n account: null,\n editEvent: null,\n editEventsStatus: null,\n deleteResponse: null,\n deleteCustomEvent: null,\n getAllNotifications: null,\n history: null,\n isAuthenticated: null,\n isFetchingDeleteEvent: null,\n isFetchingNotifications: false,\n notifications: [],\n t: null,\n theme: null,\n};\n\nNotifications.propTypes = {\n account: PropTypes.shape(),\n editEvent: PropTypes.func,\n editEventsStatus: PropTypes.func,\n deleteCustomEvent: PropTypes.func,\n deleteResponse: PropTypes.number,\n getAllNotifications: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetchingDeleteEvent: PropTypes.bool,\n isFetchingNotifications: PropTypes.bool,\n notifications: PropTypes.arrayOf(PropTypes.shape()),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(\n withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['enums', 'portale.notifications', 'portale.eventdetail'])(Notifications)))\n);\n","import React from 'react';\n\nimport { Row, Col } from 'react-bootstrap';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation, Trans } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport fitprimeImage from '../../../assets/img/fitprime_navy.png';\nimport rewardingImage from '../../../assets/img/regalati_benessere.png';\nimport sportAdvisorImage from '../../../assets/img/sport_advisor.png';\n\nimport { NotificationTypes } from '../../../enums';\nimport { fetchAllNotifications, skipNotifications } from '../../../reducers/notifications/actions';\nimport { setUpdateQuestionnaire, setUserHasQuestionnaire } from '../../../reducers/settings/actions';\nimport { fetchUserPlan } from '../../../reducers/users/actions';\n\nimport { getNotificationsBySpecificType, showNotification } from '../../../utils';\n\nimport { Button, Container, Text } from '../../../components';\nimport { ListGroup } from '../../../components/portale';\n\nconst MCol = styled(Col)((p) => ({\n [p.theme.mediaQueries.md]: {\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n padding: 30,\n },\n}));\n\nconst CPreventionPath = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 0px',\n },\n\n a: {\n '&:hover': {\n color: p.theme.colors.PRIMARY1,\n },\n },\n '.rewarding': {\n '.logo-1': {\n backgroundImage: `url(${rewardingImage})`,\n backgroundPosition: 'left',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 60,\n width: '48%',\n [p.theme.mediaQueries.md]: {\n height: 80,\n width: '30%',\n },\n },\n '.logo-2': {\n backgroundImage: `url(${fitprimeImage})`,\n backgroundPosition: 'left',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 30,\n marginLeft: 20,\n width: '45%',\n [p.theme.mediaQueries.md]: {\n height: 50,\n marginLeft: 15,\n width: '30%',\n },\n },\n 'a, span': {\n display: 'inline',\n },\n },\n}));\n\nconst LogoSport = styled.div({\n backgroundImage: `url(${sportAdvisorImage})`,\n backgroundPosition: 'right',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 40,\n width: 250,\n});\n\nclass PreventionPath extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n notificationQuestionnaire: null,\n showFirstSection: true,\n showQuestionnaireExpired: false,\n showQuestionnaireUpdate: false,\n };\n }\n\n componentDidMount() {\n const {\n account,\n getAllNotifications,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getAllNotifications(account.id);\n getUserPlan(account.id, questionnaire.healthPlanId, true);\n }\n }\n\n static getDerivedStateFromProps(props) {\n return {\n notificationQuestionnaire: getNotificationsBySpecificType(props.notifications, [NotificationTypes.QUESTIONNAIRE_EXPIRED, NotificationTypes.QUESTIONNAIRE_UPDATE]),\n showQuestionnaireExpired: showNotification(props.notifications, [\n NotificationTypes.QUESTIONNAIRE_EXPIRED,\n ]),\n showQuestionnaireUpdate: showNotification(props.notifications, [\n NotificationTypes.QUESTIONNAIRE_UPDATE,\n ]),\n };\n }\n\n checkElementsVisibility(screen, showDetails) {\n this.setState({\n showFirstSection: screen === 'large' || !showDetails,\n });\n }\n\n handleModalQuestionnaireSave(data) {\n const {\n history,\n skipNotification,\n setUpdate,\n setUserQuestionnaire,\n } = this.props;\n\n setUserQuestionnaire(false);\n\n const updateType = data.notificationType === NotificationTypes.QUESTIONNAIRE_EXPIRED ? 'expired' : 'update';\n skipNotification(data.id).then(() => {\n setUpdate(updateType);\n\n localStorage.setItem('questionnaire-notification', new Date().toISOString());\n history.push('/consenses');\n });\n }\n\n render() {\n const {\n isFetching,\n plan,\n t,\n theme,\n } = this.props;\n\n const {\n notificationQuestionnaire,\n showFirstSection,\n showQuestionnaireExpired,\n showQuestionnaireUpdate,\n } = this.state;\n\n if (isFetching || !plan) {\n return null;\n }\n\n return (\n \n \n \n \n \n \n\n {(showQuestionnaireExpired || showQuestionnaireUpdate) && (\n \n this.handleModalQuestionnaireSave(notificationQuestionnaire ? notificationQuestionnaire[0] : null)}\n small\n text={t('enums:notifications templates.QUESTIONNAIRE_cta')}\n variant=\"primary\"\n width={{ _: '100%', md: 'auto!important' }}\n />\n \n )}\n
\n \n\n {plan.activities && plan.activities.length > 0 ? (\n <>\n \n \n \n \n \n
\n \n\n \n \n \n this.checkElementsVisibility(screen, showDetails)} plan={plan} isHealthClient />\n \n
\n \n >\n ) : (\n \n \n \n \n \n
\n \n )}\n\n \n \n \n \n\n \n }} i18nKey=\"portale.preventionpath:section2.title2\" />\n \n\n \n\n \n\n \n \n \n
\n \n
\n \n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getAllNotifications: (id) => dispatch(fetchAllNotifications(id)),\n getUserPlan: (account, healthPlan, hpae) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, healthPlanActivityEnabled: hpae, id: account })),\n setUpdate: (value) => dispatch(setUpdateQuestionnaire(value)),\n setUserQuestionnaire: (params) => dispatch(setUserHasQuestionnaire(params)),\n skipNotification: (id) => dispatch(skipNotifications(id)),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n notifications: state.notifications.allNotifications.data,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nPreventionPath.defaultProps = {\n account: null,\n getAllNotifications: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: null,\n isFetching: null,\n notifications: null,\n plan: null,\n questionnaire: null,\n setUpdate: null,\n setUserQuestionnaire: null,\n skipNotification: null,\n t: null,\n theme: null,\n};\n\nPreventionPath.propTypes = {\n account: PropTypes.shape(),\n getAllNotifications: PropTypes.func,\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n notifications: PropTypes.arrayOf(PropTypes.shape()),\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n setUpdate: PropTypes.func,\n setUserQuestionnaire: PropTypes.func,\n skipNotification: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.preventionpath'])(PreventionPath))));\n","import React from 'react';\n\nimport { connect } from 'react-redux';\nimport { Trans, withTranslation } from 'react-i18next';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CheckboxInputGroup,\n Container,\n Loading,\n Modal,\n Text,\n} from '../../../components';\nimport { Authorities, Consenses } from '../../../enums';\n\nimport { setPrivacy as setPrivacyAction } from '../../../reducers/privacy/actions';\nimport {\n checkConsenses,\n getConsensesObject,\n getConsensesObjectSet,\n getCompany,\n} from '../../../utils';\nimport { setUserHasPreventionPathPrivacy, setConfirmedPrivacy as setConfirmedPrivacyAction } from '../../../reducers/settings/actions';\n\nconst CPrivacy = styled(Container)((p) => ({\n '.container-CheckboxInputGroup': {\n label: {\n p: {\n marginBottom: 0,\n },\n },\n '.rewarding-policy-link': {\n textDecoration: 'none',\n span: {\n textDecoration: 'underline',\n },\n '&:hover': {\n textDecoration: 'none',\n span: {\n color: p.theme.colors.PRIMARY1,\n },\n },\n },\n },\n}));\n\nconst ContainerButton = styled.div({\n textAlign: 'right',\n});\n\nconst ContainerScroll = styled.div(({ showConsenses, theme }) => ({\n border: showConsenses ? `1px solid ${theme.colors.GREY4}` : 0,\n marginBottom: showConsenses ? 30 : 0,\n maxHeight: showConsenses ? 500 : 'none',\n padding: showConsenses ? 10 : 0,\n overflowY: 'auto',\n}));\n\nconst Menu = styled.ul({\n i: {\n fontStyle: 'italic',\n paddingLeft: 10,\n },\n\n li: {\n marginBottom: 8,\n },\n\n strong: {\n lineHeight: '2em',\n },\n});\n\nconst MenuStyled = styled.ul({\n listStyle: 'inside',\n marginBottom: 0,\n});\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass Privacy extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n disabled: false,\n showModal: false,\n showConsenses: props.showConsenses || false,\n };\n\n this.closeModal = this.closeModal.bind(this);\n this.getSelectedValues = this.getSelectedValues.bind(this);\n this.redirect = this.redirect.bind(this);\n this.setCheckboxes = this.setCheckboxes.bind(this);\n this.setCheckboxesPreventionPath = this.setCheckboxesPreventionPath.bind(this);\n this.showModal = this.showModal.bind(this);\n this.submit = this.submit.bind(this);\n }\n\n componentDidMount() {\n const { history, location } = this.props;\n\n this.setState({\n confirmedPrivacy: getParams(history.location.search).confirmed,\n consenses: this.getSelectedValues(),\n disabled: location.state ? location.state.disabled : false,\n next: false,\n });\n }\n\n componentDidUpdate() {\n const {\n privacy,\n updateQuestionnaire,\n userHasPreventionPathPrivacy,\n } = this.props;\n\n const { confirmedPrivacy, next, showConsenses } = this.state;\n\n if (!updateQuestionnaire) {\n if (confirmedPrivacy === 'false' && !next) {\n return;\n }\n\n if (userHasPreventionPathPrivacy) {\n this.redirect();\n return;\n }\n\n if (privacy && privacy.length > 0 && privacy[0].id && showConsenses) {\n if (checkConsenses(privacy, Consenses.PREVENTION_PATH.code)) {\n this.redirect();\n }\n }\n } else if (next) {\n this.redirect();\n }\n }\n\n setCheckboxes(values) {\n const { consenses } = this.state;\n const tmp = consenses || [];\n\n // controllo WAS_5\n if (values.includes(Consenses.REWARDING.code)) {\n if (!tmp.includes(Consenses.REWARDING.code)) {\n tmp.push(Consenses.REWARDING.code);\n }\n } else {\n const index = tmp.indexOf(Consenses.REWARDING.code);\n if (index > -1) {\n tmp.splice(index, 1);\n }\n }\n\n // controllo readed e rimuovo anche WAS_5 se necessario\n if (values.includes('readed')) {\n if (!tmp.includes('readed')) {\n tmp.push('readed');\n }\n } else {\n const index = tmp.indexOf('readed');\n if (index > -1) {\n tmp.splice(index, 1);\n\n const index2 = tmp.indexOf(Consenses.REWARDING.code);\n if (index2 > -1) {\n tmp.splice(index2, 1);\n }\n }\n }\n\n this.setState({ consenses: tmp });\n }\n\n setCheckboxesPreventionPath(values) {\n const { consenses } = this.state;\n const tmp = consenses || [];\n\n if (values.includes(Consenses.PREVENTION_PATH.code)) {\n if (!tmp.includes(Consenses.PREVENTION_PATH.code)) {\n tmp.push(Consenses.PREVENTION_PATH.code);\n }\n } else {\n const index = tmp.indexOf(Consenses.PREVENTION_PATH.code);\n if (index > -1) {\n tmp.splice(index, 1);\n }\n }\n\n this.setState({ consenses: tmp });\n }\n\n getSelectedValues() {\n const {\n privacy,\n questionnaire,\n result,\n updateQuestionnaire,\n } = this.props;\n const tmp = [];\n\n if (privacy && privacy.length > 0) {\n if (checkConsenses(privacy, Consenses.PREVENTION_PATH.code)) {\n tmp.push(Consenses.PREVENTION_PATH.code);\n }\n\n if (!updateQuestionnaire && checkConsenses(privacy, Consenses.REWARDING.code && questionnaire)) {\n tmp.push('readed', Consenses.REWARDING.code);\n }\n } else if (result && result.length > 0) {\n if (checkConsenses(result, Consenses.PREVENTION_PATH.code)) {\n tmp.push(Consenses.PREVENTION_PATH.code);\n }\n\n if (checkConsenses(result, Consenses.REWARDING.code)) {\n tmp.push('readed', Consenses.REWARDING.code);\n }\n }\n\n return tmp;\n }\n\n closeModal() {\n this.setState({ showModal: false });\n }\n\n redirect() {\n const { account, history, setUserPreventionPathPrivacy } = this.props;\n const { disabled } = this.state;\n\n setUserPreventionPathPrivacy(true);\n if (!disabled) {\n if (account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role)) {\n history.push(Authorities.PB_HEALTH_CLIENT.questionnairePage);\n } else {\n history.push(Authorities.PB_PROSPECT.questionnairePage);\n }\n }\n }\n\n showModal(event) {\n event.preventDefault();\n this.setState({ showModal: true });\n }\n\n submit() {\n const {\n account,\n setPrivacy,\n setConfirmedPrivacy,\n updateQuestionnaire,\n } = this.props;\n\n const { confirmedPrivacy, consenses } = this.state;\n\n setConfirmedPrivacy(true);\n\n const consensesToSend = [];\n if (consenses.includes(Consenses.PREVENTION_PATH.code)) {\n consensesToSend.push(getConsensesObjectSet(account, 'WAS_2', Consenses.PREVENTION_PATH.code));\n }\n\n if (consenses.includes(Consenses.REWARDING.code)) {\n consensesToSend.push(getConsensesObjectSet(account, 'WAS_2', Consenses.REWARDING.code));\n } else if (updateQuestionnaire || confirmedPrivacy === 'false') {\n consensesToSend.push(getConsensesObjectSet(account, 'WAS_2', Consenses.REWARDING.code, 'N'));\n }\n\n if (consensesToSend.length > 0) {\n setPrivacy(consensesToSend, getConsensesObject(account)).then(() => {\n this.setState({ next: true });\n });\n } else if (updateQuestionnaire) {\n this.redirect();\n }\n }\n\n render() {\n const {\n isLoading,\n result,\n t,\n theme,\n updateQuestionnaire,\n } = this.props;\n\n const {\n consenses,\n disabled,\n showConsenses,\n showModal,\n } = this.state;\n\n return isLoading && !result ? (\n \n ) : (\n \n {showModal && (\n \n \n \n )}\n\n \n\n \n \n }} i18nKey=\"portale.privacy:disclaimer.0 title\" />\n \n\n \n \n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.privacy:disclaimer.2 content\" parent=\"p\" />\n\n \n \n\n \n\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n\n \n \n }} i18nKey=\"portale.privacy:disclaimer.5 list.2\" parent=\"li\" />\n \n\n \n\n \n \n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n , a: }} i18nKey=\"portale.privacy:disclaimer.7 content\" parent=\"p\" />\n\n \n \n\n { getCompany() === 'tua' ? (\n <>\n \n \n \n \n \n \n >\n ) : '' }\n\n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.privacy:disclaimer.9 content\" parent=\"p\" />\n\n \n \n \n \n \n \n \n \n {/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}\n }} i18nKey=\"portale.privacy:disclaimer.9 list.8\" parent=\"li\" />\n \n\n \n\n \n\n \n \n \n\n {showConsenses ? (\n <>\n \n\n {consenses && (\n }} i18nKey=\"portale.privacy:allow\" />,\n props: {\n onClick: this.showModal,\n },\n value: Consenses.PREVENTION_PATH.code,\n },\n ]}\n disabled={disabled || (consenses && consenses.includes(Consenses.PREVENTION_PATH.code))}\n name=\"preventionPath\"\n onChange={this.setCheckboxesPreventionPath}\n selectedValues={disabled ? [Consenses.PREVENTION_PATH.code] : consenses}\n />\n )}\n\n {!disabled && (\n \n \n \n )}\n >\n ) : null}\n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n confirmedPrivacy: state.settings.confirmedPrivacy,\n isLoading: state.privacy.isFetching,\n privacy: state.privacy.privacy,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n result: state.privacy.result,\n updateQuestionnaire: state.settings.updateQuestionnaire,\n userHasPreventionPathPrivacy: state.settings.userHasPreventionPathPrivacy,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n setPrivacy: (dataSet, dataGet) => dispatch(setPrivacyAction({ dataSet, dataGet })),\n setConfirmedPrivacy: (params) => dispatch(setConfirmedPrivacyAction(params)),\n setUserPreventionPathPrivacy: (params) => {\n dispatch(setUserHasPreventionPathPrivacy(params));\n },\n});\n\nPrivacy.defaultProps = {\n account: null,\n history: null,\n isLoading: null,\n location: null,\n privacy: null,\n questionnaire: null,\n result: null,\n setPrivacy: null,\n setConfirmedPrivacy: null,\n setUserPreventionPathPrivacy: null,\n showConsenses: null,\n t: null,\n theme: null,\n updateQuestionnaire: null,\n userHasPreventionPathPrivacy: null,\n};\n\nPrivacy.propTypes = {\n account: PropTypes.shape(),\n history: PropTypes.shape(),\n isLoading: PropTypes.bool,\n location: PropTypes.shape(),\n privacy: PropTypes.arrayOf(PropTypes.shape()),\n questionnaire: PropTypes.shape(),\n result: PropTypes.arrayOf(PropTypes.shape()),\n setPrivacy: PropTypes.func,\n setConfirmedPrivacy: PropTypes.func,\n setUserPreventionPathPrivacy: PropTypes.func,\n showConsenses: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n updateQuestionnaire: PropTypes.string,\n userHasPreventionPathPrivacy: PropTypes.bool,\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.privacy'])(Privacy))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n GoBack,\n Text,\n} from '../../../../components';\n\nconst QuestionnaireConclusion = (props) => {\n const {\n onPreviousStepClick,\n onSubmitClick,\n t,\n theme,\n } = props;\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n
\n \n );\n};\n\nQuestionnaireConclusion.defaultProps = {\n t: null,\n theme: null,\n};\n\nQuestionnaireConclusion.propTypes = {\n onPreviousStepClick: PropTypes.func.isRequired,\n onSubmitClick: PropTypes.func.isRequired,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.questionnaire', 'translation'])(QuestionnaireConclusion));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CartoonSvg,\n Container,\n GoBack,\n StepWizard,\n Text,\n} from '../../../../components';\n\nconst ContainerIcon = styled.div(({ theme }) => ({\n svg: {\n height: '100%',\n marginTop: theme.verticalSpacing.p40,\n width: 176,\n\n [theme.mediaQueries.md]: {\n marginTop: theme.verticalSpacing.p48,\n width: 250,\n },\n },\n}));\n\nconst QuestionnaireCover = (props) => {\n const {\n covers,\n onNextStepClick,\n onPreviousStepClick,\n stepObject,\n t,\n theme,\n } = props;\n\n return (\n \n \n\n \n \n \n \n \n \n
\n\n {stepObject.componentConfig.icon ? (\n \n \n \n \n \n \n
\n ) : null}\n \n \n \n \n \n \n \n \n
\n \n );\n};\n\nQuestionnaireCover.defaultProps = {\n t: null,\n theme: null,\n};\n\nQuestionnaireCover.propTypes = {\n covers: PropTypes.arrayOf(PropTypes.string).isRequired,\n onNextStepClick: PropTypes.func.isRequired,\n onPreviousStepClick: PropTypes.func.isRequired,\n stepObject: PropTypes.shape().isRequired,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.questionnaire', 'translation'])(QuestionnaireCover));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport rewardingImage from '../../../../assets/img/regalati_benessere.png';\nimport fitprimeImage from '../../../../assets/img/fitprime_navy.png';\n\nimport { Container, Button, Text } from '../../../../components';\n\nconst EPContainer = styled(Container)((p) => ({\n '.rewarding': {\n '.logo-1': {\n backgroundImage: `url(${rewardingImage})`,\n backgroundPosition: 'left',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 60,\n width: '48%',\n [p.theme.mediaQueries.md]: {\n height: 80,\n width: '30%',\n },\n },\n '.logo-2': {\n backgroundImage: `url(${fitprimeImage})`,\n backgroundPosition: 'left',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'contain',\n height: 30,\n marginLeft: 20,\n width: '45%',\n [p.theme.mediaQueries.md]: {\n height: 50,\n marginLeft: 15,\n width: '30%',\n },\n },\n span: {\n i: {\n fontSize: p.theme.fontSizes.medium,\n fontFamily: p.theme.fontFamily.sans,\n fontStyle: 'italic',\n },\n },\n },\n}));\n\nconst ContainerButton = styled.div({\n marginBottom: '65px',\n});\n\nconst QuestionnaireEntryPage = (props) => {\n const { onNextStepClick, theme } = props;\n\n return (\n \n \n \n \n\n \n\n \n\n \n \n \n \n
\n \n );\n};\n\nQuestionnaireEntryPage.defaultProps = {\n theme: null,\n};\n\nQuestionnaireEntryPage.propTypes = {\n onNextStepClick: PropTypes.func.isRequired,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.questionnaire'])(QuestionnaireEntryPage));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n GoBack,\n Text,\n} from '../../../../components';\n\nconst OverviewList = styled.ul({\n display: 'inline-block',\n margin: 0,\n padding: 0,\n textAlign: 'left',\n width: '220px',\n});\n\nconst OverviewItem = styled.li({\n listStyle: 'none',\n marginBottom: '15px',\n});\n\nconst Bullet = styled.div(({ theme }) => ({\n backgroundColor: theme.colors.OTHER1,\n borderRadius: '50%',\n display: 'inline-block',\n height: '12px',\n width: '12px',\n}));\n\nconst QuestionnaireOverview = (props) => {\n const {\n onNextStepClick,\n onPreviousStepClick,\n t,\n theme,\n } = props;\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n\n \n \n \n \n \n \n \n
\n \n );\n};\n\nQuestionnaireOverview.defaultProps = {\n t: null,\n theme: null,\n};\n\nQuestionnaireOverview.propTypes = {\n onNextStepClick: PropTypes.func.isRequired,\n onPreviousStepClick: PropTypes.func.isRequired,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['portale.questionnaire', 'translation'])(QuestionnaireOverview));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport QuestionnaireConclusion from '../QuestionnaireConclusion';\nimport QuestionnaireCover from '../QuestionnaireCover';\nimport QuestionnaireEntryPage from '../QuestionnaireEntryPage';\nimport QuestionnaireOverview from '../QuestionnaireOverview';\n\nconst QuestionnaireInformationType = (props) => {\n const {\n covers, onNextStepClick, onPreviousStepClick, onSubmitClick, stepObject,\n } = props;\n switch (stepObject.component) {\n case 'entry':\n return (\n \n );\n case 'overview':\n return (\n \n );\n case 'cover':\n return (\n \n );\n default:\n return (\n onSubmitClick(true)}\n onPreviousStepClick={onPreviousStepClick}\n />\n );\n }\n};\n\nQuestionnaireInformationType.propTypes = {\n covers: PropTypes.arrayOf(PropTypes.string).isRequired,\n onNextStepClick: PropTypes.func.isRequired,\n onPreviousStepClick: PropTypes.func.isRequired,\n onSubmitClick: PropTypes.func.isRequired,\n stepObject: PropTypes.shape().isRequired,\n};\n\nexport default QuestionnaireInformationType;\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n GoBack,\n StepWizard,\n Text,\n} from '../../../../components';\n\nimport {\n Checkbox,\n InputNumber,\n InputSearch,\n RadioButton,\n SliderCircular,\n SliderHorizontal,\n SliderVertical,\n} from '../../../../components/portale';\n\nimport { getDefaultSelectedAnswer } from '../../../../utils';\n\nclass QuestionnaireQuestion extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n isValid: false,\n };\n\n this.getComponent = this.getComponent.bind(this);\n this.onChange = this.onChange.bind(this);\n }\n\n componentDidMount() {\n const { stepObject } = this.props;\n\n const { answers } = stepObject.componentConfig;\n\n if (stepObject.type === 'CUSTOM') {\n if (answers[0].value) {\n stepObject.isValid = true;\n this.setState({ isValid: true });\n }\n } else {\n const valid = answers.some((a) => a.selected);\n stepObject.isValid = valid;\n this.setState({ isValid: valid });\n }\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n isValid: nextProps.stepObject.isValid,\n };\n }\n\n onChange(value) {\n const { stepObject } = this.props;\n const { answers } = stepObject.componentConfig;\n\n if (stepObject.type === 'CUSTOM') {\n if (stepObject.component === 'inputNumber') {\n answers[0].value = value.value;\n\n if (parseFloat(value.value)) {\n stepObject.isValid = true;\n this.setState({ isValid: true });\n } else {\n stepObject.isValid = false;\n this.setState({ isValid: false });\n }\n } else {\n answers[0].value = value;\n\n stepObject.isValid = true;\n this.setState({ isValid: true });\n }\n } else if (stepObject.type === 'MULTIPLE') {\n const freeIndex = answers.findIndex((a) => a.free === true);\n\n answers.forEach((e) => {\n e.selected = false;\n });\n\n if (freeIndex > -1) {\n answers[freeIndex].value = '';\n }\n\n value.forEach((v) => {\n const answerIndex = answers.findIndex((a) => a.value === v);\n\n if (answerIndex > -1) {\n answers[answerIndex].selected = true;\n } else if (freeIndex > -1) {\n answers[freeIndex].selected = true;\n answers[freeIndex].value = v;\n }\n });\n\n if (value.length > 0) {\n stepObject.isValid = true;\n this.setState({ isValid: true });\n } else {\n stepObject.isValid = false;\n this.setState({ isValid: false });\n }\n } else {\n const answerIndex = answers.findIndex((a) => a.value === value);\n\n if (answerIndex > -1) {\n answers.forEach((e) => {\n e.selected = false;\n });\n answers[answerIndex].selected = true;\n\n stepObject.isValid = true;\n this.setState({ isValid: true });\n }\n }\n }\n\n getComponent() {\n const { stepObject } = this.props;\n switch (stepObject.component) {\n case 'checkbox':\n return (\n \n );\n case 'circularSlider':\n return (\n \n );\n case 'inputNumber':\n return (\n \n );\n case 'inputSearch':\n console.log('Input search...')\n return (\n \n );\n case 'radiobutton':\n return (\n \n );\n case 'sliderHorizontal':\n return (\n \n );\n case 'sliderVertical':\n return (\n \n );\n default:\n break;\n }\n return stepObject.component;\n }\n\n render() {\n const {\n covers,\n onNextStepClick,\n onPreviousStepClick,\n stepObject,\n t,\n theme,\n } = this.props;\n\n const { isValid } = this.state;\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n
\n\n \n {this.getComponent()}\n
\n \n\n \n \n \n \n \n \n \n
\n \n );\n }\n}\n\nQuestionnaireQuestion.defaultProps = {\n t: null,\n theme: null,\n};\n\nQuestionnaireQuestion.propTypes = {\n covers: PropTypes.arrayOf(PropTypes.string).isRequired,\n onNextStepClick: PropTypes.func.isRequired,\n onPreviousStepClick: PropTypes.func.isRequired,\n stepObject: PropTypes.shape().isRequired,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withTranslation(['translation'])(QuestionnaireQuestion));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\n\nimport PropTypes from 'prop-types';\n\nimport { Loading } from '../../../components';\n\nimport {\n createPartialStructure,\n getCoversSectionTitle,\n getCurrentVersion,\n getQuestionnaireStructure,\n getQuestions,\n} from '../../../utils';\n\nimport { QuestionnaireSteps, Authorities } from '../../../enums';\n\nimport QuestionnaireInformationType from './QuestionnaireInformationType/QuestionnaireInformationType';\nimport QuestionnaireQuestion from './QuestionnaireQuestion/QuestionnaireQuestion';\n\nimport { createQuestionnaire, editQuestionnaire, fetchQuestionnaire } from '../../../reducers/questionnaires/actions';\nimport { setConfirmedPrivacy, setUpdateQuestionnaire, setUserHasQuestionnaire } from '../../../reducers/settings/actions';\n\nclass Questionnaire extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n oldQuestionnaire: null,\n currentStep: null,\n questionnaire: getQuestionnaireStructure(props.t),\n qstToSave: {},\n covers: getCoversSectionTitle(props.t),\n };\n\n this.calculateCurrentStep = this.calculateCurrentStep.bind(this);\n this.getCurrentStep = this.getCurrentStep.bind(this);\n this.initQuestionnaire = this.initQuestionnaire.bind(this);\n this.moveSteps = this.moveSteps.bind(this);\n this.onSave = this.onSave.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getQuestionnaireByUser,\n isAuthenticated,\n updateQuestionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getQuestionnaireByUser({ skipExpired: updateQuestionnaire ? true : undefined });\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n // check if there are fetching request\n const isFetching = nextProps.oldQuestionnairesIsFetching || nextProps.sendingCreateQuestionnaire || nextProps.sendingEditQuestionnaire;\n\n const oldQuestionnaireWithCurrentVersion = nextProps.oldQuestionnaires && nextProps.oldQuestionnaires.version === getCurrentVersion() ? nextProps.oldQuestionnaires : null;\n\n const createdQuestionnaire = nextProps.responseCreateQuestionnaire ? nextProps.responseCreateQuestionnaire : null;\n const editedQuestionnaire = nextProps.responseEditQuestionnaire ? nextProps.responseEditQuestionnaire : null;\n\n if (!isFetching) {\n if ((!oldQuestionnaireWithCurrentVersion && !editedQuestionnaire && !createdQuestionnaire) || nextProps.updateQuestionnaire === 'expired') {\n return {\n currentStep: nextState.currentStep ? nextState.currentStep : QuestionnaireSteps.ENTRYPAGE.stepKey,\n questionnaireMode: 'NEW',\n };\n // eslint-disable-next-line no-else-return\n } else if (oldQuestionnaireWithCurrentVersion && !createdQuestionnaire && !editedQuestionnaire) {\n return {\n qstToSave: createPartialStructure(nextState.questionnaire, oldQuestionnaireWithCurrentVersion),\n currentStep: nextState.currentStep ? nextState.currentStep : oldQuestionnaireWithCurrentVersion.stepKey,\n questionnaireMode: 'MODIFY',\n oldQuestionnaire: oldQuestionnaireWithCurrentVersion,\n };\n } else if (createdQuestionnaire && !editedQuestionnaire) {\n return {\n qstToSave: createPartialStructure(nextState.questionnaire, createdQuestionnaire),\n currentStep: nextState.currentStep ? nextState.currentStep : createdQuestionnaire.stepKey,\n questionnaireMode: 'MODIFY',\n oldQuestionnaire: createdQuestionnaire,\n };\n } else if (editedQuestionnaire) {\n return {\n initState: false,\n qstToSave: createPartialStructure(nextState.questionnaire, editedQuestionnaire),\n currentStep: nextState.currentStep ? nextState.currentStep : editedQuestionnaire.stepKey,\n questionnaireMode: 'MODIFY',\n oldQuestionnaire: editedQuestionnaire,\n };\n }\n }\n return {};\n }\n\n componentDidUpdate(previousProps, previousStates) {\n const {\n account,\n confirmedPrivacy,\n history,\n isFetchingPrivacy,\n setUserQuestionnaire,\n updateQuestionnaire,\n userHasPreventionPathPrivacy,\n } = this.props;\n\n const { oldQuestionnaire, questionnaire, questionnaireMode } = this.state;\n\n if (!isFetchingPrivacy && !userHasPreventionPathPrivacy) {\n history.push('/consenses');\n }\n\n if (!isFetchingPrivacy && questionnaireMode === 'NEW' && !confirmedPrivacy) {\n setConfirmedPrivacy(false);\n history.push('/consenses?confirmed=false');\n }\n\n if (oldQuestionnaire && oldQuestionnaire.id && oldQuestionnaire.completed && !updateQuestionnaire) {\n setUserQuestionnaire(true);\n if (account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role)) {\n history.push('/dashboard');\n } else {\n history.push('/home');\n }\n } else {\n setUserQuestionnaire(false);\n }\n\n if (updateQuestionnaire && oldQuestionnaire) {\n if (!previousStates.oldQuestionnaire || (previousStates.oldQuestionnaire && oldQuestionnaire.id !== previousStates.oldQuestionnaire.id)) {\n this.initQuestionnaire(questionnaire, oldQuestionnaire);\n }\n }\n }\n\n onSave(completed, nextStep) {\n const {\n saveNewQuestionnaire,\n saveExistingQuestionnaire,\n setUpdate,\n t,\n } = this.props;\n\n const {\n currentStep,\n oldQuestionnaire,\n questionnaireMode,\n qstToSave,\n } = this.state;\n\n const currentQuestionnaire = {\n version: getCurrentVersion(),\n stepKey: completed ? currentStep : nextStep,\n questions: getQuestions(qstToSave, t),\n completed,\n };\n\n if (questionnaireMode === 'NEW' && currentQuestionnaire.questions.length > 0) {\n saveNewQuestionnaire(currentQuestionnaire).then(() => {\n if (completed) {\n setUpdate(false);\n } else {\n setUpdate('update');\n }\n });\n } else if (questionnaireMode === 'MODIFY' && currentQuestionnaire.questions.length > 0) {\n if (oldQuestionnaire && oldQuestionnaire.id) {\n currentQuestionnaire.id = oldQuestionnaire.id;\n }\n saveExistingQuestionnaire(currentQuestionnaire).then(() => {\n if (completed) {\n setUpdate(false);\n }\n });\n }\n }\n\n getCurrentStep() {\n const {\n covers,\n currentStep,\n questionnaire,\n qstToSave,\n } = this.state;\n\n if (questionnaire) {\n if (!qstToSave[currentStep]) {\n qstToSave[currentStep] = { ...questionnaire[currentStep] };\n }\n\n if (qstToSave[currentStep].type === 'INFORMATION') {\n return (\n this.moveSteps(true)}\n onPreviousStepClick={() => this.moveSteps(false)}\n onSubmitClick={this.onSave}\n stepObject={qstToSave[currentStep]}\n />\n );\n }\n if (qstToSave[currentStep].type === 'SINGLE' || qstToSave[currentStep].type === 'MULTIPLE' || qstToSave[currentStep].type === 'CUSTOM') {\n return (\n this.moveSteps(true)}\n onPreviousStepClick={() => this.moveSteps(false)}\n stepObject={qstToSave[currentStep]}\n />\n );\n }\n }\n return null;\n }\n\n initQuestionnaire(questionnaire, oldQuestionnaire) {\n this.setState({\n qstToSave: {},\n currentStep: oldQuestionnaire.stepKey,\n questionnaireMode: 'MODIFY',\n oldQuestionnaire,\n });\n }\n\n calculateCurrentStep(stepObject) {\n const { questionnaire, currentStep } = this.state;\n const indexSelectedAnswer = stepObject.componentConfig.answers.findIndex((a) => a.selected);\n\n let newStep = currentStep;\n\n if (indexSelectedAnswer >= 0) {\n const selectedAnswer = stepObject.componentConfig.answers[indexSelectedAnswer];\n if (selectedAnswer.goTo) {\n if (selectedAnswer.skip && selectedAnswer.skip.length > 0) {\n selectedAnswer.skip.forEach((skipItem) => {\n questionnaire[skipItem].visible = false;\n });\n }\n questionnaire[selectedAnswer.goTo].visible = true;\n newStep = selectedAnswer.goTo;\n this.setState({ currentStep: selectedAnswer.goTo });\n }\n }\n return newStep;\n }\n\n moveSteps(next) {\n const { currentStep, questionnaire, qstToSave } = this.state;\n const stepsKeys = Object.keys(questionnaire);\n const indexCurrentStep = stepsKeys.indexOf(currentStep);\n let increment = 1;\n\n const stepObject = qstToSave[currentStep];\n if (stepObject.hasConditionalAnswers && next) {\n this.onSave(false, this.calculateCurrentStep(stepObject));\n } else if (next) {\n while (!questionnaire[stepsKeys[indexCurrentStep + increment]].visible) {\n increment += 1;\n }\n this.setState({ currentStep: stepsKeys[indexCurrentStep + increment] });\n this.onSave(false, stepsKeys[indexCurrentStep + increment]);\n } else {\n while (!questionnaire[stepsKeys[indexCurrentStep - increment]].visible) {\n increment += 1;\n }\n this.setState({ currentStep: stepsKeys[indexCurrentStep - increment] });\n }\n window.scrollTo(0, 0);\n }\n\n render() {\n const {\n isFetchingPrivacy,\n oldQuestionnairesIsFetching,\n sendingCreateQuestionnaire,\n sendingEditQuestionnaire,\n userHasPreventionPathPrivacy,\n } = this.props;\n\n const { currentStep } = this.state;\n\n if (isFetchingPrivacy || !userHasPreventionPathPrivacy || !currentStep || oldQuestionnairesIsFetching || sendingCreateQuestionnaire || sendingEditQuestionnaire) {\n return ;\n }\n return this.getCurrentStep();\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n confirmedPrivacy: state.settings.confirmedPrivacy,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingPrivacy: state.privacy.isFetching,\n oldQuestionnaires: state.questionnaires.fetchQuestionnaire.data,\n oldQuestionnairesIsFetching: state.questionnaires.fetchQuestionnaire.isFetching,\n responseCreateQuestionnaire: state.questionnaires.createQuestionnaire.data,\n responseEditQuestionnaire: state.questionnaires.editQuestionnaire.data,\n sendingCreateQuestionnaire: state.questionnaires.createQuestionnaire.isFetching,\n sendingEditQuestionnaire: state.questionnaires.editQuestionnaire.isFetching,\n updateQuestionnaire: state.settings.updateQuestionnaire,\n userHasPreventionPathPrivacy: state.settings.userHasPreventionPathPrivacy,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getQuestionnaireByUser: (params) => dispatch(fetchQuestionnaire(params)),\n saveExistingQuestionnaire: (request) => dispatch(editQuestionnaire(request)),\n saveNewQuestionnaire: (request) => dispatch(createQuestionnaire(request)),\n setUserQuestionnaire: (params) => {\n dispatch(setUserHasQuestionnaire(params));\n },\n setUpdate: (value) => dispatch(setUpdateQuestionnaire(value)),\n});\n\nQuestionnaire.defaultProps = {\n account: null,\n confirmedPrivacy: null,\n getQuestionnaireByUser: null,\n history: null,\n isAuthenticated: null,\n isFetchingPrivacy: null,\n oldQuestionnaires: null,\n oldQuestionnairesIsFetching: true,\n responseCreateQuestionnaire: null,\n responseEditQuestionnaire: null,\n saveExistingQuestionnaire: null,\n saveNewQuestionnaire: null,\n sendingCreateQuestionnaire: false,\n sendingEditQuestionnaire: false,\n setUpdate: null,\n setUserQuestionnaire: null,\n t: null,\n updateQuestionnaire: null,\n userHasPreventionPathPrivacy: false,\n};\n\nQuestionnaire.propTypes = {\n account: PropTypes.shape(),\n confirmedPrivacy: PropTypes.bool,\n getQuestionnaireByUser: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetchingPrivacy: PropTypes.bool,\n oldQuestionnaires: PropTypes.shape(),\n oldQuestionnairesIsFetching: PropTypes.bool,\n responseCreateQuestionnaire: PropTypes.shape(),\n responseEditQuestionnaire: PropTypes.shape(),\n saveExistingQuestionnaire: PropTypes.func,\n saveNewQuestionnaire: PropTypes.func,\n sendingCreateQuestionnaire: PropTypes.bool,\n sendingEditQuestionnaire: PropTypes.bool,\n setUpdate: PropTypes.func,\n setUserQuestionnaire: PropTypes.func,\n t: PropTypes.func,\n updateQuestionnaire: PropTypes.string,\n userHasPreventionPathPrivacy: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.questionnaire'])(Questionnaire)));\n","import React from 'react';\n\nimport { Row, Col } from 'react-bootstrap';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchUserPlan } from '../../../reducers/users/actions';\n\nimport { Button, Container, Text } from '../../../components';\nimport { ListGroup } from '../../../components/portale';\n\nconst MCol = styled(Col)({\n textAlign: 'center',\n});\n\nconst MRow = styled(Row)({\n margin: 0,\n});\n\nclass RecommendedPreventionPath extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n showFirstSection: true,\n };\n }\n\n componentDidMount() {\n const {\n account,\n getUserPlan,\n isAuthenticated,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId);\n }\n }\n\n checkElementsVisibility(screen, showDetails) {\n this.setState({\n showFirstSection: screen === 'large' || !showDetails,\n });\n }\n\n render() {\n const {\n history,\n isFetching,\n plan,\n theme,\n } = this.props;\n\n const { showFirstSection } = this.state;\n\n if (isFetching || !plan) {\n return null;\n }\n\n return (\n \n \n \n \n \n \n
\n \n \n \n \n
\n \n\n \n \n \n {plan ? (\n this.checkElementsVisibility(screen, showDetails)} plan={plan} showPlusControls />\n ) : null}\n \n
\n \n\n \n \n \n \n \n \n \n \n history.push('/health-coach')}\n text=\"portale.recommendedpreventionpath:section3.button\"\n textTransform=\"uppercase\"\n variant=\"primary\"\n width=\"340px\"\n />\n \n
\n \n \n \n \n\n {/* \n \n \n \n \n
\n \n \n ----- ARTICOLI -----\n \n
\n */}\n
\n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetching: state.users.fetchUserPlan.isFetching,\n plan: state.users.fetchUserPlan.data,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nRecommendedPreventionPath.defaultProps = {\n account: null,\n getUserPlan: null,\n history: null,\n isAuthenticated: null,\n isFetching: null,\n plan: null,\n questionnaire: null,\n theme: null,\n};\n\nRecommendedPreventionPath.propTypes = {\n account: PropTypes.shape(),\n getUserPlan: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetching: PropTypes.bool,\n plan: PropTypes.shape(),\n questionnaire: PropTypes.shape(),\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.recommendedpreventionpath'])(RecommendedPreventionPath))));\n","import React from 'react';\n\nimport { Row, Col } from 'react-bootstrap';\nimport { withTranslation } from 'react-i18next';\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport firstImage from '../../../assets/img/story-01.png';\nimport secondImage from '../../../assets/img/story-02.png';\n\nimport { Container, Text } from '../../../components';\n\nimport {\n getCompany,\n} from '../../../utils';\n\nconst CStory = styled.div(({ theme }) => ({\n '.container-description': {\n textAlign: 'center',\n\n [theme.mediaQueries.md]: {\n textAlign: 'left',\n },\n },\n '.container-image': {\n justifyContent: 'center',\n margin: '0',\n\n [theme.mediaQueries.md]: {\n justifyContent: 'flex-end',\n margin: '120px 0px 24px',\n },\n '.custom-rounded': {\n backgroundImage: `url(${secondImage})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '152%',\n borderRadius: '50%',\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n height: '150px',\n margin: '40px 0px',\n width: '150px',\n\n [theme.mediaQueries.md]: {\n height: '235px',\n margin: 0,\n minHeight: '235px',\n minWidth: '235px',\n width: '235px',\n },\n },\n },\n\n '.triangle': {\n backgroundImage: theme.colors.GRADIENTBG,\n backgroundPositionY: 'bottom',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '123% 123%',\n padding: 0,\n },\n\n '.list-info': {\n display: 'flex',\n\n '.content.text-left': {\n paddingRight: 16,\n\n [theme.mediaQueries.md]: {\n paddingRight: 0,\n },\n },\n },\n}));\n\nconst SeparatorV = styled.div(({ theme }) => ({\n borderLeft: `1px solid ${theme.colors.PRIMARY2}`,\n bottom: '-16px',\n height: 53,\n left: '50%',\n margin: '0 auto',\n position: 'absolute',\n width: 1,\n\n [theme.mediaQueries.md]: {\n height: 64,\n },\n}));\n\nconst IconRight = styled.div(({ theme }) => ({\n border: `4px solid ${theme.colors.PRIMARY2}`,\n borderRadius: '50%',\n height: 16,\n margin: '6px 16px 0',\n minWidth: 16,\n width: 16,\n\n [theme.mediaQueries.md]: {\n margin: '6px 20px 0 0',\n },\n}));\n\nconst Story = (props) => {\n const { t, theme } = props;\n\n const listInfo = [t('portale.story:list info.item 1'), t('portale.story:list info.item 2'), t('portale.story:list info.item 3')];\n\n return (\n \n \n \n \n \n \n \n \n
\n \n \n \n \n\n \n \n \n \n \n\n {listInfo.map((item, index) => (\n // eslint-disable-next-line react/no-array-index-key\n \n ))}\n\n \n \n\n \n
\n \n
\n \n \n );\n};\n\nStory.propTypes = {\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nStory.defaultProps = {\n t: null,\n theme: null,\n};\n\nexport default withTheme(withTranslation(['portale.story'])(Story));\n","import React from 'react';\n\nimport { Trans, withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n CartoonSvg,\n Container,\n GoBack,\n Loading,\n MaterialDesignInput,\n SelectInput,\n Text,\n} from '../../../components';\n\nimport { NotificationTypes } from '../../../enums';\nimport { getNotificationsBySpecificType } from '../../../utils';\n\nimport { createOrCheckEnrollment, fetchCheckEnrolled, fetchHealtcareResources } from '../../../reducers/sharemed/actions';\nimport { deleteNotifications, fetchAllNotifications } from '../../../reducers/notifications/actions';\n\nconst CSharemedForms = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 64px',\n },\n\n '.bg-white': {\n borderRadius: '8px',\n margin: '0 0 32px',\n padding: '34px 15px',\n\n [p.theme.mediaQueries.md]: {\n marginBottom: 32,\n padding: '64px 0',\n },\n },\n}));\n\nconst ContainerForm = styled.div((p) => ({\n marginTop: 20,\n\n '>div:last-child': {\n marginTop: 15,\n },\n\n '.inputs': {\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n width: '100%',\n\n '>div': {\n marginTop: 15,\n maxWidth: '100%',\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n marginBottom: 0,\n maxWidth: '45%',\n width: '45%',\n },\n },\n\n [p.theme.mediaQueries.md]: {\n alignItems: 'center',\n flexDirection: 'row',\n },\n },\n}));\n\nconst ContainerButton = styled.div((p) => ({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'flex-end',\n marginTop: 20,\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n marginBottom: 20,\n },\n}));\n\nclass Sharemed extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n sharemedDataForm: {\n fiscalCode: props.account.fiscalCode || '',\n },\n };\n\n this.getDataSource = this.getDataSource.bind(this);\n this.goBack = this.goBack.bind(this);\n this.handleChangeSharemedData = this.handleChangeSharemedData.bind(this);\n this.handleCloseModal = this.handleCloseModal.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getAllNotifications,\n checkEnrolled,\n } = this.props;\n\n if (account) {\n getAllNotifications(account.id);\n checkEnrolled();\n }\n }\n\n static getDerivedStateFromProps(nextProps, nextState) {\n const hasSharemedDataForm = nextState.sharemedDataForm\n && Object.keys(nextState.sharemedDataForm).filter((x) => x !== null).length === 4;\n\n return {\n disableSubmit: !(hasSharemedDataForm || (nextState.sharemedDataForm && nextState.sharemedDataForm.asl === '0')),\n disableAslSelect: !nextState.sharemedDataForm.cap\n || nextState.sharemedDataForm.cap.length < 5,\n sharemedNotification: nextProps.notifications && nextProps.notifications.length > 0\n && getNotificationsBySpecificType(nextProps.notifications, NotificationTypes.SHAREMED_INFO)\n ? getNotificationsBySpecificType(nextProps.notifications, NotificationTypes.SHAREMED_INFO)[0]\n : null,\n verifySuccessfull: !nextProps.createOrCheckEnrollmentIsFetching\n && nextProps.createOrCheckEnrollmentResult,\n verifyUnsuccessfull: (!nextProps.createOrCheckEnrollmentIsFetching\n && nextProps.createOrCheckEnrollmentErrorResult\n && nextProps.createOrCheckEnrollmentErrorResult.status === 400)\n || nextState.verifyUnsuccessfull,\n };\n }\n\n componentDidUpdate() {\n const {\n deleteNotification,\n enrollmentIsFetching,\n isEnrolled,\n } = this.props;\n\n const { sharemedNotification } = this.state;\n\n if (!enrollmentIsFetching && isEnrolled\n && sharemedNotification && sharemedNotification.id) {\n deleteNotification(sharemedNotification.id);\n }\n }\n\n handleChangeSharemedData(e) {\n const { getHealtcareResources } = this.props;\n const { sharemedDataForm } = this.state;\n\n if (e.target) {\n const { name, value } = e.target;\n\n if (value && value !== '') {\n this.setState({\n sharemedDataForm: {\n ...sharemedDataForm,\n [name]: value,\n },\n });\n } else {\n const tmpsharemedDataForm = { ...sharemedDataForm };\n delete tmpsharemedDataForm[name];\n\n this.setState({\n sharemedDataForm: { ...tmpsharemedDataForm },\n });\n }\n } else {\n const { name, value } = e;\n const tmpsharemedDataForm = { ...sharemedDataForm };\n\n if (value && value !== '') {\n if (name[0] === 'cap') {\n if (tmpsharemedDataForm.asl) {\n delete tmpsharemedDataForm.asl;\n }\n if (value.length === 5) {\n getHealtcareResources(value);\n }\n }\n\n this.setState({\n sharemedDataForm: {\n ...tmpsharemedDataForm,\n [name]: value,\n },\n });\n } else {\n delete tmpsharemedDataForm[name];\n\n this.setState({\n sharemedDataForm: { ...tmpsharemedDataForm },\n });\n }\n }\n }\n\n handleSubmit() {\n const { createOrCheckEnrollmentRequest, deleteNotification } = this.props;\n const { sharemedDataForm, sharemedNotification } = this.state;\n\n if (sharemedDataForm && sharemedDataForm.asl === '0') {\n this.setState({\n verifyUnsuccessfull: true,\n });\n } else {\n createOrCheckEnrollmentRequest(sharemedDataForm);\n }\n\n if (sharemedNotification && sharemedNotification.id) {\n deleteNotification(sharemedNotification.id);\n }\n }\n\n handleCloseModal() {\n const {\n deleteNotification,\n history,\n } = this.props;\n\n const { sharemedNotification } = this.state;\n\n if (sharemedNotification && sharemedNotification.id) {\n deleteNotification(sharemedNotification.id);\n }\n\n history.push('/medical-records');\n window.open('https://my.sharemed.eu/', '_blank').focus();\n }\n\n getDataSource() {\n const { healtcareResources, t } = this.props;\n let datasource = [];\n\n if (healtcareResources) {\n datasource = healtcareResources.filter((x) => x.type === 'ASL').map((hr) => ({\n label: hr.description,\n value: hr.code,\n }));\n }\n\n datasource.push({\n label: t('portale.sharemed:empty asl'),\n value: '0',\n });\n\n return datasource;\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n render() {\n const {\n createOrCheckEnrollmentIsFetching,\n enrollmentIsFetching,\n healtcareResourcesIsFetching,\n history,\n isEnrolled,\n t,\n theme,\n } = this.props;\n\n const {\n disableAslSelect,\n disableSubmit,\n sharemedDataForm,\n verifySuccessfull,\n verifyUnsuccessfull,\n } = this.state;\n\n return (\n \n \n \n \n {verifySuccessfull || verifyUnsuccessfull || isEnrolled ? (\n \n \n \n \n \n {verifySuccessfull || isEnrolled ? (\n <>\n \n \n \n >\n ) : (\n <>\n \n \n history.push('/dashboard')}\n text={t('portale.sharemed:dashboard button')}\n variant=\"primary\"\n width={{ _: '100%', md: '347px' }}\n />\n >\n )}\n \n
\n ) : (\n <>\n \n \n \n \n }} i18nKey=\"portale.sharemed:form desc\" />\n \n\n \n \n \n \n \n
\n { healtcareResourcesIsFetching ? null : (\n \n )}\n\n \n \n
\n\n \n \n \n this.goBack()}\n text={t('portale.sharemed:clear button')}\n variant=\"secondary\"\n width={{ _: '100%', md: '347px' }}\n />\n\n \n \n \n
\n >\n )}\n \n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n checkEnrolled: () => dispatch(fetchCheckEnrolled()),\n createOrCheckEnrollmentRequest: (params) => dispatch(createOrCheckEnrollment(params)),\n deleteNotification: (id) => dispatch(deleteNotifications(id)),\n getAllNotifications: (id) => dispatch(fetchAllNotifications(id)),\n getHealtcareResources: (params) => dispatch(fetchHealtcareResources(params)),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n createOrCheckEnrollmentErrorResult: state.sharemed.createOrCheckEnrollment.errorMessage,\n createOrCheckEnrollmentIsFetching: state.sharemed.createOrCheckEnrollment.isFetching,\n createOrCheckEnrollmentResult: state.sharemed.createOrCheckEnrollment.data,\n enrollmentIsFetching: state.sharemed.fetchCheckEnrolled.isFetching,\n healtcareResources: state.sharemed.fetchHealtcareResources.data,\n healtcareResourcesIsFetching: state.sharemed.fetchHealtcareResources.isFetching,\n isEnrolled: state.sharemed.fetchCheckEnrolled.data,\n notifications: state.notifications.allNotifications.data,\n});\n\nSharemed.defaultProps = {\n account: null,\n checkEnrolled: null,\n createOrCheckEnrollmentErrorResult: null,\n createOrCheckEnrollmentIsFetching: null,\n createOrCheckEnrollmentRequest: null,\n createOrCheckEnrollmentResult: null,\n deleteNotification: null,\n enrollmentIsFetching: null,\n getAllNotifications: null,\n getHealtcareResources: null,\n healtcareResources: null,\n healtcareResourcesIsFetching: null,\n history: null,\n isEnrolled: null,\n notifications: null,\n t: null,\n theme: null,\n};\n\nSharemed.propTypes = {\n account: PropTypes.shape(),\n checkEnrolled: PropTypes.func,\n createOrCheckEnrollmentErrorResult: PropTypes.shape(),\n createOrCheckEnrollmentIsFetching: PropTypes.bool,\n createOrCheckEnrollmentRequest: PropTypes.func,\n createOrCheckEnrollmentResult: PropTypes.number,\n deleteNotification: PropTypes.func,\n enrollmentIsFetching: PropTypes.bool,\n getAllNotifications: PropTypes.func,\n getHealtcareResources: PropTypes.func,\n healtcareResources: PropTypes.arrayOf(PropTypes.shape()),\n healtcareResourcesIsFetching: PropTypes.bool,\n history: PropTypes.shape(),\n isEnrolled: PropTypes.bool,\n notifications: PropTypes.arrayOf(PropTypes.shape()),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withTheme(withRouter(withTranslation(['portale.sharemed', 'portale.medicalreports', 'translation'])(Sharemed))));\n","import React from 'react';\n\nimport { Row, Col } from 'react-bootstrap';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport PropTypes from 'prop-types';\n\nimport ReactPlayer from 'react-player';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { fetchVideos } from '../../../reducers/videos/actions';\n\nimport {\n Container,\n GoBack,\n Modal,\n OutlineSvg,\n Text,\n} from '../../../components';\n\nconst VBox = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: p.theme.shadows.uniform,\n\n '.top': {\n backgroundImage: `url(${p.bck})`,\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n borderRadius: 8,\n height: 168,\n width: '100%',\n\n '.tag': {\n backgroundColor: '#FFC85A',\n borderBottomLeftRadius: '15px',\n borderTopLeftRadius: '15px',\n color: p.theme.colors.WHITE,\n display: 'none',\n fontSize: p.theme.fontSizes.small,\n fontWeight: p.theme.fontWeights.bold,\n padding: '5px 10px 5px 15px',\n position: 'absolute',\n right: 15,\n textTransform: 'uppercase',\n top: 10,\n },\n\n button: {\n alignItems: 'flex-end',\n background: 'none',\n border: 'none',\n borderRadius: '8px',\n cursor: 'pointer',\n display: 'flex',\n height: '100%',\n justifyContent: 'space-between',\n padding: '0 18px 12px',\n width: '100%',\n span: {\n backgroundColor: p.theme.colors.BLACK,\n borderRadius: 8,\n display: 'none',\n opacity: 0.7,\n },\n '.play': {\n height: 40,\n textAlign: 'center',\n width: 55,\n },\n '.duration': {\n color: p.theme.colors.WHITE,\n fontSize: p.theme.fontSizes.xsmall,\n padding: 5,\n },\n '&:hover': {\n span: {\n display: 'inline-block',\n },\n },\n },\n },\n\n '.bottom': {\n padding: '20px 24px 28px',\n\n p: {\n '-webkit-line-clamp': '6',\n '-webkit-box-orient': 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n },\n\n [p.theme.mediaQueries.sm]: {\n '.description': {\n minHeight: 120,\n },\n\n '.name': {\n minHeight: 50,\n },\n },\n },\n\n '&.new': {\n '.top': {\n '.tag': {\n display: 'block',\n },\n },\n },\n}));\n\nconst EList = styled.div((p) => ({\n borderTop: `1px solid ${p.theme.colors.GREY5}`,\n textAlign: 'left',\n\n '.info': {\n padding: '30px 15px 10px',\n },\n '.container-episodes-info': {\n padding: '0px 15px 20px',\n\n '.episode': {\n alignItems: 'center',\n display: 'flex',\n marginBottom: 25,\n\n svg: {\n marginRight: 20,\n },\n },\n },\n}));\n\nconst CVideoPills = styled.div((p) => ({\n minHeight: 'inherit',\n backgroundColor: p.theme.colors.GREY6,\n padding: '25px 0px 0px',\n\n [p.theme.mediaQueries.md]: {\n padding: '40px 20px 0px',\n },\n\n '.container-video-boxes': {\n margin: '20px -15px 40px !important',\n },\n\n '.player-wrapper': {\n marginTop: 25,\n position: 'relative',\n paddingTop: '56.25%' /* Player ratio: 100 / (1280 / 720) */,\n },\n '.react-player': {\n position: 'absolute',\n top: 0,\n left: 0,\n },\n '.episodes': {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n marginBottom: 50,\n\n button: {\n color: p.theme.colors.PRIMARY1,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.bold,\n textDecoration: 'underline',\n textTransform: 'uppercase',\n\n '&:focus': {\n boxShadow: 'none !important',\n outline: 0,\n },\n },\n },\n}));\n\nclass VideoPills extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n showAllVideos: true,\n };\n this.showVideo = this.showVideo.bind(this);\n this.buildList = this.buildList.bind(this);\n }\n\n componentDidMount() {\n const { getVideos } = this.props;\n getVideos();\n }\n\n showVideo(show, currentVideo) {\n if (show) {\n this.setState({\n showAllVideos: false,\n currentVideo,\n });\n } else {\n this.setState({\n showAllVideos: true,\n currentVideo: null,\n });\n }\n window.scrollTo(0, 0);\n }\n\n buildList() {\n const { theme } = this.props;\n const rows = [];\n for (let index = 0; index < 20; index += 1) {\n rows.push(\n ,\n );\n }\n return {rows}
;\n }\n\n render() {\n const {\n t,\n isFetching,\n videos,\n theme,\n } = this.props;\n const { showAllVideos, currentVideo } = this.state;\n\n if (isFetching) {\n return null;\n }\n\n return (\n \n {showAllVideos ? (\n \n \n \n \n \n
\n \n \n {videos && videos.total > 0 && videos.data && videos.data.length > 0 ? (\n <>\n \n\n {/* Modals */}\n \n
\n
\n \n \n \n \n
\n {this.buildList()}\n \n \n
\n\n \n {videos.data.map((v, index) => {\n const isNew = index === videos.data.length - 1;\n return (\n \n \n \n {t('portale.videopills:new tag')} \n this.showVideo(true, v)}>\n \n \n \n {new Date(v.video.duration * 1000).toISOString().substr(14, 5)} \n \n
\n \n \n \n \n
\n \n \n );\n })}\n
\n >\n ) : (\n \n )}\n \n
\n \n ) : (\n \n \n \n this.showVideo(false)} />\n \n \n
\n \n \n \n \n
\n \n )}\n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getVideos: () => dispatch(fetchVideos()),\n});\n\nconst mapStateToProps = (state) => ({\n isFetching: state.videos.fetchVideos.isFetching,\n videos: state.videos.fetchVideos.data,\n});\n\nVideoPills.defaultProps = {\n getVideos: null,\n isFetching: null,\n t: null,\n theme: null,\n videos: null,\n};\n\nVideoPills.propTypes = {\n getVideos: PropTypes.func,\n isFetching: PropTypes.bool,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n videos: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.videopills'])(VideoPills))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { Col, Row } from 'react-bootstrap';\nimport { Trans, withTranslation } from 'react-i18next';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport styled, { withTheme } from 'styled-components';\n\nimport image from '../../../assets/img/landing-01.jpg';\n\nimport {\n Button,\n CheckboxInputGroup,\n Container,\n Loading,\n MaterialDesignInput,\n Text,\n} from '../../../components';\n\nimport { createAuthorization, createLogin } from '../../../reducers/authentication/actions';\nimport {\n getBaseUrl, getCodeCompany, getCompany, getEgoOriginEnvironment,\n} from '../../../utils';\nimport { getEgoBackUrl } from '../../../utils/environment';\n\nconst BckImage = styled(Container)({\n backgroundImage: `url(${image})`,\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n height: '100%',\n left: 0,\n padding: 0,\n position: 'absolute',\n top: 0,\n});\n\nconst ContainerPConsent = styled.div(({ theme }) => ({\n marginTop: '16px',\n textAlign: 'left',\n\n label: {\n fontWeight: theme.fontWeights.bold,\n\n a: {\n color: theme.colors.PRIMARY1,\n\n '&:hover': {\n textDecoration: 'none',\n },\n },\n },\n}));\n\nconst Divider = styled.div(({ theme }) => ({\n borderTop: `1px solid ${theme.colors.GREY4}`,\n margin: '30px 0',\n}));\n\nconst Gradient = styled.div(({ theme }) => ({\n background: getCompany() !== 'tua' ? theme.colors.GRADIENT1 : theme.colors.GRADIENT_LANDING,\n height: '100%',\n opacity: getCompany() !== 'tua' ? 0.73 : 0.2,\n}));\n\nconst LoginData = styled.div(({ theme }) => ({\n backgroundColor: theme.colors.WHITE,\n borderRadius: 8,\n boxShadow: theme.shadows.uniform,\n margin: '40px 0',\n padding: '15px',\n\n [theme.mediaQueries.md]: {\n padding: '30px 15px',\n },\n a: {\n '&:hover': {\n color: theme.colors.PRIMARY1,\n },\n },\n}));\n\nclass Welcome extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n credentials: {},\n privacyConsent: false,\n };\n\n this.handleChange = this.handleChange.bind(this);\n this.handleLogin = this.handleLogin.bind(this);\n this.handlePrivacyConsent = this.handlePrivacyConsent.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n const {\n authorization,\n getLogin,\n history,\n isFetchingAuthorization,\n isFetchingLogin,\n loginRedirectUrl,\n } = this.props;\n\n const { credentials } = this.state;\n\n if (authorization && prevProps.authorization !== authorization && !isFetchingAuthorization) {\n getLogin({\n ...credentials,\n requestId: authorization.requestId,\n });\n }\n\n if (!isFetchingAuthorization && !isFetchingLogin && loginRedirectUrl && loginRedirectUrl.includes('/auth?code')) {\n const url = `/auth?code${loginRedirectUrl.split('/auth?code')[1]}`;\n history.push(url);\n }\n }\n\n handleChange(input) {\n const { credentials } = this.state;\n if (input.value === '') {\n credentials[input.name] = null;\n } else {\n credentials[input.name] = input.value;\n }\n this.setState({ credentials });\n }\n\n handleLogin() {\n const { getAuthorization } = this.props;\n getAuthorization();\n }\n\n handlePrivacyConsent(values) {\n this.setState({\n privacyConsent: values && values.length > 0 && values.includes('privacy'),\n });\n }\n\n render() {\n const {\n authorization,\n isFetchingAuthorization,\n isFetchingLogin,\n loginRedirectUrl,\n t,\n theme,\n } = this.props;\n\n const { credentials, privacyConsent } = this.state;\n\n return (\n <>\n \n \n \n\n \n\n \n \n \n \n\n {getCompany() !== 'tua' ? (\n <>\n \n \n >\n ) : (\n <>\n \n \n >\n )}\n\n \n\n \n\n \n\n \n }} i18nKey=\"portale.welcome:privacy consent message\" />,\n props: { href: getBaseUrl() !== '/' ? `${getBaseUrl()}/privacy-policy` : '/privacy-policy' },\n value: 'privacy',\n },\n ]}\n name=\"group1\"\n onChange={(values) => this.handlePrivacyConsent(values)}\n />\n \n\n {(!authorization && isFetchingAuthorization === false) || (!loginRedirectUrl && isFetchingLogin === false) ? (\n \n ) : null}\n\n \n\n \n\n \n\n \n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n <>\n \n \n \n\n \n \n \n\n \n \n \n >\n ) : (\n <>\n \n \n \n\n \n \n \n >\n )}\n \n \n
\n \n >\n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n authorization: state.authentication.authorization,\n isFetchingAuthorization: state.authentication.isFetchingAuthorization,\n isFetchingLogin: state.authentication.isFetchingLogin,\n loginRedirectUrl: state.authentication.loginRedirectUrl,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getAuthorization: () => dispatch(createAuthorization()),\n getLogin: (credentials) => dispatch(createLogin(credentials)),\n});\n\nWelcome.defaultProps = {\n account: null,\n authorization: null,\n getAuthorization: null,\n getLogin: null,\n history: null,\n isFetchingAuthorization: null,\n isFetchingLogin: null,\n loginRedirectUrl: null,\n t: null,\n theme: null,\n};\n\nWelcome.propTypes = {\n account: PropTypes.shape({\n authorities: PropTypes.arrayOf(PropTypes.string),\n }),\n authorization: PropTypes.shape(),\n getAuthorization: PropTypes.func,\n getLogin: PropTypes.func,\n history: PropTypes.shape(),\n isFetchingAuthorization: PropTypes.bool,\n isFetchingLogin: PropTypes.bool,\n loginRedirectUrl: PropTypes.string,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.welcome', 'app'])(Welcome))));\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport moment from 'moment';\n\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { Row, Col } from 'react-bootstrap';\nimport styled, { withTheme } from 'styled-components';\n\nimport {\n Button,\n Container,\n CartoonSvg,\n OutlineSvg,\n Text,\n} from '../../../components';\n\nimport { ModalWellnessCoach } from '../../../components/portale';\n\nimport { fetchUserPlan } from '../../../reducers/users/actions';\nimport { fetchConsultationRequest } from '../../../reducers/consultationRequests/actions';\nimport { setUpdateQuestionnaire } from '../../../reducers/settings/actions';\n\nconst CWellnessCoach = styled.div(({ theme }) => ({\n backgroundColor: theme.colors.GREY6,\n padding: '25px 0px 50px',\n\n [theme.mediaQueries.md]: {\n padding: '40px 20px 50px',\n },\n\n '.first-section': {\n margin: '50px 0 0',\n\n [theme.mediaQueries.md]: {\n margin: '90px 0 0',\n },\n },\n\n '.container-description': {\n [theme.mediaQueries.md]: {\n padding: '0px 30px 0px 15px',\n },\n },\n\n '.container-image': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'center',\n margin: '0',\n\n '.custom-rounded': {\n alignItems: 'center',\n background: theme.colors.WHITE,\n borderRadius: '50%',\n display: 'flex',\n height: '280px',\n justifyContent: 'center',\n minHeight: '280px',\n minWidth: '280px',\n width: '280px',\n\n [theme.mediaQueries.md]: {\n height: '380px',\n minHeight: '380px',\n minWidth: '380px',\n width: '380px',\n },\n\n svg: {\n marginLeft: '30px',\n width: '60%',\n },\n },\n },\n}));\n\nconst Card = styled.div(({ theme }) => ({\n background: theme.colors.WHITE,\n borderRadius: '8px',\n padding: 32,\n\n '.bottom-section': {\n marginLeft: 0,\n\n [theme.mediaQueries.md]: {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'start',\n marginLeft: 64,\n\n button: {\n marginRight: 40,\n },\n },\n },\n\n '.top-section': {\n alignItems: 'start',\n display: 'flex',\n justifyContent: 'start',\n marginBottom: 16,\n\n '.container-icon': {\n alignItems: 'center',\n background: theme.colors.PRIMARY2,\n borderRadius: '50%',\n display: 'flex',\n height: 40,\n justifyContent: 'center',\n minHeight: 40,\n minWidth: 40,\n width: 40,\n },\n },\n}));\n\nclass WellnessCoach extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n days: null,\n expired: false,\n showModal: false,\n };\n\n this.handleModalCancel = this.handleModalCancel.bind(this);\n this.handleModalProceed = this.handleModalProceed.bind(this);\n this.handleModalUpdate = this.handleModalUpdate.bind(this);\n this.requestConsultation = this.requestConsultation.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n isAuthenticated,\n getUserPlan,\n getCRequest,\n questionnaire,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n getUserPlan(account.id, questionnaire.healthPlanId).then((response) => {\n if (response.data && response.data.length > 0 && response.data[0].id) {\n getCRequest({\n healthPlanId: response.data[0].id,\n statuses: ['PENDING', 'PROCESSED'],\n });\n }\n });\n }\n }\n\n handleModalCancel() {\n this.setState({ showModal: false });\n }\n\n handleModalProceed() {\n const { history } = this.props;\n\n this.setState({ showModal: false });\n history.push('/book-consultation');\n }\n\n handleModalUpdate() {\n const { history, setUpdate } = this.props;\n\n setUpdate('update');\n\n localStorage.setItem('questionnaire-notification', new Date().toISOString());\n this.setState({ showModal: false });\n\n history.push('/consenses');\n }\n\n requestConsultation() {\n const { history, healthPlan } = this.props;\n const diff = moment(healthPlan.endDate).diff(moment(), 'days');\n\n if (diff < 0) {\n this.setState({\n days: -1,\n expired: true,\n showModal: true,\n });\n } else if (diff < 30) {\n this.setState({\n days: diff,\n showModal: true,\n });\n } else {\n history.push('/book-consultation');\n }\n }\n\n render() {\n const {\n consultationRequests,\n consultationRequestsIsFetching,\n planIsFetching,\n theme,\n } = this.props;\n\n const { days, expired, showModal } = this.state;\n\n const hasFixedDate = !consultationRequestsIsFetching && consultationRequests && consultationRequests.length > 0;\n return (\n \n \n \n \n \n \n \n \n\n {planIsFetching || consultationRequestsIsFetching ? null : (\n \n \n {hasFixedDate ? (\n \n ) : null}\n
\n )}\n \n \n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n\n 0 ? days : 0}\n expired={expired}\n onCancel={this.handleModalCancel}\n onProceed={this.handleModalProceed}\n onUpdate={this.handleModalUpdate}\n show={showModal}\n />\n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n getCRequest: (params) => dispatch(fetchConsultationRequest(params)),\n getUserPlan: (account, healthPlan) => dispatch(fetchUserPlan({ healthPlanId: healthPlan, id: account })),\n setUpdate: (value) => dispatch(setUpdateQuestionnaire(value)),\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n consultationRequests: state.consultationRequests.data,\n consultationRequestsIsFetching: state.consultationRequests.isFetching,\n isAuthenticated: state.authentication.isAuthenticated,\n healthPlan: state.users.fetchUserPlan.data,\n planIsFetching: state.users.fetchUserPlan.isFetching,\n questionnaire: state.questionnaires.fetchQuestionnaire.data,\n});\n\nWellnessCoach.defaultProps = {\n account: null,\n consultationRequests: null,\n consultationRequestsIsFetching: null,\n getCRequest: null,\n getUserPlan: null,\n healthPlan: null,\n history: null,\n isAuthenticated: false,\n planIsFetching: null,\n questionnaire: null,\n setUpdate: null,\n theme: null,\n};\n\nWellnessCoach.propTypes = {\n account: PropTypes.shape(),\n consultationRequests: PropTypes.arrayOf(PropTypes.shape({})),\n consultationRequestsIsFetching: PropTypes.bool,\n getCRequest: PropTypes.func,\n getUserPlan: PropTypes.func,\n healthPlan: PropTypes.shape(),\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n planIsFetching: PropTypes.bool,\n questionnaire: PropTypes.shape(),\n setUpdate: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTheme(withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['portale.wellnesscoach'])(WellnessCoach))));\n","import React, { useState } from 'react';\n\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\n\nimport { Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { downloadDocument } from '../../../../reducers/documents/actions';\nimport { editNote } from '../../../../reducers/events/actions';\nimport { fetchPrivacy, setPrivacy as setPrivacyAction } from '../../../../reducers/privacy/actions';\n\nimport {\n Button,\n CheckboxInputGroup,\n FileDownload,\n FileUpload,\n MaterialDesignTextarea,\n Modal,\n OutlineSvg,\n Text,\n} from '../../../../components';\n\nimport { Consenses, EventStatuses, EventTypeOutlineIcon } from '../../../../enums';\nimport { checkConsenses, getConsensesObject, getConsensesObjectSet } from '../../../../utils';\n\nconst ButtonContainer = styled.div({\n textAlign: 'right',\n});\n\nconst CEventDetail = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n height: 'auto',\n margin: '32px 0 0',\n padding: '18px 20px',\n\n '.comment': {\n color: p.theme.colors.PRIMARY1,\n fontSize: p.theme.fontSizes.xsmall,\n margin: '10px 0 10px 54px',\n },\n}));\n\nconst CEventInfo = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n height: 'auto',\n margin: '-10px 0 24px',\n padding: '38px 20px 28px',\n}));\n\nconst CEventNote = styled.div({\n margin: '18px 0',\n maxWidth: 535,\n});\n\nconst CEventNoteEdit = styled.div({\n margin: '18px auto',\n maxWidth: 535,\n});\n\nconst IconContainer = styled.div((p) => ({\n backgroundColor: p.bkg,\n borderRadius: '50%',\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n}));\n\nconst CIconTitle = styled.div({\n alignItems: 'center',\n display: 'flex',\n});\n\nconst CField = styled.div((p) => ({\n alignItems: 'center',\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n display: 'flex',\n padding: '15px 0',\n\n '&:first-child': {\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n },\n\n p: {\n color: p.theme.colors.GREY2,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.bold,\n margin: '0 16px',\n },\n\n svg: {\n minWidth: 24,\n },\n}));\n\nconst CComment = styled.div({\n display: 'flex',\n margin: '10px 0 10px 54px',\n});\n\nconst CCommentText = styled.div((p) => ({\n borderLeft: `1px solid ${p.theme.colors.GREY4}`,\n padding: '0 10px 0 10px',\n}));\n\nconst DiagnosticOrScreeningDetail = (props) => {\n const {\n editDocument,\n eventDetails,\n getDocument,\n history,\n privacy,\n t,\n theme,\n } = props;\n\n const [consenses, setConsenses] = useState(checkConsenses(privacy, Consenses.MEDICAL_RECORDS.code) ? [Consenses.MEDICAL_RECORDS.code] : []);\n\n const [documentDelete, setDocumentDelete] = useState(null);\n const [documents, setDocuments] = useState(eventDetails ? eventDetails.documents : []);\n\n const [files, setFiles] = useState([]);\n const [notes, setNotes] = useState(eventDetails && eventDetails.note ? eventDetails.note : '');\n\n const [edit, setEdit] = useState(!eventDetails.note && eventDetails.documents.length === 0);\n\n const [modalShow, setModalShow] = useState(false);\n const [modalReportShow, setModalReportShow] = useState(false);\n\n if (!eventDetails) {\n return null;\n }\n\n const endDate = new Date(eventDetails.endDate);\n const startDate = new Date(eventDetails.startDate);\n\n const eventColor = !eventDetails.activityGroupId && !eventDetails.activityId ? theme.colors.GRAPH3 : theme.colors.PRIMARY2;\n\n const handleClickDocument = (file) => {\n getDocument(file);\n };\n\n const handleClickEdit = () => {\n setEdit(true);\n };\n\n const handleClickSave = () => {\n const { account, setPrivacy } = props;\n\n eventDetails.documents = documents;\n eventDetails.note = notes;\n\n if (files.length > 0) {\n if (consenses.length > 0) {\n if (!checkConsenses(privacy, Consenses.MEDICAL_RECORDS.code)) {\n setPrivacy([getConsensesObjectSet(account, 'WAS_DS', Consenses.MEDICAL_RECORDS.code)], getConsensesObject(account)).then(() => {\n editDocument(eventDetails, files).then(() => history.go());\n });\n } else {\n editDocument(eventDetails, files).then(() => history.go());\n }\n } else {\n setModalReportShow(true);\n }\n } else {\n editDocument(eventDetails, files).then(() => history.go());\n }\n };\n\n const handleClickUndo = () => {\n setFiles([]);\n setNotes(eventDetails.note);\n\n setEdit(false);\n };\n\n const handleChangeFile = (file) => {\n const tmp = [];\n\n Object.keys(file).forEach((key) => {\n if (!files.find((f) => f.name === file[key].name)) {\n // Check file size\n if (file[key].size < 5000000) {\n tmp.push(file[key]);\n }\n }\n });\n\n setFiles([...files, ...tmp]);\n };\n\n const handleChangeNote = (note) => {\n setNotes(note.value);\n };\n\n const handleDeleteDocument = () => {\n setDocuments(documents.filter((e) => e.id !== documentDelete.id));\n\n setModalShow(false);\n setDocumentDelete(null);\n };\n\n const handleDeleteFile = (d) => {\n setFiles(files.filter((e) => e.name !== d.name));\n };\n\n const handleModalClose = () => {\n setModalShow(false);\n };\n\n const handleModalReportClose = () => {\n setModalReportShow(false);\n };\n\n const handleModalShow = (d) => {\n setModalShow(true);\n setDocumentDelete(d);\n };\n\n return (\n <>\n \n
\n \n \n \n \n
\n \n
\n \n \n \n {EventTypeOutlineIcon[eventDetails.type] ? (\n \n \n \n ) : null}\n \n \n\n \n\n {eventDetails.comment && (\n \n \n \n \n \n \n )}\n \n\n \n \n \n {eventDetails.location ? (\n \n ) : (\n \n )}\n \n\n \n \n \n \n\n \n \n \n {startDate && !Number.isNaN(startDate.getTime()) && endDate && !Number.isNaN(endDate.getTime())\n ? `${startDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })} - ${endDate.toLocaleTimeString([], {\n hour: '2-digit',\n minute: '2-digit',\n })}`\n : 'null'}\n
\n \n \n
\n \n
\n\n {eventDetails.status === EventStatuses.FATTO && !edit && (\n <>\n \n \n \n \n \n\n \n \n {t('portale.eventdetail:edit note')}\n \n \n >\n )}\n\n {eventDetails.status === EventStatuses.FATTO && edit && (\n <>\n \n \n \n\n \n\n \n\n \n\n \n\n \n\n \n\n ,\n value: Consenses.MEDICAL_RECORDS.code,\n },\n ]}\n disabled={consenses.indexOf(Consenses.MEDICAL_RECORDS.code) > -1}\n isLayoutVertical\n name=\"rewarding\"\n onChange={(values) => setConsenses(values)}\n selectedValues={consenses}\n />\n \n \n\n \n {(eventDetails.note || eventDetails.documents.length > 0) && (\n \n {t('portale.eventdetail:undo')}\n \n )}\n\n \n {t('portale.eventdetail:save note')}\n \n \n >\n )}\n\n \n\n \n \n \n >\n );\n};\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isLoading: state.privacy.isFetching,\n isLoadingAccount: state.authentication.isFetchingAccount,\n privacy: state.privacy.privacy,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n getDocument: (id) => dispatch(downloadDocument(id)),\n getPrivacy: (params) => dispatch(fetchPrivacy(params)),\n editDocument: (event, files) => dispatch(editNote({ event, files })),\n setPrivacy: (dataSet, dataGet) => dispatch(setPrivacyAction({ dataSet, dataGet })),\n});\n\nDiagnosticOrScreeningDetail.defaultProps = {\n account: null,\n editDocument: null,\n getDocument: null,\n history: null,\n privacy: null,\n setPrivacy: null,\n t: null,\n theme: null,\n};\n\nDiagnosticOrScreeningDetail.propTypes = {\n account: PropTypes.shape(),\n editDocument: PropTypes.func,\n eventDetails: PropTypes.shape().isRequired,\n getDocument: PropTypes.func,\n history: PropTypes.shape(),\n privacy: PropTypes.arrayOf(PropTypes.shape()),\n setPrivacy: PropTypes.func,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withTranslation(['portale.eventdetail', 'portale.privacy'])(withTheme(DiagnosticOrScreeningDetail))));\n","import React from 'react';\n\nimport { withTranslation } from 'react-i18next';\n\nimport { Row, Col } from 'react-bootstrap';\n\nimport PropTypes from 'prop-types';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport { OutlineSvg, Text } from '../../../../components';\n\nimport { translateRRule, translateTimeIntervals } from '../../../../utils';\n\nimport { EventTypeOutlineIcon } from '../../../../enums';\n\nconst CEventDetail = styled.div((p) => ({\n backgroundColor: p.theme.colors.WHITE,\n borderRadius: '8px',\n height: 'auto',\n margin: '32px 0',\n padding: '18px 20px',\n\n '.comment': {\n color: p.theme.colors.PRIMARY1,\n fontSize: p.theme.fontSizes.xsmall,\n margin: '10px 0 10px 54px',\n },\n}));\n\nconst IconContainer = styled.div((p) => ({\n backgroundColor: p.bkg,\n borderRadius: '50%',\n display: 'inline-block',\n height: 40,\n lineHeight: '40px',\n minWidth: 40,\n textAlign: 'center',\n width: 40,\n}));\n\nconst CIconTitle = styled.div({\n alignItems: 'center',\n display: 'flex',\n});\n\nconst CField = styled.div((p) => ({\n alignItems: 'center',\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n display: 'flex',\n padding: '15px 0',\n\n '&:first-child': {\n borderTop: `1px solid ${p.theme.colors.GREY4}`,\n },\n\n p: {\n color: p.theme.colors.GREY2,\n fontSize: p.theme.fontSizes.medium,\n fontWeight: p.theme.fontWeights.bold,\n margin: '0 16px',\n },\n\n svg: {\n minWidth: 24,\n },\n}));\n\nconst CDetail = styled.div((p) => ({\n alignItems: 'start',\n display: 'flex',\n flexDirection: 'column',\n marginTop: p.theme.verticalSpacing.p24,\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n },\n}));\n\nconst CalendarInfo = styled.div((p) => ({\n border: `1px solid ${p.theme.colors.GREY4}`,\n borderRadius: '8px',\n height: 157,\n margin: '0 auto',\n minWidth: 157,\n padding: 16,\n textAlign: 'center',\n\n [p.theme.mediaQueries.md]: {\n margin: '0 0 0 54px',\n },\n\n p: {\n marginBottom: 0,\n },\n}));\n\nconst DrugOrLifestyleDetail = (props) => {\n const {\n eventDetails,\n rule,\n t,\n theme,\n } = props;\n\n if (!eventDetails) {\n return null;\n }\n\n const eventColor = !eventDetails.activityGroupId && !eventDetails.activityId ? theme.colors.GRAPH3 : theme.colors.PRIMARY2;\n const startDate = new Date(eventDetails.startDate);\n\n const translate = () => {\n const splittedRrule = rule.split('|');\n\n if (splittedRrule.length === 2) {\n const rruleObj = translateRRule(splittedRrule[1]);\n const rruleTranslated = { timeIntervals: translateTimeIntervals(splittedRrule[0]) };\n\n if (rruleObj) {\n // days\n if (rruleObj.frequency === 'Weekly') {\n let days = '';\n Object.keys(rruleObj.weekly.days).forEach((key) => {\n if (rruleObj.weekly.days[key]) {\n days = `${days.length > 0 && key !== 'sun' ? `${days}, ` : ''}${t(`enums:days of week.${key}`)}`;\n }\n });\n\n rruleTranslated.days = days;\n }\n\n // duration\n if (rruleObj.count && rruleObj.count > 0) {\n if (rruleObj.count > 1) {\n rruleTranslated.duration = t(`enums:activity duration.NUMBEROFDAYS_${eventDetails.type === 'LIFESTYLE' ? 'activity' : 'therapy'}`, {\n days: rruleObj.count,\n });\n } else {\n rruleTranslated.duration = t(`enums:activity duration.NUMBEROFDAY_${eventDetails.type === 'LIFESTYLE' ? 'activity' : 'therapy'}`);\n }\n } else {\n rruleTranslated.duration = t(`enums:activity duration.ONGOING_${eventDetails.type === 'LIFESTYLE' ? 'activity' : 'therapy'}`);\n }\n\n // frequency\n rruleTranslated.frequency = t(`enums:activity days.${rruleObj.frequency.toUpperCase()}`);\n }\n\n return rruleTranslated;\n }\n\n return null;\n };\n\n const eventDetailsObj = translate();\n\n return (\n \n \n \n \n \n {EventTypeOutlineIcon[eventDetails.type] ? ( ) : null}\n \n\n \n \n\n \n \n \n \n \n \n\n \n \n \n\n \n {eventDetailsObj ? (\n <>\n {eventDetailsObj.duration ? (\n \n \n \n \n ) : null}\n\n {eventDetailsObj.frequency ? (\n \n \n \n \n ) : null}\n\n {eventDetailsObj.timeIntervals && eventDetailsObj.timeIntervals.length > 0 ? (\n <>\n \n \n \n \n \n \n \n {eventDetailsObj.timeIntervals.map((time, i) => (\n \n ))}\n
\n \n >\n ) : null}\n >\n ) : null}\n \n
\n \n );\n};\n\nDrugOrLifestyleDetail.defaultProps = {\n t: null,\n theme: null,\n};\n\nDrugOrLifestyleDetail.propTypes = {\n eventDetails: PropTypes.shape().isRequired,\n rule: PropTypes.string.isRequired,\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withTranslation(['enums', 'portale.eventdetail'])(withTheme(DrugOrLifestyleDetail));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { withTranslation } from 'react-i18next';\nimport styled, { withTheme } from 'styled-components';\n\nimport moment from 'moment';\n\nimport {\n deleteEvent,\n deleteRecurrentEvent,\n editEvent as editEventR,\n fetchEvent,\n fetchEventGroups,\n} from '../../../reducers/events/actions';\nimport { fetchActivity } from '../../../reducers/activities/actions';\n\nimport {\n Button,\n Container,\n GoBack,\n Modal,\n Text,\n} from '../../../components';\nimport { Notification } from '../../../components/portale';\n\nimport DiagnosticOrScreeningDetail from './DetailTypes/DiagnosticOrScreeningDetail';\nimport DrugOrLifestyleDetail from './DetailTypes/DrugOrLifestyleDetail';\n\nimport {\n EventEditTypes,\n EventStatuses,\n EventTypes,\n NotificationTypes,\n} from '../../../enums';\n\nconst CActions = styled.div((p) => ({\n '.action': {\n borderBottom: `1px solid ${p.theme.colors.GREY4}`,\n display: 'flex',\n flexDirection: 'column',\n padding: '40px 0',\n\n [p.theme.mediaQueries.md]: {\n flexDirection: 'row',\n\n div: {\n button: {\n margin: '0 16px 16px',\n },\n width: '50%',\n },\n },\n\n '&:last-child': {\n borderBottom: 0,\n padding: '40px 0 0',\n },\n\n div: {\n button: {\n marginTop: 16,\n },\n },\n },\n}));\n\nconst CButton = styled.div((p) => ({\n marginBottom: 20,\n width: '100%',\n\n [p.theme.mediaQueries.md]: {\n margin: 0,\n marginLeft: 20,\n width: 'auto',\n\n button: {\n width: 'auto',\n },\n },\n\n button: {\n width: '100%',\n },\n}));\n\nconst CEventsById = styled.div((p) => ({\n backgroundColor: p.theme.colors.GREY6,\n minHeight: 'calc(100vh - 336px)',\n padding: '25px 0px 32px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n padding: '40px 20px 64px',\n },\n}));\n\nconst CEventsStatus = styled.div((p) => ({\n backgroundColor: p.bg,\n borderRadius: '8px',\n height: 'auto',\n padding: '18px 20px',\n}));\n\nconst CFormButton = styled.div({\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n});\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n\n return tmp;\n }, {});\n};\n\nclass EventById extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n isDeleting: false,\n isEditing: false,\n showConfirmModal: false,\n showNotification: true,\n };\n\n this.buildActionsTemplate = this.buildActionsTemplate.bind(this);\n this.buildConfirmModal = this.buildConfirmModal.bind(this);\n this.buildEventDetailTemplate = this.buildEventDetailTemplate.bind(this);\n this.buildEventStatusTemplate = this.buildEventStatusTemplate.bind(this);\n this.buildNotifications = this.buildNotifications.bind(this);\n this.goBack = this.goBack.bind(this);\n this.goBooking = this.goBooking.bind(this);\n this.showModal = this.showModal.bind(this);\n }\n\n componentDidMount() {\n const {\n account,\n getEvent,\n history,\n isAuthenticated,\n match,\n } = this.props;\n\n if (account && account.id && isAuthenticated) {\n if (\n match\n && match.params.eventId\n && history\n && history.location\n && history.location.search\n ) {\n getEvent(match.params.eventId, getParams(history.location.search));\n }\n }\n }\n\n componentDidUpdate(prevProps) {\n const {\n deleteRecurrentResponse,\n deleteResponse,\n editedEvent,\n eventDetails,\n getActivity,\n getEventGroups,\n history,\n isFetchingDeleteEvent,\n isFetchingDeleteRecurrentEvent,\n isFetchingEditedEvent,\n isFetchingEvent,\n } = this.props;\n\n const { isDeleting, isEditing } = this.state;\n\n if (eventDetails && eventDetails !== prevProps.eventDetails && !isFetchingEvent) {\n if (eventDetails.activityId) {\n getActivity(eventDetails.activityId);\n } else if (eventDetails.eventGroupId) {\n getEventGroups(eventDetails.eventGroupId);\n }\n }\n\n if (\n ((!isFetchingDeleteEvent && deleteResponse && deleteResponse === 204) || (!isFetchingDeleteRecurrentEvent && deleteRecurrentResponse && deleteRecurrentResponse === 204))\n && isDeleting\n ) {\n history.push('/calendar');\n }\n\n if (!isFetchingEditedEvent && editedEvent && isEditing) {\n // success edit, refresh\n history.go();\n }\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n personalEvent:\n nextProps.eventDetails\n && !nextProps.eventDetails.activityGroupId\n && !nextProps.eventDetails.activityId,\n };\n }\n\n buildConfirmModal() {\n const {\n deleteCustomEvent,\n deleteCustomRecurrentEvent,\n editEvent,\n eventDetails,\n history,\n location,\n t,\n theme,\n } = this.props;\n const { showConfirmModal, personalEvent } = this.state;\n\n const currentDate = new Date();\n const eventDate = new Date(eventDetails.startDate);\n const locationSearch = location && location.search;\n\n const deleteE = () => {\n this.setState({\n isDeleting: true,\n showConfirmModal: false,\n });\n deleteCustomEvent(eventDetails.idParent);\n };\n\n const deleteRecurrentE = () => {\n this.setState({\n isDeleting: true,\n showConfirmModal: false,\n });\n deleteCustomRecurrentEvent(eventDetails.idParent);\n };\n\n const resheduleE = () => {\n const tomorrow = moment(new Date()).add(1, 'days');\n const resheduleStartDate = eventDate > currentDate ? eventDetails.startDate : tomorrow.toDate().toISOString();\n const resheduleEndDate = eventDate > currentDate ? eventDetails.endDate : tomorrow.add(1, 'hours').toDate().toISOString();\n\n const tmp = {\n ...eventDetails,\n startDate: resheduleStartDate,\n endDate: resheduleEndDate,\n status: EventStatuses.DRAFT,\n location: null,\n link: null,\n comment: null,\n note: null,\n documents: [],\n };\n\n this.setState({\n isEditing: true,\n showConfirmModal: false,\n });\n editEvent(eventDetails.idParent, getParams(locationSearch), tmp);\n };\n\n const onCloseModal = () => {\n this.setState({ showConfirmModal: false });\n };\n\n const goToEditBooking = () => {\n this.setState({ showConfirmModal: false });\n if (eventDetails.idParent) {\n history.push(`${eventDetails.idParent}/edit?startDate=${eventDetails.startDate}&type=${EventEditTypes.booking}`);\n }\n };\n\n const EventConfirmModal = {\n DIAGNOSTIC_DRAFT_personal: {\n title: t('portale.eventdetail:confirm modal.DIAGNOSTIC personal title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DIAGNOSTIC personal message'),\n onSaveAction: () => deleteE(),\n },\n DIAGNOSTIC_PRENOTATO_personal: {\n title: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO message'),\n onSaveAction: () => resheduleE(),\n },\n DIAGNOSTIC_PRENOTATO_future_personal: {\n title: t('portale.eventdetail:confirm modal.DIAGNOSTIC personal title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DIAGNOSTIC personal message'),\n onSaveAction: () => deleteE(),\n },\n DIAGNOSTIC_PRENOTATO_past_personal: {\n title: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal message', { event: eventDetails.title }),\n hideCancelButton: true,\n closeButton: true,\n saveButtonLabel: t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal delete button'),\n actions: (\n \n {t('portale.eventdetail:confirm modal.DIAGNOSTIC_PRENOTATO_past_personal reschedule button')}\n \n ),\n onSaveAction: () => deleteE(),\n },\n DIAGNOSTIC_PRENOTATO_future: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO future title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO future message'),\n onSaveAction: () => resheduleE(),\n },\n SCREENING_PRENOTATO_future: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO future title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO future message'),\n onSaveAction: () => resheduleE(),\n },\n DIAGNOSTIC_PRENOTATO_past: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO_past title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO_past message', { event: eventDetails.title }),\n onSaveAction: () => resheduleE(),\n },\n SCREENING_PRENOTATO_past: {\n title: t('portale.eventdetail:confirm modal.PRENOTATO_past title'),\n confirmMessage: t('portale.eventdetail:confirm modal.PRENOTATO_past message', { event: eventDetails.title }),\n onSaveAction: () => resheduleE(),\n },\n DRUG_or_LIFESTYLE_DRAFT_personal: {\n title: t('portale.eventdetail:confirm modal.DRUG_or_LIFESTYLE_DRAFT_personal title'),\n confirmMessage: t('portale.eventdetail:confirm modal.DRUG_or_LIFESTYLE_DRAFT_personal message'),\n onSaveAction: () => deleteRecurrentE(),\n },\n };\n\n const statusAndDate = eventDetails.status === EventStatuses.PRENOTATO ? `${eventDate < currentDate ? 'PRENOTATO_past' : 'PRENOTATO_future'}` : eventDetails.status;\n const type = eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE ? 'DRUG_or_LIFESTYLE' : eventDetails.type;\n const confirmModalEnumKey = `${type}_${statusAndDate}${`${personalEvent ? '_personal' : ''}`}`;\n\n if (EventConfirmModal[confirmModalEnumKey]) {\n return (\n onCloseModal()}\n onSave={EventConfirmModal[confirmModalEnumKey].onSaveAction}\n otherActions={EventConfirmModal[confirmModalEnumKey].actions}\n saveButtonLabel={EventConfirmModal[confirmModalEnumKey].saveButtonLabel || t('portale.eventdetail:confirm modal.confirm button')}\n show={showConfirmModal}\n showModalFooter\n size=\"sm\"\n subtitle={null}\n title={EventConfirmModal[confirmModalEnumKey].title}\n variant=\"pb\"\n >\n \n \n );\n }\n return null;\n }\n\n buildEventStatusTemplate() {\n const { eventDetails, t, theme } = this.props;\n\n if (!eventDetails) {\n return null;\n }\n\n const currentDate = new Date();\n const eventDate = new Date(eventDetails.startDate);\n const options = { year: 'numeric', month: 'long', day: 'numeric' };\n\n const EventStatusTemplate = {\n DRAFT: {\n bgStatus: theme.colors.LIGHTRED,\n colorText: theme.colors.ALERT,\n textStatus: `${t('portale.eventdetail:event detail.DA_PRENOTARE')} ${eventDate.toLocaleDateString('it', options)}`,\n },\n PRENOTATO_past: {\n bgStatus: theme.colors.LIGHTBLUE,\n colorText: theme.colors.PRIMARY1,\n textStatus: 'portale.eventdetail:event detail.IN_ATTESA',\n },\n PRENOTATO_future: {\n bgStatus: theme.colors.LIGHTBLUE,\n colorText: theme.colors.PRIMARY1,\n textStatus: `${t('portale.eventdetail:event detail.PRENOTATO')} ${eventDate.toLocaleDateString('it', options)}`,\n },\n SALTATO: {\n bgStatus: theme.colors.LIGHTBLUE,\n colorText: theme.colors.PRIMARY1,\n textStatus: 'portale.eventdetail:event detail.SALTATO',\n },\n FATTO: {\n bgStatus: theme.colors.OTHER1,\n colorText: theme.colors.PRIMARY2,\n textStatus: 'portale.eventdetail:event detail.COMPLETATO',\n },\n };\n\n if ((eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE) && eventDetails.status === EventStatuses.DRAFT && eventDate > currentDate) {\n return null;\n }\n\n let enumItem = '';\n if ((eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE) && eventDate < currentDate) {\n enumItem = eventDetails.status !== EventStatuses.DRAFT ? eventDetails.status : 'PRENOTATO_past';\n } else {\n enumItem = eventDetails.status !== EventStatuses.PRENOTATO ? eventDetails.status : `${eventDetails.status}_${eventDate < currentDate ? 'past' : 'future'}`;\n }\n\n if (enumItem && enumItem !== '') {\n return (\n \n \n \n );\n }\n return null;\n }\n\n buildEventDetailTemplate() {\n const { eventDetails, activityDetails, eventGroupsDetails } = this.props;\n\n if (eventDetails) {\n if (eventDetails.type === EventTypes.DIAGNOSTIC || eventDetails.type === EventTypes.SCREENING) {\n return (\n \n );\n }\n if (eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE) {\n let rule = '';\n if (eventDetails.activityGroupId && eventDetails.activityId && activityDetails && activityDetails.frequency) {\n rule = activityDetails.frequency;\n } else if (eventGroupsDetails && eventGroupsDetails.rawRrule && eventGroupsDetails.id === eventDetails.eventGroupId) {\n rule = eventGroupsDetails.rawRrule;\n }\n\n return (\n \n );\n }\n return null;\n }\n return null;\n }\n\n buildActionsTemplate() {\n const {\n eventDetails,\n history,\n t,\n theme,\n } = this.props;\n const { personalEvent } = this.state;\n\n const eventDate = new Date(eventDetails.startDate);\n const currentDate = new Date();\n\n const goToEditEvent = (editType) => {\n if (eventDetails.idParent) {\n history.push(`${eventDetails.idParent}/edit?startDate=${eventDetails.startDate}&type=${editType}`);\n }\n };\n\n const goToEditRecurrentEvent = () => {\n if (eventDetails.idParent) {\n history.push(`/customevent/${eventDetails.idParent}?type=${eventDetails.type}&startDate=${eventDetails.startDate}`);\n }\n };\n\n if (eventDetails.type === EventTypes.DIAGNOSTIC || eventDetails.type === EventTypes.SCREENING) {\n switch (eventDetails.status) {\n case EventStatuses.DRAFT:\n return (\n \n \n
\n \n \n
\n
\n goToEditEvent(EventEditTypes.reminder)}\n text={t('portale.eventdetail:edit reminder')}\n variant=\"primary\"\n width={{ _: '100%', md: '250px' }}\n />\n {/* ELIMINA REMINDER */}\n {personalEvent ? (\n \n ) : null}\n
\n
\n \n \n );\n\n case EventStatuses.PRENOTATO:\n if (eventDate > currentDate) {\n return (\n \n \n goToEditEvent(EventEditTypes.booking)}\n text={t('portale.eventdetail:edit booking')}\n variant=\"primary\"\n />\n \n\n \n \n \n \n );\n }\n return null;\n default:\n return null;\n }\n } else if ((eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE) && personalEvent) {\n switch (eventDetails.status) {\n case EventStatuses.DRAFT:\n if (eventDate > currentDate) {\n return (\n \n \n goToEditRecurrentEvent()}\n text={t('portale.eventdetail:edit')}\n variant=\"primary\"\n />\n \n\n \n \n \n \n );\n }\n return null;\n default:\n return null;\n }\n }\n return null;\n }\n\n buildNotifications() {\n const { eventDetails, location, editEvent } = this.props;\n const { showNotification } = this.state;\n\n const currentDate = new Date();\n const eventDate = new Date(eventDetails.startDate);\n const locationSearch = location && location.search;\n\n const changeEventStatus = (status) => {\n const tmp = {\n ...eventDetails,\n status,\n };\n\n this.setState({\n isEditing: true,\n showNotification: false,\n });\n\n editEvent(eventDetails.idParent, getParams(locationSearch), tmp);\n };\n\n if (\n eventDetails\n && showNotification\n && ((eventDetails.status === EventStatuses.PRENOTATO\n && (eventDetails.type === EventTypes.DIAGNOSTIC || eventDetails.type === EventTypes.SCREENING))\n || (eventDetails.status === EventStatuses.DRAFT\n && (eventDetails.type === EventTypes.DRUG || eventDetails.type === EventTypes.LIFESTYLE)))\n && eventDate < currentDate\n ) {\n return (\n changeEventStatus(EventStatuses.FATTO)}\n onCancel={\n eventDetails.status === EventStatuses.DRAFT && (eventDetails.type === EventTypes.DRUG || EventTypes.LIFESTYLE)\n ? () => changeEventStatus(EventStatuses.SALTATO)\n : this.showModal\n }\n />\n );\n }\n return null;\n }\n\n goBack() {\n const { history } = this.props;\n history.goBack();\n }\n\n goBooking() {\n const { eventDetails, history } = this.props;\n history.push(`${eventDetails.idParent}/edit?startDate=${eventDetails.startDate}&type=${EventEditTypes.booking}`);\n }\n\n showModal() {\n this.setState({\n showConfirmModal: true,\n });\n }\n\n render() {\n const { eventDetails, t, theme } = this.props;\n\n if (!eventDetails) {\n return null;\n }\n\n return (\n \n {this.buildConfirmModal()}\n\n \n \n\n \n \n\n \n {this.buildEventStatusTemplate()}\n\n {this.buildEventDetailTemplate()}\n\n {this.buildActionsTemplate()}\n\n {this.buildNotifications()}\n \n \n );\n }\n}\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n activityDetails: state.activities.data,\n deleteRecurrentResponse: state.events.deleteRecurrentEvent.response,\n deleteResponse: state.events.deleteEvent.response,\n editedEvent: state.events.editEvent.event,\n eventDetails: state.events.event.event,\n eventGroupsDetails: state.events.eventGroups.data,\n isAuthenticated: state.authentication.isAuthenticated,\n isFetchingDeleteEvent: state.events.deleteEvent.isFetching,\n isFetchingDeleteRecurrentEvent: state.events.deleteRecurrentEvent.isFetching,\n isFetchingEvent: state.events.event.isFetching,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n deleteCustomEvent: (id) => dispatch(deleteEvent(id)),\n deleteCustomRecurrentEvent: (id) => dispatch(deleteRecurrentEvent(id)),\n editEvent: (id, params, event) => dispatch(editEventR({ id, ...params, event })),\n getActivity: (id) => dispatch(fetchActivity(id)),\n getEvent: (id, params) => dispatch(fetchEvent({ id, ...params })),\n getEventGroups: (id) => dispatch(fetchEventGroups(id)),\n});\n\nEventById.defaultProps = {\n account: null,\n activityDetails: null,\n deleteCustomEvent: null,\n deleteCustomRecurrentEvent: null,\n deleteRecurrentResponse: null,\n deleteResponse: null,\n editedEvent: null,\n editEvent: null,\n eventDetails: null,\n eventGroupsDetails: null,\n getActivity: null,\n getEvent: null,\n getEventGroups: null,\n history: null,\n isAuthenticated: null,\n isFetchingDeleteEvent: null,\n isFetchingDeleteRecurrentEvent: null,\n isFetchingEditedEvent: false,\n isFetchingEvent: null,\n location: null,\n match: null,\n t: null,\n theme: null,\n};\n\nEventById.propTypes = {\n account: PropTypes.shape(),\n activityDetails: PropTypes.shape(),\n deleteCustomEvent: PropTypes.func,\n deleteCustomRecurrentEvent: PropTypes.func,\n deleteRecurrentResponse: PropTypes.number,\n deleteResponse: PropTypes.number,\n editedEvent: PropTypes.shape(),\n editEvent: PropTypes.func,\n eventDetails: PropTypes.shape(),\n eventGroupsDetails: PropTypes.shape({\n id: PropTypes.number,\n rawRrule: PropTypes.string,\n }),\n getActivity: PropTypes.func,\n getEvent: PropTypes.func,\n getEventGroups: PropTypes.func,\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n isFetchingDeleteEvent: PropTypes.bool,\n isFetchingDeleteRecurrentEvent: PropTypes.bool,\n isFetchingEditedEvent: PropTypes.bool,\n isFetchingEvent: PropTypes.bool,\n location: PropTypes.shape(),\n match: PropTypes.shape(),\n t: PropTypes.func,\n theme: PropTypes.shape(),\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation(['translation', 'portale.eventdetail'])(withTheme(EventById))));\n","import React from 'react';\n\nimport PropTypes from 'prop-types';\n\nimport { connect } from 'react-redux';\nimport { Route, Switch, withRouter } from 'react-router-dom';\n\nimport styled, { withTheme } from 'styled-components';\n\nimport PrivateRoute from '../../common/PrivateRoute';\nimport { Header, Footer, Sidebar } from '../../../components/portale';\nimport { getCompany } from '../../../utils';\n\nimport Accessibility from '../Accessibility';\nimport AccountSettings from '../AccountSettings';\nimport Agency from '../Agency';\nimport Auth from '../Auth';\n\nimport BookConsultation from '../BookConsultation';\n\nimport Calendar from '../Calendar';\nimport ClaimsDetails from '../ClaimsDetails';\nimport ClaimsManagement from '../ClaimsManagement';\nimport Collaborations from '../Collaborations';\nimport ContactMe from '../ContactMe';\nimport Contacts from '../Contacts';\nimport CookiePolicy from '../CookiePolicy';\nimport CustomEvent from '../CustomEvent';\nimport CustomerSettings from '../CustomerSettings';\n\nimport Dashboard from '../Dashboard';\nimport Drugs from '../Drugs';\n\nimport EditProfile from '../EditProfile';\nimport EventEdit from '../EventEdit';\nimport EventsByActivity from '../EventsByActivity';\n\nimport HealthCoach from '../HealthCoach';\nimport HealthNetwork from '../HealthNetwork';\nimport Home from '../Home';\n\nimport Landing from '../Landing';\n\nimport ManageTrends from '../ManageTrends';\nimport MedicalConsultation from '../MedicalConsultation';\nimport MedicalRecords from '../MedicalRecords';\n\nimport Notifications from '../Notifications';\n\nimport PreventionPath from '../PreventionPath';\nimport Privacy from '../Privacy';\n\nimport Questionnaire from '../Questionnaire';\n\nimport RecommendedPreventionPath from '../RecommendedPreventionPath';\n\nimport Story from '../Story';\nimport Sharemed from '../Sharemed';\n\nimport VideoPills from '../VideoPills';\n\nimport Welcome from '../Welcome';\nimport WellnessCoach from '../WellnessCoach';\n\nimport { Authorities } from '../../../enums';\n\nimport { setClientSidebarStatus } from '../../../reducers/settings/actions';\n\nimport './App.css';\nimport EventById from '../EventById';\n\nconst Wrapper = styled.div((p) => ({\n '&.toggled': {\n '#sidebar': {\n marginLeft: 0,\n\n [p.theme.mediaQueries.md]: {\n boxShadow: '0 2px 35px -8px rgba(0,81,114,0.4)',\n },\n },\n\n '.main-content': {\n margin: '0px 0px 0px 260px',\n width: 'calc(100% - 260px)',\n\n '.row': {\n marginLeft: 0,\n marginRight: 0,\n },\n },\n\n footer: {\n width: 'calc(100% - 260px)',\n },\n\n '&.small': {\n position: 'fixed',\n\n '#sidebar': {\n width: '100%',\n },\n },\n },\n\n '.main-content': {\n minHeight: 'calc(100vh - 336px)',\n paddingBottom: '256px',\n\n [p.theme.mediaQueries.md]: {\n minHeight: 'calc(100vh - 319px)',\n paddingBottom: '231px',\n },\n },\n\n '#sidebar': {\n marginLeft: '-260px',\n },\n}));\n\nconst getParams = (q) => {\n const query = q.substr(1).split(/\\?|&/);\n\n return query.reduce((o, p) => {\n const tmp = o;\n\n const key = p.split('=')[0];\n const value = p.split('=')[1];\n\n tmp[key] = value;\n return tmp;\n }, {});\n};\n\nclass App extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n isHealthClient: false,\n };\n\n this.mediaQuery = `screen and (min-width: ${props.theme.breakpoints.lg})`;\n this.checkMediaQuery = this.checkMediaQuery.bind(this);\n }\n\n componentDidMount() {\n this.mq = window.matchMedia(this.mediaQuery);\n this.mq.addListener(this.checkMediaQuery);\n this.setState({ screen: this.mq.matches ? 'large' : 'small' });\n }\n\n static getDerivedStateFromProps(nextProps) {\n return {\n isHealthClient:\n !nextProps.loading\n && nextProps.isAuthenticated\n && nextProps.account\n && nextProps.account.authorities\n && nextProps.account.authorities.length > 0\n && nextProps.account.authorities.includes(Authorities.PB_HEALTH_CLIENT.role),\n };\n }\n\n componentDidUpdate() {\n const { screen } = this.state;\n const {\n account,\n history,\n isAuthenticated,\n setClientSidebar,\n } = this.props;\n\n history.listen(() => {\n setClientSidebar(screen === 'large' && account && isAuthenticated);\n });\n\n if (getParams(history.location.search).noscroll !== undefined) return;\n\n window.scrollTo(0, 0);\n }\n\n componentWillUnmount() {\n this.mq.removeListener(this.checkMediaQuery);\n }\n\n checkMediaQuery() {\n const { screen } = this.state;\n const match = this.mq.matches ? 'large' : 'small';\n\n if (match !== screen) {\n this.setState({ screen: match });\n }\n }\n\n render() {\n const { match, sidebarIsOpen, userHasQuestionnaire } = this.props;\n const { screen, isHealthClient } = this.state;\n\n const path = match && match.path ? match.path : '/';\n console.log(path);\n\n return (\n \n {screen ? : null}\n\n \n {userHasQuestionnaire && }\n\n \n
\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n {getCompany() === 'bcc' ? ( ) : ( )}\n {getCompany() === 'bcc' ? ( ) : ( )}\n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n \n \n \n ) : null}\n\n {getCompany() !== 'bcc' && getCompany() !== 'vera' ? (\n \n \n \n ) : null}\n\n {getCompany() === 'bcc' ? ( ) : ( )}\n {getCompany() === 'bcc' ? ( ) : ( )}\n {getCompany() === 'bcc' ? ( ) : ( )}\n {getCompany() === 'bcc' ? ( ) : ( )}\n {getCompany() === 'bcc' ? ( ) : ( )}\n\n \n \n
\n
\n \n \n );\n }\n}\n\nconst mapDispatchToProps = (dispatch) => ({\n setClientSidebar: (params) => {\n dispatch(setClientSidebarStatus(params));\n },\n});\n\nconst mapStateToProps = (state) => ({\n account: state.authentication.account,\n isAuthenticated: state.authentication.isAuthenticated,\n loading: state.authentication.isFetchingToken,\n sidebarIsOpen: state.settings.sidebarIsOpen,\n userHasQuestionnaire: state.settings.userHasQuestionnaire,\n});\n\nApp.defaultProps = {\n account: null,\n history: null,\n isAuthenticated: false,\n loading: null,\n location: null,\n match: null,\n setClientSidebar: null,\n sidebarIsOpen: false,\n theme: null,\n userHasQuestionnaire: false,\n};\n\nApp.propTypes = {\n account: PropTypes.shape({\n authorities: PropTypes.arrayOf(PropTypes.string),\n }),\n history: PropTypes.shape(),\n isAuthenticated: PropTypes.bool,\n loading: PropTypes.bool,\n location: PropTypes.shape({\n pathname: PropTypes.string,\n }),\n match: PropTypes.shape({\n path: PropTypes.string,\n }),\n setClientSidebar: PropTypes.func,\n sidebarIsOpen: PropTypes.bool,\n theme: PropTypes.shape(),\n userHasQuestionnaire: PropTypes.bool,\n};\n\nexport default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTheme(App)));\n","import React from 'react';\n\nconst CompanyContext = React.createContext();\n\nexport const CompanyConsumer = CompanyContext.Consumer;\nexport const CompanyProvider = CompanyContext.Provider;\n\nexport default CompanyContext;\n","import React, { useContext } from 'react';\nimport { Route, Switch } from 'react-router-dom';\n\nimport Console from '../console/App';\nimport Portale from '../portale/App';\n\nimport { CompanyContext } from '../../contexts';\n\nconst AppRoutes = () => {\n const company = useContext(CompanyContext);\n console.log('🚀 ~ file: AppRoutes.jsx ~ line 11 ~ AppRoutes ~ company', company);\n\n return (\n \n \n {/* console application */}\n \n {/* portale application */}\n \n \n
\n );\n};\n\nexport default AppRoutes;\n","import React, { Suspense } from 'react';\n\nimport ReactDOM from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { BrowserRouter as Router } from 'react-router-dom';\n\nimport { ThemeProvider } from 'styled-components';\n\nimport configureStore from './config/store';\nimport * as serviceWorker from './serviceWorker';\n\nimport './config/i18n';\nimport './config/moment';\n\nimport './index.css';\nimport 'bootstrap/dist/css/bootstrap.min.css';\n\nimport { AppRoutes } from './containers';\nimport { CompanyProvider } from './contexts';\nimport { getBaseUrl, getCompany, getTheme } from './utils';\n\nconst store = configureStore;\n\nReactDOM.render(\n \n \n \n \n \n \n \n \n \n \n ,\n document.getElementById('root'),\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}