diff --git a/static/styles.css b/static/styles.css
index 24e1af5..49beb93 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -598,10 +598,18 @@ video {
flex-grow: 1;
}
+.flex-row {
+ flex-direction: row;
+}
+
.flex-col {
flex-direction: column;
}
+.justify-evenly {
+ justify-content: space-evenly;
+}
+
.overflow-auto {
overflow: auto;
}
diff --git a/templates/accounts.html b/templates/accounts.html
index 7e429ae..f63fa7c 100644
--- a/templates/accounts.html
+++ b/templates/accounts.html
@@ -9,22 +9,57 @@
-
- | Description |
- Date |
- Amount |
- Category |
-
- {% for tx in transactions %}
-
- | {{tx.description}} |
- {{tx.transaction_timestamp}} |
- {{tx.amount/100}} |
- {{tx.category}} |
-
- {% endfor %}
+
+
+ | Description |
+ Date |
+ Amount |
+ Category |
+
+
+
+ {% for tx in transactions %}
+
+ | {{tx.description}} |
+ {{tx.transaction_timestamp}} |
+ {{tx.amount/100}} |
+ {{tx.category}} |
+
+ {% endfor %}
+
-
Loaded {{n_txs}} transactions
+
+
+
+
+
+
+
+
{% endblock body %}
diff --git a/templates/accounts_add_txs.html b/templates/accounts_add_txs.html
index 805610d..7dcf8cd 100644
--- a/templates/accounts_add_txs.html
+++ b/templates/accounts_add_txs.html
@@ -28,19 +28,19 @@
['None', null],
['Date dd/mm/yyyy', el => {
let split = el.split('/');
- return new Date(
+ return new Date(Date.UTC(
parseInt(split[2], 10),
- parseInt(split[1], 10),
+ parseInt(split[1], 10)-1,
parseInt(split[0], 10),
- );
+ ));
}],
['Date yyyy/mm/dd', el => {
let split = el.split('/');
- return new Date(
+ return new Date(Date.UTC(
parseInt(split[0], 10),
- parseInt(split[1], 10),
+ parseInt(split[1], 10)-1,
parseInt(split[2], 10),
- );
+ ));
}],
['Description', el => el],
['Amount', el => parseFloat(el)]
diff --git a/webserver/src/routes/ui/account.rs b/webserver/src/routes/ui/account.rs
index 2194f59..225431c 100644
--- a/webserver/src/routes/ui/account.rs
+++ b/webserver/src/routes/ui/account.rs
@@ -16,7 +16,8 @@ use accounters::models::{transaction::TxConflictResolutionMode, Account, Transac
#[derive(Deserialize)]
pub struct AccountViewParams {
- movements: Option,
+ entries: Option,
+ page: Option,
}
pub async fn list(
@@ -24,7 +25,7 @@ pub async fn list(
State(tmpls): State>,
uid: UserToken,
Path(account_id): Path,
- Query(AccountViewParams { movements }): Query,
+ Query(AccountViewParams { entries, page }): Query,
) -> impl IntoResponse {
let mut ctx = Context::new();
@@ -47,11 +48,14 @@ pub async fn list(
);
}
+ let n_entries = entries.unwrap_or(10).max(10);
+ let page = page.unwrap_or(0).max(0);
+
let txs = match Transaction::list(
db.as_ref(),
account.get_id(),
- movements.unwrap_or(10),
- 0,
+ n_entries,
+ n_entries * page,
false,
)
.await
@@ -68,7 +72,10 @@ pub async fn list(
ctx.insert("account", &account);
ctx.insert("transactions", &txs);
- ctx.insert("n_txs", &txs.len());
+ ctx.insert("prev_page", &((page - 1).max(0)));
+ ctx.insert("curr_page", &page);
+ ctx.insert("next_page", &(page + 1));
+ ctx.insert("n_entries", &(n_entries));
(
StatusCode::OK,