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

Fix many things that I don't want to list

This commit is contained in:
Lorenzo 2017-09-11 12:47:52 +02:00
parent dbb52ccab6
commit f4649f4803
28 changed files with 362 additions and 553 deletions

112
dbgen.py
View file

@ -1,112 +0,0 @@
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
# SQL
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
db = SQLAlchemy(app)
# Utente login inventario
class User(db.Model):
uid = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
passwd = db.Column(db.String(80))
def __init__(self, username, passwd):
self.username = username
self.passwd = passwd
def __repr__(self):
return "<User {}>".format(self.username, self.passwd)
# Ente (Unione Terre di Castelli, Comune di Vignola...)
class Ente(db.Model):
eid = db.Column(db.Integer, primary_key=True)
nomeente = db.Column(db.String(64))
nomebreveente = db.Column(db.String(16))
servizi = db.relationship("Servizio", backref='ente', lazy='dynamic')
def __init__(self, nomeente, nomebreveente):
self.nomeente = nomeente
self.nomebreveente = nomebreveente
def __repr__(self):
return "<Ente {}>".format(self.nomebreveente)
# Servizio di un ente
class Servizio(db.Model):
sid = db.Column(db.Integer, primary_key=True)
eid = db.Column(db.Integer, db.ForeignKey('ente.eid'))
nomeservizio = db.Column(db.String(128))
impiegati = db.relationship("Impiegato", backref='servizio', lazy='dynamic')
def __init__(self, eid, nomeservizio):
self.eid = eid
self.nomeservizio = nomeservizio
def __repr__(self):
return "<Servizio {}>".format(self.nomeservizio)
class Impiegato(db.Model):
iid = db.Column(db.Integer, primary_key=True)
sid = db.Column(db.Integer, db.ForeignKey('servizio.sid'))
nomeimpiegato = db.Column(db.String(128))
username = db.Column(db.String(32), unique=True)
passwd = db.Column(db.String(32))
dispositivi = db.relationship("Accesso", backref='impiegato', lazy='dynamic')
def __init__(self, sid, nomeimpiegato, username, passwd):
self.sid = sid
self.nomeimpiegato = nomeimpiegato
self.username = username
self.passwd = passwd
def __repr__(self):
return "<Impiegato {}>".format(self.nome)
class Dispositivo(db.Model):
did = db.Column(db.Integer, primary_key=True)
utenti = db.relationship("Accesso", backref='dispositivo', lazy='dynamic')
tipo = db.Column(db.String(32))
marca = db.Column(db.String(64))
modello = db.Column(db.String(32))
inv_ced = db.Column(db.String(8))
inv_ente = db.Column(db.String(8))
fornitore = db.Column(db.String(64))
def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore):
self.tipo = tipo
self.marca = marca
self.modello = modello
self.inv_ced = inv_ced
self.inv_ente = inv_ente
self.fornitore = fornitore
def __repr__(self):
return "<Dispositivo {}>".format(self.inv_ced)
class Accesso(db.Model):
aid = db.Column(db.Integer, primary_key=True)
iid = db.Column(db.Integer, db.ForeignKey('impiegato.iid'))
did = db.Column(db.Integer, db.ForeignKey('dispositivo.did'))
def __init__(self, iid, did):
self.iid = iid
self.did = did
def __repr__(self):
return "<Accesso {} su {}>".format(iid, did)
db.create_all()
nuovouser = User('stagista', 'smecds')
db.session.add(nuovouser)
nuovouser = User('gmacchi', 'steffo99')
db.session.add(nuovouser)
db.session.commit()

View file

