-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
575 lines (561 loc) · 20.2 KB
/
Copy pathindex.html
File metadata and controls
575 lines (561 loc) · 20.2 KB
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Code Crafters G9🚀</title>
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
<!-- Font Awesome -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
/>
<link rel="shortcut icon" href="CCG9.png" type="image/x-icon">
<!-- Custom CSS -->
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container-fluid">
<header class="bg-primary text-white p-3 mb-4 rounded">
<div class="d-flex justify-content-between align-items-center">
<h1>
<i class="fas fa-code me-2"></i>Code Crafters G9 🚀 Price Tracker
</h1>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto gap-3">
<li class="nav-item">
<a class="nav-link active" style="font-weight: 700;" aria-current="page" href="#"
><i class="fas fa-home me-1"></i>Home</a
>
</li>
<li class="nav-item">
<a
class="nav-link active" style="font-weight: 700;"
href="#"
data-bs-toggle="modal"
data-bs-target="#contactModal"
><i class="fas fa-envelope me-1"></i>Contact Us</a
>
</li>
</ul>
</div>
</div>
</nav>
<div class="btn-group" role="group">
<button id="themeToggleBtn" class="btn btn-light me-2" title="Toggle light/dark theme">
<i class="fas fa-moon"></i>
</button>
<button
class="btn btn-light"
data-bs-toggle="modal"
data-bs-target="#helpModal"
>
<i class="fas fa-question-circle"></i> Help
</button>
</div>
</div>
</header>
<div class="row">
<div class="col-md-4">
<div class="card mb-4">
<div class="card-header bg-success text-white">
<h5>
<i class="fas fa-plus-circle me-2"></i>Add New Price Entry
</h5>
</div>
<div class="card-body">
<form id="priceForm">
<div class="mb-3">
<label for="productName" class="form-label"
>Product Name</label
>
<input
type="text"
class="form-control"
id="productName"
required
/>
</div>
<div class="mb-3">
<label for="supplierName" class="form-label"
>Supplier Name</label
>
<input
type="text"
class="form-control"
id="supplierName"
required
/>
</div>
<div class="mb-3">
<label for="price" class="form-label">Price ($)</label>
<input
type="number"
step="0.01"
class="form-control"
id="price"
required
/>
</div>
<div class="mb-3">
<label for="date" class="form-label">Date</label>
<input type="date" class="form-control" id="date" required />
</div>
<div class="mb-3">
<label for="quantity" class="form-label">Quantity/Unit</label>
<input
type="text"
class="form-control"
id="quantity"
placeholder="e.g., 1 kg, 500 ml"
required
/>
</div>
<button type="submit" class="btn btn-primary w-100">
<i class="fas fa-save me-2"></i>Save Entry
</button>
</form>
</div>
</div>
<div class="card mb-4">
<div class="card-header bg-info text-white">
<h5><i class="fas fa-filter me-2"></i>Filter Prices</h5>
</div>
<div class="card-body">
<div class="mb-3">
<label for="filterProduct" class="form-label"
>Product Name</label
>
<input
type="text"
class="form-control"
id="filterProduct"
placeholder="Search by product"
/>
</div>
<div class="mb-3">
<label for="filterSupplier" class="form-label"
>Supplier Name</label
>
<input
type="text"
class="form-control"
id="filterSupplier"
placeholder="Search by supplier"
/>
</div>
<div class="mb-3">
<label for="filterDate" class="form-label">Date Range</label>
<select class="form-select" id="filterDate">
<option value="all">All Time</option>
<option value="today">Today</option>
<option value="week">This Week</option>
<option value="month">This Month</option>
<option value="custom">Custom Range</option>
</select>
</div>
<div id="customDateRange" class="mb-3 d-none">
<div class="row">
<div class="col-md-6">
<label for="startDate" class="form-label">From</label>
<input type="date" class="form-control" id="startDate" />
</div>
<div class="col-md-6">
<label for="endDate" class="form-label">To</label>
<input type="date" class="form-control" id="endDate" />
</div>
</div>
</div>
<button id="applyFilter" class="btn btn-info w-100">
<i class="fas fa-filter me-2"></i>Apply Filters
</button>
<button
id="resetFilter"
class="btn btn-outline-secondary w-100 mt-2"
>
<i class="fas fa-undo me-2"></i>Reset Filters
</button>
</div>
</div>
</div>
<div class="col-md-8" >
<div class="card mb-4" style="height: 35vh;">
<div
class="card-header text-light"
style="background-color: blueviolet"
>
<h5><i class="fas fa-chart-line me-2"></i>Price Trends</h5>
</div>
<div class="card-body">
<canvas id="priceChart" height="300"></canvas>
</div>
</div>
<div class="card">
<div class="card-header bg-secondary text-white">
<div class="d-flex justify-content-between align-items-center">
<h5><i class="fas fa-list me-2"></i>Price Records</h5>
<div>
<button id="exportBtn" class="btn btn-sm btn-light me-2">
<i class="fas fa-file-export me-1"></i>Export
</button>
<!-- jsPDF for PDF export -->
<button id="deleteAllBtn" class="btn btn-sm btn-danger">
<i class="fas fa-trash me-1"></i>Clear All
</button>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Product</th>
<th>Supplier</th>
<th>Price ($)</th>
<th>Quantity</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="priceTableBody">
<!-- Data will be inserted here by JavaScript -->
</tbody>
</table>
</div>
<div id="noDataMessage" class="text-center py-4">
<i class="fas fa-info-circle fa-3x text-muted mb-3"></i>
<h5>No price records found</h5>
<p>Add your first price entry using the form on the left</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Contact Us Modal -->
<div class="modal fade" id="contactModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-success text-white">
<h5 class="modal-title">
<i class="fas fa-envelope me-2"></i>Contact Us
</h5>
<button
type="button"
class="btn-close btn-close-white"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<form id="contactForm">
<div class="mb-3">
<label for="contactName" class="form-label">Your Name</label>
<input
type="text"
class="form-control"
id="contactName"
required
/>
</div>
<div class="mb-3">
<label for="contactEmail" class="form-label">Your Email</label>
<input
type="email"
class="form-control"
id="contactEmail"
required
/>
</div>
<div class="mb-3">
<label for="contactMessage" class="form-label">Message</label>
<textarea
class="form-control"
id="contactMessage"
rows="4"
required
></textarea>
</div>
</form>
<div
id="contactSuccess"
class="alert alert-success d-none mt-3"
role="alert"
>
Thank you for contacting us! We'll get back to you soon.
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button type="submit" class="btn btn-success" form="contactForm">
Send Message
</button>
</div>
</div>
</div>
</div>
<script>
// Open Contact Us modal when nav link is clicked
document.addEventListener("DOMContentLoaded", function () {
const contactNav = document.querySelector(
'a.nav-link[href="#"]:not(.active)'
);
if (contactNav) {
contactNav.addEventListener("click", function (e) {
e.preventDefault();
const contactModal = new bootstrap.Modal(
document.getElementById("contactModal")
);
contactModal.show();
});
}
// Handle contact form submission
const contactForm = document.getElementById("contactForm");
if (contactForm) {
contactForm.addEventListener("submit", function (e) {
e.preventDefault();
document
.getElementById("contactSuccess")
.classList.remove("d-none");
contactForm.reset();
setTimeout(() => {
const modal = bootstrap.Modal.getInstance(
document.getElementById("contactModal")
);
if (modal) modal.hide();
document.getElementById("contactSuccess").classList.add("d-none");
}, 2000);
});
}
});
</script>
<!-- Edit Modal -->
<div class="modal fade" id="editModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h5 class="modal-title">Edit Price Entry</h5>
<button
type="button"
class="btn-close btn-close-white"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<form id="editForm">
<input type="hidden" id="editId" />
<div class="mb-3">
<label for="editProductName" class="form-label"
>Product Name</label
>
<input
type="text"
class="form-control"
id="editProductName"
required
/>
</div>
<div class="mb-3">
<label for="editSupplierName" class="form-label"
>Supplier Name</label
>
<input
type="text"
class="form-control"
id="editSupplierName"
required
/>
</div>
<div class="mb-3">
<label for="editPrice" class="form-label">Price ($)</label>
<input
type="number"
step="0.01"
class="form-control"
id="editPrice"
required
/>
</div>
<div class="mb-3">
<label for="editDate" class="form-label">Date</label>
<input
type="date"
class="form-control"
id="editDate"
required
/>
</div>
<div class="mb-3">
<label for="editQuantity" class="form-label"
>Quantity/Unit</label
>
<input
type="text"
class="form-control"
id="editQuantity"
required
/>
</div>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Cancel
</button>
<button type="button" class="btn btn-primary" id="saveEditBtn">
Save Changes
</button>
</div>
</div>
</div>
</div>
<!-- Help Modal -->
<div class="modal fade" id="helpModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header bg-info text-white">
<h5 class="modal-title">
<i class="fas fa-question-circle me-2"></i>Help & Instructions
</h5>
<button
type="button"
class="btn-close btn-close-white"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<h5>How to use the Price Tracker:</h5>
<ol>
<li>
<strong>Add New Price Entry:</strong> Fill in the product
details, supplier name, price, date, and quantity/unit.
</li>
<li>
<strong>View Records:</strong> All your price entries will
appear in the table and chart.
</li>
<li>
<strong>Filter Data:</strong> Use the filters to view specific
products, suppliers, or date ranges.
</li>
<li>
<strong>Edit/Delete:</strong> Click the action buttons to modify
or remove entries.
</li>
<li>
<strong>Export Data:</strong> Export your price history for
record-keeping.
</li>
</ol>
<h5 class="mt-4">Tips for Best Use:</h5>
<ul>
<li>Record prices regularly to track trends accurately</li>
<li>Use consistent product names for better filtering</li>
<li>
Compare prices from different suppliers before making purchases
</li>
<li>Watch the price chart to identify seasonal price changes</li>
</ul>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
data-bs-dismiss="modal"
>
Got it!
</button>
</div>
</div>
</div>
</div>
<!-- Confirmation Modal -->
<div class="modal fade" id="confirmModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-danger text-white">
<h5 class="modal-title">Confirm Action</h5>
<button
type="button"
class="btn-close btn-close-white"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body" id="confirmMessage">
Are you sure you want to delete this entry?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Cancel
</button>
<button type="button" class="btn btn-danger" id="confirmActionBtn">
Confirm
</button>
</div>
</div>
</div>
</div>
<footer class="bg-dark text-white py-4 mt-5">
<div class="container text-center">
<div class="mb-2">
<i class="fas fa-code me-1"></i>
<span style="font-weight: 600;"> Code Crafters G9 🚀</span> © 2025
</div>
<div>
<small>
Built with <i class="fab fa-bootstrap text-info"></i> Bootstrap,
<i class="fas fa-chart-line text-warning"></i> Chart.js,
<i class="fab fa-html5 text-danger"></i> HTML,
<i class="fab fa-css3-alt text-primary"></i> CSS,
<i class="fab fa-js-square text-warning"></i> JS.
| <a href="#" class="text-info text-decoration-underline font-weight-700" data-bs-toggle="modal" data-bs-target="#contactModal">Contact Us</a>
</small>
</div>
</div>
</footer>
<!-- Bootstrap JS Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- jsPDF for PDF export -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.28/jspdf.plugin.autotable.min.js"></script>
<!-- Custom JS -->
<script src="script.js"></script>
</body>
</html>