Skip to content

Commit

Permalink
Aggiunta funzionalità QRCode e correzioni varie
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppericcio committed Sep 2, 2022
1 parent 7d4494e commit 5251ace
Show file tree
Hide file tree
Showing 23 changed files with 378 additions and 171 deletions.
210 changes: 122 additions & 88 deletions main.py

Large diffs are not rendered by default.

Binary file modified selftestcovid19.db
Binary file not shown.
17 changes: 10 additions & 7 deletions selftestcovid19.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CREATE TABLE `Farmacie` (
NomeFarmacia VARCHAR(50),
Citta VARCHAR(50),
CAP INT(5),
Indirizzo VARCHAR(50),
Email VARCHAR(50),
PWD VARCHAR(50)
);
Expand All @@ -29,8 +30,10 @@ CREATE TABLE `Prenotazioni` (
Telefono VARCHAR(10),
Giorno DATE,
Ora TIME,
TipoTampone VARCHAR(10),
EsitoTampone VARCHAR(20),
ID_Farmacia INTEGER
ID_Farmacia INTEGER,
ID_Tampone INTEGER
);

CREATE TABLE `Tamponi` (
Expand Down Expand Up @@ -65,14 +68,14 @@ CREATE TABLE `Pazienti` (
INSERT INTO Admin (Username,PWD) VALUES ('admin','admin');

INSERT INTO Tamponi (NomeTampone, Tipo, N_pezzi, Giorno, OraInizio, OraFine, Prezzo, ID_Farmacia) VALUES ('Tamporum', 'Rapido', 20,'2022-08-26','11:00', '11:15',15.0, 1);
INSERT INTO Tamponi (NomeTampone, Tipo, N_pezzi, Giorno, OraInizio, OraFine, Prezzo, ID_Farmacia) VALUES ('DazTamp', 'Molecolare', 20,'2022-08-26','11:15', '11:30',15.0, 2);
INSERT INTO Tamponi (NomeTampone, Tipo, N_pezzi, Giorno, OraInizio, OraFine, Prezzo, ID_Farmacia) VALUES ('DazTamp', 'Molecolare', 20,'2022-08-26','11:15', '11:30',15.0, 1);

INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, EsitoTampone, ID_Farmacia) VALUES ('Gino', 'Pino', 'gino@gmail.com','GNOPNOLX12HJ', '3333233212','2022-08-26','11:00','Negativo',1);
INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, EsitoTampone, ID_Farmacia) VALUES ('Ciccio', 'Verde', 'cicc@gmail.com','GMOVRELX13HJ', '3332355789','2022-08-26','11:15','Negativo',2);
INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, EsitoTampone, ID_Farmacia) VALUES ('Giacomino', 'Pilopino', 'giacc@gmail.com','GNOPNOLX12HJ', '3334566654','2022-08-26','11:30','Negativo',1);
INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, TipoTampone, EsitoTampone, ID_Farmacia, ID_Tampone) VALUES ('Gino', 'Pino', 'gino@gmail.com','GNOPNOLX12HJ', '3333233212','2022-08-26','11:00','Rapido','Negativo',1,1);
INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, TipoTampone, EsitoTampone, ID_Farmacia, ID_Tampone) VALUES ('Ciccio', 'Verde', 'cicc@gmail.com','GMOVRELX13HJ', '3332355789','2022-08-26','11:15','Molecolare','Negativo',2,1);
INSERT INTO Prenotazioni (Nome, Cognome, Email, CodiceFiscale, Telefono, Giorno, Ora, TipoTampone, EsitoTampone, ID_Farmacia, ID_Tampone) VALUES ('Giacomino', 'Pilopino', 'giacc@gmail.com','GNOPNOLX12HJ', '3334566654','2022-08-26','11:30','Rapido','Negativo',1,2);

INSERT INTO Farmacie (NomeFarmacia, Citta, CAP, Email, PWD) VALUES ('Don Bosco','Napoli','80001','donbosco@farmacia.it','prova1');
INSERT INTO Farmacie (NomeFarmacia, Citta, CAP, Email, PWD) VALUES ('Mastrelia','Napoli','80001','mastrelia@farmacia.it','prova2');
INSERT INTO Farmacie (NomeFarmacia, Citta, CAP, Indirizzo, Email, PWD) VALUES ('Don Bosco','Napoli','80001','Via Roma 1','donbosco@farmacia.it','prova1');
INSERT INTO Farmacie (NomeFarmacia, Citta, CAP, Indirizzo, Email, PWD) VALUES ('Mastrelia','Napoli','80001','Corso Garibaldi 56','mastrelia@farmacia.it','prova2');

