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

Ora vanno un po' di cose in più.

Per la precisione:
enti
servizi
impiegati
This commit is contained in:
Steffo 2017-02-01 10:37:53 +01:00
parent ab12a2ca55
commit 1e761cdbf4
17 changed files with 401 additions and 137 deletions

View file

@ -23,8 +23,8 @@ class User(db.Model):
# Ente (Unione Terre di Castelli, Comune di Vignola...) # Ente (Unione Terre di Castelli, Comune di Vignola...)
class Ente(db.Model): class Ente(db.Model):
eid = db.Column(db.Integer, primary_key=True) eid = db.Column(db.Integer, primary_key=True)
nome = db.Column(db.String(64)) nomeente = db.Column(db.String(64))
nomebreve = db.Column(db.String(16)) nomebreveente = db.Column(db.String(16))
servizi = db.relationship("Servizio", backref='ente', lazy='dynamic') servizi = db.relationship("Servizio", backref='ente', lazy='dynamic')
def __init__(self, nome, nomebreve): def __init__(self, nome, nomebreve):
@ -39,7 +39,7 @@ class Ente(db.Model):
class Servizio(db.Model): class Servizio(db.Model):
sid = db.Column(db.Integer, primary_key=True) sid = db.Column(db.Integer, primary_key=True)
eid = db.Column(db.Integer, db.ForeignKey('ente.eid')) eid = db.Column(db.Integer, db.ForeignKey('ente.eid'))
nome = db.Column(db.String(128)) nomeservizio = db.Column(db.String(128))
impiegati = db.relationship("Impiegato", backref='servizio', lazy='dynamic') impiegati = db.relationship("Impiegato", backref='servizio', lazy='dynamic')
def __init__(self, eid, nome): def __init__(self, eid, nome):
@ -53,7 +53,7 @@ class Servizio(db.Model):
class Impiegato(db.Model): class Impiegato(db.Model):
iid = db.Column(db.Integer, primary_key=True) iid = db.Column(db.Integer, primary_key=True)
sid = db.Column(db.Integer, db.ForeignKey('servizio.sid')) sid = db.Column(db.Integer, db.ForeignKey('servizio.sid'))
nome = db.Column(db.String(128)) nomeimpiegato = db.Column(db.String(128))
username = db.Column(db.String(32), unique=True) username = db.Column(db.String(32), unique=True)
passwd = db.Column(db.String(32)) passwd = db.Column(db.String(32))

167
server.py
View file

