Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Attestation pas visibles pour admin et dreal sur la timeline #2214

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { IdentifiantProjet } from '@potentiel-domain/common';

export type TimelineProps = {
projectEventList: ProjectEventListDTO;
identifiantProjet: IdentifiantProjet.RawType
identifiantProjet: IdentifiantProjet.RawType;
};

type ItemProps =
Expand All @@ -67,7 +67,7 @@ export const Timeline = ({
events,
project: { status },
},
identifiantProjet
identifiantProjet,
}: TimelineProps) => {
const itemProps: ItemProps[] = [
extractDesignationItemProps(events, status, identifiantProjet),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
import React from 'react';
import { ItemDate, PastIcon, ItemTitle, ContentArea } from '.';
import { DesignationItemProps } from '../helpers/extractDesignationItemProps';
import { DownloadLink } from '../..';
import { afficherDate } from '../../../helpers';
import { Routes } from '@potentiel-applications/routes';
import { DownloadLink, DownloadLinkButton } from '../../UI';
import { DesignationItemProps } from '../helpers';

// TODO: revoir cette partie
// en trouvant la date de génération (date de notification) ?

export const DesignationItem = ({
certificate,
role,
date,
// date,
projectStatus,
}: DesignationItemProps) => (
<>
<PastIcon />
<ContentArea>
<ItemDate date={date} />
<ItemTitle title="Notification des résultats" />
{certificate ? (
<Certificate {...{ certificate, role, projectStatus }} />
) : (
role === 'porteur-projet' && <span>Votre attestation sera disponible sous 24h</span>
)}
</ContentArea>
</>
);
identifiantProjet,
}: DesignationItemProps) => {
return (
<>
<PastIcon />
<ContentArea>
{/* <ItemDate date={date} /> */}
<ItemTitle title="Notification des résultats" />
<Attestation projectStatus={projectStatus} identifiantProjet={identifiantProjet} />
</ContentArea>
</>
);
};

type CertificateProps = {
certificate: Exclude<DesignationItemProps['certificate'], undefined>;
// certificate?: Exclude<DesignationItemProps['certificate'], undefined>;
projectStatus: DesignationItemProps['projectStatus'];
identifiantProjet: DesignationItemProps['identifiantProjet'];
};

const Certificate = ({ certificate, projectStatus }: CertificateProps) => {
const { status } = certificate;
const Attestation = ({ projectStatus, identifiantProjet }: CertificateProps) => {
// const { status } = certificate;

// if (status === 'not-applicable') {
// return <span>Attestation non disponible pour cette période</span>;
// }

// const { url: fileUrl, date } = certificate;

if (status === 'not-applicable') {
return <span>Attestation non disponible pour cette période</span>;
}
// const urlTitle =
// projectStatus === 'Eliminé'
// ? status === 'generated'
// ? `avis de rejet (édité`
// : `avis de rejet (transmis`
// : status === 'generated'
// ? `attestation de désignation (éditée`
// : `attestation de désignation (transmise`;

const { url: fileUrl, date } = certificate;
const urlTitle = projectStatus === 'Eliminé' ? "l'avis de rejet" : "l'attestation de désignation";

const urlTitle =
projectStatus === 'Eliminé'
? status === 'generated'
? `avis de rejet (édité`
: `avis de rejet (transmis`
: status === 'generated'
? `attestation de désignation (éditée`
: `attestation de désignation (transmise`;
return (
<DownloadLink {...{ fileUrl }}>{`Télécharger l'${urlTitle} le ${afficherDate(
date,
)})`}</DownloadLink>
<DownloadLink
fileUrl={Routes.Candidature.téléchargerAttestation(identifiantProjet)}
className="m-auto"
>
{urlTitle}
{/* {`Télécharger l'${urlTitle}}) le ${afficherDate(date)})`} */}
</DownloadLink>
);
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { or } from '../../../../core/utils';
import { Routes } from '@potentiel-applications/routes';
import { IdentifiantProjet } from '@potentiel-domain/common';

// TODO: reprendre cette partie

export type DesignationItemProps = {
type: 'designation';
date: number;
Expand All @@ -24,6 +26,7 @@ export type DesignationItemProps = {
status: 'not-applicable';
}
| undefined;
identifiantProjet: string;
};

export const extractDesignationItemProps = (
Expand All @@ -46,6 +49,7 @@ export const extractDesignationItemProps = (
certificate: makeCertificateProps(certificateEvent, identifiantProjet),
role: certificateEvent.variant,
projectStatus: status,
identifiantProjet,
};
}

Expand All @@ -58,6 +62,7 @@ export const extractDesignationItemProps = (
: undefined,
role,
projectStatus: status,
identifiantProjet,
};
};

Expand Down