Skip to content

Commit

Permalink
feat: link partenaire with moissonneur orgnizations and api-depot client
Browse files Browse the repository at this point in the history
  • Loading branch information
fufeck committed Apr 16, 2024
1 parent fcea01a commit 4ebafc5
Show file tree
Hide file tree
Showing 21 changed files with 1,255 additions and 789 deletions.
67 changes: 0 additions & 67 deletions components/api-depot/client-item.js

This file was deleted.

95 changes: 95 additions & 0 deletions components/api-depot/client-item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import Badge from "@codegouvfr/react-dsfr/Badge";
import Button from "@codegouvfr/react-dsfr/Button";
import Link from "next/link";
import {
ChefDeFileApiDepotType,
ClientApiDepotType,
MandataireApiDepotType,
} from "types/api-depot";
import { PartenaireDeLaChartType } from "types/partenaire-de-la-charte";

interface ClientItemProps {
client: ClientApiDepotType;
mandataire: MandataireApiDepotType;
chefDeFile: ChefDeFileApiDepotType;
partenaire: PartenaireDeLaChartType;
isDemo: boolean;
}

const ClientItem = ({
client,
mandataire,
chefDeFile,
partenaire,
isDemo,
}: ClientItemProps) => (
<tr>
<td className="fr-col fr-my-1v">{client.nom}</td>
<td className="fr-col fr-my-1v">{mandataire.nom}</td>
<td className="fr-col fr-my-1v">{chefDeFile ? chefDeFile.nom : "-"}</td>
<td className="fr-col fr-my-1v">{client.authorizationStrategy}</td>
<td className="fr-col fr-my-1v">
<input
type="checkbox"
id="checkbox"
name="checkbox"
checked={client.active}
disabled
/>
</td>
<td className="fr-col fr-my-1v">
<input
type="checkbox"
id="checkbox"
name="checkbox"
checked={client.options.relaxMode}
disabled
/>
</td>
<td className="fr-col fr-my-1v">
{partenaire ? (
<Link
legacyBehavior
passHref
href={{
pathname: `/partenaires-de-la-charte/${partenaire._id}`,
}}
>
{partenaire.name}
</Link>
) : (
<Badge severity="warning">Non partenaire</Badge>
)}
</td>
<td className="fr-col fr-my-1v">
<Link
legacyBehavior
passHref
href={{
pathname: "/api-depot/client/client-form",
query: { clientId: client._id, demo: isDemo ? 1 : 0 },
}}
>
<Button iconId="fr-icon-edit-line" iconPosition="right">
Editer
</Button>
</Link>
</td>
<td className="fr-col fr-my-1v">
<Link
legacyBehavior
passHref
href={{
pathname: "/api-depot/client",
query: { clientId: client._id, demo: isDemo ? 1 : 0 },
}}
>
<Button iconId="fr-icon-arrow-right-line" iconPosition="right">
Consulter
</Button>
</Link>
</td>
</tr>
);

export default ClientItem;
26 changes: 0 additions & 26 deletions components/api-depot/client/client-header.js

This file was deleted.

46 changes: 46 additions & 0 deletions components/api-depot/client/client-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Link from "next/link";
import Button from "@codegouvfr/react-dsfr/Button";
import Badge from "@codegouvfr/react-dsfr/Badge";

import CopyToClipBoard from "@/components/copy-to-clipboard";
import { ClientApiDepotType } from "types/api-depot";
import { PartenaireDeLaChartType } from "types/partenaire-de-la-charte";

interface ClientHeaderProps {
client: ClientApiDepotType;
partenaire: PartenaireDeLaChartType;
}

const ClientHeader = ({ client, partenaire }: ClientHeaderProps) => (
<div className="fr-py-4v">
<h1 className="fr-m-1v">Client</h1>
<div className="fr-container fr-py-4v">
<div className="fr-grid-row fr-grid-row--gutters">
<div className="fr-col-10">
<h2>{client.nom}</h2>
<CopyToClipBoard text={client._id} title="Id" />
<CopyToClipBoard text={client.token} title="Token" />

{partenaire ? (
<>
<h3>Partenaire de la charte</h3>
<Link
legacyBehavior
passHref
href={{
pathname: `/partenaires-de-la-charte/${partenaire._id}`,
}}
>
<Button priority="secondary">{partenaire.name}</Button>
</Link>
</>
) : (
<Badge severity="warning">Non partenaire</Badge>
)}
</div>
</div>
</div>
</div>
);

export default ClientHeader;
89 changes: 0 additions & 89 deletions components/api-depot/clients-list.js

This file was deleted.

Loading

0 comments on commit 4ebafc5

Please sign in to comment.