diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 96bce55..e41f301 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..9bcef28 100644 --- a/config/settings.py +++ b/config/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.humanize', 'core', ] @@ -179,4 +180,4 @@ if EMAIL_USE_SSL: # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' \ No newline at end of file diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index b221b6f..b0be599 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index d422696..0cae82c 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index fca06b7..28f5090 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0004_payrollrecord.py b/core/migrations/0004_payrollrecord.py new file mode 100644 index 0000000..f02c761 --- /dev/null +++ b/core/migrations/0004_payrollrecord.py @@ -0,0 +1,26 @@ +# Generated by Django 5.2.7 on 2026-02-03 17:44 + +import django.db.models.deletion +import django.utils.timezone +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0003_project_is_active_team_is_active_worker_is_active'), + ] + + operations = [ + migrations.CreateModel( + name='PayrollRecord', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateField(default=django.utils.timezone.now)), + ('amount', models.DecimalField(decimal_places=2, max_digits=10)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('work_logs', models.ManyToManyField(related_name='paid_in', to='core.worklog')), + ('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payroll_records', to='core.worker')), + ], + ), + ] diff --git a/core/migrations/__pycache__/0004_payrollrecord.cpython-311.pyc b/core/migrations/__pycache__/0004_payrollrecord.cpython-311.pyc new file mode 100644 index 0000000..45a2daf Binary files /dev/null and b/core/migrations/__pycache__/0004_payrollrecord.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 6ddeb3f..4b96c36 100644 --- a/core/models.py +++ b/core/models.py @@ -2,6 +2,7 @@ from django.db import models from django.core.validators import MinValueValidator from decimal import Decimal from django.contrib.auth.models import User +from django.utils import timezone class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') @@ -54,4 +55,14 @@ class WorkLog(models.Model): notes = models.TextField(blank=True) def __str__(self): - return f"{self.date} - {self.project.name}" \ No newline at end of file + return f"{self.date} - {self.project.name}" + +class PayrollRecord(models.Model): + worker = models.ForeignKey(Worker, on_delete=models.CASCADE, related_name='payroll_records') + date = models.DateField(default=timezone.now) + amount = models.DecimalField(max_digits=10, decimal_places=2) + work_logs = models.ManyToManyField(WorkLog, related_name='paid_in') + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"Payment to {self.worker.name} on {self.date}" diff --git a/core/templates/base.html b/core/templates/base.html index 3393d4f..b795b33 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -3,7 +3,7 @@ - {% block title %}LabourFlow - Work & Payroll{% endblock %} + {% block title %}Fox Fitt - Work & Payroll{% endblock %} {% if project_description %} {% endif %} @@ -23,7 +23,7 @@
+ {% if messages %} +
+ {% for message in messages %} + + {% endfor %} +
+ {% endif %} + {% block content %}{% endblock %}
- + \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index ff32edd..d35183c 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} -{% load static %} +{% load static humanize %} -{% block title %}Dashboard | LabourFlow{% endblock %} +{% block title %}Dashboard | Fox Fitt{% endblock %} {% block content %}
@@ -21,43 +21,44 @@
-
- + +
-
+
+
+
+

Outstanding Payments

+

R {{ outstanding_total|intcomma }}

+
+
+ +
+
+ View details → +
+
+
+
+
+
+

Paid (Last 60 Days)

+

R {{ recent_payments_total|intcomma }}

+
+
+ +
+
+
+
+
+

Active Workers

{{ workers_count }}

-
- -
-
-
-
-
-
-
-
-

Projects

-

{{ projects_count }}

-
-
- -
-
-
-
-
-
-
-
-

Teams

-

{{ teams_count }}

-
-
- +
+
@@ -66,6 +67,34 @@
+ +
+

Project Costs (Active)

+ {% if project_costs %} +
+ + + + + + + + + {% for p in project_costs %} + + + + + {% endfor %} + +
Project NameTotal Labor Cost
{{ p.name }}R {{ p.cost|intcomma }}
+
+ {% else %} +

No cost data available for active projects.

+ {% endif %} +
+ +

Recent Daily Logs

@@ -109,6 +138,9 @@

Quick Links