Skip to content

Commit

Permalink
1019 (#1022)
Browse files Browse the repository at this point in the history
* content: idcc and banner update

* chore: migration dirigeants and elus

* refactor: use date fermeture

* style: smaller info banner

* chore: update footer
  • Loading branch information
XavierJp authored Apr 26, 2024
1 parent 5e55195 commit 40afff1
Show file tree
Hide file tree
Showing 29 changed files with 420 additions and 384 deletions.
66 changes: 66 additions & 0 deletions app/(header-default)/dirigeants/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Metadata } from 'next';
import Title from '#components/title-section';
import { FICHE } from '#components/title-section/tabs';
import { getServicePublicByUniteLegale } from '#models/service-public';
import {
uniteLegalePageDescription,
uniteLegalePageTitle,
} from '#utils/helpers';
import { cachedGetUniteLegale } from '#utils/server-side-helper/app/cached-methods';
import extractParamsAppRouter, {
AppRouterProps,
} from '#utils/server-side-helper/app/extract-params';
import getSession from '#utils/server-side-helper/app/get-session';
import ResponsableSection from 'app/(header-default)/dirigeants/_component/sections/responsables-service-public';
import { DirigeantInformation } from '../_component/sections';

export const generateMetadata = async (
props: AppRouterProps
): Promise<Metadata> => {
const { slug, page, isBot } = extractParamsAppRouter(props);

const session = await getSession();
const uniteLegale = await cachedGetUniteLegale(slug, isBot, page);

return {
title: `Dirigeants de la structure - ${uniteLegalePageTitle(
uniteLegale,
session
)}`,
description: uniteLegalePageDescription(uniteLegale, session),
robots: 'noindex, nofollow',
alternates: {
canonical: `https://annuaire-entreprises.data.gouv.fr/dirigeants/${uniteLegale.siren}`,
},
};
};

const DirigeantsPage = async (props: AppRouterProps) => {
const { slug, isBot } = extractParamsAppRouter(props);

const uniteLegale = await cachedGetUniteLegale(slug, isBot);
const servicePublic = await getServicePublicByUniteLegale(uniteLegale, {
isBot,
});

const session = await getSession();

return (
<>
<div className="content-container">
<Title
uniteLegale={uniteLegale}
ficheType={FICHE.DIRIGEANTS}
session={session}
/>
{servicePublic ? (
<ResponsableSection servicePublic={servicePublic} />
) : (
<DirigeantInformation uniteLegale={uniteLegale} />
)}
</div>
</>
);
};

export default DirigeantsPage;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import routes from '#clients/routes';
import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down';
Expand Down
45 changes: 45 additions & 0 deletions app/(header-default)/dirigeants/_component/sections/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use client';

import BreakPageForPrint from '#components-ui/print-break-page';
import { DonneesPriveesSection } from '#components/donnees-privees-section';
import { estDiffusible } from '#models/core/statut-diffusion';
import { IUniteLegale } from '#models/core/types';
import { EScope, hasRights } from '#models/user/rights';
import { useFetchImmatriculationRNE } from 'hooks';
import useSession from 'hooks/use-session';
import BeneficiairesSection from './beneficiaires';
import DirigeantsSection from './rne-dirigeants';
import DirigeantSummary from './summary';