INSERT INTO Pazienti (Nome, Cognome, Email, PWD, CodiceFiscale, Telefono) VALUES ('Gino', 'Pino', 'gino@gmail.com', 'prova1','GNOPNOLX12HJ', '3333233212');
INSERT INTO Pazienti (Nome, Cognome, Email, PWD, CodiceFiscale, Telefono) VALUES ('Ciccio', 'Verde', 'cicc@gmail.com', 'prova2','GMOVRELX13HJ', '3332355789');
Expand Down
4 changes: 4 additions & 0 deletions templates/AdminView/creaFarmacia.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<label for="CAP">CAP</label>
<input type="text" class="form-control" name="CAP" placeholder="CAP" value="{{ request.form['CAP'] }}" required>
</div>
<div class="form-group">
<label for="Indirizzo">Indirizzo</label>
<input type="text" class="form-control" name="Indirizzo" placeholder="Indirizzo della Farmacia" value="{{ request.form['Indirizzo'] }}" required>
</div>
<div class="form-group">
<label for="Email">Email</label>
<input type="email" class="form-control" name="Email" placeholder="Email della Farmacia"
Expand Down
2 changes: 2 additions & 0 deletions templates/AdminView/dashboardAdmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<th scope="col">Nome Farmacia</th>
<th scope="col">Città</th>
<th scope="col">CAP</th>
<th scope="col">Indirizzo</th>
<th scope="col">Email</th>
<th scope="col">PWD</th>
</tr>
Expand All @@ -132,6 +133,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<td>{{ farmacia.NomeFarmacia }}</td>
<td>{{ farmacia.Citta }}</td>
<td>{{ farmacia.CAP }}</td>
<td>{{ farmacia.Indirizzo }}</td>
<td>{{ farmacia.Email }}</td>
<td>{{ farmacia.PWD }}</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions templates/AdminView/listaFarmacie.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<th scope="col">Nome Farmacia</th>
<th scope="col">Città</th>
<th scope="col">CAP</th>
<th scope="col">Indirizzo</th>
<th scope="col">Email</th>
<th scope="col">PWD</th>
</tr>
Expand All @@ -78,6 +79,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<td>{{ farmacia.NomeFarmacia }}</td>
<td>{{ farmacia.Citta }}</td>
<td>{{ farmacia.CAP }}</td>
<td>{{ farmacia.Indirizzo }}</td>
<td>{{ farmacia.Email }}</td>
<td>{{ farmacia.PWD }}</td>
</tr>
Expand Down
20 changes: 20 additions & 0 deletions templates/AdminView/modificaFarmacia.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
Modifica informazioni di una Farmacia </span></b></h2>
</div>

<div class="d-flex justify-content-center mt-3">
{% if msg != "" %}
{% block content %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ msg }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endblock content %}
{% endif %}
</div>

<div class="container">
<div class="container-sm m-5">
<div class="d-flex justify-content-center mt-5">
Expand All @@ -75,6 +88,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<th scope="col">NomeFarmacia </th>
<th scope="col">Città</th>
<th scope="col">CAP</th>
<th scope="col">Indirizzo</th>
<th scope="col">Email</th>
<th scope="col">PWD</th>
<th scope="col">Azione</th>
Expand Down Expand Up @@ -104,6 +118,12 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
value="{{ farmacia.CAP }}" required>
</div>
</td>
<td>
<div class="form-group mr-1">
<input type="text" class="form-control" name="Indirizzo" placeholder="Indirizzo della Farmacia"
value="{{ farmacia.Indirizzo }}" required>
</div>
</td>
<td>
<div class="form-group mr-1">
<input type="email" class="form-control" name="Email" placeholder="Email"
Expand Down
15 changes: 15 additions & 0 deletions templates/AdminView/rimozioneFarmacia.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
Rimozione di una Farmacia </span></b></h2>
</div>

<div class="d-flex justify-content-center mt-3">
{% if msg != "" %}
{% block content %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ msg }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endblock content %}
{% endif %}
</div>