@ -1,8 +1,8 @@
from flask import Flask, render_template, request, url_for, session, redirect, jsonify from flask import Flask, session, url_for, redirect, request, render_template
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__) app = Flask(__name__)
app.secret_key = 'itsapepperonisecret' app.secret_key = "pepsecret"
# SQL # SQL
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
@ -24,48 +24,48 @@ class User(db.Model):
# Ente (Unione Terre di Castelli, Comune di Vignola...) # Ente (Unione Terre di Castelli, Comune di Vignola...)
class Ente(db.Model): class Ente(db.Model):
eid = db.Column(db.Integer, primary_key=True) eid = db.Column(db.Integer, primary_key=True)
nome = db.Column(db.String(64)) nomeente = db.Column(db.String(64))
nomebreve = db.Column(db.String(16)) nomebreveente = db.Column(db.String(16))
servizi = db.relationship("Servizio", backref='ente', lazy='dynamic') servizi = db.relationship("Servizio", backref='ente', lazy='dynamic')
def __init__(self, nome, nomebreve): def __init__(self, nomeente, nomebreveente):
self.nome = nome self.nomeente = nomeente
self.nomebreve = nomebreve self.nomebreveente = nomebreveente
def __repr__(self): def __repr__(self):
return "<Ente {}>".format(self.nomebreve) return "<Ente {}>".format(self.nomebreveente)
# Servizio di un ente # Servizio di un ente
class Servizio(db.Model): class Servizio(db.Model):
sid = db.Column(db.Integer, primary_key=True) sid = db.Column(db.Integer, primary_key=True)
eid = db.Column(db.Integer, db.ForeignKey('ente.eid')) eid = db.Column(db.Integer, db.ForeignKey('ente.eid'))
nome = db.Column(db.String(128)) nomeservizio = db.Column(db.String(128))
impiegati = db.relationship("Impiegato", backref='servizio', lazy='dynamic') impiegati = db.relationship("Impiegato", backref='servizio', lazy='dynamic')
def __init__(self, eid, nome): def __init__(self, eid, nomeservizio):
self.eid = eid self.eid = eid
self.nome = nome self.nomeservizio = nomeservizio
def __repr__(self): def __repr__(self):
return "<Servizio {}>".format(self.nome) return "<Servizio {}>".format(self.nomeservizio)
class Impiegato(db.Model): class Impiegato(db.Model):
iid = db.Column(db.Integer, primary_key=True) iid = db.Column(db.Integer, primary_key=True)
sid = db.Column(db.Integer, db.ForeignKey('servizio.sid')) sid = db.Column(db.Integer, db.ForeignKey('servizio.sid'))
nome = db.Column(db.String(128)) nomeimpiegato = db.Column(db.String(128))
username = db.Column(db.String(32), unique=True) username = db.Column(db.String(32), unique=True)
passwd = db.Column(db.String(32)) passwd = db.Column(db.String(32))
def __init__(self, sid, nome, username, passwd): def __init__(self, sid, nomeimpiegato, username, passwd):
self.sid = sid self.sid = sid
self.nome = nome self.nomeimpiegato = nomeimpiegato
self.username = username self.username = username
self.passwd = passwd self.passwd = passwd
def __repr__(self): def __repr__(self):
return "<Impiegato {}>".format(self.nome) return "<Impiegato {}>".format(self.nomeimpiegato)
# Funzioni del sito # Funzioni del sito
def login(username, password): def login(username, password):
@ -103,12 +103,10 @@ def page_ente_add():
if 'username' not in session: if 'username' not in session:
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
if request.method == 'GET': if request.method == 'GET':
# Visualizza la pagina di creazione ente
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("ente_add.html.j2", css=css) return render_template("ente/add.html.j2", css=css)
else: else:
# Crea un nuovo ente nuovoent = Ente(request.form['nomeente'], request.form['nomebreveente'])
nuovoent = Ente(request.form['nome'], request.form['nomebreve'])
db.session.add(nuovoent) db.session.add(nuovoent)
db.session.commit() db.session.commit()
return redirect(url_for('page_ente_list')) return redirect(url_for('page_ente_list'))
@ -118,6 +116,12 @@ def page_ente_del(eid):
if 'username' not in session: if 'username' not in session:
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
servizi = Servizio.query.filter_by(eid=ente.eid).all()
for serv in servizi:
impiegati = Impiegato.query.filter_by(sid=serv.sid).all()
for imp in impiegati:
db.session.delete(imp)
db.session.delete(serv)
db.session.delete(ente) db.session.delete(ente)
db.session.commit() db.session.commit()
return redirect(url_for('page_ente_list')) return redirect(url_for('page_ente_list'))
@ -128,7 +132,7 @@ def page_ente_list():
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
enti = Ente.query.all() enti = Ente.query.all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("ente_list.html.j2", css=css, enti=enti) return render_template("ente/list.html.j2", css=css, enti=enti)
@app.route('/ente_show/<int:eid>', methods=['GET', 'POST']) @app.route('/ente_show/<int:eid>', methods=['GET', 'POST'])
def page_ente_show(eid): def page_ente_show(eid):
@ -137,10 +141,125 @@ def page_ente_show(eid):
if request.method == "GET": if request.method == "GET":
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("ente_show.html.j2", css=css, ente=ente) return render_template("ente/show.html.j2", css=css, ente=ente)
else: else:
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
ente.nome = request.form["nome"] ente.nomeente = request.form["nomeente"]
ente.nomebreve = request.form["nomebreve"] ente.nomebreveente = request.form["nomebreveente"]
db.session.commit() db.session.commit()
return redirect(url_for('page_ente_list')) return redirect(url_for('page_ente_list'))
@app.route('/serv_add', methods=['GET', 'POST'])
def page_serv_add():
if 'username' not in session:
return redirect(url_for('page_login'))
if request.method == 'GET':
enti = Ente.query.all()
css = url_for("static", filename="style.css")
return render_template("servizio/add.html.j2", css=css, enti=enti)
else:
nuovoserv = Servizio(request.form['eid'], request.form['nomeservizio'])
db.session.add(nuovoserv)
db.session.commit()
return redirect(url_for('page_serv_list'))
@app.route('/serv_del/<int:sid>')
def page_serv_del(sid):
if 'username' not in session:
return redirect(url_for('page_login'))
serv = Servizio.query.get(sid)
impiegati = Impiegato.query.filter_by(sid=serv.sid).all()
for imp in impiegati:
db.session.delete(imp)
db.session.delete(serv)
db.session.commit()
return redirect(url_for('page_serv_list'))
@app.route('/serv_list')
def page_serv_list():
if 'username' not in session:
return redirect(url_for('page_login'))
serv = Servizio.query.join(Ente).all()
css = url_for("static", filename="style.css")
return render_template("servizio/list.html.j2", css=css, serv=serv)
@app.route('/serv_list/<int:eid>')
def page_serv_list_plus(eid):
if 'username' not in session:
return redirect(url_for('page_login'))
serv = Servizio.query.join(Ente).filter_by(eid=eid).all()
css = url_for("static", filename="style.css")
return render_template("servizio/list.html.j2", css=css, serv=serv)
@app.route('/serv_show/<int:sid>', methods=['GET', 'POST'])
def page_serv_show(sid):
if 'username' not in session:
return redirect(url_for('page_login'))
if request.method == "GET":
serv = Servizio.query.get(sid)
enti = Ente.query.all()
css = url_for("static", filename="style.css")
return render_template("servizio/show.html.j2", css=css, serv=serv, enti=enti)
else:
serv = Servizio.query.get(sid)
serv.eid = request.form["eid"]
serv.nomeservizio = request.form["nomeservizio"]
db.session.commit()
return redirect(url_for('page_serv_list'))
@app.route('/imp_add', methods=['GET', 'POST'])
def page_imp_add():
if 'username' not in session:
return redirect(url_for('page_login'))
if request.method == 'GET':
servizi = Servizio.query.all()
css = url_for("static", filename="style.css")
return render_template("impiegato/add.html.j2", css=css, servizi=servizi)
else:
nuovoimp = Impiegato(request.form['sid'], request.form['nomeimpiegato'], request.form['username'], request.form['passwd'],)
db.session.add(nuovoimp)
db.session.commit()
return redirect(url_for('page_imp_list'))
@app.route('/imp_del/<int:iid>')
def page_imp_del(iid):
if 'username' not in session:
return redirect(url_for('page_login'))
imp = Impiegato.query.get(iid)
db.session.delete(imp)
db.session.commit()
return redirect(url_for('page_imp_list'))
@app.route('/imp_list')
def page_imp_list():
if 'username' not in session:
return redirect(url_for('page_login'))
impiegati = Impiegato.query.join(Servizio).join(Ente).all()
css = url_for("static", filename="style.css")
return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati)
@app.route('/imp_list/<int:sid>')
def page_imp_list_plus(sid):
if 'username' not in session:
return redirect(url_for('page_login'))
impiegati = Impiegato.query.join(Servizio).filter_by(sid=sid).join(Ente).all()
css = url_for("static", filename="style.css")
return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati)
@app.route('/imp_show/<int:iid>', methods=['GET', 'POST'])
def page_imp_show(iid):
if 'username' not in session:
return redirect(url_for('page_login'))
if request.method == "GET":
imp = Impiegato.query.get(iid)
servizi = Servizio.query.all()
css = url_for("static", filename="style.css")
return render_template("impiegato/show.html.j2", css=css, imp=imp, servizi=servizi)
else:
imp = Impiegato.query.get(iid)
imp.sid = request.form["sid"]
imp.nomeimpiegato = request.form["nomeimpiegato"]
imp.username = request.form["username"]
imp.passwd = request.form["passwd"]
db.session.commit()
return redirect(url_for('page_imp_list'))

