From 2baa947c21ee92baae7b84b98530ba42a05a00ae Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 18 Dec 2025 20:20:48 +0545 Subject: [PATCH] feat(finance): add finance dashboard and CRUD templates Add new finance dashboard with key financial metrics and recent transaction overviews. Implement invoice and expense management templates with create, edit, and list views. **New Features** - **Finance Dashboard**: Shows total income, expenses, net profit, and pending income stats - **Recent Transactions**: Displays tables for recent invoices and expenses - **Invoice Management**: - Create/edit invoice form with client, project, amount, status - Invoice list view with filtering and actions - **Expense Tracking**: - Expense creation/editing form - Expense list with category filter and delete action **Enhancements & Refinements** - Responsive grid layouts for dashboard components - Status badges with color coding for invoices - HTMX integration for delete actions in list views - Consistent styling with borders, shadows, and hover states - Quick action buttons for creating new invoices/expenses - Dynamic form titles for create/edit modes --- templates/finance/dashboard.html | 117 ++++++++++++++++++++++++++++ templates/finance/expense_form.html | 79 +++++++++++++++++++ templates/finance/expense_list.html | 55 +++++++++++++ templates/finance/invoice_form.html | 95 ++++++++++++++++++++++ templates/finance/invoice_list.html | 72 +++++++++++++++++ 5 files changed, 418 insertions(+) create mode 100644 templates/finance/expense_form.html diff --git a/templates/finance/dashboard.html b/templates/finance/dashboard.html index e69de29..2575480 100644 --- a/templates/finance/dashboard.html +++ b/templates/finance/dashboard.html @@ -0,0 +1,117 @@ +{% extends "shared/base.html" %} +{% load static %} +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Finance Dashboard

+ +
+ + +
+
+
Total Income
+
Rs.{{ total_income|floatformat:2 }}
+
Paid Invoices
+
+ +
+
Total Expenses
+
Rs.{{ total_expenses|floatformat:2 }}
+
+ +
+
Net Profit
+
Rs.{{ + net_profit|floatformat:2 }}
+
+ +
+
Pending Income
+
Rs.{{ pending_income|floatformat:2 }}
+
+
+ +
+ +
+
+

Recent Invoices

+ View All +
+
+ + + + + + + + + + + {% for invoice in invoices %} + + + + + + + {% empty %} + + + + {% endfor %} + +
NumberClientAmountStatus
#{{ invoice.invoice_number }}{{ invoice.client.name }}Rs.{{ invoice.amount|floatformat:2 }} + + {{ invoice.get_status_display }} + +
No recent invoices
+
+
+ + +
+
+

Recent Expenses

+ View All +
+
+ + + + + + + + + + + {% for expense in expenses %} + + + + + + + {% empty %} + + + + {% endfor %} + +
DescriptionCategoryAmountDate
{{ expense.description }}{{ expense.category }}Rs.{{ expense.amount|floatformat:2 }}{{ expense.date|date:"M d" }}
No recent expenses
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/finance/expense_form.html b/templates/finance/expense_form.html new file mode 100644 index 0000000..e7e5652 --- /dev/null +++ b/templates/finance/expense_form.html @@ -0,0 +1,79 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

{% if expense %}Edit Expense{% else %}Add Expense{% endif %} +

+
+ +
+
+ {% csrf_token %} + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ Cancel + +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/finance/expense_list.html b/templates/finance/expense_list.html index e69de29..9a5fff0 100644 --- a/templates/finance/expense_list.html +++ b/templates/finance/expense_list.html @@ -0,0 +1,55 @@ +{% extends "shared/base.html" %} +{% load static %} +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Expenses

+ Add Expense +
+ +
+
+ + + + + + + + + + + + {% for expense in expenses %} + + + + + + + + {% empty %} + + + + {% endfor %} + +
DescriptionCategoryAmountDateActions
{{ expense.description }}{{ expense.category }}Rs.{{ expense.amount|floatformat:2 }}{{ expense.date }} +
+ Edit + +
+
No expenses found
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/finance/invoice_form.html b/templates/finance/invoice_form.html index e69de29..c22acc0 100644 --- a/templates/finance/invoice_form.html +++ b/templates/finance/invoice_form.html @@ -0,0 +1,95 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

{% if invoice %}Edit Invoice{% else %}Create Invoice{% endif %} +

+
+ +
+
+ {% csrf_token %} + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ Cancel + +
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/finance/invoice_list.html b/templates/finance/invoice_list.html index e69de29..6d8777b 100644 --- a/templates/finance/invoice_list.html +++ b/templates/finance/invoice_list.html @@ -0,0 +1,72 @@ +{% extends "shared/base.html" %} +{% load static %} +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Invoices

+ Create Invoice +
+ +
+
+ + + + + + + + + + + + + + + {% for invoice in invoices %} + + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
Invoice #ClientProjectAmountDate IssuedDue DateStatusActions
#{{ invoice.invoice_number }}{{ invoice.client.name }} + {% if invoice.project %} + {{ invoice.project.name }} + {% else %} + - + {% endif %} + Rs.{{ invoice.amount|floatformat:2 }}{{ invoice.date_issued }}{{ invoice.due_date }} + + {{ invoice.get_status_display }} + + +
+ Edit + +
+
No invoices found
+
+
+
+
+{% endblock %} \ No newline at end of file