aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-06-23 19:05:09 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-06-23 19:05:09 +0200
commit684c019daf76b499417c85e4ea5877a96b0ddb0e (patch)
treea87fbd3ed23d41dfc1a0a1996803a1e6a6e5541a /client
parentDownload docs, better preview (diff)
downloadscout-subs-684c019daf76b499417c85e4ea5877a96b0ddb0e.tar.gz
scout-subs-684c019daf76b499417c85e4ea5877a96b0ddb0e.zip
Nicer user list, multi group support
Diffstat (limited to 'client')
-rw-r--r--client/migrations/0025_documenttype_custom_group.py18
-rw-r--r--client/models.py1
-rw-r--r--client/templates/client/approve_doc_pdf.html113
-rw-r--r--client/views.py4
4 files changed, 52 insertions, 84 deletions
diff --git a/client/migrations/0025_documenttype_custom_group.py b/client/migrations/0025_documenttype_custom_group.py
new file mode 100644
index 0000000..56c77f9
--- /dev/null
+++ b/client/migrations/0025_documenttype_custom_group.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.7 on 2020-06-23 14:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('client', '0024_auto_20200622_1930'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='documenttype',
+ name='custom_group',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/client/models.py b/client/models.py
index 105165b..4d8ae83 100644
--- a/client/models.py
+++ b/client/models.py
@@ -10,6 +10,7 @@ class DocumentType(models.Model):
auto_sign = models.BooleanField(default=False)
group_private = models.BooleanField(default=False)
group = models.ForeignKey(Group, default=None, on_delete=models.CASCADE)
+ custom_group = models.BooleanField(default=False)
personal_data = models.BooleanField(default=False)
medical_data = models.BooleanField(default=False)
custom_data = models.BooleanField(default=False)
diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html
index 4b7df8b..deabd99 100644
--- a/client/templates/client/approve_doc_pdf.html
+++ b/client/templates/client/approve_doc_pdf.html
@@ -2,98 +2,47 @@
<html>
<head>
<meta charset="utf-8">
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<title></title>
-<style>
-.center {
- text-align: center;
-}
-.left {
- text-align: left;
-}
-.right {
- text-align: right;
-}
-
-h1, h2, h3, h4, h5, h6 {
- font-weight: 400;
- line-height: 1.3;
-}
-
-h1 {
- font-size: 4.2rem;
- line-height: 110%;
- margin: 2.8rem 0 1.68rem 0;
-}
-
-h2 {
- font-size: 3.56rem;
- line-height: 110%;
- margin: 2.3733333333rem 0 1.424rem 0;
-}
-
-h3 {
- font-size: 2.92rem;
- line-height: 110%;
- margin: 1.9466666667rem 0 1.168rem 0;
-}
-
-h4 {
- font-size: 2.28rem;
- line-height: 110%;
- margin: 1.52rem 0 0.912rem 0;
-}
-
-h5 {
- font-size: 1.64rem;
- line-height: 110%;
- margin: 1.0933333333rem 0 0.656rem 0;
-}
-
-h6 {
- font-size: 1.15rem;
- line-height: 110%;
- margin: 0.7666666667rem 0 0.46rem 0;
-}
-
-.footer {
-}
-
-.content {
- margin-left: 25%;
- width: 50%;
-}
-
-table {
- border-collapse:collapse;
- margin:0px;
- padding:0;
- width:100%;
-}
-
-</style>
</head>
<body>
<main style="margin-left: 10px;margin-right: 10px;margin-top: 10px;">
- <div class="title"><h1 class="center">{{doc.code}}</h1></div>
- <div class="code"><h3 class="center">{{doc.document_type.name}}</h3></div>
- <div class="content">
- <p>Con la presente firma approvo il documento con codice {{doc.code}} accettando
- tutte le clausole apposte su di esso.
- Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento.
- </p>
+ <br><br><br><br>
+ <br><br><br><br>
+ <div class="row">
+ <h2 class="center">{{doc.code}}</h2>
+ </div>
+ <div class="row">
+ <h4 class="center">{{doc.document_type.name}}</h4>
+ </div>
+ <div class="row">
+ <div class="col s6 offset-s3">
+ <p>Con la presente firma approvo il documento con codice {{doc.code}} accettando
+ tutte le clausole apposte su di esso.
+ Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento.
+ </p>
+ </div>
</div>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
- <div class"footer">
- <table>
- <tr>
- <td><h4 class="left">Data</h4></div></td>
- <td><h4 class="right">Firma</h4></td>
- </tr>
- </table>
+ <div class="row">
+ <div class="col s4 offset-s1">
+ <div class="input-field">
+ <input type="text">
+ <span class="helper-text">Data e luogo</span>
+ </div>
+ </div>
+ <div class="col s4 offset-s2">
+ <div class="input-field">
+ <input type="text">
+ <span class="helper-text">Firma</span>
+ </div>
+ </div>
</div>
</main>
</body>
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</html> \ No newline at end of file
diff --git a/client/views.py b/client/views.py
index b43a3c9..17d9e0a 100644
--- a/client/views.py
+++ b/client/views.py
@@ -92,7 +92,7 @@ def approve(request):
if not (request.user.is_staff or request.user.has_perm('approved')):
usercode = UserCode.objects.filter(user=request.user)[0]
okay = False
- if request.user.first_name != "" and request.user.last_name != "" and request.user.email != "" and len(request.user.groups.values_list('name', flat=True)) != 0:
+ if request.user.first_name != "" and request.user.last_name != "" and request.user.email != "" and usercode.phone != "":
okay = True
context = {'code': 'U' + str(usercode.code), 'okay': okay}
return render(request, 'client/approve.html', context)
@@ -162,7 +162,7 @@ def create(request):
break
document = Document(
- user=request.user, group=group, code=code, status=status, document_type=document_type, personal_data=personal_data, medical_data=medical_data)
+ user=request.user, group=document_type.group, code=code, status=status, document_type=document_type, personal_data=personal_data, medical_data=medical_data)
document.save()
if document_type.custom_data: