Skip to content

Commit

Permalink
wip referents
Browse files Browse the repository at this point in the history
  • Loading branch information
RenauxLeaInsee committed Jan 4, 2024
1 parent 5619774 commit 5bb1e17
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/components/CampaignPortal/CampaignPortal.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
width: 30%;
}

.MailRow{
background-color: white;
}

.ContactRow{
width: 100%;
}

.DatesLeftHeader{
width: 30%;
}
Expand Down
39 changes: 38 additions & 1 deletion src/components/CampaignPortal/CampaignPortal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,44 @@ function CampaignPortal({
</Row>
<Row>
<Col>
<Contacts email = {surveyInfo.email} />
<Contacts
email={surveyInfo.email}
// TODO: remove mock
referents={[
{
"firstName":"Bob",
"lastName":"Lennon",
"phoneNumber":"0123456789",
"role":"PRIMARY"
},
{
"firstName":"Bob",
"lastName":"Lennon",
"phoneNumber":"0123456789",
"role":"PRIMARY"
},
{
"firstName":"Bob",
"lastName":"Lennon",
"phoneNumber":"0123456789",
"role":"PRIMARY"
},
{
"firstName":"Bob",
"lastName":"Lennon",
"phoneNumber":"0123456789",
"role":"PRIMARY"
},

{
// "firstName":"John",
"lastName":"Doe",
"phoneNumber":"9876543210",
"role":"SECONDARY"
},

]}
/>
<DatesTable
identificationPhaseStartDate={surveyInfo.identificationPhaseStartDate}
collectionStartDate={surveyInfo.collectionStartDate}
Expand Down
43 changes: 33 additions & 10 deletions src/components/CampaignPortal/Contacts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import Popover from 'react-bootstrap/Popover';
import D from '../../i18n';

function Contacts({email}) {
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");

console.log(primaryReferents)
return (
<Card className="ViewCard">
<div>
Expand All @@ -27,23 +32,41 @@ function Contacts({email}) {
onClick={() => { window.location.assign(`mailto:${email}`); }}
>
<th className="ContactsLeftHeader">{D.functionalBox}</th>
<td className=" LightGreyLine MailLink">{email}</td>
<td className="MailLink MailRow" >{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>
{primaryReferents.map((primaryReferent) => {
return (
<tr key={primaryReferent.phoneNumber} className="LightGreyLine">
<td >
<div className='ContactRow' >
{primaryReferent.firstName || primaryReferent.lastName ?
`${primaryReferent.firstName ?? ""} ${primaryReferent.lastName ?? ""}`
: "-"
}
</div>
<div >
{primaryReferent.phoneNumber ?? "-"}
</div>
</td>
</tr>
)
})}
</tr>
<tr>
{/* <tr>
<th rowSpan="2" className="VerticallyCentered ContactsLeftHeader">{D.deputyCpos}</th>
<td className="LightGreyLine">Thierry Fabres</td>
<td className="LightGreyLine">
{secondaryReferent.firstName || secondaryReferent.lastName ?
`${secondaryReferent.firstName ?? ""} ${secondaryReferent.lastName ?? ""}`
: "-"
}
</td>
</tr>
<tr>
<td className="LightGreyLine">02 01 01 01 01</td>
</tr>
<td className="LightGreyLine">{secondaryReferent && secondaryReferent.phoneNumber }</td>
</tr> */}
</tbody>
</Table>
</div>
Expand Down

0 comments on commit 5bb1e17

Please sign in to comment.