Commit a11f2895d65cf536bc3edeadef3d1784833a1239

Authored by Adhidarma Hadiwinoto
1 parent 73fe179e0d
Exists in master

tanggal pada sms

Showing 3 changed files with 9 additions and 4 deletions Side-by-side Diff

lib/modem-dashboard/router-sms.js
... ... @@ -9,10 +9,15 @@ const router = express.Router();
9 9 module.exports = router;
10 10  
11 11 function pageSmsIndex(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 'sms.index.html',
14 18 {
15   - page_title: 'Histori SMS'
  19 + page_title: 'Histori SMS',
  20 + input_date: req.query.input_date
16 21 }
17 22 )
18 23 }
... ... @@ -20,7 +25,7 @@ function pageSmsIndex(req, res, next) {
20 25 function pageSmsDataTables(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 sms 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="{{ inputDate }}">
  7 + <input type="date" class="form-control" id="inputDate" placeholder="Tanggal" name="inputDate" value="{{ input_date }}">
8 8 </div>
9 9 </div>
10 10  
lib/modem-dashboard/views/sms.index.html
... ... @@ -36,7 +36,7 @@
36 36 <script>
37 37 $(document).ready(function() {
38 38 $('#smsHistory').DataTable( {
39   - "ajax": "/sms/datatables",
  39 + "ajax": "/sms/datatables?input_date={{ input_date}}",
40 40 "language": { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Indonesian.json" },
41 41 "columns": [
42 42 { "data": "rowid" },