Commit f410645402471f70e01867a7d7c76a36b8366277
1 parent
a11f2895d6
Exists in
master
tanggal pada ussd dan sms index
Showing 3 changed files with 11 additions and 4 deletions Side-by-side Diff
lib/modem-dashboard/router-ussd.js
... | ... | @@ -9,10 +9,15 @@ const router = express.Router(); |
9 | 9 | module.exports = router; |
10 | 10 | |
11 | 11 | function pageIndex(req, res, next) { |
12 | + if (!req.query.input_date) { | |
13 | + req.query.input_date = moment().format('YYYY-MM-DD'); | |
14 | + } | |
15 | + | |
12 | 16 | res.render( |
13 | 17 | 'ussd.index.html', |
14 | 18 | { |
15 | - page_title: 'Histori USSD' | |
19 | + page_title: 'Histori USSD', | |
20 | + input_date: req.query.input_date | |
16 | 21 | } |
17 | 22 | ) |
18 | 23 | } |
... | ... | @@ -20,7 +25,7 @@ function pageIndex(req, res, next) { |
20 | 25 | function pageDataTables(req, res, next) { |
21 | 26 | const db = localDb.getConnection(); |
22 | 27 | |
23 | - const created_date = moment().format('YYYY-MM-DD'); | |
28 | + const created_date = req.query.input_date || moment().format('YYYY-MM-DD'); | |
24 | 29 | const query = "SELECT rowid, * FROM ussd WHERE created_date = ? ORDER BY created DESC, rowid DESC"; |
25 | 30 | db.all(query, created_date, function (err, rows) { |
26 | 31 | if (err) { |
lib/modem-dashboard/views/date-selector.html
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <div class="form-group"> |
5 | 5 | <label for="inputDate" class="col-sm-2 control-label">Tanggal:</label> |
6 | 6 | <div class="col-sm-3"> |
7 | - <input type="date" class="form-control" id="inputDate" placeholder="Tanggal" name="inputDate" value="{{ input_date }}"> | |
7 | + <input type="date" class="form-control" id="inputDate" placeholder="Tanggal" name="input_date" value="{{ input_date }}"> | |
8 | 8 | </div> |
9 | 9 | </div> |
10 | 10 |
lib/modem-dashboard/views/ussd.index.html
... | ... | @@ -8,6 +8,8 @@ |
8 | 8 | |
9 | 9 | {% block content %} |
10 | 10 | |
11 | +{% include "date-selector.html" %} | |
12 | + | |
11 | 13 | <table id="smsHistory" class="display table table-hover table-striped"> |
12 | 14 | <thead> |
13 | 15 | <tr> |
... | ... | @@ -32,7 +34,7 @@ |
32 | 34 | <script> |
33 | 35 | $(document).ready(function() { |
34 | 36 | $('#smsHistory').DataTable( { |
35 | - "ajax": "/ussd/datatables", | |
37 | + "ajax": "/ussd/datatables?input_date={{ input_date}}", | |
36 | 38 | "language": { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Indonesian.json" }, |
37 | 39 | "columns": [ |
38 | 40 | { "data": "rowid" }, |