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