From 1d4ffdae015ee499680aeb549183c0afcd38a9c0 Mon Sep 17 00:00:00 2001 From: Arnaud AMBROSELLI Date: Mon, 18 Dec 2023 14:03:16 +0100 Subject: [PATCH] fix: acces to new report --- .../scenes/report/components/ActionsReport.js | 6 ++- .../report/components/CommentsReport.js | 11 ++-- dashboard/src/scenes/report/view.js | 52 +++++++++---------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/dashboard/src/scenes/report/components/ActionsReport.js b/dashboard/src/scenes/report/components/ActionsReport.js index df8571698..f6f629842 100644 --- a/dashboard/src/scenes/report/components/ActionsReport.js +++ b/dashboard/src/scenes/report/components/ActionsReport.js @@ -20,9 +20,13 @@ export const ActionsOrConsultations = ({ actions, consultations }) => { const filteredData = activeTab.includes('Actions') ? filteredActions : filteredConsultations; const history = useHistory(); const user = useRecoilValue(userState); - const tabs = ['admin', 'normal'].includes(user.role) + + const canSeeMedicalData = ['admin', 'normal'].includes(user.role) && !!user.healthcareProfessional; + + const tabs = canSeeMedicalData ? [`Actions (${filteredActions.length})`, `Consultations (${filteredConsultations.length})`] : [`Actions (${filteredActions.length})`]; + return ( <>
diff --git a/dashboard/src/scenes/report/components/CommentsReport.js b/dashboard/src/scenes/report/components/CommentsReport.js index 3167b38d9..4c78a50df 100644 --- a/dashboard/src/scenes/report/components/CommentsReport.js +++ b/dashboard/src/scenes/report/components/CommentsReport.js @@ -6,7 +6,7 @@ import { FullScreenIcon } from '../../../assets/icons/FullScreenIcon'; import TabsNav from '../../../components/tailwind/TabsNav'; import Table from '../../../components/table'; import ExclamationMarkButton from '../../../components/tailwind/ExclamationMarkButton'; -import { organisationState } from '../../../recoil/auth'; +import { organisationState, userState } from '../../../recoil/auth'; import { useRecoilValue } from 'recoil'; import UserName from '../../../components/UserName'; import TagTeam from '../../../components/TagTeam'; @@ -17,8 +17,13 @@ import DateBloc from '../../../components/DateBloc'; export const CommentsSocialAndMedical = ({ comments, commentsMedical }) => { const [activeTab, setActiveTab] = useLocalStorage('reports-comments-toggle', 'Commentaires'); const [fullScreen, setFullScreen] = useState(false); - const data = activeTab.includes('Commentaires médicaux') ? commentsMedical : comments; - const tabs = [`Commentaires (${comments.length})`, `Commentaires médicaux (${commentsMedical.length})`]; + const user = useRecoilValue(userState); + const canSeeMedicalData = ['admin', 'normal'].includes(user.role) && !!user.healthcareProfessional; + + const data = canSeeMedicalData && activeTab.includes('Commentaires médicaux') ? commentsMedical : comments; + const tabs = canSeeMedicalData + ? [`Commentaires (${comments.length})`, `Commentaires médicaux (${commentsMedical.length})`] + : [`Commentaires (${comments.length})`]; return ( <> diff --git a/dashboard/src/scenes/report/view.js b/dashboard/src/scenes/report/view.js index e3cb5bb57..1c539ee07 100644 --- a/dashboard/src/scenes/report/view.js +++ b/dashboard/src/scenes/report/view.js @@ -261,7 +261,7 @@ const View = () => { document.title = 'Mano - Admin'; }; }); - + const canSeeComments = ['admin', 'normal'].includes(user.role); return ( <> @@ -348,42 +348,42 @@ const View = () => {
- {['admin', 'normal'].includes(user.role) && ( + {canSeeComments && (
)}
-
-
-
-
- -
-
-
-
- -
+
+ {organisation.passagesEnabled && ( +
+
-
-
-
-
- -
+ )} + {organisation.rencontresEnabled && ( +
+
-
-
- -
+ )} + {organisation.territoriesEnabled && ( +
+
+ )} +
+
-
- -
+ {organisation.receptionEnabled && ( +
+ +
+ )}