View file

@ -3,25 +3,7 @@
width: 25vh; width: 25vh;
} }
.container .monospace
{ {
text-align: center; font-family: "Consolas", monospace;
border-radius: 8px;
}
body
{
background-color: black;
font-family: "Calibri", sans-serif;
color: white;
}
table
{
border-collapse: collapse;
}
table, td, tr, th
{
border: 1px solid white;
} }

View file

@ -0,0 +1,19 @@
<html>
<head>
<title>Aggiunta ente - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Aggiunta nuovo ente
</h1>
<form class="form-inline" action="/ente_add" method="post">
<input class="form-control" type="text" placeholder="Nome ente" name="nomeente">
<input class="form-control" type="text" placeholder="Nome breve" name="nomebreveente">
<input class="btn btn-primary" type="submit">
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,37 @@
<html>
<head>
<title>Elenco enti - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Enti esistenti
</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Nome ente</th>
<th>Nome breve</th>
<th>Ispeziona</th>
<th>Modifica</th>
<th>Elimina</th>
</tr>
</thead>
<tbody>
{% for ente in enti %}
<tr>
<td>{{ ente.nomeente }}</td>
<td>{{ ente.nomebreveente }}</td>
<td><a href="/serv_list/{{ ente.eid }}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
<td><a href="/ente_show/{{ ente.eid }}"><span class="glyphicon glyphicon-pencil"></span></a></td>
<td><a href="/ente_del/{{ ente.eid }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-success" href="/ente_add">Aggiungi</a>
</div>
</body>
</html>

