diff --git a/client/components/Agendas/AgendaNameList.jsx b/client/components/Agendas/AgendaNameList.jsx index 2296bd101..165035d09 100644 --- a/client/components/Agendas/AgendaNameList.jsx +++ b/client/components/Agendas/AgendaNameList.jsx @@ -1,24 +1,32 @@ +/* eslint-disable react/no-multi-comp */ import React from 'react'; import PropTypes from 'prop-types'; import {get, sortBy} from 'lodash'; import {gettext} from '../../utils'; +import {OverlayTrigger, Tooltip} from 'react-bootstrap'; -export const AgendaNameList = ({agendas}) => ( - - {get(agendas, 'length', 0) === 0 ? gettext('No Agenda Assigned.') : - sortBy(agendas.filter((a) => a), [(a) => get(a, 'name', '').toLowerCase()]) - .map((agenda, index, arr) => { - const className = !agenda.is_enabled ? 'sd-list-item__text--disabled' : ''; +export const AgendaNameList = ({agendas}) => { + let tooltipElem = (agendas || []).map((a) => +
{a.name}{!a.is_enabled ? ' (Disabled)' : ''}
); - return ( - - {agenda.name}{arr.length - 1 > index && ', '} - - ); - }) + return ( + {get(agendas, 'length', 0) === 0 ? gettext('No Agenda Assigned.') : + ( + {tooltipElem} + }> + + {sortBy(agendas.filter((a) => a), [(a) => get(a, 'name', '').toLowerCase()]) + .map((a, index, arr) => ( + {a.name}{index === arr.length - 1 ? '' : ', '} + ))} + ) } - -); +
); +}; AgendaNameList.propTypes = { agendas: PropTypes.array, diff --git a/client/components/fields/agendas.jsx b/client/components/fields/agendas.jsx index 6edd6f2d3..1300a4591 100644 --- a/client/components/fields/agendas.jsx +++ b/client/components/fields/agendas.jsx @@ -1,16 +1,16 @@ -import React from 'react'; +import React, {Fragment} from 'react'; import PropTypes from 'prop-types'; import {get} from 'lodash'; import {AgendaNameList} from '../Agendas'; export const agendas = ({item, fieldsProps}) => ( -
+ Agenda: - + -
+ ); diff --git a/client/components/fields/calendars.jsx b/client/components/fields/calendars.jsx index d85848ff1..fb99bc7b1 100644 --- a/client/components/fields/calendars.jsx +++ b/client/components/fields/calendars.jsx @@ -1,24 +1,34 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; +/* eslint-disable react/no-multi-comp */ +import React, {Fragment} from 'react'; +import PropTypes from 'prop-types'; import {get} from 'lodash'; +import {OverlayTrigger, Tooltip} from 'react-bootstrap'; export const calendars = ({item, calendars, grow}) => { const isCalendarActive = (cal) => (get((calendars || []).find((c) => c.qcode === cal.qcode), 'is_active', false)); + let tooltipElem = get(item, 'calendars', []).map((c) => +
{c.name}{!isCalendarActive(c) ? ' (Disabled)' : ''}
); - return (
+ return ( {gettext('Calendar:')} { - {get(item, 'calendars.length', 0) > 0 && item.calendars.map((c, index, arr) => - - {c.name}{arr.length - 1 > index && ', '} - ) - } + {get(item, 'calendars.length', 0) > 0 && ( + {tooltipElem} + }> + + {item.calendars.map((c, index, arr) => ( + + {c.name}{index === arr.length - 1 ? '' : ', '} + + ))} + )} {get(item, 'calendars.length', 0) === 0 && {gettext('No calendar assigned')}} } -
); + ); }; calendars.propTypes = {