<div class="container">
<table class="table">
<thead>
Expand All @@ -73,6 +86,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<th scope="col">Nome Farmacia</th>
<th scope="col">Città</th>
<th scope="col">CAP</th>
<th scope="col">Indirizzo</th>
<th scope="col">Email</th>
<th scope="col">PWD</th>
<th scope="col">Azione</th>
Expand All @@ -85,6 +99,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<td>{{ farmacia.NomeFarmacia }}</td>
<td>{{ farmacia.Citta }}</td>
<td>{{ farmacia.CAP }}</td>
<td>{{ farmacia.Indirizzo }}</td>
<td>{{ farmacia.Email }}</td>
<td>{{ farmacia.PWD }}</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="/dashboardFarmacia">Dashboard</a>
<a class="nav-link" href="/dashboardFarmacia"><i class="fa fa-tachometer" aria-hidden="true"></i> Dashboard </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Creazione esito tamponi<span class="sr-only">(current)</span></a>
<a class="nav-link" href="#"><i class="fa fa-plus" aria-hidden="true"></i> Aggiungi esito tamponi <span class="sr-only">(current)</span></a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="/logout">Logout</a>
<a class="nav-link" href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i> Logout </a>
</li>
</ul>
</div>
Expand Down Expand Up @@ -78,7 +78,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
</thead>
<tbody>
{% for prenotazione in prenotazioni %}
<form action="/{{ prenotazione.ID }}/creazioneEsitoTamponi" method="POST">
<form action="/{{ prenotazione.ID }}/aggiuntaEsitoTamponi" method="POST">
<tr>
<th scope="row">{{ prenotazione.ID }}</th>
<td>{{ prenotazione.Nome }}</td>
Expand Down
20 changes: 18 additions & 2 deletions templates/FarmaciaView/checkQRCode.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<div class="d-flex justify-content-center m-5">
<center>
<h4><p style="color: #006eff;"> Risultato della scansione </p></h4>
<div id="result"></div>
<div class = "m-4" id="result"></div>
</center>
</div>

Expand Down Expand Up @@ -163,10 +163,26 @@ <h6 class="text-uppercase fw-bold mb-4 text-primary">SOURCE CODE</h6>


