From 6f309c54af06ca436e10e6f25204aef32ba1a63a Mon Sep 17 00:00:00 2001 From: Arnaud Ambroselli <31724752+arnaudambro@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:52:18 +0100 Subject: [PATCH] feat: print new report (#1861) --- dashboard/src/components/IncrementorSmall.js | 2 +- .../report/SelectAndCreateCollaboration.js | 3 +- .../ActionsOrConsultationsReport.js | 40 +++++- .../report/components/CommentsReport.js | 24 +++- .../report/components/ObservationsReport.js | 16 ++- .../report/components/PassagesReport.js | 16 ++- .../scenes/report/components/PersonsReport.js | 16 ++- .../report/components/RencontresReport.js | 18 ++- .../report/components/ServicesReport.js | 130 ++++++++++------- .../scenes/report/components/Transmissions.js | 136 +++++++++++------- dashboard/src/scenes/report/view.js | 98 +++++++------ dashboard/tailwind.config.js | 3 + 12 files changed, 333 insertions(+), 169 deletions(-) diff --git a/dashboard/src/components/IncrementorSmall.js b/dashboard/src/components/IncrementorSmall.js index 8392a891a..bb1628e7b 100644 --- a/dashboard/src/components/IncrementorSmall.js +++ b/dashboard/src/components/IncrementorSmall.js @@ -22,7 +22,7 @@ export default function IncrementorSmall({ service, team, date, count: initialVa [value] ); return ( -
+

{service}

diff --git a/dashboard/src/scenes/report/SelectAndCreateCollaboration.js b/dashboard/src/scenes/report/SelectAndCreateCollaboration.js index 06d6bedcf..0e1ae3c3f 100644 --- a/dashboard/src/scenes/report/SelectAndCreateCollaboration.js +++ b/dashboard/src/scenes/report/SelectAndCreateCollaboration.js @@ -11,7 +11,7 @@ const NoOptionsMessage = () => ( ); -const SelectAndCreateCollaboration = ({ values, onChange }) => { +const SelectAndCreateCollaboration = ({ values, onChange, className = '' }) => { const [organisation, setOrganisation] = useRecoilState(organisationState); const onChangeRequest = (newCollabs) => { @@ -47,6 +47,7 @@ const SelectAndCreateCollaboration = ({ values, onChange }) => { isSearchable isMulti name="collaborations" + className={className} components={{ NoOptionsMessage }} onChange={(v) => onChangeRequest(v.map((v) => v.value))} placeholder={' -- Ajoutez une co-intervention -- '} diff --git a/dashboard/src/scenes/report/components/ActionsOrConsultationsReport.js b/dashboard/src/scenes/report/components/ActionsOrConsultationsReport.js index abf58ed83..420c96c03 100644 --- a/dashboard/src/scenes/report/components/ActionsOrConsultationsReport.js +++ b/dashboard/src/scenes/report/components/ActionsOrConsultationsReport.js @@ -30,7 +30,7 @@ export const ActionsOrConsultationsReport = ({ actions, consultations, period }) return ( <> -
+
+ + setFullScreen(false)}> setFullScreen(false)}>
diff --git a/dashboard/src/scenes/report/components/CommentsReport.js b/dashboard/src/scenes/report/components/CommentsReport.js index ec4098dc2..a1a939a5b 100644 --- a/dashboard/src/scenes/report/components/CommentsReport.js +++ b/dashboard/src/scenes/report/components/CommentsReport.js @@ -28,7 +28,7 @@ export const CommentsSocialAndMedical = ({ comments, commentsMedical }) => { return ( <> -
+
{
+ + {!!canSeeMedicalData && ( + + )} setFullScreen(false)}> setFullScreen(false)} /> diff --git a/dashboard/src/scenes/report/components/ObservationsReport.js b/dashboard/src/scenes/report/components/ObservationsReport.js index da8f83d86..336f180ea 100644 --- a/dashboard/src/scenes/report/components/ObservationsReport.js +++ b/dashboard/src/scenes/report/components/ObservationsReport.js @@ -18,7 +18,7 @@ export const ObservationsReport = ({ observations, period, selectedTeams }) => { return ( <> -
+

{observations.length}

observation{observations.length > 1 ? 's' : ''}

+ setFullScreen(false)}> setFullScreen(false)} /> @@ -99,8 +109,8 @@ const ObservationsTable = ({ period, observations, selectedTeams }) => { return ( <> -
-
+
+

Observations

+ setFullScreen(false)}> setFullScreen(false)} /> @@ -52,8 +62,8 @@ const PassagesTable = ({ period, passages, selectedTeams }) => { return ( <> -
-
+
+

Passages

+ setFullScreen(false)}> setFullScreen(false)} /> @@ -49,8 +59,8 @@ const PersonsTable = ({ period, personsCreated, selectedTeams }) => { return ( <> -
-
+
+

Personnes créées

{!!personsCreated.length && ( diff --git a/dashboard/src/scenes/report/components/RencontresReport.js b/dashboard/src/scenes/report/components/RencontresReport.js index a40d17692..4457f7d14 100644 --- a/dashboard/src/scenes/report/components/RencontresReport.js +++ b/dashboard/src/scenes/report/components/RencontresReport.js @@ -17,7 +17,7 @@ export const RencontresReport = ({ rencontres, period, selectedTeams }) => { return ( <> -
+

{rencontres.length}

rencontre{rencontres.length > 1 ? 's' : ''}

+ setFullScreen(false)}> setFullScreen(false)} /> @@ -51,8 +61,8 @@ const RencontresTable = ({ period, rencontres, selectedTeams }) => { return ( <> -
-
+
+

Rencontres

-
+
-
-

Services effectués

- -
-
- {!serviceSumsForAllReports ? ( - - ) : ( -
- {teamIds.length > 1 ? ( - <> -
-

- Services effectués par toutes les équipes sélectionnées - <> -
- - Ces données sont en lecture seule. Pour les modifier, vous devez le faire équipe par équipe en plein écran - - -

-
- {Object.entries(serviceSumsForAllReports).map(([key, value]) => ( - - ))} - - ) : ( - setServices((s) => ({ ...s, [teamIds[0]]: updated }))} - team={selectedTeamsObject[teamIds[0]]} - disabled={!isSingleDay} - dateString={dayjs(period.startDate).format('YYYY-MM-DD')} - dataTestIdPrefix={`${selectedTeamsObject[teamIds[0]].name}-`} - /> - )} -
- )} -
+ <> +
+
+

Services effectués

+ +
+
+ {!serviceSumsForAllReports ? ( + + ) : ( +
+ {teamIds.length > 1 ? ( + <> +
+

+ Services effectués par toutes les équipes sélectionnées + <> +
+ + Ces données sont en lecture seule. Pour les modifier, vous devez le faire équipe par équipe en plein écran + + +

+
+ {Object.entries(serviceSumsForAllReports).map(([key, value]) => ( + + ))} + + ) : ( + setServices((s) => ({ ...s, [teamIds[0]]: updated }))} + team={selectedTeamsObject[teamIds[0]]} + disabled={!isSingleDay} + dateString={dayjs(period.startDate).format('YYYY-MM-DD')} + dataTestIdPrefix={`${selectedTeamsObject[teamIds[0]].name}-`} + /> + )} +
+ )} +
+
setFullScreen(false)} @@ -138,7 +140,27 @@ export default function ServicesReport({ period, selectedTeamsObject }) { selectedTeamsObject={selectedTeamsObject} isSingleDay={isSingleDay} /> -
+ + ); } diff --git a/dashboard/src/scenes/report/components/Transmissions.js b/dashboard/src/scenes/report/components/Transmissions.js index 31b6e1524..d3e45b3ad 100644 --- a/dashboard/src/scenes/report/components/Transmissions.js +++ b/dashboard/src/scenes/report/components/Transmissions.js @@ -25,22 +25,40 @@ export default function Transmissions({ period, selectedTeamsObject, reports }) }, [period]); return ( -
-

👋 Comment s'est passée la journée ?

- {days.map((day) => { - return ( -
- -

{dayjs(day).format('dddd D MMM')}

-
- {Object.keys(selectedTeamsObject).map((teamId) => { - const report = reports.find((report) => report.team === teamId && report.date === day); - return ; - })} -
- ); - })} -
+ <> +
+

👋 Comment s'est passée la journée ?

+ {days.map((day) => { + return ( +
+ +

{dayjs(day).format('dddd D MMM')}

+
+ {Object.keys(selectedTeamsObject).map((teamId) => { + const report = reports.find((report) => report.team === teamId && report.date === day); + return ; + })} +
+ ); + })} +
+ + ); } @@ -76,49 +94,61 @@ function Transmission({ report, team, day, teamId }) { return ( <> -
+

{team?.nightSession ? '🌒' : '☀️ '} {team?.name || ''}

- {!report?.description ? ( - - ) : ( - <> -

- {report?.description?.split('\n').map((sentence, index) => ( - - {sentence} -
-
- ))} -

- - - )} -
-
- {!!collaborations.length && ( +
+ {!report?.description ? ( + <> +
Aucune transmission pour cette journée
+ + + ) : ( <> -

Co-interventions avec :

+ {report?.description?.length > 0 &&
Transmission :
} +

+ {report?.description?.split('\n').map((sentence, index) => ( + + {sentence} +
+
+ ))} +

+ )} - { - const nextCollabs = e.currentTarget.value; - setCollaborations(nextCollabs); - onSaveReport({ - ...report, - collaborations: nextCollabs, - team: teamId, - date: day, - }); - }} - /> +
+
+ {!!collaborations.length && ( + <> +

Co-interventions avec :

+

{collaborations.join(', ')}

+ + )} + { + const nextCollabs = e.currentTarget.value; + setCollaborations(nextCollabs); + onSaveReport({ + ...report, + collaborations: nextCollabs, + team: teamId, + date: day, + }); + }} + /> +
diff --git a/dashboard/src/scenes/report/view.js b/dashboard/src/scenes/report/view.js index 903a7b6e6..976f3a67b 100644 --- a/dashboard/src/scenes/report/view.js +++ b/dashboard/src/scenes/report/view.js @@ -15,7 +15,7 @@ import SelectTeamMultiple from '../../components/SelectTeamMultiple'; import { arrayOfitemsGroupedByPersonSelector, onlyFilledObservationsTerritories } from '../../recoil/selectors'; import { ActionsOrConsultationsReport } from './components/ActionsOrConsultationsReport'; import ServicesReport from './components/ServicesReport'; -import DateRangePickerWithPresets, { reportsPresets } from '../../components/DateRangePickerWithPresets'; +import DateRangePickerWithPresets, { formatPeriod, reportsPresets } from '../../components/DateRangePickerWithPresets'; import { CommentsSocialAndMedical } from './components/CommentsReport'; import { PassagesReport } from './components/PassagesReport'; import { RencontresReport } from './components/RencontresReport'; @@ -263,6 +263,17 @@ const View = () => { return ( <> +
+ Compte-rendu{' '} + {viewAllOrganisationData ? ( + <>global + ) : ( + <> + {selectedTeams.length > 1 ? 'des équipes' : "de l'équipe"} {selectedTeams.map((t) => t.name).join(', ')} + + )}{' '} + - {formatPeriod({ period, preset })} +
@@ -336,59 +347,56 @@ const View = () => {
{!!selectedTeams.length && ( -
-
-
-
- -
- {canSeeComments && ( -
- + <> +
+
+
+
+
- )} -
-
-
- {organisation.passagesEnabled && ( -
- + {canSeeComments && ( +
+
)} - {organisation.rencontresEnabled && ( -
- +
+
+
+ {organisation.passagesEnabled && ( +
+ +
+ )} + {organisation.rencontresEnabled && ( +
+ +
+ )} + {organisation.territoriesEnabled && ( +
+ +
+ )} +
+
- )} - {organisation.territoriesEnabled && ( -
- +
+ {organisation.receptionEnabled && ( +
+
)} -
- -
- {organisation.receptionEnabled && ( -
- -
- )} -
- -
- +
+ +
-
+ )} ); diff --git a/dashboard/tailwind.config.js b/dashboard/tailwind.config.js index 0fee50f8a..5003dbaf6 100644 --- a/dashboard/tailwind.config.js +++ b/dashboard/tailwind.config.js @@ -36,6 +36,9 @@ module.exports = { '20%': { transform: 'rotate(0deg)' }, }, }, + gridTemplateColumns: { + "new-report-squares": 'repeat(auto-fit, minmax(40%, 1fr))' + }, colors: { main: '#226854', // higher contrast main75: '#617e71',