Skip to content

Commit

Permalink
feat: improve documents list
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierJp committed Jun 27, 2024
1 parent 7f5c4bd commit 84aac9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ import { ISession } from '#models/user/session';
import { formatDateLong } from '#utils/helpers';
import { useAPIRouteData } from 'hooks/fetch/use-API-route-data';

const NoDocument = () => (
<>Aucun document n’a été retrouvé dans le RNE pour cette entreprise.</>
);

export const AgentActesRNE: React.FC<{
uniteLegale: IUniteLegale;
session: ISession | null;
Expand Down Expand Up @@ -62,13 +58,13 @@ export const AgentActesRNE: React.FC<{
Cette entreprise possède {documents.actes.length} document(s) au
RNE. Chaque document peut contenir un ou plusieurs actes :
</p>
{documents.actes.length >= 5 ? (
{documents.actes.length > 5 ? (
<ShowMore
label={`Voir les ${
documents.actes.length - 5
} documents supplémentaires`}
>
<ActesTable actes={documents.actes} />
<ActesTable actes={documents.actes.slice(0, 5)} />
</ShowMore>
) : (
<ActesTable actes={documents.actes} />
Expand All @@ -89,18 +85,22 @@ function ActesTable({ actes }: IActesTableProps) {
head={['Date de dépôt', 'Acte(s) contenu(s)', 'Lien']}
body={actes.map((a) => [
formatDateLong(a.dateDepot),
a.actes && (
<ul>
{(a?.actes || []).map((acteName) => (
<li key={acteName}>{acteName}</li>
))}
</ul>
),
<ul>
{(a?.detailsDocuments || []).map(({ nom, label }) => (
<li key={nom}>
<b>
{nom}
{label && ' :'}
</b>
{label}
</li>
))}
</ul>,
<ButtonLink
target="_blank"
alt
small
to={`${routes.api.espaceAgent.rne.documents.download}${a.id}?type=acte`}
to={`${routes.espaceAgent.documents.download}${a.id}?type=acte`}
>
Télécharger
</ButtonLink>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const AgentBilansSection: React.FC<{
alt
small
target="_blank"
to={`${routes.api.espaceAgent.rne.documents.download}${a.id}?type=bilan`}
to={`${routes.espaceAgent.documents.download}${a.id}?type=bilan`}
>
Télécharger
</ButtonLink>,
Expand Down
2 changes: 1 addition & 1 deletion models/immatriculation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Siren } from '#utils/helpers';
interface IActeRNE {
id: string;
dateDepot: string;
actes?: string[];
detailsDocuments: { nom: string; label: string }[];
}

interface IBilanRNE {
Expand Down

0 comments on commit 84aac9d

Please sign in to comment.