export function DirigeantInformation({
uniteLegale,
}: {
uniteLegale: IUniteLegale;
}) {
const immatriculationRNE = useFetchImmatriculationRNE(uniteLegale);
const session = useSession();
return (
<>
<DirigeantSummary
uniteLegale={uniteLegale}
immatriculationRNE={immatriculationRNE}
/>
{estDiffusible(uniteLegale) ||
hasRights(session, EScope.nonDiffusible) ? (
<>
<DirigeantsSection
immatriculationRNE={immatriculationRNE}
uniteLegale={uniteLegale}
/>
<BreakPageForPrint />
<BeneficiairesSection
immatriculationRNE={immatriculationRNE}
uniteLegale={uniteLegale}
/>
</>
) : (
<DonneesPriveesSection />
)}
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import routes from '#clients/routes';
import InpiPartiallyDownWarning from '#components-ui/alerts-with-explanations/inpi-partially-down';
Expand Down
File renamed without changes.
63 changes: 63 additions & 0 deletions app/(header-default)/elus/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { GetServerSideProps, Metadata } from 'next';
import Meta from '#components/meta/meta-client';
import Title from '#components/title-section';
import { FICHE } from '#components/title-section/tabs';
import { getNomComplet } from '#models/core/statut-diffusion';
import { IUniteLegale } from '#models/core/types';
import { getUniteLegaleFromSlug } from '#models/core/unite-legale';
import extractParamsPageRouter from '#utils/server-side-helper/page/extract-params';
import {
IPropsWithMetadata,
postServerSideProps,
} from '#utils/server-side-helper/page/post-server-side-props';
import ElusSection from 'app/(header-default)/elus/_component/section/elus-section';
import { NextPageWithLayout } from 'pages/_app';
import extractParamsAppRouter, {
AppRouterProps,
} from '#utils/server-side-helper/app/extract-params';
import { cachedGetUniteLegale } from '#utils/server-side-helper/app/cached-methods';
import getSession from '#utils/server-side-helper/app/get-session';
import {
uniteLegalePageDescription,
uniteLegalePageTitle,
} from '#utils/helpers';

export const generateMetadata = async (
props: AppRouterProps
): Promise<Metadata> => {
const { slug, page, isBot } = extractParamsAppRouter(props);

const session = await getSession();
const uniteLegale = await cachedGetUniteLegale(slug, isBot, page);

return {
title: `Élus de ${getNomComplet(uniteLegale, session)} - ${
uniteLegale.siren
}`,
description: uniteLegalePageDescription(uniteLegale, session),
robots: 'noindex, nofollow',
alternates: {
canonical: `https://annuaire-entreprises.data.gouv.fr/elus/${uniteLegale.siren}`,
},
};
};

const ElusPage = async (props: AppRouterProps) => {
const { slug, isBot } = extractParamsAppRouter(props);

const uniteLegale = await cachedGetUniteLegale(slug, isBot);
const session = await getSession();

return (
<div className="content-container">
<Title
uniteLegale={uniteLegale}
ficheType={FICHE.ELUS}
session={session}
/>
<ElusSection uniteLegale={uniteLegale} />
</div>
);
};

export default ElusPage;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import NonRenseigne from '#components/non-renseigne';
import { Section } from '#components/section';
import { FullTable } from '#components/table/full';
import { EAdministration } from '#models/administrations/EAdministration';
import { isCollectiviteTerritoriale, IUniteLegale } from '#models/core/types';
import { IEtatCivil } from '#models/immatriculation';
import { capitalize, formatDatePartial } from '#utils/helpers';
import { Section } from '../section';
import { FullTable } from '../table/full';

/**
* Elus section
Expand Down Expand Up @@ -42,36 +42,29 @@ const ElusSection: React.FC<{ uniteLegale: IUniteLegale }> = ({
const plural = elus.length > 1 ? 's' : '';

return (
<>
<Section
id="collectivite-elus"
title={`Élu${plural}`}
sources={[EAdministration.MI, EAdministration.DINUM]}
>
{elus.length > 0 ? (
<>
<p>
Cette collectivité possède {elus.length} élu{plural} enregistré
{plural} au Répertoire National des Élus&nbsp;:
</p>
<FullTable
head={['Role', 'Élu(e)', 'Date de naissance']}
body={elus.sort(sortByRole).map((elu) => formatElus(elu))}
/>
</>
) : (
<Section
id="collectivite-elus"
title={`Élu${plural}`}
sources={[EAdministration.MI, EAdministration.DINUM]}
>
{elus.length > 0 ? (
<>
<p>
Cette collectivité ne possède aucun élu enregistré au Répertoire
National des Élus
Cette collectivité possède {elus.length} élu{plural} enregistré
{plural} au Répertoire National des Élus&nbsp;:
</p>
)}
</Section>
<style jsx>{`
table > tbody > tr > td {
min-width: 30%;
}
`}</style>
</>
<FullTable
head={['Role', 'Élu(e)', 'Date de naissance']}
body={elus.sort(sortByRole).map((elu) => formatElus(elu))}
/>
</>
) : (
<p>
Cette collectivité ne possède aucun élu enregistré au Répertoire
National des Élus
</p>
)}
</Section>
);
};
export default ElusSection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const ImmatriculationSummary: React.FC<IJustificatifs> = ({
) : (
<a href="#insee">
<strong>Cessée</strong> auprès de l’Insee
{uniteLegale.dateDebutActivite
? `, depuis le ${formatDateLong(uniteLegale.dateDebutActivite)}`
{uniteLegale.dateFermeture
? `, depuis le ${formatDateLong(uniteLegale.dateFermeture)}`
: ''}
</a>
)}
Expand Down
12 changes: 8 additions & 4 deletions clients/sirene-insee/siren.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import routes from '#clients/routes';
import stubClientWithSnapshots from '#clients/stub-client-with-snaphots';
import { createEtablissementsList } from '#models/core/etablissements-list';
import { estActif } from '#models/core/etat-administratif';
import {
createDefaultEtablissement,
createDefaultUniteLegale,
Expand Down Expand Up @@ -168,6 +169,11 @@ const mapToDomainObject = (
'T'
)[0];

const etatAdministratif = etatFromEtatAdministratifInsee(
etatAdministratifUniteLegale,
siren
);

return {
...defaultUniteLegale,
siren,
Expand All @@ -186,10 +192,8 @@ const mapToDomainObject = (
dateMiseAJourInsee: dateDernierTraitement,
dateMiseAJourInpi: '',
dateDebutActivite: dateDebut,
etatAdministratif: etatFromEtatAdministratifInsee(
etatAdministratifUniteLegale,
siren
),
dateFermeture: !estActif({ etatAdministratif }) ? dateDebut : '',
etatAdministratif,
statutDiffusion: statuDiffusionFromStatutDiffusionInsee(
statutDiffusionUniteLegale,
siren
Expand Down
47 changes: 15 additions & 32 deletions components-ui/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,15 @@ const communityFill = (
</svg>
);

const humanPin = (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="100%"
height="100%"
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
>
<path d="M12 2c5.523 0 10 4.477 10 10 0 4.747-3.308 8.722-7.745 9.745L12 24l-2.255-2.255C5.308 20.722 2 16.747 2 12 2 6.477 6.477 2 12 2Zm.16 14c-2.036 0-3.87.87-5.148 2.257a7.953 7.953 0 0 0 3.182 1.539l.56.129L12 21.172l1.247-1.247.56-.13a7.956 7.956 0 0 0 3.36-1.686A6.979 6.979 0 0 0 12.16 16ZM6.554 6.14a8 8 0 0 0-.938 10.681v-.001A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 6.554 6.141ZM12 5a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z" />
</svg>
);
const user = (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="100%"
height="100%"
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
>
<path d="M4 22a8 8 0 1 1 16 0H4Zm8-9c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6Z" />
<path d="M12 14a8 8 0 0 1 8 8h-2a6 6 0 1 0-12 0H4a8 8 0 0 1 8-8Zm0-13c3.315 0 6 2.685 6 6s-2.685 6-6 6-6-2.685-6-6 2.685-6 6-6Zm0 2C9.79 3 8 4.79 8 7s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4Z" />
</svg>
);

Expand Down Expand Up @@ -126,20 +111,6 @@ const building = (
</svg>
);

const questionnaire = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="100%"
height="100%"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
>
<path d="M21 3a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6.455L2 22.5V4a1 1 0 0 1 1-1h18Zm-1 2H4v13.385L5.763 17H20V5Zm-7 9v2h-2v-2h2Zm-.54-7.972A3.501 3.501 0 0 1 12 13h-1v-2h1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393a3.501 3.501 0 0 1 3.892-2.785Z" />
</svg>
);

const alertFill = (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down Expand Up @@ -441,9 +412,23 @@ const discussion = (
</svg>
);

const accountLine = (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="100%"
height="100%"
stroke="none"
fill="currentColor"
>
<path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10Zm-4.987-3.744A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16a6.981 6.981 0 0 0-5.147 2.256ZM5.616 16.82A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634 8 8 0 1 0-12.906.187v-.001ZM12 13a4 4 0 1 1 0-8 4 4 0 0 1 0 8Zm0-2a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" />
</svg>
);

export type IIconsSlug = keyof typeof icons;

export const icons = {
accountLine,
errorFill,
lightbulbFill,
lockFill,
Expand All @@ -455,7 +440,6 @@ export const icons = {
buildingFill,
open,
closed,
humanPin,
file,
building,
moneyCircle,
Expand All @@ -471,7 +455,6 @@ export const icons = {
download,
questionFill,
alertFill,
questionnaire,
successFill,
discussion,
};
Loading

0 comments on commit 40afff1

Please sign in to comment.