Skip to content

Commit

Permalink
fix: label and certif
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierJp committed May 15, 2024
1 parent 7b925d1 commit 1207847
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { EAdministration } from '#models/administrations/EAdministration';
import { IAPILoading, isAPILoading } from '#models/api-loading';
import {
IAPINotRespondingError,
isAPI404,
isAPINotResponding,
} from '#models/api-not-responding';
import { IUniteLegale } from '#models/core/types';
Expand All @@ -26,10 +25,6 @@ async function MandatairesRCSSection({
immatriculationRNE,
mandatairesRCS,
}: IProps) {
if (isAPI404(mandatairesRCS)) {
return null;
}

return (
<DataSection
id="rne-dirigeants"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Icon } from '#components-ui/icon/wrapper';
import NonRenseigne from '#components/non-renseigne';
import { isAPINotResponding } from '#models/api-not-responding';
import constants from '#models/constants';
import { getOpqibi } from '#models/espace-agent/certificats/opqibi';
Expand All @@ -11,7 +12,8 @@ import { LabelWithLinkToSection } from './label-with-link-to-section';
export const ProtectedCertificatesBadgesSection: React.FC<{
uniteLegale: IUniteLegale;
session: ISession | null;
}> = async ({ uniteLegale, session }) => {
hasOtherCertificates: boolean;
}> = async ({ uniteLegale, session, hasOtherCertificates }) => {
const [opqibi, qualifelec, qualibat] = await Promise.all([
getOpqibi(uniteLegale.siren, session?.user?.siret),
getQualifelec(uniteLegale.siege.siret, session?.user?.siret),
Expand All @@ -23,7 +25,7 @@ export const ProtectedCertificatesBadgesSection: React.FC<{
isAPINotResponding(qualibat) &&
isAPINotResponding(qualifelec)
) {
return null;
return hasOtherCertificates ? null : <NonRenseigne />;
}

return (
Expand Down
11 changes: 10 additions & 1 deletion components/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ const Footer = () => (
mon-entreprise.fr
</a>
</li>

<li className="fr-footer__content-item">
<a
className="fr-footer__top-link"
Expand All @@ -138,6 +137,16 @@ const Footer = () => (
formalites.entreprises.gouv.fr
</a>
</li>
<li className="fr-footer__content-item">
<a
className="fr-footer__top-link"
target="_blank"
rel="noreferrer noopener"
href="https://conseillers-entreprises.service-public.fr"
>
Conseillers Entreprises
</a>
</li>
</ul>
</div>
<div className="fr-col-12 fr-col-sm-4 fr-col-md-4">
Expand Down
8 changes: 4 additions & 4 deletions components/unite-legale-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ const UniteLegaleSection: React.FC<{
uniteLegale: IUniteLegale;
session: ISession | null;
}> = ({ uniteLegale, session }) => {
const hasLabelsAndCertificates =
checkHasLabelsAndCertificates(uniteLegale) ||
hasRights(session, EScope.protectedCertificats);
const hasLabelsAndCertificates = checkHasLabelsAndCertificates(uniteLegale);
const conventionsCollectives = Object.keys(
uniteLegale.conventionsCollectives || {}
);
Expand Down Expand Up @@ -112,7 +110,8 @@ const UniteLegaleSection: React.FC<{
/>,
],
// jump line and add label and certificates
...(hasLabelsAndCertificates
...(hasLabelsAndCertificates ||
hasRights(session, EScope.protectedCertificats)
? [
['', <br />],
[
Expand All @@ -126,6 +125,7 @@ const UniteLegaleSection: React.FC<{
<ProtectedCertificatesBadgesSection
session={session}
uniteLegale={uniteLegale}
hasOtherCertificates={hasLabelsAndCertificates}
/>
</Suspense>
)}
Expand Down

0 comments on commit 1207847

Please sign in to comment.