From c2ef469d5d731b8d0cbeb04ac29e6a8df6cc5f3d Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 27 Oct 2024 13:11:42 +0000 Subject: [PATCH] Finance dashboard (#600) * Enable commas for float thousands separation * Add new invoice dashboard template * Add new view controller for finance dashboard * Add finance dashboard to dropdown * Update finance URLs to put dashboard at index route * Add payment methods to generated sample data * Flip 'outstanding' and 'waiting' cards on dashboard to match order in dropdown Also made them link to their respective lists and fixed low text contrast --------- Co-authored-by: FreneticScribbler --- PyRIGS/settings.py | 2 + .../commands/generateSampleRIGSData.py | 2 +- RIGS/templates/base_rigs.html | 1 + RIGS/templates/invoice_dashboard.html | 105 ++++++++++++++++++ RIGS/urls.py | 3 +- RIGS/views/finance.py | 72 +++++++++++- 6 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 RIGS/templates/invoice_dashboard.html diff --git a/PyRIGS/settings.py b/PyRIGS/settings.py index 20d1ac1f..5116440a 100644 --- a/PyRIGS/settings.py +++ b/PyRIGS/settings.py @@ -224,6 +224,8 @@ USE_L10N = True USE_TZ = True +USE_THOUSAND_SEPARATOR = True + # Need to allow seconds as datetime-local input type spits out a time that has seconds DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S') diff --git a/RIGS/management/commands/generateSampleRIGSData.py b/RIGS/management/commands/generateSampleRIGSData.py index 0f89cc07..b8331891 100644 --- a/RIGS/management/commands/generateSampleRIGSData.py +++ b/RIGS/management/commands/generateSampleRIGSData.py @@ -254,7 +254,7 @@ class Command(BaseCommand): new_invoice.void = True elif random.randint(0, 2) > 1: # 1 in 3 have been paid models.Payment.objects.create(invoice=new_invoice, amount=new_invoice.balance, - date=datetime.date.today()) + date=datetime.date.today(), method=random.choice(models.Payment.METHODS)[0]) if i == 1 or random.randint(0, 5) > 0: # Event 1 and 1 in 5 have a RA models.RiskAssessment.objects.create(event=new_event, supervisor_consulted=bool(random.getrandbits(1)), nonstandard_equipment=bool(random.getrandbits(1)), diff --git a/RIGS/templates/base_rigs.html b/RIGS/templates/base_rigs.html index 16d06ba9..68a27e8e 100644 --- a/RIGS/templates/base_rigs.html +++ b/RIGS/templates/base_rigs.html @@ -45,6 +45,7 @@ Invoices {{ todo }}