Skip to content

Commit

Permalink
card verify system update
Browse files Browse the repository at this point in the history
  • Loading branch information
vcardoneit committed Oct 25, 2023
1 parent 000a45a commit 3a296b6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
50 changes: 34 additions & 16 deletions autenticazione/templates/verifycode.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
{% extends "base.html" %}
{% load static %}
<!-- Jupiter - Vincenzo Cardone (vcardone.it) - GNU General Public License v3.0 - https://github.com/vcardoneit/jupiter -->
<!doctype html>
<html lang="it">

{% block content %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Croce Rossa Italiana</title>
<link href="{% static 'bootstrap.min.css' %}" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="{% static 'favicon.ico' %}">
<link rel="manifest" href="{% static 'manifest.webmanifest' %}" />
</head>

<body style="background-color: #e7e7e7" class="p-4">

{% if errore %}
<div class="row justify-content-center m-4"><div class="col-lg-3 alert alert-danger text-center" role="alert"><h1>{{ errore }}</h1><br><p>Croce Rossa Italiana - Comitato di Avola<br>Via Santa Lucia 86<br>96012 Avola (SR)<br>Email: avola@cri.it</p></div></div>
{% endif %}
<div class="row justify-content-center">
<div class="col-lg-3 text-center rounded-4" role="alert" style="background-color: white;">
<img src="{% static 'logo_v_r.png' %}" class="img-thumbnail border-0 mb-4" style="max-width:70%">

{% if donatore %}
<div class="row justify-content-center m-4">
<div class="col-lg-3 alert alert-success text-center" role="alert">
<h1>Tessera valida!</h1><br>
<p><b>Numero Tessera:</b> {{ donatore.tessera }}<br><b>Donatore:</b> {{ donatore.nome }} {{ donatore.cognome }}<br><b>Data di nascita:</b> {{ donatore.datadinascita|date:"d/m/Y" }}</p>
<br>
<p>Croce Rossa Italiana - Comitato di Avola<br>Via Santa Lucia 86<br>96012 Avola (SR)<br>Email: avola@cri.it</p>
</div>
</div>
{% endif %}
{% if donatore %}
<h2>Tessera valida!</h2><br>
<p><b>Numero Tessera:</b> {{ donatore.tessera }}<br><b>Donatore:</b> {{ donatore.nome }} {{ donatore.cognome }}<br><b>Data di nascita:</b> {{ donatore.datadinascita|date:"d/m/Y" }}<br>{% if ultimaDonazione %}<b>Ultima donazione:</b> {{ ultimaDonazione.data }}{% else %}<br><b>!! Nessuna donazione effettuata !!</b>{% endif %}</p>
{% endif %}

{% endblock %}
{% if errore %}
<h2>{{ errore }}</h2><br>
{% endif %}

<p>Via Santa Lucia 86<br>96012 Avola (SR)<br>Email: avola@cri.it</p>
</div>
</div>

<script src="{% static 'bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'popper.min.js' %}"></script>
<script src="{% static 'bootstrap.min.js' %}"></script>
</body>

</html>
7 changes: 6 additions & 1 deletion autenticazione/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from donatori.models import donatori
from donazioni.models import donazioni


@login_required
Expand Down Expand Up @@ -49,6 +50,10 @@ def requestOk(request):
def verifyqr(request, verifycode):
if donatori.objects.filter(qrverify=verifycode).exists():
donatore = donatori.objects.get(qrverify=verifycode)
return render(request, "verifycode.html", {'donatore': donatore})
if donazioni.objects.filter(donatore=donatore.tessera).exists():
ultimaDonazione = donazioni.objects.filter(donatore=donatore.tessera).latest('data')
return render(request, "verifycode.html", {'donatore': donatore, 'ultimaDonazione': ultimaDonazione})
else:
return render(request, "verifycode.html", {'donatore': donatore})
else:
return render(request, "verifycode.html", {'errore': "Tessera non valida!"})
Binary file added main/static/logo_v_r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3a296b6

Please sign in to comment.