@ -131,7 +131,7 @@ def page_login():
if request.method == 'GET': if request.method == 'GET':
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
goldfish = url_for("static", filename="goldfish.png") goldfish = url_for("static", filename="goldfish.png")
return render_template("login.html.j2", css=css, goldfish=goldfish) return render_template("login.htm", css=css, goldfish=goldfish)
else: else:
if login(request.form['username'], request.form['password']): if login(request.form['username'], request.form['password']):
session['username'] = request.form['username'] session['username'] = request.form['username']
@ -150,7 +150,7 @@ def page_dashboard():
for ente in enti: for ente in enti:
conteggioutenti[ente.nomeente] = Impiegato.query.join(Servizio).join(Ente).filter_by(eid=ente.eid).count() conteggioutenti[ente.nomeente] = Impiegato.query.join(Servizio).join(Ente).filter_by(eid=ente.eid).count()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("dashboard.html.j2", css=css, type="main", user=session["username"], return render_template("dashboard.htm", css=css, type="main", user=session["username"],
conteggioutenti=conteggioutenti, conteggioservizi=conteggioservizi) conteggioutenti=conteggioutenti, conteggioservizi=conteggioservizi)
@ -160,7 +160,7 @@ def page_ente_add():
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
if request.method == 'GET': if request.method == 'GET':
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("ente/add.html.j2", css=css, type="ente", user=session["username"]) return render_template("ente/add.htm", css=css, type="ente", user=session["username"])
else: else:
nuovoent = Ente(request.form['nomeente'], request.form['nomebreveente']) nuovoent = Ente(request.form['nomeente'], request.form['nomebreveente'])
db.session.add(nuovoent) db.session.add(nuovoent)
@ -190,7 +190,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, type="ente", user=session["username"]) return render_template("ente/list.htm", css=css, enti=enti, type="ente", user=session["username"])
@app.route('/ente_show/<int:eid>', methods=['GET', 'POST']) @app.route('/ente_show/<int:eid>', methods=['GET', 'POST'])
@ -200,7 +200,7 @@ 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, user=session["username"]) return render_template("ente/show.htm", css=css, ente=ente, user=session["username"])
else: else:
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
ente.nomeente = request.form["nomeente"] ente.nomeente = request.form["nomeente"]
@ -216,7 +216,7 @@ def page_serv_add():
if request.method == 'GET': if request.method == 'GET':
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("servizio/add.html.j2", css=css, enti=enti, type="serv", user=session["username"]) return render_template("servizio/add.htm", css=css, enti=enti, type="serv", user=session["username"])
else: else:
nuovoserv = Servizio(request.form['eid'], request.form['nomeservizio']) nuovoserv = Servizio(request.form['eid'], request.form['nomeservizio'])
db.session.add(nuovoserv) db.session.add(nuovoserv)
@ -243,7 +243,7 @@ def page_serv_list():
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
serv = Servizio.query.join(Ente).all() serv = Servizio.query.join(Ente).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("servizio/list.html.j2", css=css, serv=serv, type="serv", user=session["username"]) return render_template("servizio/list.htm", css=css, serv=serv, type="serv", user=session["username"])
@app.route('/serv_show/<int:sid>', methods=['GET', 'POST']) @app.route('/serv_show/<int:sid>', methods=['GET', 'POST'])
@ -254,7 +254,7 @@ def page_serv_show(sid):
serv = Servizio.query.get(sid) serv = Servizio.query.get(sid)
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("servizio/show.html.j2", css=css, serv=serv, enti=enti, user=session["username"]) return render_template("servizio/show.htm", css=css, serv=serv, enti=enti, user=session["username"])
else: else:
serv = Servizio.query.get(sid) serv = Servizio.query.get(sid)
serv.eid = request.form["eid"] serv.eid = request.form["eid"]
@ -270,7 +270,7 @@ def page_imp_add():
if request.method == 'GET': if request.method == 'GET':
servizi = Servizio.query.join(Ente).all() servizi = Servizio.query.join(Ente).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/add.html.j2", css=css, servizi=servizi, type="imp", user=session["username"]) return render_template("impiegato/add.htm", css=css, servizi=servizi, type="imp", user=session["username"])
else: else:
nuovoimp = Impiegato(request.form['sid'], request.form['nomeimpiegato'], request.form['username'], nuovoimp = Impiegato(request.form['sid'], request.form['nomeimpiegato'], request.form['username'],
request.form['passwd'],) request.form['passwd'],)
@ -295,7 +295,7 @@ def page_imp_list():
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
impiegati = Impiegato.query.join(Servizio).join(Ente).all() impiegati = Impiegato.query.join(Servizio).join(Ente).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati, type="imp", user=session["username"]) return render_template("impiegato/list.htm", css=css, impiegati=impiegati, type="imp", user=session["username"])
@app.route('/imp_list/<int:sid>') @app.route('/imp_list/<int:sid>')
@ -304,7 +304,7 @@ def page_imp_list_plus(sid):
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
impiegati = Impiegato.query.join(Servizio).filter_by(sid=sid).join(Ente).all() impiegati = Impiegato.query.join(Servizio).filter_by(sid=sid).join(Ente).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati, user=session["username"]) return render_template("impiegato/list.htm", css=css, impiegati=impiegati, user=session["username"])
@app.route('/imp_show/<int:iid>', methods=['GET', 'POST']) @app.route('/imp_show/<int:iid>', methods=['GET', 'POST'])
@ -315,7 +315,7 @@ def page_imp_show(iid):
imp = Impiegato.query.get(iid) imp = Impiegato.query.get(iid)
servizi = Servizio.query.all() servizi = Servizio.query.all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/show.html.j2", css=css, imp=imp, servizi=servizi, user=session["username"]) return render_template("impiegato/show.htm", css=css, imp=imp, servizi=servizi, user=session["username"])
else: else:
imp = Impiegato.query.get(iid) imp = Impiegato.query.get(iid)
imp.sid = request.form["sid"] imp.sid = request.form["sid"]
@ -335,7 +335,7 @@ def page_disp_add():
"Server", "Stampante di rete", "Switch", "Telefono IP", "Monitor", "Scanner", "Stampante locale"] "Server", "Stampante di rete", "Switch", "Telefono IP", "Monitor", "Scanner", "Stampante locale"]
impiegati = Impiegato.query.all() impiegati = Impiegato.query.all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("dispositivo/add.html.j2", css=css, impiegati=impiegati, opzioni=opzioni, type="dev", return render_template("dispositivo/add.htm", css=css, impiegati=impiegati, opzioni=opzioni, type="dev",
user=session["username"]) user=session["username"])
else: else:
nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'], nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'],
@ -379,9 +379,17 @@ def page_disp_list():
accesso = Accesso.query.join(Dispositivo).filter_by(did=dispositivo.did).join(Impiegato).all() accesso = Accesso.query.join(Dispositivo).filter_by(did=dispositivo.did).join(Impiegato).all()
accessi.append(accesso) accessi.append(accesso)
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("dispositivo/list.html.j2", css=css, accessi=accessi, type="disp", user=session["username"]) return render_template("dispositivo/list.htm", css=css, accessi=accessi, type="disp", user=session["username"])
@app.route('/disp_details') @app.route('/disp_details')
def page_details_host(): def page_details_host():
raise NotImplementedError() raise NotImplementedError()
if __name__ == "__main__":
# db.create_all()
# u = User("lavaleria", "lava")
# db.session.add(u)
# db.session.commit()
app.run(debug=True)