<!--JavaScript-->
<!--QRCode Script-->
<script src="/static/html5-qrcode.min.js"></script>
<script type="text/javascript">
function onScanSuccess(qrCodeMessage) {
document.getElementById('result').innerHTML = '<h5 class="alert alert-success" role="alert" style="font-family: sans-serif;"><i class="fa fa-check" aria-hidden="true"> Prenotazione riconosciuta - Nome: Cognome: </i></h5>';
"{% for prenotazione in prenotazioni %}"
var id = "{{ prenotazione.ID }}"
if (id == qrCodeMessage) {
var nome = "{{ prenotazione.Nome }}"
var cognome = "{{ prenotazione.Cognome }}"
document.getElementById('result').innerHTML = '\
<h7 class="alert alert-success" role="alert">\
<i class="fa fa-check" aria-hidden="true"></i> Prenotazione <b>nr. ' + qrCodeMessage + '</b> \
riconosciuta - Nome: ' + nome +' Cognome: ' + cognome + ' </h7>';
} else {
document.getElementById('result').innerHTML = '\
<h7 class="alert alert-danger" role="alert">\
<i class="fa fa-check" aria-hidden="true"></i> Prenotazione <b>nr. ' + qrCodeMessage + '</b> \
NON riconosciuta </h7>';
}
"{% endfor %}"
}
function onScanError(errorMessage) {
//handle scan error
Expand Down
6 changes: 3 additions & 3 deletions templates/FarmaciaView/creazioneDisponibilitaTamponi.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
Creazione disponibilità tamponi</span></b></h2>
<h7>Aggiungi disponibilità dei tamponi nel sistema e aggiorna <b>la disponibilità</b> giornaliera per la somministrazione del tampone. <br>
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> Puoi aggiungere nuovi tamponi qualora siano arrivati in magazzino nuovi tamponi da <b>altre case produttici</b>. <br>
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> Puoi aggiungere nuovi tamponi qualora siano arrivati in magazzino da <b>altre case produttici</b>. <br>
Se la casa produttice dei tamponi è già presente nel sistema, vai in <b>modifica disponibilità tamponi</b></h7>
</center>
</div>
Expand Down Expand Up @@ -100,7 +100,7 @@ <h5>Disponibilità tampone molecolare <span
</div>
<div class="form-group">
<label for="N_pezzi">Numero pezzi</label>
<input type="text" class="form-control" name="N_pezzi" placeholder="N_pezzi"
<input type="number" class="form-control" name="N_pezzi" placeholder="N_pezzi"
value="{{ request.form['N_pezzi'] }}" required>
<small id="npezziHelp" class="form-text text-muted"><b><i class="fa fa-exclamation-circle" aria-hidden="true"></i> ATTENZIONE:</b> quando aggiorni la disponibilità dei tamponi tieni d'occhio il contatore della disponibilità. Puoi aggiornare il numero dei pezzi in funzione di esso.</small>
</div>
Expand All @@ -122,7 +122,7 @@ <h5>Disponibilità tampone molecolare <span
</div>
<div class="form-group">
<label for="Prezzo">Prezzo €</label>
<input type="text" class="form-control" name="Prezzo" placeholder="Prezzo" value="{{ request.form['Prezzo'] }}"
<input type="number" class="form-control" name="Prezzo" placeholder="Prezzo" value="{{ request.form['Prezzo'] }}"
required>
</div>
<div class="form-group text-center mt-3">
Expand Down
28 changes: 11 additions & 17 deletions templates/FarmaciaView/dashboardFarmacia.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</h2>
</li>
<li class="nav-item">
<a class="nav-link" href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i> Logout</a>
<a class="nav-link" href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i> Logout </a>
</li>
</ul>
</div>
Expand All @@ -67,49 +67,41 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
</center>
<div class="d-flex justify-content-center">
<center><a href="#listaprenotati" class="btn btn-primary m-3" role="button">
&#9989 Vai alla lista prenotati della giornata</a></center>
&#9989 Vai alla lista prenotati della giornata </a></center>
<center><a href="/checkQRCode" class="btn btn-primary m-3" role="button">
<i class="fa fa-qrcode" aria-hidden="true"></i> Check QR Code</a></center>
<i class="fa fa-qrcode" aria-hidden="true"></i> Check QR Code </a></center>
</div>
</div>

<div class="container">
{% for totaleRap in totaleRapido %}
{% if totaleRap.TOT < 5 %}
{% if totaleRapido['TOT'] < 5 %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>ATTENZIONE!</strong> Si necessitano di tamponi <b>RAPIDI</b> in magazzino.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
{% endfor %}

{% for totaleMol in totaleMolecolare %}
{% if totaleMol.TOT < 5 %}
{% if totaleMolecolare['TOT'] < 5 %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>ATTENZIONE!</strong> Si necessitano di tamponi <b>MOLECOLARI</b> in magazzino.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
{% endfor %}
</div>

<div class="container">
<div class="row">
<div class="col-sm">
{% for totaleRap in totaleRapido %}
<h5 style="text-align: right;">Disponibilità tampone rapido <span
class="badge badge-pill badge-success">{{totaleRap.TOT}}</span></h3>
{% endfor %}
class="badge badge-pill badge-success">{{ totaleRapido['TOT'] }}</span></h3>
</div>
<div class="col-sm">
{% for totaleMol in totaleMolecolare %}
<h5>Disponibilità tampone molecolare <span
class="badge badge-pill badge-danger">{{totaleMol.TOT}}</span></h3>
{% endfor %}
class="badge badge-pill badge-danger">{{ totaleMolecolare['TOT'] }}</span></h3>
</div>
</div>
</div>
Expand All @@ -121,7 +113,7 @@ <h5>Disponibilità tampone molecolare <span
<span class="badge badge-pill badge-danger mb-3">Gestione esito tamponi</span>
<h5 class="card-title">&#10010 Aggiornare esito tampone</h5>
<p class="card-text">Aggiornamento esito tamponi rapidi e/o molecolari ai prenotati </p>
<a href="/creazioneEsitoTamponi" class="card-link text-danger">&#8594 Accedi</a>
<a href="/aggiuntaEsitoTamponi" class="card-link text-danger">&#8594 Accedi</a>
</div>
</div>
<div class="card border-primary m-3" style="max-width: 18rem;">
Expand Down Expand Up @@ -193,6 +185,7 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<th scope="col">Telefono</th>
<th scope="col">Giorno</th>
<th scope="col">Ora</th>
<th scope="col">Tipo Tampone</th>
<th scope="col">Esito</th>
</tr>
</thead>
Expand All @@ -207,10 +200,11 @@ <h2 class="text-center" style="margin: 25px;"><b><span style="color: #006eff;">
<td>{{ prenotazione.Telefono }}</td>
<td>{{ prenotazione.Giorno }}</td>
<td>{{ prenotazione.Ora }}</td>
<td>{{ prenotazione.TipoTampone }}</td>
<td>{{ prenotazione.EsitoTampone }}</td>
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
</div>
</div>
Expand Down
Loading

0 comments on commit 5251ace

Please sign in to comment.