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

Fornitore is now a field of Ordine class

This commit is contained in:
Lorenzo 2017-09-19 15:49:01 +02:00
parent dc8f49a1e2
commit ff9d3201aa
7 changed files with 20 additions and 25 deletions

View file

@ -117,7 +117,6 @@ class Dispositivo(db.Model):
modello = db.Column(db.String) modello = db.Column(db.String)
inv_ced = db.Column(db.Integer, unique=True) inv_ced = db.Column(db.Integer, unique=True)
inv_ente = db.Column(db.Integer, unique=True) inv_ente = db.Column(db.Integer, unique=True)
fornitore = db.Column(db.String)
seriale = db.Column(db.String) seriale = db.Column(db.String)
ip = db.Column(db.String) ip = db.Column(db.String)
nid = db.Column(db.Integer, db.ForeignKey('reti.nid')) nid = db.Column(db.Integer, db.ForeignKey('reti.nid'))
@ -126,13 +125,12 @@ class Dispositivo(db.Model):
so = db.Column(db.String) so = db.Column(db.String)
oid = db.Column(db.Integer, db.ForeignKey('ordini.oid')) oid = db.Column(db.Integer, db.ForeignKey('ordini.oid'))
def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore, nid, seriale, ip, hostname, so, oid): def __init__(self, tipo, marca, modello, inv_ced, inv_ente, nid, seriale, ip, hostname, so, oid):
self.tipo = tipo self.tipo = tipo
self.marca = marca self.marca = marca
self.modello = modello self.modello = modello
self.inv_ced = inv_ced self.inv_ced = inv_ced
self.inv_ente = inv_ente self.inv_ente = inv_ente
self.fornitore = fornitore
self.nid = nid self.nid = nid
self.seriale = seriale self.seriale = seriale
self.ip = ip self.ip = ip
@ -203,6 +201,7 @@ class Ordine(db.Model):
numero_ordine = db.Column(db.String) numero_ordine = db.Column(db.String)
garanzia = db.Column(db.Date) garanzia = db.Column(db.Date)
dispositivo = db.relationship("Dispositivo", backref='ordine', lazy='dynamic', cascade="delete") dispositivo = db.relationship("Dispositivo", backref='ordine', lazy='dynamic', cascade="delete")
fornitore = db.Column(db.String)
def __str__(self): def __str__(self):
if self.numero_ordine is not None: if self.numero_ordine is not None:
@ -546,7 +545,7 @@ def page_disp_add():
nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'], nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'],
int(request.form['inv_ced']) if request.form['inv_ced'] else None, int(request.form['inv_ced']) if request.form['inv_ced'] else None,
int(request.form['inv_ente']) if request.form['inv_ente'] else None, int(request.form['inv_ente']) if request.form['inv_ente'] else None,
request.form['fornitore'], request.form['rete'], request.form['seriale'], request.form['rete'], request.form['seriale'],
request.form['ip'], request.form['hostname'] if request.form['hostname'] else None, request.form['so'], request.form['ip'], request.form['hostname'] if request.form['hostname'] else None, request.form['so'],
int(request.form['ordine']) if request.form['ordine'] else None) int(request.form['ordine']) if request.form['ordine'] else None)
db.session.add(nuovodisp) db.session.add(nuovodisp)
@ -646,7 +645,6 @@ def page_disp_show(did):
disp.tipo = request.form['tipo'] disp.tipo = request.form['tipo']
disp.marca = request.form['marca'] disp.marca = request.form['marca']
disp.modello = request.form['modello'] disp.modello = request.form['modello']
disp.fornitore = request.form['fornitore']
disp.nid = int(request.form['rete']) disp.nid = int(request.form['rete'])
disp.ip = request.form['ip'] disp.ip = request.form['ip']
disp.hostname = request.form['hostname'] if request.form['hostname'] else None disp.hostname = request.form['hostname'] if request.form['hostname'] else None
@ -699,7 +697,7 @@ def page_disp_clone(did):
nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'], nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'],
int(request.form['inv_ced']) if request.form['inv_ced'] else None, int(request.form['inv_ced']) if request.form['inv_ced'] else None,
int(request.form['inv_ente']) if request.form['inv_ente'] else None, int(request.form['inv_ente']) if request.form['inv_ente'] else None,
request.form['fornitore'], request.form['rete'], request.form['seriale'], request.form['rete'], request.form['seriale'],
request.form['ip'], request.form['hostname'] if request.form['hostname'] else None, request.form['so'], request.form['ip'], request.form['hostname'] if request.form['hostname'] else None, request.form['so'],
int(request.form['ordine']) if request.form['ordine'] else None) int(request.form['ordine']) if request.form['ordine'] else None)
db.session.add(nuovodisp) db.session.add(nuovodisp)
@ -874,7 +872,8 @@ def page_order_add():
garanzia = datetime.date(int(yyyy), int(mm), int(dd)) garanzia = datetime.date(int(yyyy), int(mm), int(dd))
else: else:
garanzia = None garanzia = None
nuovoordine = Ordine(data=data, numero_ordine=request.form["numero_ordine"], garanzia=garanzia) nuovoordine = Ordine(data=data, numero_ordine=request.form["numero_ordine"], garanzia=garanzia,
fornitore=request.form['fornitore'])
db.session.add(nuovoordine) db.session.add(nuovoordine)
db.session.commit() db.session.commit()
return redirect(url_for("page_order_list")) return redirect(url_for("page_order_list"))
@ -902,6 +901,7 @@ def page_order_show(oid):
else: else:
order.garanzia = None order.garanzia = None
order.numero_ordine = request.form["numero_ordine"] order.numero_ordine = request.form["numero_ordine"]
order.fornitore = request.form['fornitore']
db.session.commit() db.session.commit()
return redirect(url_for("page_order_list")) return redirect(url_for("page_order_list"))

