diff --git a/templates/account.html b/templates/account.html
new file mode 100644
index 0000000..6d45d1b
--- /dev/null
+++ b/templates/account.html
@@ -0,0 +1,25 @@
+{% extends 'layout.html' %}
+{% block main_content %}
+
{{ account.name }}
+{% if records %}
+
+ Name | Type | Amount | Posted | |
+ {% for record in records %}
+
+ {{ record.name }} |
+ {{ record.type }} |
+ {{ record.amount }} |
+ {{ account.posted }} |
+
+
+ |
+
+ {% endfor %}
+
+{% else %}
+ This account does not have any transactions yet
+{% endif %}
+{% endblock %}
diff --git a/templates/accounts.html b/templates/accounts.html
index fab87ba..b2c954f 100644
--- a/templates/accounts.html
+++ b/templates/accounts.html
@@ -6,7 +6,7 @@
Name | Type | Institution | Last Update | |
{% for account in accounts %}
- {{ account.name }} |
+ {{ account.name }} |
{{ account.type }} |
{{ account.source.name }} |
{{ account.last_updated }} |
diff --git a/vanth/pages/accounts.py b/vanth/pages/accounts.py
index 9b7f61d..723fe68 100644
--- a/vanth/pages/accounts.py
+++ b/vanth/pages/accounts.py
@@ -13,6 +13,12 @@ def get_accounts():
sources = vanth.platform.ofxsource.get()
return flask.render_template('accounts.html', accounts=my_accounts, sources=sources)
+@blueprint.route('/accounts//', methods=['GET'])
+def get_account(account_uuid):
+ account = vanth.platform.ofxaccount.by_uuid(account_uuid)
+ records = vanth.platform.ofxrecord.by_account(account_uuid)
+ return flask.render_template('account.html', account=account, records=records)
+
@blueprint.route('/account/', methods=['POST'])
@vanth.pages.tools.parse({
'account_id' : str,
diff --git a/vanth/platform/ofxrecord.py b/vanth/platform/ofxrecord.py
index 4369684..afff768 100644
--- a/vanth/platform/ofxrecord.py
+++ b/vanth/platform/ofxrecord.py
@@ -32,3 +32,17 @@ def ensure_exists(account, transactions):
if to_insert:
engine.execute(vanth.tables.OFXRecord.insert(), to_insert) # pylint: disable=no-value-for-parameter
LOGGER.debug("Done inserting %d records", len(new_records))
+
+def by_account(account_uuid):
+ engine = chryso.connection.get()
+ query = sqlalchemy.select([
+ vanth.tables.OFXRecord.c.amount,
+ vanth.tables.OFXRecord.c.available,
+ vanth.tables.OFXRecord.c.fid,
+ vanth.tables.OFXRecord.c.name,
+ vanth.tables.OFXRecord.c.memo,
+ vanth.tables.OFXRecord.c.posted,
+ vanth.tables.OFXRecord.c.type,
+ ]).where(vanth.tables.OFXRecord.c.ofxaccount == account_uuid)
+ rows = engine.execute(query).fetchall()
+ return [dict(row) for row in rows]