1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-21 23:24:18 +00:00

Add Impiegato details page

This commit is contained in:
Lorenzo 2017-09-11 15:42:28 +02:00
parent ae2369e658
commit 4970653e44
3 changed files with 48 additions and 2 deletions

View file

@ -410,12 +410,20 @@ def page_disp_list():
def page_details_host(did): def page_details_host(did):
if 'username' not in session: if 'username' not in session:
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
disp = Dispositivo.query.filter_by(did=did).first() disp = Dispositivo.query.filter_by(did=did).first_or_404()
accessi = Accesso.query.filter_by(did=did).all() accessi = Accesso.query.filter_by(did=did).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("dispositivo/details.htm", css=css, disp=disp, accessi=accessi, type="disp", user=session["username"]) return render_template("dispositivo/details.htm", css=css, disp=disp, accessi=accessi, type="disp", user=session["username"])
@app.route('/imp_details/<int:iid>')
def page_details_imp(iid):
if 'username' not in session:
return redirect(url_for('page_login'))
impiegato = Impiegato.query.filter_by(iid=iid).first()
css = url_for("static", filename="style.css")
return render_template("impiegato/details.htm", css=css, imp=impiegato, type="imp",user=session["username"])
if __name__ == "__main__": if __name__ == "__main__":
# db.create_all() # db.create_all()
# p = b"admin" # p = b"admin"

View file

@ -43,7 +43,7 @@
</h4> </h4>
<div class="list-group-item-text"> <div class="list-group-item-text">
{% for accesso in accessi %} {% for accesso in accessi %}
<a href="/imp_show/{{ accesso.iid }}">{{ accesso.impiegato.nomeimpiegato }}</a><br> <a href="/imp_details/{{ accesso.iid }}">{{ accesso.impiegato.nomeimpiegato }}</a><br>
{% endfor %} {% endfor %}
</div> </div>
</li> </li>

View file

@ -0,0 +1,38 @@
{% extends "base.htm" %}
{% block title %}Dettagli Impiegato{% endblock %}
{% block content %}
<h1>
Ispeziona Impiegato
</h1>
<ul class="list-group">
<li class="list-group-item">
<h4 class="list-group-item-heading">
Nome Impiegato
</h4>
<div class="list-group-item-text">
{{ imp.nomeimpiegato }}
</div>
</li>
<li class="list-group-item">
<h4 class="list-group-item-heading">
Username
</h4>
<div class="list-group-item-text">
{{ imp.username }}
</div>
</li>
<li class="list-group-item">
<h4 class="list-group-item-heading">
Password
</h4>
<div class="list-group-item-text">
<code>{{ imp.passwd }}</code>
</div>
</li>
</ul>
<a href="/imp_show/{{ imp.iid }}">
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Modifica
</button>
</a>
{% endblock %}