15
templates/base.htm Normal file
View file

@ -0,0 +1,15 @@
<html>
<head>
<title>{% block title %}{% endblock %}</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 }}">
{% block extrahead %}{% endblock %}
</head>
<body>
{% include 'nav.htm' %}
<div class="container">
{% block content %}{% endblock %}
</div>
</body>
</html>

35
templates/dashboard.htm Normal file
View file

@ -0,0 +1,35 @@
{% extends "base.htm" %}
{% block title %}Dashboard - Estus{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-4">
<h2>
Servizi per ente
</h2>
<ul class="list-group">
{% for ente in conteggioservizi %}
<li class="list-group-item">
{{ ente }}
<span class="badge">{{ conteggioservizi[ente] }}</span>
</li>
{% endfor %}
</ul>
</div>
<div class="col-sm-4">
<h2>
Utenti per ente
</h2>
<ul class="list-group">
{% for ente in conteggioutenti %}
<li class="list-group-item">
{{ ente }}
<span class="badge">{{ conteggioutenti[ente] }}</span>
</li>
{% endfor %}
</ul>
</div>
<div class="col-sm-4">
Destra
</div>
</div>
{% endblock %}

View file

@ -1,43 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<div class="container">
<div class="row">
<div class="col-sm-4">
<h2>
Servizi per ente
</h2>
<ul class="list-group">
{% for ente in conteggioservizi %}
<li class="list-group-item">
{{ente}}
<span class="badge">{{conteggioservizi[ente]}}</span>
</li>
{% endfor %}
</ul>
</div>
<div class="col-sm-4">
<h2>
Utenti per ente
</h2>
<ul class="list-group">
{% for ente in conteggioutenti %}
<li class="list-group-item">
{{ente}}
<span class="badge">{{conteggioutenti[ente]}}</span>
</li>
{% endfor %}
</ul>
</div>
<div class="col-sm-4">
Destra
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
{% extends "base.htm" %}
{% block extrahead %}
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"
integrity="sha256-/SIrNqv8h6QGKDuNoLGA4iret+kyesCkHGzVUUV0shc=" crossorigin="anonymous"></script>
<script>
var users = 0;
function genhtml(n) {
return "<select id=\"utente" + n + "\" class=\"form-control\" name=\"utente" + n + "\">{% for impiegato in impiegati %}<option value=\"{{impiegato.iid}}\">{{impiegato.nomeimpiegato}} - {{impiegato.username}}</option>{% endfor %}</select>"
}
function adduser() {
$("#users-column").append(genhtml(users));
users += 1;
$("#remove-user").removeClass("disabled");
}
function removeuser() {
if (users > 0) {
$("#utente" + (users - 1)).remove();
users -= 1;
if (users === 0) {
$("#remove-user").addClass("disabled");
}
}
}
</script>
{% endblock %}
{% block content %}
<h1>
Aggiunta nuovo dispositivo
</h1>
<form class="form-horizontal" action="/disp_add" method="post">
<div class="form-group">
<label class="col-xs-2" for="">Tipo dispositivo</label>
<div class="col-xs-10">
<select id="form-tipo" class="form-control" name="tipo">
{% for opzione in opzioni %}
<option value="{{ opzione }}">{{ opzione }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-utente">Utenti</label>
<div class="col-xs-10" id="users-column">
<div id="add-user" class="btn btn-success" onclick="adduser()">+</div>
<div id="remove-user" class="btn btn-danger disabled" onclick="removeuser()">-</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-marca">Marca</label>
<div class="col-xs-10">
<input id="form-marca" class="form-control" type="text" placeholder="Marca" name="marca">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-modello">Modello</label>
<div class="col-xs-10">
<input id="form-modello" class="form-control" type="text" placeholder="Modello" name="modello">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ced">Inventario CED</label>
<div class="col-xs-10">
<input id="form-ced" class="form-control" type="text" placeholder="Inventario CED" name="inv_ced">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ente">Inventario ente</label>
<div class="col-xs-10">
<input id="form-ente" class="form-control" type="text" placeholder="Inventario ente" name="inv_ente">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-fornitore">Fornitore</label>
<div class="col-xs-10">
<input id="form-fornitore" class="form-control" type="text" placeholder="Fornitore" name="fornitore">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-control"></label>
<div class="col-xs-10">
<input class="form-control btn btn-primary" type="submit">
</div>
</div>
</form>
{% endblock %}

View file

@ -1,99 +0,0 @@
<html>
<head>
<title>Aggiunta dispositivo - 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}}">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha256-/SIrNqv8h6QGKDuNoLGA4iret+kyesCkHGzVUUV0shc=" crossorigin="anonymous"></script>
<script>
var users = 0
function genhtml(n)
{
return "<select id=\"utente" + n + "\" class=\"form-control\" name=\"utente" + n + "\">{% for impiegato in impiegati %}<option value=\"{{impiegato.iid}}\">{{impiegato.nomeimpiegato}} - {{impiegato.username}}</option>{% endfor %}</select>"
}
function adduser()
{
$("#users-column").append(genhtml(users))
users += 1
$("#remove-user").removeClass("disabled")
}
function removeuser()
{
if(users > 0)
{
$("#utente" + (users-1)).remove()
users -= 1
if(users == 0)
{
$("#remove-user").addClass("disabled")
}
}
}
</script>
</head>
<body>
{% include 'nav.html.j2' %}
<div class="container">
<h1>
Aggiunta nuovo dispositivo
</h1>
<form class="form-horizontal" action="/disp_add" method="post">
<div class="form-group">
<label class="col-xs-2" for="">Tipo dispositivo</label>
<div class="col-xs-10">
<select id="form-tipo" class="form-control" name="tipo">
{% for opzione in opzioni %}
<option value="{{opzione}}">{{opzione}}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-utente">Utenti</label>
<div class="col-xs-10" id="users-column">
<div id="add-user" class="btn btn-success" onclick="adduser()">+</div>
<div id="remove-user" class="btn btn-danger disabled" onclick="removeuser()">-</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-marca">Marca</label>
<div class="col-xs-10">
<input id="form-marca" class="form-control" type="text" placeholder="Marca" name="marca">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-modello">Modello</label>
<div class="col-xs-10">
<input id="form-modello" class="form-control" type="text" placeholder="Modello" name="modello">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ced">Inventario CED</label>
<div class="col-xs-10">
<input id="form-ced" class="form-control" type="text" placeholder="Inventario CED" name="inv_ced">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ente">Inventario ente</label>
<div class="col-xs-10">
<input id="form-ente" class="form-control" type="text" placeholder="Inventario ente" name="inv_ente">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-fornitore">Fornitore</label>
<div class="col-xs-10">
<input id="form-fornitore" class="form-control" type="text" placeholder="Fornitore" name="fornitore">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-control"></label>
<div class="col-xs-10">
<input class="form-control btn btn-primary" type="submit">
</div>
</div>
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,36 @@
{% extends "base.htm" %}
{% block title %}Elenco dispositivi{% endblock %}
{% block content %}
<h1>
Dispositivi esistenti
</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Tipo dispositivo</th>
<th>Utenti</th>
<th>Inventario CED</th>
<th>Inventario ente</th>
<th>Marca</th>
<th>Modello</th>
<th>Fornitore</th>
<th>Ispeziona</th>
<th>Elimina</th>
</tr>
</thead>
{% for d in accessi %}
<tr>
<td>{{ d[0].dispositivo.tipo }}</td>
<td>{% for u in d %}<p>{{ u.impiegato.nomeimpiegato }}</p>{% endfor %}</td>
<td>{{ d[0].dispositivo.inv_ced }}</td>
<td>{{ d[0].dispositivo.inv_ente }}</td>
<td>{{ d[0].dispositivo.marca }}</td>
<td>{{ d[0].dispositivo.modello }}</td>
<td>{{ d[0].dispositivo.fornitore }}</td>
<td><a href="/disp_details/{{ d.did }}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
<td><a href="/disp_del/{{ d.did }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
{% endfor %}
</table>
<a class="btn btn-success" href="/disp_add">Aggiungi</a>
{% endblock %}

