Skip to content

Commit

Permalink
feat: add alert messages for news on welcom and encounterForm - R…
Browse files Browse the repository at this point in the history
…ef gestion-de-projet#2741 gestion-de-projet#2740
  • Loading branch information
Mehdi-BOUYAHIA committed Sep 25, 2024
1 parent 00308f7 commit 5e15084
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import InfoIcon from '@mui/icons-material/Info'
import useStyles from './styles'
import { useAppSelector } from 'state'

import { infoMessages } from 'data/infoMessage'

import { CriteriaDrawerComponentProps, ScopeElement } from 'types'
import { DurationRangeType, LabelObject } from 'types/searchCriterias'
import { Comparators, CriteriaDataKey, EncounterDataType, CriteriaType } from 'types/requestCriterias'
import { Comparators, CriteriaDataKey, EncounterDataType, CriteriaType, ResourceType } from 'types/requestCriterias'
import { BlockWrapper } from 'components/ui/Layout'
import OccurenceInput from 'components/ui/Inputs/Occurences'
import Collapse from 'components/ui/Collapse'
Expand Down Expand Up @@ -176,15 +178,15 @@ const EncounterForm = ({

<Grid className={classes.formContainer}>
{error === Error.NO_ERROR && !multiFields && (
<Alert
severity="info"
onClose={() => {
localStorage.setItem('multiple_fields', 'ok')
setMultiFields('ok')
}}
>
Tous les éléments des champs multiples sont liés par une contrainte OU
</Alert>
<Alert severity="info">Tous les éléments des champs multiples sont liés par une contrainte OU</Alert>
)}
{infoMessages.map(
(infoMessage) =>
infoMessage.resourceType === ResourceType.ENCOUNTER && (
<Alert key={'alertMessage' + infoMessage.id} severity={infoMessage.level}>
{infoMessage.message}
</Alert>
)
)}
{error === Error.EMPTY_FORM && (
<Alert severity="error">Merci de renseigner au moins un nombre d'occurence supérieur ou égal à 1</Alert>
Expand Down
23 changes: 23 additions & 0 deletions src/data/infoMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ResourceType } from 'types/requestCriterias'

enum level {
INFO = 'info',
ERROR = 'error',
WARNING = 'warning'
}

export const infoMessages: { id: number; resourceType?: ResourceType; level: level; message: string }[] = [
{
id: 0,
level: level.INFO,
message:
"Suite à l'incident ayant eu lieu début août 2024, la saisie de certaines données de soin a posteriori dans leur application source peut prendre du délai. Elles seront donc manquantes dans Cohort360, et rattrapées au fil de l'eau."
},
{
id: 1,
resourceType: ResourceType.ENCOUNTER,
level: level.INFO,
message:
"Le critère de prise en charge se base sur tous les séjours et passages. Les consultations étant des prises en charge non clôturées, elles n'ont pas de date de fin. Indiquer une durée ou une date de fin de prise en charge exclue ainsi les consultations."
}
]
6 changes: 6 additions & 0 deletions src/views/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { CohortsType } from 'types/cohorts'
import { Direction, Order } from 'types/searchCriterias'
import { WebSocketContext } from 'components/WebSocket/WebSocketProvider'
import servicesCohorts from 'services/aphp/serviceCohorts'
import { infoMessages } from 'data/infoMessage'

const Welcome = () => {
const { classes, cx } = useStyles()
Expand Down Expand Up @@ -167,6 +168,11 @@ const Welcome = () => {
</Typography>
</Grid>
<Grid item>
{infoMessages.map((infoMessage) => (
<Alert key={'alertMessage' + infoMessage.id} severity={infoMessage.level} className={classes.alert}>
{infoMessage.message}
</Alert>
))}
{maintenanceIsActive && (
<Alert severity="warning" className={classes.alert}>
Une maintenance est en cours. Seules les consultations de cohortes, requêtes et données patients sont
Expand Down

0 comments on commit 5e15084

Please sign in to comment.