Commit d9f5cfc9a58cc948c71f5c6368d62347499d7dcc

Authored by hitier
1 parent 71b91c22

New agent page dynamically gets agent charge with d3js

app/main/routes.py
... ... @@ -66,7 +66,14 @@ def charge_add():
66 66  
67 67  
68 68 @bp.route('/charge/agent/<agent_id>')
69   -def charge_user(agent_id):
  69 +def charge_agent(agent_id):
70 70 resp = make_response(json.dumps(db_mgr.charges_by_agent(agent_id)))
71 71 resp.headers['Content-Type'] = 'application/json'
72 72 return resp
  73 +
  74 +@bp.route('/agent/<agent_id>')
  75 +def agent(agent_id):
  76 + agent = Agent.query.get(int(agent_id))
  77 + return render_template('agent.html',
  78 + agent=agent,
  79 + subtitle="Fiche agent: {} {}".format(agent.firstname, agent.secondname))
... ...
app/main/templates/agent.html 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +{% extends "base_page.html" %}
  2 +{% block content %}
  3 +{{agent.firstname}}
  4 +<div id="charge_div"></div>
  5 +<svg id="charge"></svg>
  6 +{% endblock %}