2024-02-19 23:51:18 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
{% block title %}Account {{account.account_name}}{% endblock title %}
|
|
|
|
|
{% block body %}
|
2024-03-18 23:04:48 +01:00
|
|
|
<div class="flex">
|
|
|
|
|
<span class="text-lg grow">{{account.account_name}}</span>
|
|
|
|
|
<div>
|
|
|
|
|
<a href="/accounts/id/{{account.account_id}}/transactions/add">+</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-05-15 13:30:59 +02:00
|
|
|
<div class="mb-4">
|
|
|
|
|
<h2>Net amount</h2>
|
|
|
|
|
<div class="ars-input">
|
|
|
|
|
<label>
|
2024-05-16 22:32:05 +02:00
|
|
|
<span>Dates</span>
|
|
|
|
|
<button style="float: right;" class="ars-button" onclick="onDateChange(event)">Update</button>
|
|
|
|
|
<input id="amount-date-range" />
|
2024-05-15 13:30:59 +02:00
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="height: 400px; width: 800px; position: relative;">
|
|
|
|
|
<canvas id="amount-trend"></canvas>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<h2>Last transactions</h2>
|
2024-05-22 19:11:54 +02:00
|
|
|
<a class="ars-button" href="/accounts/id/{{account.account_id}}/transactions">More</a>
|
2024-04-24 23:20:37 +02:00
|
|
|
<table width="100%">
|
2024-03-20 20:26:28 +01:00
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2024-04-24 23:20:37 +02:00
|
|
|
<th width="40%">Description</th>
|
|
|
|
|
<th width="20%">Date</th>
|
|
|
|
|
<th width="10%">Amount</th>
|
|
|
|
|
<th width="10%">Acc</th>
|
|
|
|
|
<th width="15%">Category</th>
|
|
|
|
|
<th width="5%">Link</th>
|
2024-03-20 20:26:28 +01:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{% for tx in transactions %}
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{tx.description}}</td>
|
2024-04-24 23:20:37 +02:00
|
|
|
<td>{{tx.tx_date}}</td>
|
2024-03-20 20:26:28 +01:00
|
|
|
<td>{{tx.amount/100}}</td>
|
2024-04-24 23:20:37 +02:00
|
|
|
<td>{{tx.accumulated/100}}</td>
|
|
|
|
|
<td>{% if tx.category %}{{categories[tx.category]}}{% endif %}</td>
|
|
|
|
|
<td><a href="/transaction/{{ tx.transaction_id }}">Go to</a></td>
|
2024-03-20 20:26:28 +01:00
|
|
|
</tr>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tbody>
|
2024-02-19 23:51:18 +01:00
|
|
|
</table>
|
|
|
|
|
</div>
|
2024-03-20 20:26:28 +01:00
|
|
|
<style>
|
|
|
|
|
table {
|
|
|
|
|
border-spacing: 0.2rem;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2024-05-15 13:30:59 +02:00
|
|
|
<script src="https://cdn.jsdelivr.net/npm/litepicker/dist/litepicker.js"></script>
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
2024-03-20 20:26:28 +01:00
|
|
|
<script>
|
2024-05-15 13:30:59 +02:00
|
|
|
function onDateChange(e) {
|
2024-05-16 22:32:05 +02:00
|
|
|
let date_val = document.getElementById('amount-date-range').value.split(' - ');
|
|
|
|
|
|
|
|
|
|
let params = new URLSearchParams(window.location.search);
|
|
|
|
|
params.set('from', date_val[0]);
|
|
|
|
|
params.set('to', date_val[1]);
|
|
|
|
|
window.location.search = params.toString();
|
2024-05-15 13:30:59 +02:00
|
|
|
}
|
|
|
|
|
|
2024-03-20 20:26:28 +01:00
|
|
|
function onSelect(e) {
|
2024-05-16 22:32:05 +02:00
|
|
|
let params = new URLSearchParams(window.location.search);
|
2024-03-20 20:26:28 +01:00
|
|
|
params.set("entries", e.target.value);
|
|
|
|
|
window.location.search = params.toString();
|
|
|
|
|
}
|
2024-05-15 13:30:59 +02:00
|
|
|
|
|
|
|
|
const dateEl = document.getElementById('amount-date-range');
|
|
|
|
|
|
|
|
|
|
const picker = new Litepicker({
|
|
|
|
|
element: dateEl,
|
|
|
|
|
singleMode: false,
|
|
|
|
|
maxDate: new Date(),
|
|
|
|
|
startDate: "{{date_from}}",
|
|
|
|
|
endDate: "{{date_to}}"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function formatDate(date) {
|
|
|
|
|
return date.substr(0, date.indexOf('T'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data = [
|
|
|
|
|
{% for txag in tx_agg -%}
|
|
|
|
|
{x: formatDate("{{txag.tx_date}}"), y: {{txag.accumulated/100}} },
|
|
|
|
|
{% endfor %}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const ctx = document.getElementById('amount-trend');
|
|
|
|
|
|
|
|
|
|
const chart = new Chart(ctx, {
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: {
|
|
|
|
|
datasets: [{label: 'Account', data: data}],
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-03-20 20:26:28 +01:00
|
|
|
</script>
|
2024-02-19 23:51:18 +01:00
|
|
|
{% endblock body %}
|
|
|
|
|
|