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

Remove imp_add page

This commit is contained in:
Steffo 2017-09-18 16:26:17 +02:00 committed by Stefano Pigozzi
parent b121e2a248
commit 4ece310bc0
3 changed files with 12 additions and 27 deletions

View file

@ -392,7 +392,7 @@ def page_imp_add():
return abort(403)
if request.method == 'GET':
servizi = Servizio.query.join(Ente).order_by(Ente.nomeente, Servizio.nomeservizio).all()
return render_template("impiegato/add.htm", servizi=servizi, pagetype="imp", user=session.get("username"))
return render_template("impiegato/show.htm", action="add", servizi=servizi, pagetype="imp", user=session.get("username"))
else:
nuovoimp = Impiegato(request.form['sid'], request.form['nomeimpiegato'], request.form['username'],
request.form['passwd'],)
@ -438,7 +438,7 @@ def page_imp_show(iid):
if request.method == "GET":
imp = Impiegato.query.get_or_404(iid)
servizi = Servizio.query.all()
return render_template("impiegato/show.htm", imp=imp, servizi=servizi, user=session.get("username"))
return render_template("impiegato/show.htm", action="show", imp=imp, servizi=servizi, user=session.get("username"))
else:
imp = Impiegato.query.get_or_404(iid)
imp.sid = request.form["sid"]

View file

@ -1,19 +0,0 @@
{% extends "base.htm" %}
{% block title %}Aggiungi impiegato • estus{% endblock %}
{% block content %}
<h1>
Aggiungi nuovo impiegato
</h1>
<form class="form-inline" action="/imp_add" method="post">
<select class="form-control" name="sid">
{% for servizio in servizi %}
<option value="{{ servizio.sid }}">{{ servizio.ente.nomebreveente }}
- {{ servizio.nomeservizio }}</option>
{% endfor %}
</select>
<input class="form-control" type="text" placeholder="Nome e cognome" name="nomeimpiegato">
<input class="form-control" type="text" placeholder="Nome utente" name="username">
<input class="form-control" type="text" placeholder="Password" name="passwd">
<input class="btn btn-primary" type="submit">
</form>
{% endblock %}

View file

@ -2,20 +2,24 @@
{% block title %}Modifica impiegato • estus{% endblock %}
{% block content %}
<h1>
{% if action == "add" %}
Crea impiegato
{% elif action == "show" %}
Modifica impiegato
{% endif %}
</h1>
<form class="form-inline" action="/imp_show/{{ imp.iid }}" method="post">
<form class="form-inline" {% if imp %}action="/imp_show/{{ imp.iid }}"{% endif %} method="post">
<select class="form-control" name="sid">
{% for servizio in servizi %}
<option value="{{ servizio.sid }}"
{% if imp.sid == servizio.sid %}selected="selected"{% endif %}>{{ servizio.ente.nomebreveente }}
{% if imp and imp.sid == servizio.sid %}selected="selected"{% endif %}>{{ servizio.ente.nomebreveente }}
- {{ servizio.nomeservizio }}</option>
{% endfor %}
</select>
<input class="form-control" type="text" placeholder="Nome e cognome" name="nomeimpiegato"
value="{{ imp.nomeimpiegato }}">
<input class="form-control" type="text" placeholder="Nome utente" name="username" value="{{ imp.username }}">
<input class="form-control" type="text" placeholder="Password" name="passwd" value="{{ imp.passwd }}">
{% if imp %}value="{{ imp.nomeimpiegato }}{% endif %}">
<input class="form-control" type="text" placeholder="Nome utente" name="username" {% if imp %}value="{{ imp.username }}"{% endif %}>
<input class="form-control" type="text" placeholder="Password" name="passwd" {% if imp %}value="{{ imp.passwd }}"{% endif %}>
<input class="btn btn-primary" type="submit">
</form>
{% endblock %}