Feat: Start display summary
This commit is contained in:
parent
9c19e2ac56
commit
b737612adb
@ -60,7 +60,7 @@ layout = html.Div(
|
||||
children=[
|
||||
"Nom de l'évaluation",
|
||||
dcc.Input(
|
||||
id="name",
|
||||
id="exam_name",
|
||||
type="text",
|
||||
placeholder="Nom de l'évaluation",
|
||||
),
|
||||
@ -70,7 +70,7 @@ layout = html.Div(
|
||||
children=[
|
||||
"Date",
|
||||
dcc.DatePickerSingle(
|
||||
id="my-date-picker-single",
|
||||
id="date",
|
||||
date=date.today(),
|
||||
**get_current_year_limit(),
|
||||
),
|
||||
@ -101,7 +101,7 @@ layout = html.Div(
|
||||
className="add-exercise",
|
||||
),
|
||||
html.Div(
|
||||
id="output",
|
||||
id="summary",
|
||||
),
|
||||
]
|
||||
),
|
||||
@ -116,6 +116,8 @@ layout = html.Div(
|
||||
dash.dependencies.State("exercises", "children"),
|
||||
)
|
||||
def add_exercise(n_clicks, children):
|
||||
if n_clicks is None:
|
||||
return children
|
||||
element_table = pd.DataFrame(columns=NO_ST_COLUMNS)
|
||||
element_table = element_table.append(pd.Series(name=0))
|
||||
new_exercise = html.Div(
|
||||
@ -130,7 +132,7 @@ def add_exercise(n_clicks, children):
|
||||
),
|
||||
html.Button(
|
||||
"X",
|
||||
id=f"delete-exercise-{n_clicks}",
|
||||
id={"type": "exercice", "index": str(n_clicks)},
|
||||
className="delete-exercise",
|
||||
),
|
||||
],
|
||||
@ -152,10 +154,13 @@ def add_exercise(n_clicks, children):
|
||||
],
|
||||
data=element_table.to_dict("records"),
|
||||
editable=True,
|
||||
row_deletable=True,
|
||||
dropdown={
|
||||
"Competence": {"options": [
|
||||
{'label': i, 'value': i} for i in config["competences"]
|
||||
]},
|
||||
"Competence": {
|
||||
"options": [
|
||||
{"label": i, "value": i} for i in config["competences"]
|
||||
]
|
||||
},
|
||||
},
|
||||
style_cell={
|
||||
"whiteSpace": "normal",
|
||||
@ -169,6 +174,7 @@ def add_exercise(n_clicks, children):
|
||||
),
|
||||
],
|
||||
className="exercise",
|
||||
id=f"exercise-{n_clicks}",
|
||||
)
|
||||
children.append(new_exercise)
|
||||
return children
|
||||
@ -197,10 +203,22 @@ def add_element(n_clicks, elements):
|
||||
|
||||
|
||||
@app.callback(
|
||||
dash.dependencies.Output("output", "children"),
|
||||
dash.dependencies.Input(
|
||||
{"type": "exercice", "index": dash.dependencies.ALL}, "value"
|
||||
),
|
||||
dash.dependencies.Output("summary", "children"),
|
||||
[
|
||||
dash.dependencies.Input("tribe", "value"),
|
||||
dash.dependencies.Input("exam_name", "value"),
|
||||
dash.dependencies.Input("date", "date"),
|
||||
dash.dependencies.Input("term", "value"),
|
||||
dash.dependencies.Input(
|
||||
{"type": "exercice", "index": dash.dependencies.ALL}, "value"
|
||||
),
|
||||
],
|
||||
)
|
||||
def display_output(exercices):
|
||||
return html.Div([html.P(f"{value}") for (i, value) in enumerate(exercices)])
|
||||
def display_summary(tribe, exam_name, date, term, exercices):
|
||||
return html.Section(
|
||||
children=[
|
||||
html.H1(f"{exam_name} pour les {tribe}"),
|
||||
html.P(f"Fait le {date} (Trimestre {term})"),
|
||||
]
|
||||
+ [html.P(f"{value}") for (i, value) in enumerate(exercices)]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user