View file

@ -0,0 +1,19 @@
<html>
<head>
<title>Modifica ente - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Modifica ente
</h1>
<form class="form-inline" action="/ente_show/{{ ente.eid }}" method="post">
<input class="form-control" type="text" placeholder="Nome ente" name="nomeente" value="{{ ente.nomeente }}">
<input class="form-control" type="text" placeholder="Nome breve" name="nomebreveente" value="{{ ente.nomebreveente }}">
<input class="btn btn-primary" type="submit">
</form>
</div>
</body>
</html>

View file

@ -1,19 +0,0 @@
<html>
<head>
<title>Aggiungi un pesce rosso</title>
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="pepsecret">Ciao Ciao</div>
<div class="container">
<h1>
Aggiunta nuovo ente
</h1>
<form action="/ente_add" method="post">
<input type="text" placeholder="Nome ente" name="nome">
<input type="text" placeholder="Nome breve" name="nomebreve">
<input type="submit">
</form>
</div>
</body>
</html>

View file

@ -1,24 +0,0 @@
<html>
<head>
<title>Visualizza un pesce rosso</title>
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="pepsecret">Ciao pesce</div>
<div class="container">
<h1>
Enti esistenti
</h1>
<table>
{% for ente in enti %}
<tr>
<td>{{ ente.nome }}</td>
<td>{{ ente.nomebreve }}</td>
<td><a href="/ente_show/{{ ente.eid }}">Modifica</a></td>
<td><a href="/ente_del/{{ ente.eid }}">Elimina</a></td>
</tr>
{% endfor %}
</table>
</div>
</body>
</html>

View file

@ -1,19 +0,0 @@
<html>
<head>
<title>Aggiungi un pesce rosso</title>
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="pepsecret">Risio e le risiaie</div>
<div class="container">
<h1>
Aggiunta nuovo ente
</h1>
<form action="/ente_show/{{ ente.eid }}" method="post">
<input type="text" placeholder="Nome ente" name="nome" value="{{ ente.nome }}">
<input type="text" placeholder="Nome breve" name="nomebreve" value="{{ ente.nomebreve }}">
<input type="submit">
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<html>
<head>
<title>Aggiunta impiegato - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Aggiunta 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.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>
</div>
</body>
</html>

View file

