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

Intégration de l'Espace collaboratif #491

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ed9b47e
feat: wrap espaceco Communities avec AppLayout
ocruze Jul 8, 2024
040a487
feat: mise en place du premier formulaire (description) en mode édition
pprev94 Jul 10, 2024
490e455
feat: mise en palce de l'outil de recherche
pprev94 Jul 12, 2024
e466d7c
feat: maquette => edition guichet (description et zoom) #324 #327
pprev94 Jul 23, 2024
53fd93c
ajout de quelques élements à partir des maquettes (grids, ...)
pprev94 Jul 26, 2024
ce1bbba
feat: gestion des documents (début) et des grids
pprev94 Jul 29, 2024
3c09eb9
ajout du path root dans l'uri des images
pprev94 Jul 29, 2024
29e9bb1
maquette édition d'un guichet suite
pprev94 Jul 30, 2024
e3fd70c
feat: Mise en place de l'onglet Signalements des guichets (début)
pprev94 Sep 13, 2024
21b5fb5
feat: Mise en place de l'ajout d'un attribut
pprev94 Sep 17, 2024
254786d
feat: début d'ajout des statuts des signalements
pprev94 Sep 17, 2024
84d5d7d
feat: Toujours la modification d'une communauté espace co
pprev94 Oct 7, 2024
c0922c9
feat: Ajout de la gestion des membres pour un guichet (début)
pprev94 Oct 9, 2024
4721505
feat: liens provisoires des guichets vers l'espace collaboratif
pprev94 Oct 15, 2024
4749caa
Edition d'un guichet suite ...
pprev94 Oct 21, 2024
594310c
feat: ajout de email planner et continuation edition community
pprev94 Oct 29, 2024
14fbd05
feat: Gestion des documents, emailplanners ...
pprev94 Nov 19, 2024
51f80a7
feat: Modification des email planners
pprev94 Nov 19, 2024
bb5bc49
gestion des membres, invitation, emailplanners ...
pprev94 Nov 26, 2024
618f4bb
feat: CGU ref #563
pprev94 Nov 27, 2024
d3b50b2
Mise à jour provisoire suite échanges avec Tony
pprev94 Dec 6, 2024
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
6 changes: 6 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"request": "launch",
"port": 9003
},
{
"name": "Listen for Xdebug 2 (Legacy)",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Listen for Xdebug (in docker)",
"type": "php",
Expand Down
Binary file added Topic_category_cartesgouv.xlsx
Binary file not shown.
122 changes: 121 additions & 1 deletion assets/@types/app_espaceco.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,129 @@
import { BasicRecipients, EmailPlannerDTO, GridDTO, ReportStatusesDTO, SharedGeorem, SharedThemesDTO, ThemeDTO, UserDTO } from "./espaceco";

export type GetResponse<T> = {
content: T[];
totalPages: number;
previousPage: number;
nextPage: number;
};

export const arrCommunityListFilters = ["public", "iam_member", "affiliation"];
export const arrCommunityListFilters = ["public", "iam_member", "affiliation"] as const;
export type CommunityListFilter = (typeof arrCommunityListFilters)[number];

export type Address = {
country: string;
city: string;
x: number;
y: number;
zipcode: string;
street: string;
classification: number;
kind: string;
fulltext: string;
metropole: boolean;
};

export type Poi = {
country: string;
city: string;
x: number;
y: number;
zipcode: string;
zipcodes: string[];
poiType: string[];
street: string;
classification: number;
kind: string;
fulltext: string;
metropole: boolean;
};

export type SearchResult = {
status: string;
results: (Address | Poi)[];
};

export type SearchGridFilters = {
searchBy?: ("name" | "title")[];
fields?: ("name" | "title" | "type" | "extent" | "deleted")[];
adm?: boolean;
};

export type UserType = {
user_id: number;
username: string;
firstname: string | null;
surname: string | null;
};

export type Role = "pending" | "member" | "admin" | "invited";
export type CommunityMember = UserType & {
grids: GridDTO[];
role: Role;
active: boolean;
date: string;
};

export type CommunityMemberDetailed = {
user_id: number;
community_name: string;
community_id: number;
grids: GridDTO[];
role: Role;
active: boolean;
date: string;
};

export type Profile = {
community_id: number;
themes: ThemeDTO[];
};

export type UserMe = {
id: number;
email: string;
username: string;
surname: string | null;
description: string | null;
administrator: boolean;
profile: Profile;
shared_themes: SharedThemesDTO[];
communities_member: CommunityMemberDetailed[];
};

/* FORMULAIRES */
export type ReportFormType = {
attributes: ThemeDTO[];
report_statuses: ReportStatusesDTO;
email_planners?: EmailPlannerDTO[];
shared_themes?: SharedThemesDTO[];
shared_georem: SharedGeorem;
all_members_can_valid: boolean;
};

export type DescriptionFormType = {
name: string;
description?: string;
keywords?: string[];
};

/* email planners */
export const BasicRecipientsArray: string[] = [...BasicRecipients] as string[];

export const EmailPlannerTypes = ["basic", "personal"] as const;
export type EmailPlannerType = (typeof EmailPlannerTypes)[number];

export type EmailPlannerAddType = Omit<EmailPlannerDTO, "id">;

export type EmailPlannerFormType = Omit<EmailPlannerDTO, "id" | "recipients" | "event" | "cancel_event" | "themes" | "condition"> & {
id?: number;
event: string;
cancel_event: string;
recipients: string[];
statuses?: string[];
themes?: string[];
};

export const isUser = (v: UserDTO | string): v is UserDTO => {
return (v as UserDTO).username !== undefined;
};
205 changes: 198 additions & 7 deletions assets/@types/espaceco.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,220 @@
import statuses from "../data/report_statuses.json";

export interface ConstraintsDTO {
minLength?: number;
maxLength?: number;
minValue?: string;
maxValue?: string;
pattern?: string;
}

export const AttributeTypes = ["text", "integer", "double", "checkbox", "list", "date"];

export type AttributeType = (typeof AttributeTypes)[number];
export type AttributeDTO = {
name: string;
type: AttributeType;
default?: string | null;
mandatory?: boolean;
multiple?: boolean;
values?: string[] | null;
help?: string | null;
title?: string;
input_constraints?: ConstraintsDTO | null;
json_schema?: object | null;
required?: boolean;
condition_field?: string;
};

export interface ThemeDTO {
theme: string;
database?: string;
table?: string;
attributes: AttributeDTO[];
help?: string;
global?: boolean;
}

export type UserSharedThemesDTO = {
community_id: number;
community_name: string;
themes: ThemeDTO[];
};

export type SharedThemesDTO = {
community_id: number;
community_name: string;
themes: string[];
};

export type ReportStatusesType = keyof typeof statuses;

export type ReportStatusParams = {
title: string;
description?: string;
active: boolean;
};
export type ReportStatusesDTO = Record<string, ReportStatusParams>;

/* Email planners */
export const TriggerEvents = ["georem_created", "georem_status_changed"] as const;
export type TriggerEventType = (typeof TriggerEvents)[number];

export const CancelEvents = ["georem_status_changed", "none"] as const;
export type CancelEventType = (typeof CancelEvents)[number];

export const BasicRecipients = ["Auteur", "Gestionnaire", "Majec"] as const;
export type RecipientType = (typeof BasicRecipients)[number];

export type EmailPlannerDTO = {
id: number;
subject: string;
body: string;
delay: number;
repeat: boolean;
recipients: string[];
event: TriggerEventType;
cancel_event: CancelEventType;
condition: { status: string[] } | null;
themes: string[];
};

const SharedGeoremOptions = ["all", "restrained", "personal"];
export type SharedGeorem = (typeof SharedGeoremOptions)[number];
export interface CommunityResponseDTO {
id: number;
description: string | null;
detailed_description?: string | null;
name: string;
active: boolean;
listed: boolean;
shared_georem: "all" | "restrained" | "personal";
shared_extractions: boolean;
email: string | null;
attributes: object[];
attributes: ThemeDTO[];
default_comment: string | null;
position: string;
position: string | null;
zoom: number;
zoom_min: number | null;
zoom_max: number | null;
extent: number[] | null;
all_members_can_valid: boolean;
open_without_affiliation: boolean;
open_with_email?: string[];
offline_allowed: boolean;
shared_extractions: boolean;
/** @format date-time */
creation: string;
grids: Grids[];
logo_url: string;
grids: GridDTO[];
logo_url: string | null;
keywords?: string[];
documents?: DocumentDTO[];
report_statuses?: ReportStatusesDTO;
shared_themes?: SharedThemesDTO[];
}

export interface UserDTO {
id: number;
username: string;
firstname?: string;
surname?: string;
}

export interface DocumentDTO {
id: number;
title: string;
description: string | null;
short_fileName: string;
mime_type: string;
size: number | null;
width: number | null;
height: number | null;
date: string;
geometry: string | null;
uri: string | null;
download_uri: string;
}

export interface Grids {
export interface GridDTO {
name: string;
title: string;
type: string;
type: GridType;
deleted: boolean;
extent: number[];
}

export interface GridType {
name: string;
title: string;
}
export interface CommunityPatchDTO extends Partial<Omit<CommunityResponseDTO, "logo_url">> {
logo: File | null;
}

export interface PermissionResponseDTO {
id: number;
database: number;
table: number | null;
column: number | null;
level: "NONE" | "VIEW" | "EXPORT" | "EDIT" | "ADMIN";
}

export interface ColumnDTO {
table_id: number;
crs: string | null;
enum: object | string[] | null;
default_value: string | null;
read_only: boolean;
id: number;
type: string;
target_table: string | null;
target_entity: string | null;
name: string;
short_name: string;
title: string;
description: string | null;
min_length: number | null;
max_length: number | null;
nullable: boolean;
unique: boolean;
srid: number | null;
position: number;
min_value: string | null;
max_value: string | null;
pattern: string | null;
is3d: boolean;
constraint: object | null;
condition_field: string | null;
computed: boolean;
automatic: boolean;
custom_id: boolean;
formula: string | null;
json_schema: object | null;
jeux_attributs: object | null;
queryable: boolean;
required: boolean;
mime_types: string | null;
}

export interface TableResponseDTO {
database_id: number;
database: string;
database_versioning: boolean;
full_name: string;
id_name: string;
geometry_name: string;
min_zoom_level: number | null;
max_zoom_level: number | null;
tile_zoom_level: number | null;
read_only: boolean;
id: number;
name: string;
title: string;
description: string | null;
thematic_ids: string[] | null;
position: number;
wfs: string;
wfs_transactions: string;
columns: ColumnDTO[];
}

export { SharedGeoremOptions };
7 changes: 4 additions & 3 deletions assets/components/Input/AutocompleteSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { fr } from "@codegouvfr/react-dsfr";
import MuiDsfrThemeProvider from "@codegouvfr/react-dsfr/mui";
import { Autocomplete, AutocompleteFreeSoloValueMapping, AutocompleteValue, CreateFilterOptionsConfig, TextField, createFilterOptions } from "@mui/material";
import { CSSProperties, useId } from "react";
import { CSSProperties, ReactNode, useId } from "react";
import { ControllerRenderProps } from "react-hook-form";
import { symToStr } from "tsafe/symToStr";

import "../../../assets/sass/components/autocomplete.scss";

interface AutocompleteSelectProps<T> {
id?: string;
label: string;
hintText: string;
hintText?: ReactNode;
state?: "default" | "error" | "success";
stateRelatedMessage?: string;
defaultValue?: T[];
Expand Down Expand Up @@ -76,7 +78,6 @@ const AutocompleteSelect = <T,>(props: AutocompleteSelectProps<T>) => {
{label}
{hintText && <span className="fr-hint-text">{hintText}</span>}
</label>

<Autocomplete
{...controllerField}
id={inputId}
Expand Down
Loading
Loading