View file

@ -1,44 +0,0 @@
<html>
<head>
<title>Elenco dispositivi - 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>
{% include 'nav.html.j2' %}
<div class="container">
<h1>
Dispositivi esistenti
</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Tipo dispositivo</th>
<th>Utenti</th>
<th>Inventario CED</th>
<th>Inventario ente</th>
<th>Marca</th>
<th>Modello</th>
<th>Fornitore</th>
<th>Ispeziona</th>
<th>Elimina</th>
</tr>
</thead>
{% for d in accessi %}
<tr>
<td>{{ d[0].dispositivo.tipo }}</td>
<td>{% for u in d %}<p>{{ u.impiegato.nomeimpiegato }}</p>{% endfor %}</td>
<td>{{ d[0].dispositivo.inv_ced }}</td>
<td>{{ d[0].dispositivo.inv_ente }}</td>
<td>{{ d[0].dispositivo.marca }}</td>
<td>{{ d[0].dispositivo.modello }}</td>
<td>{{ d[0].dispositivo.fornitore }}</td>
<td><a href="/disp_details/{{ d.did }}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
<td><a href="/disp_del/{{ d.did }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
{% endfor %}
</table>
<a class="btn btn-success" href="/disp_add">Aggiungi</a>
</div>
</body>
</html>

