From f90cd0da3eda7c1723ce4de439f64334c81db712 Mon Sep 17 00:00:00 2001
From: Pacien TRAN-GIRARD
Date: Sun, 8 Feb 2015 17:06:58 +0100
Subject: Implement account summary page
---
app/controllers/Account.scala | 17 +++++-
app/views/fragments/accountInfos.scala.html | 2 +-
app/views/pages/accountSummary.scala.html | 89 +++++++++++++++++++++++++++++
3 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 app/views/pages/accountSummary.scala.html
(limited to 'app')
diff --git a/app/controllers/Account.scala b/app/controllers/Account.scala
index ff1d44d..7557ef1 100644
--- a/app/controllers/Account.scala
+++ b/app/controllers/Account.scala
@@ -14,6 +14,21 @@ import scala.concurrent.Future
import models._
-object Account {
+object Account extends Controller {
+
+ def summary = Auth { implicit request =>
+ if (request.account.isEmpty) {
+ Redirect(routes.Authentication.login())
+ .flashing("error" -> "Authentication required")
+ } else {
+
+ DB.withSession { implicit session =>
+ val userUuid = request.account.get.userUuid
+ val transactions = Tables.Transactions.filter(_.userUuid === userUuid).sortBy(_.transactionDate.desc).run
+
+ Ok(views.html.pages.accountSummary(transactions))
+ }
+ }
+ }
}
diff --git a/app/views/fragments/accountInfos.scala.html b/app/views/fragments/accountInfos.scala.html
index 887e485..60c3583 100644
--- a/app/views/fragments/accountInfos.scala.html
+++ b/app/views/fragments/accountInfos.scala.html
@@ -7,7 +7,7 @@
Logout
-
+
@account.equity €
diff --git a/app/views/pages/accountSummary.scala.html b/app/views/pages/accountSummary.scala.html
new file mode 100644
index 0000000..3a10d3d
--- /dev/null
+++ b/app/views/pages/accountSummary.scala.html
@@ -0,0 +1,89 @@
+@(transactions: Seq[Tables.Transaction])(implicit request: AuthRequest[AnyContent], flash: Flash, token: play.filters.csrf.CSRF.Token)
+
+@templates.pepal("Account summary")(request.account) {
+
+
+ @fragments.pepalMainActions()
+
+
+
+
+
+
+
+
My wallet
+
+
+
+
+ Account summary |
+
+
+
+
+
+ Balance |
+ @request.account.get.balance € |
+
+
+
+ Available funds |
+ @request.account.get.equity € |
+
+
+
+
+
+
+
+
+
+
+
+
+
Transaction history
+
+
+
+
+
+ Date |
+ Amount |
+ Label |
+
+
+
+
+ @for(transaction <- transactions) {
+
+ @transaction.transactionDate |
+ @transaction.amount
+ € |
+ @transaction.label |
+
+ }
+
+
+
+
+
+
+
+
+}
--
cgit v1.2.3