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

View file

@ -53,16 +53,6 @@
</div>
</li>
{% 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 %}
<li class="list-group-item">
<h4 class="list-group-item-heading">

View file

@ -13,7 +13,6 @@
<th>Inventario CED</th>
<th>Marca</th>
<th>Modello</th>
<th>Fornitore</th>
<th>Seriale</th>
<th>Azioni</th>
</tr>
@ -25,7 +24,6 @@
<td>{% if d[0].dispositivo.inv_ced %}{{ d[0].dispositivo.inv_ced }}{% endif %}</td>
<td>{{ d[0].dispositivo.marca }}</td>
<td>{{ d[0].dispositivo.modello }}</td>
<td>{{ d[0].dispositivo.fornitore }}</td>
<td>{{ d[0].dispositivo.seriale }}</td>
<td>
<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 %}>
</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">
<label class="col-xs-2" for="form-seriale">Numero Seriale</label>
<div class="col-xs-10">

View file

@ -42,6 +42,16 @@
</div>
</li>
{% 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 %}
<li class="list-group-item">
<h4 class="list-group-item-heading">

View file

@ -10,6 +10,7 @@
<tr>
<th>Data dell'ordine</th>
<th>Numero dell'ordine</th>
<th>Fornitore</th>
<th>Stato garanzia</th>
<th>Azioni</th>
</tr>
@ -19,6 +20,7 @@
<tr>
<td>{% if order.data %}{{ order.data }}{% endif %}</td>
<td>{% if order.numero_ordine %}{{ order.numero_ordine }}{% endif %}</td>
<td>{% if order.fornitore %}{{ order.fornitore }}{% endif %}</td>
<td>
{% if order.garanzia %}
{% 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="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="text" placeholder="Fornitore" name="fornitore" {% if order %} value="{{ order.fornitore }}" {% endif %}>
<input class="btn btn-primary" type="submit">
</form>
{% endblock %}