From 3643e34304f6126637e49b439d6001ff065ec9e3 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 18 Dec 2025 21:16:30 +0545 Subject: [PATCH] feat(finance): add expense management endpoints This update introduces new endpoints for expense management in the finance API, complementing the existing invoice functionality. The changes include new URL routes for listing and creating expenses, along with minor formatting improvements to the URL configuration file. **New Features:** - Added `/expenses/` endpoint for listing expenses - Added `/expenses/create/` endpoint for creating new expenses **Enhancements & Refinements:** - Removed trailing whitespace and blank lines in `urls.py` for improved code consistency - Reorganized imports to place Django imports first, followed by local imports ``` --- src/api/finance/urls.py | 3 +- templates/productivity/dashboard.html | 115 +++++++++++++++++++++ templates/productivity/note_form.html | 47 +++++++++ templates/productivity/note_list.html | 51 +++++++++ templates/productivity/timeentry_form.html | 87 ++++++++++++++++ templates/productivity/timeentry_list.html | 73 +++++++++++++ 6 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 templates/productivity/dashboard.html create mode 100644 templates/productivity/note_form.html create mode 100644 templates/productivity/note_list.html create mode 100644 templates/productivity/timeentry_form.html create mode 100644 templates/productivity/timeentry_list.html diff --git a/src/api/finance/urls.py b/src/api/finance/urls.py index fc2e4f0..d5d5dd5 100644 --- a/src/api/finance/urls.py +++ b/src/api/finance/urls.py @@ -1,15 +1,14 @@ from django.urls import path + from . import views urlpatterns = [ path("", views.finance_dashboard, name="finance_dashboard"), - # Invoices path("invoices/", views.invoice_list, name="invoice_list"), path("invoices/create/", views.invoice_create, name="invoice_create"), path("invoices//edit/", views.invoice_edit, name="invoice_edit"), path("invoices//delete/", views.invoice_delete, name="invoice_delete"), - # Expenses path("expenses/", views.expense_list, name="expense_list"), path("expenses/create/", views.expense_create, name="expense_create"), diff --git a/templates/productivity/dashboard.html b/templates/productivity/dashboard.html new file mode 100644 index 0000000..0f68e51 --- /dev/null +++ b/templates/productivity/dashboard.html @@ -0,0 +1,115 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Productivity Dashboard

+ +
+ + +
+
+
Recent Notes
+
{{ recent_notes|length }}
+
Last {{ recent_notes|length }} notes
+
+ +
+
Recent Time Entries
+
{{ recent_time_entries|length }}
+
Tracked sessions
+
+ +
+
Tracked Hours (Recent)
+
{{ total_tracked_hours|floatformat:2 }}
+
From recent entries
+
+
+ +
+ +
+
+

Recent Notes

+ View All +
+
+ {% for note in recent_notes %} +
+
+
+

{{ note.title }}

+

+ {{ note.created_at|date:"M d, Y H:i" }} +

+
+ Edit +
+

+ {{ note.content }} +

+
+ {% empty %} +

No notes yet.

+ {% endfor %} +
+
+ + +
+
+

Recent Time Entries

+ View All +
+
+ + + + + + + + + + + + {% for entry in recent_time_entries %} + + + + + + + + {% empty %} + + + + {% endfor %} + +
DescriptionProjectTaskStartDuration
{{ entry.description }} + {% if entry.project %}{{ entry.project.name }}{% else %}-{% endif %} + + {% if entry.task %}{{ entry.task.title }}{% else %}-{% endif %} + + {{ entry.start_time|date:"M d, Y H:i" }} + + {% if entry.duration %}{{ entry.duration }}{% else %}-{% endif %} +
No time entries yet.
+
+
+
+
+
+{% endblock %} + + diff --git a/templates/productivity/note_form.html b/templates/productivity/note_form.html new file mode 100644 index 0000000..0234978 --- /dev/null +++ b/templates/productivity/note_form.html @@ -0,0 +1,47 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

+ {% if note %}Edit Note{% else %}New Note{% endif %} +

+
+ +
+
+ {% csrf_token %} + +
+ + +
+ +
+ + +
+ +
+ Cancel + +
+
+
+
+
+{% endblock %} + + diff --git a/templates/productivity/note_list.html b/templates/productivity/note_list.html new file mode 100644 index 0000000..e8a3e89 --- /dev/null +++ b/templates/productivity/note_list.html @@ -0,0 +1,51 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Notes

+ New Note +
+ +
+ {% if notes %} +
+ {% for note in notes %} +
+
+
+

{{ note.title }}

+

{{ note.content }}

+
+
+ + {{ note.updated_at|date:"M d, Y H:i" }} + +
+ Edit +
+ {% csrf_token %} + +
+
+
+
+
+ {% endfor %} +
+ {% else %} +

No notes yet. Create your first note!

+ {% endif %} +
+
+
+{% endblock %} + + diff --git a/templates/productivity/timeentry_form.html b/templates/productivity/timeentry_form.html new file mode 100644 index 0000000..e6e1fec --- /dev/null +++ b/templates/productivity/timeentry_form.html @@ -0,0 +1,87 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

+ {% if time_entry %}Edit Time Entry{% else %}Log Time{% endif %} +

+
+ +
+
+ {% csrf_token %} + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+ +
+ + +
+
+ +
+ Cancel + +
+
+
+
+
+{% endblock %} + + diff --git a/templates/productivity/timeentry_list.html b/templates/productivity/timeentry_list.html new file mode 100644 index 0000000..5f0a2ac --- /dev/null +++ b/templates/productivity/timeentry_list.html @@ -0,0 +1,73 @@ +{% extends "shared/base.html" %} +{% load static %} + +{% block content %} +{% include "shared/navbar.html" %} + +
+
+
+

Time Entries

+ Log Time +
+ +
+
+ + + + + + + + + + + + + + {% for entry in time_entries %} + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
DescriptionProjectTaskStartEndDurationActions
{{ entry.description }} + {% if entry.project %}{{ entry.project.name }}{% else %}-{% endif %} + + {% if entry.task %}{{ entry.task.title }}{% else %}-{% endif %} + + {{ entry.start_time|date:"M d, Y H:i" }} + + {% if entry.end_time %}{{ entry.end_time|date:"M d, Y H:i" }}{% else %}In Progress{% endif %} + + {% if entry.duration %}{{ entry.duration }}{% else %}-{% endif %} + +
+ Edit +
+ {% csrf_token %} + +
+
+
No time entries yet.
+
+
+
+
+{% endblock %} + +