-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpenses.html
388 lines (338 loc) · 26.3 KB
/
expenses.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<!DOCTYPE html>
<html lang="en">
<head>
<!--Metadata-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Amaan Kazi">
<meta name="description" content="Track your expenses">
<title>Expense Tracker</title>
<script defer src = "https://code.jquery.com/jquery-3.7.1.js"></script>
<script defer src = "https://cdn.datatables.net/2.1.5/js/dataTables.js"></script>
<script defer src = "https://cdn.datatables.net/2.1.5/js/dataTables.bootstrap5.js"></script>
<script defer src = "https://cdn.datatables.net/colreorder/2.0.4/js/dataTables.colReorder.min.js"></script>
<script defer src = "https://cdn.datatables.net/responsive/3.0.3/js/dataTables.responsive.min.js"></script>
<script defer src = "https://cdn.datatables.net/buttons/3.1.2/js/dataTables.buttons.min.js"></script>
<script defer src = "https://cdn.datatables.net/buttons/3.1.2/js/buttons.dataTables.js"></script>
<script defer src = "https://cdn.datatables.net/buttons/3.1.2/js/buttons.html5.min.js"></script>
<script defer src = "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script defer src = "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script defer src = "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel = "stylesheet" href = "https://cdn.datatables.net/2.1.5/css/dataTables.bootstrap5.css">
<link rel = "stylesheet" href = "https://cdn.datatables.net/colreorder/2.0.4/css/colReorder.dataTables.min.css">
<link rel = "stylesheet" href = "https://cdn.datatables.net/responsive/3.0.3/css/responsive.dataTables.min.css">
<link rel = "stylesheet" href = "https://cdn.datatables.net/buttons/3.1.2/css/buttons.dataTables.min.css">
<link rel = "stylesheet" href = "stylesheets/expenses.css">
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<body id = "htmlBody" data-bs-theme="dark" style="height: 100%;">
<div id = "Header" class = "fixed-top">
<nav class="navbar navbar-expand-lg shadow border-primary-subtle border-bottom border-3" style = "background-color: #4e73df;" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Expense Tracker</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="./expenses.html">Expenses</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./dashboard.html">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
</ul>
<button class = "btn border-white navbar-nav mb-2 mb-lg-0" style="margin-right: 5px; display: flex; padding-left: 6px; padding-right: 6px;" onclick="ToggleTheme()">
<svg id = "DarkThemeIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-moon-stars-fill" viewBox="0 0 16 16">
<path d="M6 .278a.77.77 0 0 1 .08.858 7.2 7.2 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277q.792-.001 1.533-.16a.79.79 0 0 1 .81.316.73.73 0 0 1-.031.893A8.35 8.35 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.75.75 0 0 1 6 .278"/>
<path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.73 1.73 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.73 1.73 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.73 1.73 0 0 0 1.097-1.097zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.16 1.16 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.16 1.16 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732z"/>
</svg>
<svg id = "LightThemeIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-brightness-high-fill" viewBox="0 0 16 16" style="display: none;">
<path d="M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0M8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0m0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13m8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5M3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8m10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0m-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0m9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707M4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708"/>
</svg>
</button>
<div class="nav-item dropdown navbar-nav">
<button id = "AccountDropdown" class="btn dropdown-toggle border-white" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{Account}
</button>
<ul class="dropdown-menu dropdown-menu-end" style="margin-top: 20px;">
<li><a class="dropdown-item" href="#">Profile</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><button class="dropdown-item text-danger" onclick="LogOut()">Log Out</button></li>
</ul>
</div>
</div>
</div>
</nav>
<div class = "container-fluid bg-secondary-subtle" style="padding: 5px;">
<div style="display: flex; justify-content: space-between; align-items: center;">
<button class = "btn" style="margin: 0px; padding: 0px;" onclick="Back()">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
</svg>
</button>
<div hidden style = "display: flex;" id = "MonthYear">
<button class="btn" style="margin-right: 5px; padding-left: 0px; padding-right: 0px;" onclick = "ChangeYM(-1)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-left-fill" viewBox="0 0 16 16">
<path d="m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z"/>
</svg>
</button>
<select id = "Year" class="form-select" style="width: 90px; margin-right: 10px;" onchange = "GetTransactions()" aria-label="Year">
<option value="0">2020</option>
<option value="1">2021</option>
<option value="2">2022</option>
<option value="3">2023</option>
<option value="4">2024</option>
<option value="5">2025</option>
<option value="6">2026</option>
<option value="7">2027</option>
<option value="8">2028</option>
<option value="9">2029</option>
</select>
<select id = "Month" class="form-select" style="width: 130px;" onchange = "GetTransactions()" aria-label="Month">
<option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select>
<button class = "btn" style="margin-left: 5px; padding-left: 0px; padding-right: 0px;" onclick = "ChangeYM(1)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-right-fill" viewBox="0 0 16 16">
<path d="m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"/>
</svg>
</button>
</div>
<button id = "NewButton" class = "btn btn-outline-primary" style = "padding-right: 10px; padding-left: 10px;" onclick="New()" data-new = "Sheet">New</button>
</div>
</div>
</div>
<script>
if (localStorage.getItem("theme") != null)
{
let theme = localStorage.getItem("theme");
document.getElementById("htmlBody").setAttribute("data-bs-theme", theme);
if(theme == "dark")
{
document.getElementById("LightThemeIcon").style.display = "none";
document.getElementById("DarkThemeIcon").style.display = "inline-block";
}
else
{
document.getElementById("LightThemeIcon").style.display = "inline-block";
document.getElementById("DarkThemeIcon").style.display = "none";
}
}
</script>
<div id = "EmptyHeader" style = "height: 83px; margin-bottom: 50px;"></div>
<div hidden id = "SheetsView" class = "container-fluid">
<div id = "NewSheetModal" class="modal fade" tabindex="-1" data-bs-backdrop = "static" data-bs-keyboard = "false">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-secondary-subtle">
<h1 class="modal-title fs-5" id="exampleModalLabel">New Sheet</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body border">
Sheet name:
<input type="text" id = "newSheetName" maxlength="20" style = "text-align: center; margin-top: 20px;" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg">
</div>
<div class="modal-footer bg-secondary-subtle">
<button type="button" class="btn btn-primary" onclick = "NewSheet()">Create</button>
</div>
</div>
</div>
</div>
</div>
<div hidden id = "TransactionsView" class = "container-fluid">
<div class = "container">
<table role = "button" id="TransactionsTable" class="table table-striped order-column table-hover table-bordered" style = "width: 100%;">
</table>
</div>
<div id = "TransactionDetailsModal" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-secondary-subtle">
<h1 class="modal-title fs-5 me-3" id="TransactionDetailsModalTitle">Transaction</h1>
<ul class="nav nav-underline">
<li class="nav-item">
<button class="nav-link active" aria-current="true" href="#" data-bs-toggle="tab" data-bs-target="#details">Details</a>
</li>
<li class="nav-item">
<button class="nav-link" href="#" data-bs-toggle="tab" data-bs-target="#info">Info</button>
</li>
</ul>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body tab-content border">
<div class = "tab-pane fade show active" id = "details">
<dl class="row" style = "margin: 0px;">
<dt class="col-sm-4">Date</dt>
<dd class="col-sm-8" id = "TransactionDetailsDate">Date</dd>
<dt class="col-sm-4">Transaction</dt>
<dd class="col-sm-8" id = "TransactionDetailsTransaction">Transaction</dd>
<dt class="col-sm-4">Category</dt>
<dd class="col-sm-8" id = "TransactionDetailsCategory">Category</dd>
<dt class="col-sm-4">Mode</dt>
<dd class="col-sm-8" id = "TransactionDetailsMode">Mode</dd>
<dt class="col-sm-4">Description</dt>
<dd class="col-sm-8" id = "TransactionDetailsDescription">Description</dd>
<dt class="col-sm-4">Amount</dt>
<dd class="col-sm-8" id = "TransactionDetailsAmount">Amount</dd>
<dt class="col-sm-4">Comments</dt>
<dd class="col-sm-8" id = "TransactionDetailsComments">Comments</dd>
</dl>
</div>
<div class = "tab-pane fade" id = "info">
<dl class="row" style = "margin: 0px;">
<dt class="col-sm-4">Transaction ID</dt>
<dd class="col-sm-8" id = "TransactionDetailsTransactionID">Transaction ID</dd>
<dt class="col-sm-4">Author</dt>
<dd class="col-sm-8" id = "TransactionDetailsAuthor">Author</dd>
<dt class="col-sm-4">Timestamp</dt>
<dd class="col-sm-8" id = "TransactionDetailsTimestamp">Timestamp</dd>
</dl>
</div>
</div>
<div class="modal-footer bg-secondary-subtle">
<button id = "deleteTransactionButton" type="button" class="btn btn-danger" onclick = "DeleteTransaction()" data-transactionId = "">Delete</button>
<button id = "updateTransactionButton" type="button" class="btn btn-primary" onclick = "UpdateTransaction()" data-transactionId = "">Update</button>
</div>
</div>
</div>
</div>
<div id = "NewTransactionModal" class="modal fade" tabindex="-1" data-bs-backdrop = "static" data-bs-keyboard = "false">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-secondary-subtle">
<h1 class="modal-title fs-5">New Transaction</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id = "NewTransactionForm" autocomplete="off">
<div class="modal-body border">
<div class = "input-group mb-3">
<div class = "form-floating" style = "max-width: 17.5%;">
<input id = "newTransactionDate" type = "number" min = "1" max = "31" class="form-control" aria-label = "Date (2 digit)" placeholder = "Transaction Date">
<label for = "newTransactionDate" class="form-label">Date</label>
</div>
<div class = "form-floating">
<input id = "newTransactionName" type = "text" maxlength = "24" class = "form-control" aria-label = "TransactionName" placeholder = "Transaction Name">
<label for = "newTransactionName" class="form-label">Transaction Name</label>
</div>
<div class = "form-floating" style = "max-width: 25%;">
<input id = "newTransactionAmount" type = "number" class = "form-control" aria-label = "Amount" placeholder = "Transaction Amount">
<label for = "newTransactionAmount" class="form-label">Amount</label>
</div>
</div>
<div class = "input-group mb-3">
<div class = "form-floating">
<select class = "form-select" id = "newTransactionCategory" name = "newTransactionCategory">
</select>
<label for = "newTransactionCategory" class = "form-label">Category</label>
</div>
<div class = "form-floating">
<select class = "form-select" id = "newTransactionMode" name = "newTransactionMode">
</select>
<label for = "newTransactionMode" class = "form-label">Mode</label>
</div>
</div>
<div class = "form-floating mb-3">
<input id = "newTransactionDescription" type = "text" maxlength = "32" class = "form-control" aria-label = "TransactionDescription" placeholder = "Transaction Description">
<label for = "newTransactionDescription" class="form-label">Description</label>
</div>
<div class = "form-floating mb-3">
<input id = "newTransactionComment" type = "text" maxlength = "32" class = "form-control" aria-label = "TransactionComment" placeholder = "Transaction Comment">
<label for = "newTransactionComment" class="form-label">Comment</label>
</div>
</div>
<div class="modal-footer bg-secondary-subtle">
<button type="submit" class="btn btn-primary">Create</button>
</div>
</form>
</div>
</div>
</div>
<div id = "UpdateTransactionModal" class="modal fade" tabindex="-1" data-bs-backdrop = "static" data-bs-keyboard = "false">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-secondary-subtle">
<h1 class="modal-title fs-5">Update Transaction</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id = "UpdateTransactionForm" autocomplete="off">
<input hidden id = "updatedTransactionId" type = "number">
<div class="modal-body border">
<div class = "input-group mb-3">
<div class = "form-floating" style = "max-width: 17.5%;">
<input id = "updatedTransactionDate" type = "number" min = "1" max = "31" class="form-control" aria-label = "Date (2 digit)" placeholder = "Transaction Date">
<label for = "updatedTransactionDate" class="form-label">Date</label>
</div>
<div class = "form-floating">
<input id = "updatedTransactionName" type = "text" maxlength = "24" class = "form-control" aria-label = "TransactionName" placeholder = "Transaction Name">
<label for = "updatedTransactionName" class="form-label">Transaction Name</label>
</div>
<div class = "form-floating" style = "max-width: 25%;">
<input id = "updatedTransactionAmount" type = "number" class = "form-control" aria-label = "Amount" placeholder = "Transaction Amount">
<label for = "updatedTransactionAmount" class="form-label">Amount</label>
</div>
</div>
<div class = "input-group mb-3">
<div class = "form-floating">
<select class = "form-select" id = "updatedTransactionCategory" name = "updatedTransactionCategory">
</select>
<label for = "updatedTransactionCategory" class = "form-label">Category</label>
</div>
<div class = "form-floating">
<select class = "form-select" id = "updatedTransactionMode" name = "updatedTransactionMode">
</select>
<label for = "updatedTransactionMode" class = "form-label">Mode</label>
</div>
</div>
<div class = "form-floating mb-3">
<input id = "updatedTransactionDescription" type = "text" maxlength = "32" class = "form-control" aria-label = "TransactionDescription" placeholder = "Transaction Description">
<label for = "updatedTransactionDescription" class="form-label">Description</label>
</div>
<div class = "form-floating mb-3">
<input id = "updatedTransactionComment" type = "text" maxlength = "32" class = "form-control" aria-label = "TransactionComment" placeholder = "Transaction Comment">
<label for = "updatedTransactionComment" class="form-label">Comment</label>
</div>
</div>
<div class="modal-footer bg-secondary-subtle">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id = "spinner" class="spinner-border" style="width: 5rem; height: 5rem; position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; margin: auto; z-index: 0;" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header bg-secondary-subtle">
<strong id = "ToastHeader" class="me-auto">Bootstrap</strong>
<small id = "ToastDetail">11 mins ago</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div id = "ToastBody" class="toast-body">
Hello, world! This is a toast message.
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script defer src="js/expenses.js"></script>
</body>
</html>