View file

@ -53,16 +53,6 @@
</div> </div>
</li> </li>
{% endif %} {% endif %}
{% if disp.fornitore %}
<li class="list-group-item">
<h4 class="list-group-item-heading">
Fornitore
</h4>
<div class="list-group-item-text">
{{ disp.fornitore }}
</div>
</li>
{% endif %}
{% if accessi %} {% if accessi %}
<li class="list-group-item"> <li class="list-group-item">
<h4 class="list-group-item-heading"> <h4 class="list-group-item-heading">

View file

@ -13,7 +13,6 @@
<th>Inventario CED</th> <th>Inventario CED</th>
<th>Marca</th> <th>Marca</th>
<th>Modello</th> <th>Modello</th>
<th>Fornitore</th>
<th>Seriale</th> <th>Seriale</th>
<th>Azioni</th> <th>Azioni</th>
</tr> </tr>
@ -25,7 +24,6 @@
<td>{% if d[0].dispositivo.inv_ced %}{{ d[0].dispositivo.inv_ced }}{% endif %}</td> <td>{% if d[0].dispositivo.inv_ced %}{{ d[0].dispositivo.inv_ced }}{% endif %}</td>
<td>{{ d[0].dispositivo.marca }}</td> <td>{{ d[0].dispositivo.marca }}</td>
<td>{{ d[0].dispositivo.modello }}</td> <td>{{ d[0].dispositivo.modello }}</td>
<td>{{ d[0].dispositivo.fornitore }}</td>
<td>{{ d[0].dispositivo.seriale }}</td> <td>{{ d[0].dispositivo.seriale }}</td>
<td> <td>
<a href="/disp_details/{{ d[0].did }}" title="Dettagli"><span class="glyphicon glyphicon-zoom-in"></span></a> <a href="/disp_details/{{ d[0].did }}" title="Dettagli"><span class="glyphicon glyphicon-zoom-in"></span></a>

View file

@ -128,12 +128,6 @@
<input id="form-ente" class="form-control" type="text" placeholder="Inventario ente" name="inv_ente" {% if dispositivo and dispositivo.inv_ente %}value="{{ dispositivo.inv_ente }}"{% endif %}> <input id="form-ente" class="form-control" type="text" placeholder="Inventario ente" name="inv_ente" {% if dispositivo and dispositivo.inv_ente %}value="{{ dispositivo.inv_ente }}"{% endif %}>
</div> </div>
</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" {% if dispositivo %}value="{{ dispositivo.fornitore }}"{% endif %}>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-xs-2" for="form-seriale">Numero Seriale</label> <label class="col-xs-2" for="form-seriale">Numero Seriale</label>
<div class="col-xs-10"> <div class="col-xs-10">

View file

@ -42,6 +42,16 @@
</div> </div>
</li> </li>
{% endif %} {% endif %}
{% if ordine.fornitore %}
<li class="list-group-item">
<h4 class="list-group-item-heading">
Fornitore
</h4>
<div class="list-group-item-text">
{{ ordine.fornitore }}
</div>
</li>
{% endif %}
{% if dispositivi %} {% if dispositivi %}
<li class="list-group-item"> <li class="list-group-item">
<h4 class="list-group-item-heading"> <h4 class="list-group-item-heading">

View file

@ -10,6 +10,7 @@
<tr> <tr>
<th>Data dell'ordine</th> <th>Data dell'ordine</th>
<th>Numero dell'ordine</th> <th>Numero dell'ordine</th>
<th>Fornitore</th>
<th>Stato garanzia</th> <th>Stato garanzia</th>
<th>Azioni</th> <th>Azioni</th>
</tr> </tr>
@ -19,6 +20,7 @@
<tr> <tr>
<td>{% if order.data %}{{ order.data }}{% endif %}</td> <td>{% if order.data %}{{ order.data }}{% endif %}</td>
<td>{% if order.numero_ordine %}{{ order.numero_ordine }}{% endif %}</td> <td>{% if order.numero_ordine %}{{ order.numero_ordine }}{% endif %}</td>
<td>{% if order.fornitore %}{{ order.fornitore }}{% endif %}</td>
<td> <td>
{% if order.garanzia %} {% if order.garanzia %}
{% if order.garanzia > soon %} {% if order.garanzia > soon %}

View file

@ -15,6 +15,7 @@
<input class="form-control" type="date" placeholder="yyyy-mm-dd" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="data" {% if order %}value="{{ order.data }}"{% endif %}> <input class="form-control" type="date" placeholder="yyyy-mm-dd" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="data" {% if order %}value="{{ order.data }}"{% endif %}>
<input class="form-control" type="text" placeholder="Numero ordine" name="numero_ordine" {% if order %}value="{{ order.numero_ordine }}"{% endif %}> <input class="form-control" type="text" placeholder="Numero ordine" name="numero_ordine" {% if order %}value="{{ order.numero_ordine }}"{% endif %}>
<input class="form-control" type="date" placeholder="yyyy-mm-dd" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="garanzia" {% if order %}value="{{ order.garanzia }}"{% endif %}> <input class="form-control" type="date" placeholder="yyyy-mm-dd" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="garanzia" {% if order %}value="{{ order.garanzia }}"{% endif %}>
<input class="form-control" type="text" placeholder="Fornitore" name="fornitore" {% if order %} value="{{ order.fornitore }}" {% endif %}>
<input class="btn btn-primary" type="submit"> <input class="btn btn-primary" type="submit">
</form> </form>
{% endblock %} {% endblock %}