@ -0,0 +1,39 @@
<html>
<head>
<title>Elenco impiegati - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Impiegati esistenti
</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Nome ente</th>
<th>Nome servizio</th>
<th>Nome impiegato</th>
<th>Nome utente</th>
<th>Password</th>
<th>Modifica</th>
<th>Elimina</th>
</tr>
</thead>
{% for imp in impiegati %}
<tr>
<td>{{ imp.servizio.ente.nomeente }}</td>
<td>{{ imp.servizio.nomeservizio }}
<td>{{ imp.nomeimpiegato }}</td>
<td><span class="monospace">{{ imp.username }}</span></td>
<td><span class="monospace">{{ imp.passwd }}</span></td>
<td><a href="/imp_show/{{ imp.iid }}"><span class="glyphicon glyphicon-pencil"></span></a></td>
<td><a href="/imp_del/{{ imp.iid }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
{% endfor %}
</table>
<a class="btn btn-success" href="/imp_add">Aggiungi</a>
</div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<html>
<head>
<title>Modifica impiegato - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Modifica impiegato
</h1>
<form class="form-inline" action="/imp_show/{{imp.iid}}" method="post">
<select class="form-control" name="sid" value="{{imp.sid}}">
{% for servizio in servizi %}
<option value="{{servizio.sid}}">{{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}}">
<input class="btn btn-primary" type="submit">
</form>
</div>
</body>
</html>

View file

@ -1,22 +1,22 @@
<html> <html>
<head> <head>
<title>Pesci rossi nel login</title> <title>Login - Acquario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}"> <link rel="stylesheet" href="{{css}}">
</head> </head>
<body> <body>
<div class="pepsecret">Ciao Ruozi!</div>
<div class="container"> <div class="container">
<h1> <h1>
Login Login
</h1> </h1>
<form action="/login" method="post"> <form class="form-inline" action="/login" method="post">
<input type="text" placeholder="Username" name="username"> <input class="form-control" type="text" placeholder="Username" name="username">
<input type="password" placeholder="Password" name="password"> <input class="form-control" type="password" placeholder="Password" name="password">
<input type="submit"> <input class="btn btn-primary" type="submit">
</form> </form>
<img class="goldfish" src="{{goldfish}}"> <img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}"> <img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}"> <img class="goldfish" src="{{goldfish}}">
</div> </div>
</body> </body>
</html> </html>

View file

@ -0,0 +1,23 @@
<html>
<head>
<title>Aggiunta servizio - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Aggiunta nuovo servizio
</h1>
<form class="form-inline" action="/serv_add" method="post">
<select class="form-control" name="eid">
{% for ente in enti %}
<option value="{{ente.eid}}">{{ente.nomeente}}</option>
{% endfor %}
</select>
<input class="form-control" type="text" placeholder="Nome ente" name="nomeservizio">
<input class="form-control" type="submit">
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,35 @@
<html>
<head>
<title>Elenco servizi - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Servizi esistenti
</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Nome ente</th>
<th>Nome servizio</th>
<th>Ispeziona</th>
<th>Modifica</th>
<th>Elimina</th>
</tr>
</thead>
{% for servizio in serv %}
<tr>
<td>{{ servizio.ente.nomeente }}</td>
<td>{{ servizio.nomeservizio }}</td>
<td><a href="/imp_list/{{ servizio.sid }}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
<td><a href="/serv_show/{{ servizio.sid }}"><span class="glyphicon glyphicon-pencil"></span></a></td>
<td><a href="/serv_del/{{ servizio.sid }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
{% endfor %}
</table>
<a class="btn btn-success" href="/serv_add">Aggiungi</a>
</div>
</body>
</html>

View file

@ -0,0 +1,23 @@
<html>
<head>
<title>Modifica servizio - Inventario</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="container">
<h1>
Modifica servizio
</h1>
<form class="form-inline" action="/serv_show/{{serv.sid}}" method="post">
<select class="form-control" name="eid" value="serv.eid">
{% for ente in enti %}
<option value="{{ente.eid}}">{{ente.nomeente}}</option>
{% endfor %}
</select>
<input class="form-control" type="text" placeholder="Nome servizio" name="nomeservizio" value="{{serv.nomeservizio}}">
<input class="btn btn-primary" type="submit">
</form>
</div>
</body>
</html>

View file

@ -1,20 +0,0 @@
<html>
<head>
<title>Aggiungi un pesce rosso</title>
<link rel="stylesheet" href="{{css}}">
</head>
<body>
<div class="pepsecret">Ciao Ciao</div>
<div class="container">
<h1>
Login
</h1>
<form action="/user_add" method="post">
<input type="text" placeholder="Nome e cognome" name="nome">
<input type="text" placeholder="Username" name="username">
<input type="password" placeholder="Password" name="password">
<input type="submit">
</form>
</div>
</body>
</html>