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 +++++++++++++++++++++++++++++
conf/routes | 4 +-
public/stylesheets/main.css | 16 ++++++
public/stylesheets/pepal.css | 13 +++++
6 files changed, 136 insertions(+), 5 deletions(-)
create mode 100644 app/views/pages/accountSummary.scala.html
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 |
+
+ }
+
+
+
+
+
+
+
+
+}
diff --git a/conf/routes b/conf/routes
index 732fa3f..d9d1cb1 100644
--- a/conf/routes
+++ b/conf/routes
@@ -21,9 +21,7 @@ POST /signup controllers.Profile.signupSubmit
#POST /profile controllers.Application.index
#
## Internal wallet and transactions (Pépal)
-#GET /account controllers.Application.index
-#
-#GET /transactions controllers.Application.index
+GET /account controllers.Account.summary
#
#GET /deposit controllers.Application.index
#POST /deposit controllers.Application.index
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index d96f0e7..22bf120 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -23,11 +23,27 @@ p {
margin-right: auto;
}
+.align-left {
+ text-align: left;
+}
+
+.align-right {
+ text-align: right;
+}
+
+.align-center {
+ text-align: center;
+}
+
.input-invalid {
border: 1px solid #a94442 !important;
box-shadow: inset 0 1px 3px #f79291 !important;
}
+table {
+ width: 100%;
+}
+
/***** DISCLAIMER BAR *****/
.disclaimer-bar {
diff --git a/public/stylesheets/pepal.css b/public/stylesheets/pepal.css
index 3ca71f3..bad5a08 100644
--- a/public/stylesheets/pepal.css
+++ b/public/stylesheets/pepal.css
@@ -20,3 +20,16 @@
.light-blue-bg {
background-color: #029de0;
}
+
+.income {
+ color: darkgreen;
+}
+
+.outcome {
+ color: darkred;
+}
+
+.wallet-actions a {
+ width: 100%;
+ box-sizing: border-box;
+}
--
cgit v1.2.3