diff --git a/api/src/services/affiliation.service.ts b/api/src/services/affiliation.service.ts
index b54e538..4fc340a 100644
--- a/api/src/services/affiliation.service.ts
+++ b/api/src/services/affiliation.service.ts
@@ -4,7 +4,7 @@ import {SecurityBindings, UserProfile} from '@loopback/security';
import {capitalize} from 'lodash';
-import {WEBSITE_FQDN} from '../constants';
+import {IDP_FQDN, realmName, WEBSITE_FQDN} from '../constants';
import {Affiliation, Citizen, User, Enterprise, Funder} from '../models';
import {
AffiliationRepository,
@@ -59,7 +59,7 @@ export class AffiliationService {
* @param enterpriseEmails[]: string[] - email patterns of the enterprise citizen want to be member
*/
isValidEmailProPattern(emailCitizen: string, enterpriseEmails: string[]): Boolean {
- return enterpriseEmails.includes(emailCitizen.replace(/^.+@/, '@'));
+ return enterpriseEmails.map(email => email.toLowerCase()).includes(emailCitizen.replace(/^.+@/, '@').toLowerCase());
}
/**
@@ -178,7 +178,7 @@ export class AffiliationService {
* @param enterpriseName entreprise to be affiliated to
*/
async sendValidatedAffiliation(citizen: Citizen, enterpriseName: string) {
- const websiteLink = `${WEBSITE_FQDN}/recherche`;
+ const websiteLink = `${IDP_FQDN}/auth/realms/${realmName}/protocol/openid-connect/auth?client_id=platform&redirect_uri=${WEBSITE_FQDN}/recherche&response_mode=fragment&response_type=code`;
await this.mailService.sendMailAsHtml(
citizen.personalInformation.email.value!,
"Votre demande d'affiliation a été acceptée !",
diff --git a/api/src/services/citizen.service.ts b/api/src/services/citizen.service.ts
index 1af3cb5..005c87d 100644
--- a/api/src/services/citizen.service.ts
+++ b/api/src/services/citizen.service.ts
@@ -605,7 +605,7 @@ export class CitizenService {
// Send a manual affiliation mail to the company's funders accepting the manual affiliation or to citizen
if (affiliation.status === AFFILIATION_STATUS.TO_AFFILIATE) {
- if (enterprise!.enterpriseDetails.hasManualAffiliation) {
+ if (enterprise!.enterpriseDetails.hasManualAffiliation && !citizen.affiliation.enterpriseEmail) {
await this.affiliationService.sendManualAffiliationMail(citizen, enterprise!);
Logger.info(
CitizenService.name,
diff --git a/idp/mcm_template/login/info.ftl b/idp/mcm_template/login/info.ftl
index 65f53eb..5b7c604 100644
--- a/idp/mcm_template/login/info.ftl
+++ b/idp/mcm_template/login/info.ftl
@@ -19,7 +19,8 @@
${kcSanitize(msg("activeAccountDescription2"))?no_esc}
>
) : (
- Strings['profile.phrase.not.affiliated']
+ Strings['profile.phrase.not.affiliated.waiting']
)
) : (
UserAffiliationStatus[
diff --git a/website/src/components/Profile/locale/fr.json b/website/src/components/Profile/locale/fr.json
index fd3bc8f..204034b 100644
--- a/website/src/components/Profile/locale/fr.json
+++ b/website/src/components/Profile/locale/fr.json
@@ -44,6 +44,7 @@
"profile.label.gender.male": "M.",
"profile.label.gender.female": "Mme.",
"profile.phrase.not.affiliated": "Non Affilié",
+ "profile.phrase.not.affiliated.waiting": "En cours de validation par votre employeur",
"profile.tooltip.linked.accounts": "Rendez-vous sur votre application régionale de mobilité pour lier vos comptes et profiter de l'ensemble des fonctionnalités MOB",
"profile.tooltip.refresh.page": "Veuillez rafraîchir cette page pour visualiser le changement de statut",
"profile.modal.validate.button": "Valider ma désaffiliation",
diff --git a/website/src/components/Profile/locale/fr.json.d.ts b/website/src/components/Profile/locale/fr.json.d.ts
index 16ed452..4b4e542 100644
--- a/website/src/components/Profile/locale/fr.json.d.ts
+++ b/website/src/components/Profile/locale/fr.json.d.ts
@@ -44,6 +44,7 @@ interface Fr {
'profile.label.gender.female': string;
'profile.label.gender.male': string;
'profile.phrase.not.affiliated': string;
+ 'profile.phrase.not.affiliated.waiting': string;
'profile.tooltip.linked.accounts': string;
'profile.tooltip.refresh.page': string;
'profile.modal.validate.button': string;
diff --git a/website/src/components/Tabs/Tabs.tsx b/website/src/components/Tabs/Tabs.tsx
index 48d3456..ca12010 100644
--- a/website/src/components/Tabs/Tabs.tsx
+++ b/website/src/components/Tabs/Tabs.tsx
@@ -1,4 +1,4 @@
-import React, { FC, useState } from 'react';
+import React, { FC, useEffect, useState } from 'react';
import classNames from 'classnames';
import './_tabs.scss';
@@ -19,6 +19,9 @@ const Tab: FC = ({ tabs, setSelectedIndex, defaultActiveTab }) => {
const [activeTab, setActiveTab] = useState(
defaultActiveTab || tabs[0]?.id
);
+ useEffect(() => {
+ setActiveTab(defaultActiveTab || tabs[0]?.id)
+ }, [defaultActiveTab])
const handleTabClick = (tabID: React.SetStateAction) => {
setActiveTab(tabID);
diff --git a/website/src/components/Toast/Toast.tsx b/website/src/components/Toast/Toast.tsx
index a4c0b99..83cf3e2 100644
--- a/website/src/components/Toast/Toast.tsx
+++ b/website/src/components/Toast/Toast.tsx
@@ -28,10 +28,10 @@ const toastOptions = {
},
};
const containerStyle = {
- top: 0,
+ top: "115px",
left: 0,
bottom: 0,
- right: 0,
+ right: 0
};
const Toast: FC = () => {
diff --git a/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx b/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx
index 15dbbd2..e7fe59a 100644
--- a/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx
+++ b/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx
@@ -5,6 +5,8 @@ import Button from '@components/Button/Button';
import { useSession } from '../../../../context';
import Strings from '../../locale/fr.json';
+import { navigate } from 'gatsby';
+import { INCENTIVE_TYPE } from '../../../../utils/demandes';
const AffiliateSuccessMessage: FC = () => {
const { isKCInit, keycloak } = useSession();
@@ -26,6 +28,12 @@ const AffiliateSuccessMessage: FC = () => {
{Strings['affiliation.success.button']}
)}
+ {isKCInit && keycloak?.authenticated && (
+ // User is logged in, invite them to go to incentives page
+ navigate("/recherche?tab=" + INCENTIVE_TYPE.EMPLOYER_INCENTIVE)}>
+ {Strings['affiliation.success.button.incentives']}
+
+ )}
>
);
};
diff --git a/website/src/modules/inscription/locale/fr.json b/website/src/modules/inscription/locale/fr.json
index e116e41..b16f2ba 100644
--- a/website/src/modules/inscription/locale/fr.json
+++ b/website/src/modules/inscription/locale/fr.json
@@ -6,6 +6,7 @@
"affiliation.success": "Félicitations ! Vous êtes désormais affilié à votre employeur.",
"affiliation.success.action": "Si vous avez activé votre compte, vous pouvez désormais vous connecter pour visualiser les aides de votre employeur.",
"affiliation.success.button": "Me connecter",
+ "affiliation.success.button.incentives": "Consulter mes aides employeur",
"affiliation.title": "Vous avez demandé une affiliation",
"affiliation.button": "Affilier mon compte",
"affiliation.profile": "Mon profil",
diff --git a/website/src/modules/inscription/locale/fr.json.d.ts b/website/src/modules/inscription/locale/fr.json.d.ts
index 78ff2e3..f278f4d 100644
--- a/website/src/modules/inscription/locale/fr.json.d.ts
+++ b/website/src/modules/inscription/locale/fr.json.d.ts
@@ -6,6 +6,7 @@ interface Fr {
'affiliation.success': string;
'affiliation.success.action': string;
'affiliation.success.button': string;
+ 'affiliation.success.button.incentives': string;
'affiliation.title': string;
'affiliation.button': string;
'affiliation.profile': string;
diff --git a/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx b/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx
index b2784b3..dcc66b8 100644
--- a/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx
+++ b/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx
@@ -24,11 +24,13 @@ import { StatusCode } from '@utils/https';
import { matomoTrackEvent } from '@utils/matomo';
import { useMatomo } from '@datapunt/matomo-tracker-react';
+import { useUser } from '../../../context';
import Strings from '../locale/fr.json';
const InscriptionPageAffiliation: FC = () => {
const [token] = useQueryParam('token', StringParam);
const { trackEvent } = useMatomo();
+ const { citizen, refetchCitizen } = useUser();
const { error, refetch, isIdle, isLoading, isSuccess, isError } = useQuery(
'affiliate',
async () => {
@@ -50,8 +52,11 @@ const InscriptionPageAffiliation: FC = () => {
}
}, []);
- const handleClick = (): void => {
- refetch();
+ const handleClick = async (): Promise => {
+ await refetch();
+ if (citizen) {
+ refetchCitizen();
+ }
};
const renderMessage = (): React.ReactNode => {
diff --git a/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx b/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx
index 46dbb55..5ed5449 100644
--- a/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx
+++ b/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx
@@ -204,7 +204,7 @@ const GererSalaries: FC = ({ location, pageContext }) => {
const renderSalaries = (): ReactNode => {
if (salaries && salaries.length) {
return salaries.map(
- ({ id, firstName, lastName, enterpriseEmail, email, birthDate }) => {
+ ({ id, firstName, lastName, enterpriseEmail, email, birthdate }) => {
return (
@@ -222,7 +222,7 @@ const GererSalaries: FC = ({ location, pageContext }) => {
{
- openModal(id, lastName, firstName, email, birthDate);
+ openModal(id, lastName, firstName, email, birthdate);
}}
>
{
@@ -438,7 +438,7 @@ const GererSalaries: FC = ({ location, pageContext }) => {
};
/*
- * Open Modal Delete Affiliation
+ * Open any Modal
*/
const openModal = (
citizen: string,
@@ -458,7 +458,7 @@ const GererSalaries: FC = ({ location, pageContext }) => {
};
/*
- * Close Modal Delete Affiliation
+ * Close any Modal
*/
const closeModal = () => {
setShowModal(false);
diff --git a/website/src/pages/locale/fr.json b/website/src/pages/locale/fr.json
index e9a06dc..fd44d2d 100644
--- a/website/src/pages/locale/fr.json
+++ b/website/src/pages/locale/fr.json
@@ -298,5 +298,8 @@
"search.incentive.tabs.all.incentives": "Toutes les aides {0}",
"search.incentive.tabs.territory.incentives": "Aides territoriales {0}",
"search.incentive.tabs.employees.incentives": "Aides employeur {0}",
- "search.incentive.tabs.nationals.incentives": "Aides nationales {0}"
+ "search.incentive.tabs.nationals.incentives": "Aides nationales {0}",
+ "search.incentive.affiliation.toast.part1": "Votre affiliation employeur n'est pas finalisée, un email a du vous être envoyé sur l'adresse ",
+ "search.incentive.affiliation.toast.part2": "Consultez votre profil pour plus d'information, ou pour renvoyer l'email",
+ "search.incentive.affiliation.toast.close": "Fermer"
}
diff --git a/website/src/pages/locale/fr.json.d.ts b/website/src/pages/locale/fr.json.d.ts
index 2f09ad2..d765eed 100644
--- a/website/src/pages/locale/fr.json.d.ts
+++ b/website/src/pages/locale/fr.json.d.ts
@@ -299,6 +299,9 @@ interface Fr {
'search.incentive.tabs.territory.incentives': string;
'search.incentive.tabs.employees.incentives': string;
'search.incentive.tabs.nationals.incentives': string;
+ 'search.incentive.affiliation.toast.part1': string;
+ 'search.incentive.affiliation.toast.part2': string;
+ 'search.incentive.affiliation.toast.close': string;
}
declare const value: Fr;
diff --git a/website/src/pages/recherche.tsx b/website/src/pages/recherche.tsx
index 5abe130..6ce6014 100644
--- a/website/src/pages/recherche.tsx
+++ b/website/src/pages/recherche.tsx
@@ -3,6 +3,7 @@ import { Breadcrumb } from 'gatsby-plugin-breadcrumb/';
import { useQueryParam, StringParam } from 'use-query-params';
import { useQueryClient, useQuery } from 'react-query';
import { useMatomo } from '@datapunt/matomo-tracker-react';
+import toast from 'react-hot-toast';
import { AuthorizationRoute } from '@modules/routes';
@@ -32,6 +33,7 @@ import Strings from './locale/fr.json';
import { Helmet } from 'react-helmet';
import mobLogo from '../../static/mob-favicon.png';
+import { navigate } from 'gatsby';
interface RechercheProps {
pageContext: { breadcrumb: { crumbs: string } };
@@ -380,6 +382,23 @@ const RechercheComponent: FC = ({ pageContext }) => {
setTermSearch(term);
};
+ useEffect(() => {
+ if (authenticated && citizen && citizen.affiliation && citizen.affiliation.status === "A_AFFILIER" && citizen.affiliation.enterpriseEmail) {
+ toast.loading((t) => (
+
+
{Strings['search.incentive.affiliation.toast.part1']} {citizen.affiliation.enterpriseEmail}.
+
{Strings['search.incentive.affiliation.toast.part2']}: navigate('/mon-profil/', { replace: true })}>Mon Profil .
+
toast.dismiss(t.id)}>{Strings['search.incentive.affiliation.toast.close']}
+
+ ), {
+ style: {
+ minWidth: '50%',
+ }
+ })
+ }
+ return toast.dismiss
+ }, [])
+
useEffect(() => {
if (allIncentivesCount) {
setIncentivesCount((previousState) => ({
@@ -413,6 +432,9 @@ const RechercheComponent: FC = ({ pageContext }) => {
...previousState,
employerIncentives: employerIncentivesCount?.count,
}));
+ if (employerIncentivesCount?.count > 0 && !routeSelectedTab) {
+ setSelectedTab(INCENTIVE_TYPE.EMPLOYER_INCENTIVE)
+ }
}
}, [employerIncentivesCount]);
@@ -433,7 +455,7 @@ const RechercheComponent: FC = ({ pageContext }) => {
territoryFilter,
transportsFilter,
]);
-
+
return (
{
- this.showToaster();
+ //this.showToaster();
return injectToken(config);
},
(error) => Promise.reject(error)
@@ -69,11 +69,11 @@ class Https {
https.interceptors.response.use(
(response) => {
- this.dismissToaster();
+ //this.dismissToaster();
return response;
},
(error) => {
- this.dismissToaster();
+ //this.dismissToaster();
const { response } = error;
return this.handleError(response);
}