aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/Account.scala17
-rw-r--r--app/views/fragments/accountInfos.scala.html2
-rw-r--r--app/views/pages/accountSummary.scala.html89
-rw-r--r--conf/routes4
-rw-r--r--public/stylesheets/main.css16
-rw-r--r--public/stylesheets/pepal.css13
6 files changed, 136 insertions, 5 deletions
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
14import models._ 14import models._
15 15
16 16
17object Account { 17object Account extends Controller {
18
19 def summary = Auth { implicit request =>
20 if (request.account.isEmpty) {
21 Redirect(routes.Authentication.login())
22 .flashing("error" -> "Authentication required")
23 } else {
24
25 DB.withSession { implicit session =>
26 val userUuid = request.account.get.userUuid
27 val transactions = Tables.Transactions.filter(_.userUuid === userUuid).sortBy(_.transactionDate.desc).run
28
29 Ok(views.html.pages.accountSummary(transactions))
30 }
31 }
32 }
18 33
19} 34}
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 @@
7 Logout 7 Logout
8 </a> 8 </a>
9 9
10 <a class="pure-button" href="#"> 10 <a class="pure-button" href="@routes.Account.summary()">
11 <i class="fa fa-money fa-lg"></i> 11 <i class="fa fa-money fa-lg"></i>
12 @account.equity € 12 @account.equity €
13 </a> 13 </a>
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 @@
1@(transactions: Seq[Tables.Transaction])(implicit request: AuthRequest[AnyContent], flash: Flash, token: play.filters.csrf.CSRF.Token)
2
3@templates.pepal("Account summary")(request.account) {
4
5 <div class="action-buttons pure-g">
6 @fragments.pepalMainActions()
7 </div>
8
9 <br>
10
11 <div class="pure-g">
12 <div class="pure-u-1 pure-u-lg-1-4">
13 <div class="l-box">
14 <h2>My wallet</h2>
15
16 <table class="pure-table pure-table-horizontal">
17 <thead>
18 <tr>
19 <td colspan="2">Account summary</td>
20 </tr>
21 </thead>
22
23 <tbody>
24 <tr class="dark-blue">
25 <td>Balance</td>
26 <td>@request.account.get.balance €</td>
27 </tr>
28
29 <tr class="light-blue">
30 <td>Available funds</td>
31 <td>@request.account.get.equity €</td>
32 </tr>
33 </tbody>
34 </table>
35
36 <br>
37
38 <div class="pure-g wallet-actions">
39 <div class="pure-u-1 pure-u-lg-1-1">
40 <a class="pure-button" href="#">
41 <i class="fa fa-download"></i>
42 Deposit
43 </a>
44 </div>
45
46 <br><br>
47
48 <div class="pure-u-1 pure-u-lg-1-1">
49 <a class="pure-button" href="#HAHAHAHA">
50 <i class="fa fa-upload"></i>
51 Withdraw
52 </a>
53 </div>
54 </div>
55 </div>
56 </div>
57
58 <div class="pure-u-1 pure-u-lg-3-4">
59 <div class="l-box">
60 <h2>Transaction history</h2>
61
62 <table class="pure-table pure-table-horizontal">
63
64 <thead>
65 <tr>
66 <td>Date</td>
67 <td>Amount</td>
68 <td>Label</td>
69 </tr>
70 </thead>
71
72 <tbody>
73 @for(transaction <- transactions) {
74 <tr>
75 <td>@transaction.transactionDate</td>
76 <td class="align-right @if(transaction.amount >= 0) {income} else {outcome}">@transaction.amount
77 €</td>
78 <td>@transaction.label</td>
79 </tr>
80 }
81 </tbody>
82
83
84 </table>
85 </div>
86 </div>
87 </div>
88
89}
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
21#POST /profile controllers.Application.index 21#POST /profile controllers.Application.index
22# 22#
23## Internal wallet and transactions (Pépal) 23## Internal wallet and transactions (Pépal)
24#GET /account controllers.Application.index 24GET /account controllers.Account.summary
25#
26#GET /transactions controllers.Application.index
27# 25#
28#GET /deposit controllers.Application.index 26#GET /deposit controllers.Application.index
29#POST /deposit controllers.Application.index 27#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 {
23 margin-right: auto; 23 margin-right: auto;
24} 24}
25 25
26.align-left {
27 text-align: left;
28}
29
30.align-right {
31 text-align: right;
32}
33
34.align-center {
35 text-align: center;
36}
37
26.input-invalid { 38.input-invalid {
27 border: 1px solid #a94442 !important; 39 border: 1px solid #a94442 !important;
28 box-shadow: inset 0 1px 3px #f79291 !important; 40 box-shadow: inset 0 1px 3px #f79291 !important;
29} 41}
30 42
43table {
44 width: 100%;
45}
46
31/***** DISCLAIMER BAR *****/ 47/***** DISCLAIMER BAR *****/
32 48
33.disclaimer-bar { 49.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 @@
20.light-blue-bg { 20.light-blue-bg {
21 background-color: #029de0; 21 background-color: #029de0;
22} 22}
23
24.income {
25 color: darkgreen;
26}
27
28.outcome {
29 color: darkred;
30}
31
32.wallet-actions a {
33 width: 100%;
34 box-sizing: border-box;
35}