Ajout d'une arborescence de departements #66
This commit is contained in:
@@ -254,7 +254,8 @@ summary > h3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CSS for the /a-propos page Layout and Table of Contents */
|
/* CSS for the /a-propos page Layout and Table of Contents
|
||||||
|
Généré par Gemini 3.0 Pro */
|
||||||
|
|
||||||
.a-propos-container {
|
.a-propos-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -122,6 +122,14 @@ Rien d’exceptionnel, je respecte simplement la loi, qui dit que certains outil
|
|||||||
|
|
||||||
J’utilise pour cela [Matomo](https://matomo.org/), un outil [libre](https://matomo.org/free-software/), paramétré pour être en conformité avec [la recommandation « Cookies »](https://www.cnil.fr/fr/solutions-pour-les-cookies-de-mesure-daudience) de la CNIL. Cela signifie que votre adresse IP, par exemple, est anonymisée avant d’être enregistrée. Il m’est donc impossible d’associer vos visites sur ce site à votre personne."""
|
J’utilise pour cela [Matomo](https://matomo.org/), un outil [libre](https://matomo.org/free-software/), paramétré pour être en conformité avec [la recommandation « Cookies »](https://www.cnil.fr/fr/solutions-pour-les-cookies-de-mesure-daudience) de la CNIL. Cela signifie que votre adresse IP, par exemple, est anonymisée avant d’être enregistrée. Il m’est donc impossible d’associer vos visites sur ce site à votre personne."""
|
||||||
),
|
),
|
||||||
|
html.H4(
|
||||||
|
"Liste des marchés par département", id="liste_marches"
|
||||||
|
),
|
||||||
|
dcc.Markdown(
|
||||||
|
"""
|
||||||
|
- [Marchés par département](/departements)
|
||||||
|
"""
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
# Table of Contents Column
|
# Table of Contents Column
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import polars as pl
|
||||||
|
from dash import Input, Output, callback, dcc, html, register_page
|
||||||
|
|
||||||
|
from src.utils import departements, df_acheteurs_departement
|
||||||
|
|
||||||
|
name = "Département"
|
||||||
|
|
||||||
|
|
||||||
|
def get_title(code):
|
||||||
|
return f"Marchés publics de {departements[code]['departement']} | decp.info"
|
||||||
|
|
||||||
|
|
||||||
|
def get_description(code):
|
||||||
|
return f"Marchés publics passés dans le département {departements[code]['departement']} | decp.info"
|
||||||
|
|
||||||
|
|
||||||
|
register_page(
|
||||||
|
__name__,
|
||||||
|
path_template="/departements/<code>",
|
||||||
|
title=get_title,
|
||||||
|
description=get_description,
|
||||||
|
order=50,
|
||||||
|
name=name,
|
||||||
|
)
|
||||||
|
|
||||||
|
layout = html.Div(
|
||||||
|
[
|
||||||
|
dcc.Location(id="departement_url", refresh="callback-nav"),
|
||||||
|
html.Div(id="departement_marches"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@callback(
|
||||||
|
Output(component_id="departement_marches", component_property="children"),
|
||||||
|
Input(component_id="departement_url", component_property="pathname"),
|
||||||
|
)
|
||||||
|
def departement_marches(url):
|
||||||
|
departement = url.split("/")[-1]
|
||||||
|
acheteurs = []
|
||||||
|
df = df_acheteurs_departement.filter(
|
||||||
|
pl.col("acheteur_departement_code") == departement
|
||||||
|
)
|
||||||
|
for row in df.iter_rows(named=True):
|
||||||
|
p = html.P(
|
||||||
|
[
|
||||||
|
dcc.Link(
|
||||||
|
row["acheteur_nom"],
|
||||||
|
href=url + f"/{row['acheteur_id']}",
|
||||||
|
title=f"Marchés publics de {row['acheteur_nom']}",
|
||||||
|
),
|
||||||
|
" ",
|
||||||
|
dcc.Link(
|
||||||
|
"(page dédiée)",
|
||||||
|
href=f"/acheteurs/{row['acheteur_id']}",
|
||||||
|
title=f"Page dédiée aux marchés publics de {row['acheteur_nom']}",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
acheteurs.append(p)
|
||||||
|
return acheteurs
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from dash import dcc, html, register_page
|
||||||
|
|
||||||
|
from src.utils import departements
|
||||||
|
|
||||||
|
name = "Départements"
|
||||||
|
|
||||||
|
register_page(
|
||||||
|
__name__,
|
||||||
|
path="/departements",
|
||||||
|
title="Marchés par département | decp.info",
|
||||||
|
name="Départements",
|
||||||
|
description="Tous les marchés publics, classés par départements",
|
||||||
|
)
|
||||||
|
|
||||||
|
layout = html.Div(
|
||||||
|
[
|
||||||
|
html.P(dcc.Link(d["departement"], href=f"/departements/{k}"))
|
||||||
|
for k, d in departements.items()
|
||||||
|
]
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user