12
templates/ente/add.htm Normal file
View file

@ -0,0 +1,12 @@
{% extends "base.htm" %}
{% block title %}Aggiunta Ente{% endblock %}
{% block content %}
<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>
{% endblock %}

View file

@ -1,20 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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>

30
templates/ente/list.htm Normal file
View file

@ -0,0 +1,30 @@
{% extends "base.htm" %}
{% block title %}Elenco Enti{% endblock %}
{% block content %}
<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>
{% endblock %}

View file

@ -1,38 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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>

13
templates/ente/show.htm Normal file
View file

@ -0,0 +1,13 @@
{% extends "base.htm" %}
{% block title %}Modifica Ente{% endblock %}
{% block content %}
<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>
{% endblock %}

View file

@ -1,20 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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

@ -0,0 +1,19 @@
{% extends "base.htm" %}
{% block title %}Aggiunta Impiegato{% endblock %}
{% block content %}
<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.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

@ -1,26 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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.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>
</div>
</body>
</html>

View file

@ -0,0 +1,32 @@
{% extends "base.htm" %}
{% block title %}Elenco Impiegati{% endblock %}
{% block content %}
<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>
{% endblock %}

View file

@ -1,40 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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,21 @@
{% extends "base.htm" %}
{% block title %}Modifica Impiegato{% endblock %}
{% block content %}
<h1>
Modifica impiegato
</h1>
<form class="form-inline" action="/imp_show/{{ imp.iid }}" 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 }}
- {{ 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>
{% endblock %}

View file

@ -1,26 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<div class="container">
<h1>
Modifica impiegato
</h1>
<form class="form-inline" action="/imp_show/{{imp.iid}}" 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}} - {{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>

15
templates/login.htm Normal file
View file

@ -0,0 +1,15 @@
{% extends "base.htm" %}
{% block title %}Benvenuto all'Acquario{% endblock %}
{% block content %}
<h1>
Login
</h1>
<form class="form-inline" action="/login" method="post">
<input class="form-control" type="text" placeholder="Username" name="username">
<input class="form-control" type="password" placeholder="Password" name="password">
<input class="btn btn-primary" type="submit">
</form>
<img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}">
{% endblock %}

View file

@ -1,23 +0,0 @@
<html>
<head>
<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}}">
</head>
<body>
{% include 'nav.html.j2' %}
<div class="container">
<h1>
Login
</h1>
<form class="form-inline" action="/login" method="post">
<input class="form-control" type="text" placeholder="Username" name="username">
<input class="form-control" type="password" placeholder="Password" name="password">
<input class="btn btn-primary" type="submit">
</form>
<img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}">
<img class="goldfish" src="{{goldfish}}">
</div>
</body>
</html>

