Skip to content

Commit

Permalink
fiche-action/participation-citoyenne: Save slug in BDD
Browse files Browse the repository at this point in the history
  • Loading branch information
farnoux committed Nov 27, 2024
1 parent 64b618c commit 5c29be4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { FicheAction } from '@tet/api/plan-actions';
import { Button } from '@tet/ui';
import { Button, getOptionLabel } from '@tet/ui';
import classNames from 'classnames';
import { useState } from 'react';
import { ficheActionParticipationOptions } from '../../../../../../ui/dropdownLists/listesStatiques';
import EmptyCard from '../EmptyCard';
import ListeActeurs from './ListeActeurs';
import ModaleActeurs from './ModaleActeurs';
import CiblePicto from './PictosActeurs/CiblePicto';
import CitoyenPicto from './PictosActeurs/CitoyenPicto';
import EluPicto from './PictosActeurs/EluPicto';
import EmptyActeursPicto from './PictosActeurs/EmptyActeursPicto';
import PartenairePicto from './PictosActeurs/PartenairePicto';
import PersonnePilotePicto from './PictosActeurs/PersonnePilotePicto';
import ServicePilotePicto from './PictosActeurs/ServicePilotePicto';
import StructurePilotePicto from './PictosActeurs/StructurePilotePicto';
import CitoyenPicto from './PictosActeurs/CitoyenPicto';

type FicheActionActeursProps = {
isReadonly: boolean;
Expand Down Expand Up @@ -119,7 +120,12 @@ const FicheActionActeurs = ({
titre="Participation citoyenne"
liste={
participationCitoyenneType
? [participationCitoyenneType as string]
? [
getOptionLabel(
participationCitoyenneType,
ficheActionParticipationOptions
) as string,
]
: undefined
}
comment={participationCitoyenne ?? undefined}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
Card,
List,
ListElement,
Paragraph,
Stack,
Title,
} from 'ui/export-pdf/components';
import { FicheActionPdfProps } from './FicheActionPdf';
import { getOptionLabel } from '@tet/ui';
import {
CiblePicto,
CitoyenPicto,
Expand All @@ -16,6 +8,16 @@ import {
ServicePilotePicto,
StructurePilotePicto,
} from 'ui/export-pdf/assets/picto';
import {
Card,
List,
ListElement,
Paragraph,
Stack,
Title,
} from 'ui/export-pdf/components';
import { ficheActionParticipationOptions } from '../../../../../../ui/dropdownLists/listesStatiques';
import { FicheActionPdfProps } from './FicheActionPdf';

type ListeActeursProps = {
titre: string;
Expand Down Expand Up @@ -106,7 +108,12 @@ const Acteurs = ({ fiche }: FicheActionPdfProps) => {
titre="Participation citoyenne"
liste={
participationCitoyenneType
? [participationCitoyenneType as string]
? [
getOptionLabel(
participationCitoyenneType,
ficheActionParticipationOptions
) as string,
]
: undefined
}
comment={participationCitoyenne ?? undefined}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Select, SelectFilter, SelectMultipleProps } from '@tet/ui';
import { ficheActionParticipationOptions } from '../../listesStatiques';
import { ParticipationCitoyenne } from '@tet/api/plan-actions';
import { Select, SelectMultipleProps } from '@tet/ui';
import { ficheActionParticipationOptions } from '../../listesStatiques';

type ParticipationCitoyenneDropdownProps = Omit<
SelectMultipleProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Statut, ParticipationCitoyenne } from '@tet/api/plan-actions';
import { ParticipationCitoyenne, Statut } from '@tet/api/plan-actions';
import { ModifiedSince } from '@tet/api/plan-actions/fiche-resumes.list/domain/fetch-options.schema';
import {
TFicheActionCibles,
Expand Down Expand Up @@ -109,11 +109,11 @@ export const ficheActionEcheanceOptions: Options<TFicheActionEcheances> = [
export const ficheActionParticipationOptions: Options<ParticipationCitoyenne> =
[
{
value: 'Pas de participation citoyenne',
value: 'pas-de-participation',
label: 'Pas de participation citoyenne',
},
{ value: 'Information', label: 'Information' },
{ value: 'Consultation', label: 'Consultation' },
{ value: 'Concertation', label: 'Concertation' },
{ value: 'Co-construction', label: 'Co-construction' },
{ value: 'information', label: 'Information' },
{ value: 'consultation', label: 'Consultation' },
{ value: 'concertation', label: 'Concertation' },
{ value: 'co-construction', label: 'Co-construction' },
];
10 changes: 5 additions & 5 deletions backend/src/fiches/models/fiche-action.table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ export const ficheActionNiveauxPrioriteEnum = pgEnum(
);

export const ficheActionParticipationCitoyenneTypeEnumValues = [
'Pas de participation citoyenne',
'Information',
'Consultation',
'Concertation',
'Co-construction',
'pas-de-participation',
'information',
'consultation',
'concertation',
'co-construction',
] as const;

export const ficheActionTable = pgTable('fiche_action', {
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/plan-actions/domain/fiche-action.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export const cibleSchema = z.enum([
export type Cible = z.infer<typeof cibleSchema>;

export const participationCitoyenneTypeSchema = z.enum([
'Pas de participation citoyenne',
'Information',
'Consultation',
'Concertation',
'Co-construction',
'pas-de-participation',
'information',
'consultation',
'concertation',
'co-construction',
]);

export type ParticipationCitoyenne = z.infer<
Expand Down

0 comments on commit 5c29be4

Please sign in to comment.