-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbudgettracker.html
314 lines (295 loc) · 11.4 KB
/
budgettracker.html
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
304
305
306
307
308
309
310
<head>
<title>Budget Tracker</title>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600' rel='stylesheet' type='text/css'>
</head>
<body role="document">
{{> main}}
</body>
<!-- Main Template -->
<template name="main">
{{#if isLoggedIn}}
<div class="navbar navbar-inverse navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Budget Tracker</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="#transactions">Transactions</a></li>
<li><a href="#categories">Categories</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">User <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#changepassword" class="changepassword">Change Password</a></li>
<li><a href="#logout" class="logout">Log Out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-offset-2 col-sm-8">
<div class="text-center">
<h1 class="title">Budget Tracker</h1>
</div>
{{> monthselection}}
{{> transactionslist}}
{{> categorieslist}}
</div>
</div>
</div>
<!-- Modal for changing password -->
<div class="modal fade in" id="changePasswordModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<form class="form-horizontal change-password">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"></button>
<h4 class="modal-title">Change Password</h4>
</div>
<div class="modal-body">
<div class="panel-body">
<div class="form-group {{getErrorClass "changepassword-oldpassword"}}" name="changepassword-oldpassword">
<label class="col-xs-5 col-sm-5 control-label">Old Password:</label>
<div class="col-xs-7 col-sm-7">
<input class="form-control oldpassword" type="password">
</div>
</div>
<div class="form-group {{getErrorClass "changepassword-newpassword"}}" name="changepassword-newpassword">
<label class="col-xs-5 col-sm-5 control-label">New Password:</label>
<div class="col-xs-7 col-sm-7">
<input class="form-control newpassword" type="password">
</div>
</div>
<div class="form-group {{getErrorClass "changepassword-confirmnewpassword"}}" name="changepassword-confirmnewpassword">
<label class="col-xs-5 col-sm-5 control-label">Confirm New Password:</label>
<div class="col-xs-7 col-sm-7">
<input class="form-control confirmnewpassword" type="password">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary" id="changepassword-submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
{{else}}
{{> signin}}
{{/if}}
</template>
<!-- Sign In Template -->
<template name="signin">
<div class="container">
<div class="row">
<div class="col-sm-offset-3 col-sm-6 col-xs-offset-1 col-xs-10">
<div id="transactions" class="panel panel-default">
<div class="panel-heading">
<div class="panel-title-advanced clearfix">
<h1 class="panel-title subtitle">Log In</h1>
</div>
</div>
<div class="panel-body">
<form class="form-horizontal login-form">
<div class="form-group">
<label class="control-label">Password:</label>
<input class="form-control password" name="password" id="password" type="password">
</div>
<div class="form-group">
<input class="btn btn-primary col-xs-offset-5" type="submit" value="Log In">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</template>
<!-- Month Selection Template -->
<template name="monthselection">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title-advanced clearfix">
<h1 class="panel-title subtitle">Month</h1>
</div>
</div>
<div class="panel-body">
<div class="text-center">
<input class="month-select" type="month" value="{{getCurrentMonth}}"/>
</div>
</div>
</div>
</template>
<!-- Transactions List Template -->
<template name="transactionslist">
<div id="transactions" class="panel panel-default">
<div class="panel-heading">
<div class="panel-title-advanced clearfix">
<h1 class="panel-title subtitle">Transactions</h1>
</div>
</div>
<div class="panel-body">
<div class="add-transaction">
<a href="#" class="btn btn-success" role="button">
<i class="glyphicon glyphicon-plus"></i>
</a>
</div>
{{#if isAddingTransaction}}
<form class="add-transaction form-horizontal">
{{#if isWithdrawal}}
<div class="form-group required">
<label class="col-xs-5 col-sm-3 control-label">Category:</label>
<div class="col-xs-7 col-sm-9">
<select class="form-control" name="category">
{{#each categories}}
<option value="{{_id}}">{{_id}}</option>
{{/each}}
</select>
</div>
</div>
{{/if}}
<div class="form-group required {{getErrorClass "transaction-amount"}}" name="transaction-amount">
<label class="col-xs-5 col-sm-3 control-label">Amount:</label>
<div class="col-xs-7 col-sm-9">
<input class="form-control" type="number" min="0.01" step="0.01" name="amount">
</div>
</div>
<div class="form-group required {{getErrorClass "transaction-date"}}" name="transaction-date">
<label class="col-xs-5 col-sm-3 control-label">Date:</label>
<div class="col-xs-7 col-sm-9">
<input class="form-control" type="date" name="date" value="{{getTodaysDateFormatted}}">
</div>
</div>
<div class="form-group">
<label class="col-xs-5 col-sm-3 control-label">Comments:</label>
<div class="col-xs-7 col-sm-9">
<input class="form-control" type="text" name="comments">
</div>
</div>
<div class="form-group required">
<label class="col-xs-5 col-sm-3 control-label">Type:</label>
<div class="col-xs-7 col-sm-9">
<select class="transaction-type form-control" name="type">
<option value="withdrawal">Withdrawal</option>
<option value="deposit">Deposit</option>
</select>
</div>
</div>
<div class="btn-group pull-right">
<input class="btn btn-primary" type="submit" value="Add">
</div>
</form>
{{/if}}
<table class="sortable table table-bordered table-striped table-hover table-condensed">
<thead>
<tr>
<th class="sort-dates">Date</th>
<th class="sort-categories">Category</th>
<th class="sort-amounts">Amount</th>
</tr>
</thead>
<tbody>
{{#each transactions}}
<tr class="transaction-row" id="{{_id}}">
<td class="col-xs-2">{{getFormattedDate}}</td>
<td class="col-xs-5">{{category_id}}
<div class="comments">
{{comments}}
</div>
</td>
<td class="col-xs-2 {{type}}">
$<span class="transaction-amount">{{getAmount}}</span>
</td>
<td class="col-xs-1 text-center">
<a href="#" class="btn btn-danger btn-xs transaction-remove" role="button">
<i class="glyphicon glyphicon-remove"></i>
</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</template>
<!-- Categories List Template -->
<template name="categorieslist">
<div id="categories" class="panel panel-default">
<div class="panel-heading">
<div class="panel-title-advanced clearfix">
<h1 class="panel-title subtitle">Categories</h1>
</div>
</div>
<div class="panel-body">
<div class="add-category">
<a href="#" class="btn btn-success" role="button">
<i class="glyphicon glyphicon-plus"></i>
</a>
</div>
{{#if isAddingCategory}}
<form class="add-category form-horizontal">
<div class="form-group required {{getErrorClass "category-name"}}" name="category-name">
<label class="col-xs-5 col-sm-3 control-label">Name:</label>
<div class="col-xs-7 col-sm-9">
<input class="form-control" type="text" name="name">
</div>
</div>
<div class="form-group required {{getErrorClass "category-amount"}}" name="category-amount">
<label class="col-xs-5 col-sm-3 control-label">Amount:</label>
<div class="col-xs-7 col-sm-9">
<input class="form-control" type="number" min="0.01" step="0.01" name="amount">
</div>
</div>
<div class="btn-group pull-right">
<input class="btn btn-primary" type="submit" value="Add">
</div>
</form>
{{/if}}
<table class="table table-bordered table-striped table-hover table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Amount</th>
<th>Used</th>
</tr>
</thead>
<tbody>
{{#each categories}}
<tr class="category-row" id="{{_id}}">
<td class="col-xs-4">{{_id}}</td>
<td class="col-xs-2">
$<span class="category-amount">{{getAmount}}</span>
</td>
<td class="col-xs-6">
<div class="progress">
<div class="progress-bar {{getProgressBarClass}}" role="progressbar" aria-valuemin="0"
aria-valuemax="100" style="min-width: 3em; width:{{getPercentUsed}}%">
${{getAmountUsedForThisMonth}}
</div>
</div>
</td>
<td class="col-xs-1 text-center">
<a href="#" class="btn btn-danger btn-xs category-remove" role="button">
<i class="glyphicon glyphicon-remove"></i>
</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</template>