From 8f4bc8f11c6cb70d7adb0cee73225494062d5918 Mon Sep 17 00:00:00 2001 From: oscar Date: Sun, 14 Sep 2025 19:25:38 +0300 Subject: [PATCH] editable date and amount --- static/app.js | 18 +++++++++++++++++- templates/index.html | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/static/app.js b/static/app.js index 37cce30..d1bb891 100644 --- a/static/app.js +++ b/static/app.js @@ -33,4 +33,20 @@ document.addEventListener('DOMContentLoaded', () => { if (bill) bill.addEventListener('change', () => onKindChange('bill')); if (xfer) xfer.addEventListener('change', () => onKindChange('transfer')); onKindChange((xfer && xfer.checked) ? 'transfer' : 'bill'); -}); \ No newline at end of file + + // inline edit toggles + document.querySelectorAll('[data-edit]').forEach(btn => { + btn.addEventListener('click', () => { + const id = btn.getAttribute('data-edit'); + const row = document.getElementById(`edit-row-${id}`); + if (row) row.style.display = row.style.display === 'none' ? '' : 'none'; + }); + }); + document.querySelectorAll('[data-cancel-edit]').forEach(btn => { + btn.addEventListener('click', () => { + const id = btn.getAttribute('data-cancel-edit'); + const row = document.getElementById(`edit-row-${id}`); + if (row) row.style.display = 'none'; + }); + }); +}); diff --git a/templates/index.html b/templates/index.html index 9d8322a..3918d4f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -94,7 +94,7 @@ {% for e in entries %} - + {{ e.created_at|human_time }} {{ e.kind }} {{ A if e.payer=='A' else B }} @@ -106,8 +106,35 @@ {{ currency }}{{ '%.2f'|format(e.delta) }} -
- +
+ + + + +
+ + + + +
+
+ + +
+
+ + +
+ {% if e.kind == 'bill' %} +
+ + +
+ {% endif %} +
+ + +