Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: ajout bouton renvoi mail candidat #555

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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