mirror of
https://github.com/Lyxminxx/jast.git
synced 2026-10-11 12:51:51 +02:00
Ready for production deployment
This commit is contained in:
commit
e06c56e76e
23 files changed
+664
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Edit Transaction</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; }
|
||||
button { background: #3b82f6; color: white; padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; }
|
||||
.cancel { background: #e4e4e7; color: black; text-decoration: none; padding: 8px 16px; border-radius: 4px; display: inline-block; margin-left: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Editing: {{ transaction.title }}</h2>
|
||||
<div class="card">
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Save Changes</button>
|
||||
<a href="{% url 'home' %}" class="cancel">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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>
|
||||
</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>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Add Transaction</h3>
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Save Transaction</button>
|
||||
</form>
|
||||
</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 %}
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>DIME Statistics</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<style>
|
||||
body { font-family: system-ui, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; }
|
||||
.nav { margin-bottom: 20px; }
|
||||
.nav a { background: #e4e4e7; color: black; text-decoration: none; padding: 8px 16px; border-radius: 4px; font-weight: bold; }
|
||||
.filters { margin-bottom: 30px; display: flex; gap: 10px; }
|
||||
.filters a { padding: 6px 12px; border-radius: 4px; text-decoration: none; border: 1px solid #d4d4d8; color: black; }
|
||||
.filters a.active { background: #18181b; color: white; border-color: #18181b; }
|
||||
.chart-container { position: relative; height: 400px; width: 100%; margin-top: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="nav">
|
||||
<a href="{% url 'home' %}">← Back to Tracker</a>
|
||||
</div>
|
||||
|
||||
<h1>Spending Statistics</h1>
|
||||
|
||||
<div class="filters">
|
||||
<a href="?filter=week" class="{% if current_filter == 'week' %}active{% endif %}">Last 7 Days</a>
|
||||
<a href="?filter=month" class="{% if current_filter == 'month' %}active{% endif %}">Last 30 Days</a>
|
||||
<a href="?filter=year" class="{% if current_filter == 'year' %}active{% endif %}">Last 365 Days</a>
|
||||
<a href="?filter=all" class="{% if current_filter == 'all' %}active{% endif %}">All Time</a>
|
||||
</div>
|
||||
|
||||
<div class="chart-container">
|
||||
<canvas id="categoryChart"></canvas>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Parse the JSON data passed from Django
|
||||
const labels = JSON.parse('{{ labels|safe }}');
|
||||
const data = JSON.parse('{{ data|safe }}');
|
||||
|
||||
const ctx = document.getElementById('categoryChart').getContext('2d');
|
||||
|
||||
if (data.length === 0) {
|
||||
ctx.font = "16px system-ui";
|
||||
ctx.fillText("No expenses logged for this time period.", 10, 50);
|
||||
} else {
|
||||
new Chart(ctx, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Amount Spent (kr)',
|
||||
data: data,
|
||||
// A simple color palette
|
||||
backgroundColor: ['#ef4444', '#3b82f6', '#10b981', '#f59e0b', '#8b5cf6', '#ec4899', '#14b8a6'],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: { position: 'right' }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user