From 58c824ec7cd42a6b310d9027ac500ae98ac79779 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Sat, 12 Mar 2022 22:31:06 +0100
Subject: [PATCH] Add invoic edue date field

---
 .../tezor/migrations/0002_invoice_due_date.py  | 18 ++++++++++++++++++
 aleksis/apps/tezor/models/invoice.py           |  1 +
 .../tezor/templates/tezor/invoice/full.html    |  8 ++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 aleksis/apps/tezor/migrations/0002_invoice_due_date.py

diff --git a/aleksis/apps/tezor/migrations/0002_invoice_due_date.py b/aleksis/apps/tezor/migrations/0002_invoice_due_date.py
new file mode 100644
index 0000000..373f9dc
--- /dev/null
+++ b/aleksis/apps/tezor/migrations/0002_invoice_due_date.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.12 on 2022-03-12 21:25
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('tezor', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='invoice',
+            name='due_date',
+            field=models.DateField(null=True, verbose_name='Payment due date'),
+        ),
+    ]
diff --git a/aleksis/apps/tezor/models/invoice.py b/aleksis/apps/tezor/models/invoice.py
index 3ea79e3..c67e29d 100644
--- a/aleksis/apps/tezor/models/invoice.py
+++ b/aleksis/apps/tezor/models/invoice.py
@@ -55,6 +55,7 @@ class Invoice(BasePayment, PureDjangoModel):
     )
 
     number = models.CharField(verbose_name=_("Invoice number"), max_length=255)
+    due_date = models.DateField(verbose_name=_("Payment due date"), null=True)
 
     for_content_type = models.ForeignKey(ContentType, on_delete=models.SET_NULL, null=True)
     for_object_id = models.PositiveIntegerField()
diff --git a/aleksis/apps/tezor/templates/tezor/invoice/full.html b/aleksis/apps/tezor/templates/tezor/invoice/full.html
index a40e62f..345aed9 100644
--- a/aleksis/apps/tezor/templates/tezor/invoice/full.html
+++ b/aleksis/apps/tezor/templates/tezor/invoice/full.html
@@ -78,6 +78,14 @@
                   {{ object.get_status_display }}
                 </td>
               </tr>
+              <tr>
+                <td>
+                  <i class="material-icons iconify" data-icon="mdi:calendar-end"></i>
+                </td>
+                <td>
+                  {{ object.due_date }}
+                </td>
+              </tr>
             </table>
           </div>
           {% if object.status == "waiting" or object.status == "rejected" or object.status == "input" and can_do_payment %}
-- 
GitLab