Skip to content

Commit

Permalink
ajout bouton renvoi espace candidat si non activer (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ornella452 authored Nov 8, 2024
1 parent 593cc12 commit 964be47
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/views/connected/admin/conseillers/ConseillerDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function ConseillerDetails() {
const loading = useSelector(state => state.conseiller?.loading);
const roleActivated = useSelector(state => state.authentication?.roleActivated);
const successSendMail = useSelector(state => state.conseiller?.successRelanceInvitation);
const successSendMailCandidat = useSelector(state => state.conseiller?.successResendInvitCandidatConseiller);
const errorSendMail = useSelector(state => state.conseiller?.errorRelanceInvitation);
const errorSendMailCandidat = useSelector(state => state.conseiller?.errorCandidat);
const currentPage = useSelector(state => state.pagination?.currentPage);

const [misesEnRelationFinalisee, setMisesEnRelationFinalisee] = useState([]);
Expand All @@ -31,6 +33,10 @@ function ConseillerDetails() {
const resendInvitationEspaceCoop = conseillerId => {
dispatch(conseillerActions.resendInvitConseiller(conseillerId));
};
const resendInvitCandidat = () => {
window.scrollTo(0, 0);
dispatch(conseillerActions.resendInvitCandidat(conseiller?._id));
};

useEffect(() => {
if (!errorConseiller) {
Expand Down Expand Up @@ -81,7 +87,22 @@ function ConseillerDetails() {
status: null, description: null
}));
}
}, [successSendMail, errorSendMail]);

if (successSendMailCandidat) {
dispatch(alerteEtSpinnerActions.getMessageAlerte({
type: 'success',
message: successSendMailCandidat,
status: null, description: null
}));
}
if (errorSendMailCandidat) {
dispatch(alerteEtSpinnerActions.getMessageAlerte({
type: 'error',
message: errorSendMailCandidat,
status: null, description: null
}));
}
}, [successSendMail, errorSendMail, successSendMailCandidat, errorSendMailCandidat]);

return (
<div className="fr-container conseillerDetails">
Expand Down Expand Up @@ -156,17 +177,24 @@ function ConseillerDetails() {
}
</div>
}
<div className="fr-col-md-4 fr-col-sm-6 fr-col-12 btn-invitation">
{conseiller?.statut === 'RECRUTE' &&
<div className="fr-col-12 btn-invitation">
{conseiller?.statut === 'RECRUTE' && <>
<button
className="fr-btn fr-icon-mail-line fr-btn--icon-left fr-ml-auto"
className="fr-col-lg-3 fr-col-md-3 fr-col-sm-6 fr-btn fr-icon-mail-line fr-btn--icon-left fr-ml-auto"
title="Inviter &agrave; rejoindre l&rsquo;espace Coop"
onClick={() => {
resendInvitationEspaceCoop(conseiller?._id);
}}
>
Inviter sur l&rsquo;espace Coop
</button>
{conseiller?.usersActived[0]?.passwordCreated === true &&
<button className="fr-col-lg-3 fr-col-md-3 fr-col-sm-6 fr-btn fr-icon-mail-line fr-btn--icon-left fr-ml-md-2w fr-mt-2w fr-mt-md-0"
title="Renvoyer l&rsquo;email d&rsquo;invitation" onClick={resendInvitCandidat}>
Inviter sur l&rsquo;espace Candidat
</button>
}
</>
}
</div>
</div>
Expand Down

0 comments on commit 964be47

Please sign in to comment.