-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuser-dashboard.php
303 lines (293 loc) · 16.1 KB
/
user-dashboard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<?php
require_once('connect-db.php');
session_start();
if(!isset($_SESSION['idNo'])){
header("location: authenticate.html#login");
}
else{
$selectBalance = "SELECT * FROM wallet where User_ID = {$_SESSION['idNo']}";
$balanceSelectQuery = $con->query($selectBalance);
if($balanceSelectQuery->num_rows>0){
$balanceData = $balanceSelectQuery->fetch_array();
$_SESSION['wallet-balance'] = $balanceData['WalletBalance'];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>User Dashboard</title>
<link rel="icon" type="image/png" href="./images/blue-coin.png">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="css/materialize.css" media="screen,projection" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body style="display:flex; min-height: 100vh; flex-direction: column;">
<nav>
<div class="nav-wrapper top-nav">
<div style="margin-top: 5px;" class="img-hold">
<a href="user-dashboard.php" class="brand-logo"><img src="./images/p2p-logo-white-resize.png"></a>
</div>
<!--Menu Trigger on Small Screen-->
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="user-dashboard.php">Dashboard</a></li>
<li><a href="feedback.php">Suggestions & Complaints</a></li>
<li><a class="dropdown-trigger user-name" href="#" data-target="dropdown1"><?php echo $_SESSION['FName'][0];?><i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
<!-- Drop Down Links -->
<ul id="dropdown1" class="dropdown-content">
<li><a href="./user-profile.php">My Profile<i class="material-icons left">account_circle</i></a></li>
<li><a href="./user-settings.php">Settings<i class="material-icons left">settings</i></a></li>
<li class="divider"></li>
<li><a href="./logout.php">Logout<i class="material-icons left">power_settings_new</i></a></li>
</ul>
<!-- Smaller Screen Menu -->
<ul class="sidenav" id="mobile-demo">
<li><a href="./wallet.php">Wallet<i class="fas fa-wallet left"></i></a></li>
<li><a href="./lend.php">Lend Money<i class="fas fa-hand-holding-usd left"></i></a></li>
<li><a href="./borrow.php">Borrow Money<i class="fas fa-exchange-alt"></i></a></li>
<li><a href="./user-settings.php">Manage Settings<i class="fas fa-cog left"></i></a></li>
<li><a href="./feedback.php">Feedback<i class="fas fa-comment-alt left"></i></a></li>
<li><a href="./wallet.phpcent-transactions">Recent Transactions<i class="fas fa-history left"></i></a></li>
<li><a href="./logout.php">Logout<i class="fas fa-power-off left"></i></a></li>
</ul>
<main style="flex:1 0 auto;">
<div class="white container user-options">
<div class="row" style="padding: 5px 0px;">
<div class="col s4 m4 l4" style="border-right: 1px solid rgba(46,62,79,0.48);">
<div class="row">
<div class="col s12 m12 l12">
<div class="center">
<img src="./images/wallet.png" alt="deposit-icon" class="responsive-img">
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div class="btn-hold center">
<a href="./wallet.php" class="waves-effect waves-light btn ">Deposit</a>
</div>
</div>
</div>
</div>
<div class="col s4 m4 l4" style="border-right: 1px solid rgba(46,62,79,0.48);">
<div class="row">
<div class="col s12 m12 l12">
<div class="center">
<img src="./images/borrow-1.png" alt="borrow-icon" class="responsive-img">
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div class="btn-hold center">
<a href="lend.php" class="waves-effect waves-light btn ">Lend</a>
</div>
</div>
</div>
</div>
<div class="col s4 m4 l4">
<div class="row">
<div class="col s12 m12 l12">
<div class="center">
<img src="./images/loan.png" alt="loan-icon" class="responsive-img">
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div class="btn-hold center">
<a href="./borrow.php" class="waves-effect waves-light btn ">Borrow</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m4 l3 hide-on-med-and-down">
<div class="container">
<span class="grey-text" style="text-transform: uppercase;">Summary</span>
<ul>
<li class="super-list">Payments
<div> </div>
<div class="divider"></div>
<ul class="sublists">
<li><a href="./wallet.php">Deposit</a></li>
<div class="divider"></div>
<li><a href="./wallet.php">Withdraw</a></li>
<div class="divider"></div>
<div> </div>
</ul>
</li>
<li class="super-list">Lend
<div> </div>
<div class="divider"></div>
<ul class="sublists">
<li><a href="./lend.php">Lend Money</a></li>
<div class="divider"></div>
<div> </div>
</ul>
</li>
<li class="super-list">Borrow
<div> </div>
<div class="divider"></div>
<ul class="sublists">
<li><a href="./borrow.php">Borrow Money</a></li>
<div class="divider"></div>
</ul>
</li>
<div> </div>
<li class="super-list">Account History
<div> </div>
<div class="divider"></div>
<ul class="sublists">
<li><a href="wallet.php#recent-transactions">Transaction History</a></li>
<div class="divider"></div>
</ul>
</li>
</ul>
</div>
</div>
<div class="col s12 m12 l9">
<div class="row">
<div class="col s12 m12 l12 center">
<div class="card" id="last-transact-container" style="padding:10px 15px;">
<div class="row">
<div class="col s12 m12 l12">
<div class="center-align card-title">
<span id="card-head">Last Transaction</span>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div class="container">
<div class="row" id="tr-header">
<div class="col s3 m3 l3">
<span>Transaction ID</span>
</div>
<div class="col s3 m3 l3">
<span>Time Stamp</span>
</div>
<div class="col s3 m3 l3">
<span>Amount</span>
</div>
<div class="col s3 m3 l3">
<span>Transaction Type</span>
</div>
</div>
<div class="row tr-body">
<?php
$selectTransactionSQL = "SELECT * FROM transactions WHERE User_ID ={$_SESSION['idNo']} ORDER BY TimeStamp DESC LIMIT 1";
$selectTransaction = $con->query($selectTransactionSQL);
if($selectTransaction->num_rows>0){
$tRow = $selectTransaction->fetch_array();
echo "<div class='col s3 m3 l3>";
echo "<span class='tr-values'>".$tRow['TID']."</span>";
echo "</div>";
echo "<div class='col s3 m3 l3>";
echo "<span class='tr-values'>".$tRow['TimeStamp']."</span>";
echo "</div>";
echo "<div class='col s3 m3 l3>";
echo "<span class='tr-values'>".$tRow['Amount']."</span>";
echo "</div>";
echo "<div class='col s3 m3 l3>";
echo "<span class='tr-values>".$tRow['TransactionType']."</span>";
echo "</div>";
}
else{
echo "<span style='font-size:22px; font-weight:600;'>You don't have any transactions</span>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<ul class="collapsible popout">
<li class="active">
<div class="collapsible-header" style="background-color: rgb(46,62,79); color: #25BB9B;">Your
Money</div>
<div class="collapsible-body">
<table class="stripped reponsive-table popup-table">
<tbody>
<!-- <tr>
<td>Amount on Loan</td>
<td class="account-data">Ksh. 1022</td>
</tr>
<tr>
<td>Amount Owed</td>
<td class="account-data">Ksh. 20020</td>
</tr> -->
<tr>
<td>Wallet Balance</td>
<td class="account-data"><?php echo "Ksh. ".$_SESSION['wallet-balance'];?></td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
</div>
</div>
<div> </div>
<div> </div>
<div class="row">
<div class="col s12 m12 l12">
<ul class="collapsible popout">
<li>
<div class="collapsible-header" style="background-color: rgb(46,62,79); color: #25BB9B;">
Your Account History
</div>
<div class="collapsible-body">
<table class="popup-table">
<tbody>
<tr>
<td>No. of times you've borrowed money</td>
<td class="account-data"><?php echo $_SESSION['bCount'];?> times</td>
</tr>
<tr>
<td>No. of times you've loaned out money</td>
<td class="account-data"><?php echo $_SESSION['lCount'];?> times</td>
</tr>
</tbody>
</table>
<a href="wallet.php#recent-transactions">View more details on my transactions</a>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div class="divider"></div>
</div>
</div>
</main>
<footer class="black lighten-2 page-footer" style="text-align:center; padding: 10px;">
<!-- <div class="center-align container" id="foot-logo">
<img src="./images/p2p-blue-new-layout.png" alt="company-logo">
</div> -->
<div class=" center-align container">
© 2018 StrathFund
</div>
</footer>
<script type="text/javascript" src="js/materialize.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>