-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/add collection dates table (#92)
* fix collectionStartDate and add email * wip referents * fix useEffect and add referents in portal page * bump version * remove useless className and add default referents value
- Loading branch information
1 parent
e46e441
commit cd4c82c
Showing
16 changed files
with
410 additions
and
388 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
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 |
---|---|---|
|
@@ -2,6 +2,11 @@ | |
width: 30%; | ||
} | ||
|
||
.ContactRow{ | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.DatesLeftHeader{ | ||
width: 30%; | ||
} | ||
|
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
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 |
---|---|---|
|
@@ -5,14 +5,18 @@ import OverlayTrigger from 'react-bootstrap/OverlayTrigger'; | |
import Popover from 'react-bootstrap/Popover'; | ||
import D from '../../i18n'; | ||
|
||
function Contacts() { | ||
function Contacts({email, referents}) { | ||
const renderTooltip = ( | ||
<Popover id="popover-basic"> | ||
<Popover.Content> | ||
{D.sendMail} | ||
</Popover.Content> | ||
</Popover> | ||
); | ||
|
||
const primaryReferents = referents?.filter((referent) => referent.role === "PRIMARY") ?? []; | ||
const secondaryReferents = referents?.filter((referent) => referent.role === "SECONDARY") ?? []; | ||
|
||
return ( | ||
<Card className="ViewCard"> | ||
<div> | ||
|
@@ -24,26 +28,64 @@ function Contacts() { | |
<tr | ||
className="Clickable" | ||
data-testid="mail-button" | ||
onClick={() => { window.location.assign('mailto:[email protected]'); }} | ||
onClick={() => { window.location.assign(`mailto:${email}`); }} | ||
> | ||
<th className="ContactsLeftHeader">{D.functionalBox}</th> | ||
<td className=" LightGreyLine MailLink">[email protected]</td> | ||
<td className=" LightGreyLine MailLink" >{email}</td> | ||
</tr> | ||
</OverlayTrigger> | ||
<tr> | ||
<th rowSpan="2" className="VerticallyCentered ContactsLeftHeader">{D.cpos}</th> | ||
<td className="LightGreyLine">Chloé Dupont</td> | ||
</tr> | ||
<tr> | ||
<td className="LightGreyLine">01 01 01 01 01</td> | ||
</tr> | ||
<tr> | ||
<th rowSpan="2" className="VerticallyCentered ContactsLeftHeader">{D.deputyCpos}</th> | ||
<td className="LightGreyLine">Thierry Fabres</td> | ||
</tr> | ||
<tr> | ||
<td className="LightGreyLine">02 01 01 01 01</td> | ||
</tr> | ||
|
||
{(referents === undefined || primaryReferents.length === 0) && | ||
<tr> | ||
<th className="VerticallyCentered ContactsLeftHeader">{D.cpos}</th> | ||
<td>{"-"}</td> | ||
</tr> | ||
} | ||
|
||
{primaryReferents.map((primaryReferent) => { | ||
return ( | ||
<tr key={primaryReferent.phoneNumber}> | ||
<th className="VerticallyCentered ContactsLeftHeader">{D.cpos}</th> | ||
<td className="ContactRow"> | ||
<span> | ||
{primaryReferent.firstName || primaryReferent.lastName ? | ||
`${primaryReferent.firstName ?? ""} ${primaryReferent.lastName ?? ""}` | ||
: "-" | ||
} | ||
</span> | ||
<span > | ||
{primaryReferent.phoneNumber ?? "-"} | ||
</span> | ||
</td> | ||
</tr> | ||
) | ||
})} | ||
|
||
{(referents === undefined || secondaryReferents.length === 0) && | ||
<tr> | ||
<th className="VerticallyCentered ContactsLeftHeader">{D.deputyCpos}</th> | ||
<td>{"-"}</td> | ||
</tr> | ||
} | ||
|
||
{secondaryReferents.map((secondaryReferent) => { | ||
return ( | ||
<tr key={secondaryReferent.phoneNumber}> | ||
<th className="VerticallyCentered ContactsLeftHeader">{D.deputyCpos}</th> | ||
<td className="ContactRow"> | ||
<span> | ||
{secondaryReferent.firstName || secondaryReferent.lastName ? | ||
`${secondaryReferent.firstName ?? ""} ${secondaryReferent.lastName ?? ""}` | ||
: "-" | ||
} | ||
</span> | ||
<span > | ||
{secondaryReferent.phoneNumber ?? "-"} | ||
</span> | ||
</td> | ||
</tr> | ||
) | ||
})} | ||
</tbody> | ||
</Table> | ||
</div> | ||
|
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
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
Oops, something went wrong.