mirror of
https://github.com/Lyxminxx/jast.git
synced 2026-10-11 20:57:43 +02:00
redesign, added user system, added api endpoints
This commit is contained in:
1 parent
2c76e1df78
commit
72b8e569aa
17 files changed
+782
-99
No files matched your search
+53
-43
@@ -1,25 +1,30 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>DIME Tracker</title>
|
||||
<style>
|
||||
body { font-family: system-ui, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; }
|
||||
.card { background: #f4f4f5; padding: 20px; border-radius: 8px; margin-bottom: 30px; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { padding: 12px; border-bottom: 1px solid #e4e4e7; text-align: left; }
|
||||
.income { color: #16a34a; font-weight: bold; }
|
||||
.expense { color: #dc2626; }
|
||||
button { background: #18181b; color: white; padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; }
|
||||
.btn-edit { background: #3b82f6; color: white; text-decoration: none; padding: 6px 12px; border-radius: 4px; font-size: 14px; margin-right: 5px; }
|
||||
.btn-delete { background: #ef4444; color: white; padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>JAST</title>
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Just another spending tracker</h1>
|
||||
<div style="margin-bottom: 20px;">
|
||||
<h2>Total Balance: {{ total_balance|floatformat:2 }} kr</h2>
|
||||
<a href="{% url 'stats' %}" style="background: #e4e4e7; color: black; text-decoration: none; padding: 8px 16px; border-radius: 4px; font-weight: bold;">View Statistics 📊</a>
|
||||
|
||||
<nav class="navbar">
|
||||
<a href="{% url 'home' %}" class="navbar-brand">JAST</a>
|
||||
<div class="navbar-actions">
|
||||
<a href="{% url 'stats' %}" class="btn btn-stats">View Statistics 📊</a>
|
||||
<form action="{% url 'logout' %}" method="POST" style="display:inline;" onsubmit="return confirm('Are you sure you want to log out?');">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-logout">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="header-section">
|
||||
<h1>Hello, {% if user.first_name %}{{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}!</h1>
|
||||
<p class="balance-text">Total Balance: <strong>{{ total_balance|floatformat:2 }} kr</strong></p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>Add Transaction</h3>
|
||||
<form method="POST">
|
||||
@@ -30,32 +35,37 @@
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Title</th>
|
||||
<th>Category</th>
|
||||
<th>Amount</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
{% for t in transactions %}
|
||||
<tr>
|
||||
<td>{{ t.date }}</td>
|
||||
<td>{{ t.title }}</td>
|
||||
<td>{{ t.category.name|default:"-" }}</td>
|
||||
<td class="{% if t.is_income %}income{% else %}expense{% endif %}">
|
||||
{{ t.amount }} kr
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'edit_transaction' t.pk %}" class="btn-edit">Edit</a>
|
||||
<form action="{% url 'delete_transaction' t.pk %}" method="POST" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this transaction?');">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn-delete">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="5">No transactions yet. Start spending!</td></tr>
|
||||
{% endfor %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Title</th>
|
||||
<th>Category</th>
|
||||
<th>Amount</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in transactions %}
|
||||
<tr>
|
||||
<td>{{ t.date }}</td>
|
||||
<td>{{ t.title }}</td>
|
||||
<td>{{ t.category.name|default:"-" }}</td>
|
||||
<td class="{% if t.is_income %}income{% else %}expense{% endif %}">
|
||||
{{ t.amount }} kr
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'edit_transaction' t.pk %}" class="btn-edit">Edit</a>
|
||||
<form action="{% url 'delete_transaction' t.pk %}" method="POST" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this transaction?');">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn-delete">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="5">No transactions yet. Start spending!</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user