View file

@ -0,0 +1,16 @@
{% extends "base.htm" %}
{% block title %}Aggiunta Servizio{% endblock %}
{% block content %}
<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>
{% endblock %}

View file

@ -1,24 +0,0 @@
<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>
{% include 'nav.html.j2' %}
<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

@ -1,12 +1,6 @@
<html> {% extends "base.htm" %}
<head> {% block title %}Lista Servizi{% endblock %}
<title>Elenco servizi - Inventario</title> {% block content %}
<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>
{% include 'nav.html.j2' %}
<div class="container">
<h1> <h1>
Servizi esistenti Servizi esistenti
</h1> </h1>
@ -31,6 +25,4 @@
{% endfor %} {% endfor %}
</table> </table>
<a class="btn btn-success" href="/serv_add">Aggiungi</a> <a class="btn btn-success" href="/serv_add">Aggiungi</a>
</div> {% endblock %}
</body>
</html>

View file

@ -1,12 +1,6 @@
<html> {% extends "base.htm" %}
<head> {% block title %}Modifica Servizio{% endblock %}
<title>Modifica servizio - Inventario</title> {% block content %}
<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>
{% include 'nav.html.j2' %}
<div class="container">
<h1> <h1>
Modifica servizio Modifica servizio
</h1> </h1>
@ -19,6 +13,4 @@
<input class="form-control" type="text" placeholder="Nome servizio" name="nomeservizio" value="{{serv.nomeservizio}}"> <input class="form-control" type="text" placeholder="Nome servizio" name="nomeservizio" value="{{serv.nomeservizio}}">
<input class="btn btn-primary" type="submit"> <input class="btn btn-primary" type="submit">
</form> </form>
</div> {% endblock %}
</body>
</html>