-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajoute l'affichage et l'édition des référents sur la page Synthèse EDL
- Loading branch information
1 parent
0e0e924
commit 3e0efbc
Showing
3 changed files
with
157 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...t/src/app/pages/collectivite/EtatDesLieux/Accueil/EtatDesLieux/referents/ReferentItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Icon, Tooltip, useCopyToClipboard } from '@tet/ui'; | ||
import { CollectiviteMembre } from './useMembres'; | ||
import { referentielToName, membreFonctionToLabel } from 'app/labels'; | ||
import { useBaseToast } from 'core-logic/hooks/useBaseToast'; | ||
|
||
export type ReferentItemProps = { | ||
membre: CollectiviteMembre; | ||
}; | ||
|
||
/** | ||
* Affiche des infos à propos d'un référent de la collectivité | ||
*/ | ||
export const ReferentItem = (props: ReferentItemProps) => { | ||
const { membre } = props; | ||
const { copy } = useCopyToClipboard(); | ||
const { setToast, renderToast } = useBaseToast(); | ||
|
||
return ( | ||
<Tooltip | ||
label={ | ||
<div> | ||
<p> | ||
<span className="text-grey-8">Champ d'intervention :</span>{' '} | ||
<span> | ||
{membre.champIntervention?.length | ||
? membre.champIntervention | ||
.map((ref) => referentielToName[ref]) | ||
.join(' / ') | ||
: 'Non renseigné'} | ||
</span> | ||
</p> | ||
<p> | ||
<span className="text-grey-8">Intitulé de poste :</span>{' '} | ||
<span> | ||
{membre.fonction ? membreFonctionToLabel[membre.fonction] : ''} | ||
</span> | ||
</p> | ||
<p className="text-primary underline">{membre.email}</p> | ||
</div> | ||
} | ||
> | ||
<div | ||
className="inline-flex gap-1 items-center p-1 cursor-pointer text-grey-8 hover:rounded-md hover:bg-grey-3" | ||
onClick={() => { | ||
if (membre.email) { | ||
copy(membre.email); | ||
setToast('success', 'Courriel copié'); | ||
} | ||
}} | ||
> | ||
{membre.prenom} {membre.nom}{' '} | ||
<Icon icon="mail-line" className="text-grey-5" /> | ||
{renderToast()} | ||
</div> | ||
</Tooltip> | ||
); | ||
}; |
26 changes: 26 additions & 0 deletions
26
.../src/app/pages/collectivite/EtatDesLieux/Accueil/EtatDesLieux/referents/ReferentsList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ReferentItem } from './ReferentItem'; | ||
import { CollectiviteMembre } from './useMembres'; | ||
|
||
export type ReferentsListProps = { | ||
nomFonction: string; | ||
referents?: CollectiviteMembre[]; | ||
}; | ||
|
||
/** | ||
* Affiche une liste de membres référents de la collectivité | ||
*/ | ||
export const ReferentsList = (props: ReferentsListProps) => { | ||
const { nomFonction, referents } = props; | ||
return ( | ||
<p className="mb-0"> | ||
<span className="text-primary">{nomFonction} :</span>{' '} | ||
{referents?.length ? ( | ||
referents.map((membre) => ( | ||
<ReferentItem key={membre.userId} membre={membre} /> | ||
)) | ||
) : ( | ||
<i>Non renseigné</i> | ||
)} | ||
</p> | ||
); | ||
}; |