From 4db255d2f6540a225a3a3c0e99fbf8d9fcd6096d Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Tue, 30 Jan 2018 17:46:27 +0800 Subject: [PATCH] Add outlet and rider lists to hub + fix minute stepping for timepickers --- templates/hub/form.html.twig | 274 +++++++++++++++++++++-------- templates/job-order/form.html.twig | 2 +- templates/outlet/form.html.twig | 10 +- 3 files changed, 212 insertions(+), 74 deletions(-) diff --git a/templates/hub/form.html.twig b/templates/hub/form.html.twig index 5ed46295..7b78ce59 100644 --- a/templates/hub/form.html.twig +++ b/templates/hub/form.html.twig @@ -32,84 +32,109 @@ -
+
-
-
- - - -
-
-
-
- - - -
-
-
-
- - - -
-
- -
-
- -
- - - - + +
+
+
+
+ + + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
- -
-
- -
- - - - +
+
+ + + +
+
+ + + +
- -
-
- -
-
- - - -
- - - - +
+
+ + + +
+ + + + +
+
+
-
+ {% if mode == 'update' %} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% endif %}
- -
@@ -194,7 +219,15 @@ $("#m_gmap_address").keypress(function(e) { $(document).ready(function() { // timepickers - $('#timepicker_open, #timepicker_close').timepicker(); + $('#timepicker_open, #timepicker_close').timepicker({ + format: "HH:ii P", + minuteStep: 1, + showMeridian: true, + snapToStep: true, + bootcssVer: 3, + todayHighlight: true, + autoclose: true + }); // check if we need to set map {% if mode == 'update' %} @@ -268,6 +301,103 @@ $(function() { $("[data-field]").removeClass('has-danger'); $(".form-control-feedback[data-field]").addClass('hide'); } + + // initialize arrays + var outletRows = []; + var riderRows = []; + + {% for outlet in obj.getOutlets() %} + orow = { + name: "{{ outlet.getName() }}", + address: "{{ outlet.getAddress() }}", + contact_nums: '{{ outlet.getContactNumbers()|replace({"\r\n": "
"})|raw }}', + time_open: "{{ outlet.getTimeOpen()|date('g:i A') }}", + time_close: "{{ outlet.getTimeClose()|date('g:i A') }}" + }; + + outletRows.push(orow); + {% endfor %} + + {% for rider in obj.getRiders() %} + rrow = { + first_name: "{{ rider.getFirstName() }}", + last_name: "{{ rider.getLastName() }}", + contact_num: "{{ rider.getContactNumber() }}", + plate_number: "{{ rider.getPlateNumber() }}" + }; + + riderRows.push(rrow); + {% endfor %} + + // outlets data table + var outletOptions = { + data: { + type: 'local', + source: outletRows, + saveState: { + cookie: false, + webstorage: false + } + }, + columns: [ + { + field: 'name', + title: 'Name' + }, + { + field: 'address', + title: 'Address' + }, + { + field: 'contact_nums', + title: 'Contact Nos.' + }, + { + field: 'time_open', + title: 'Time Open' + }, + { + field: 'time_close', + title: 'Time Close' + } + ], + pagination: false + }; + + var outletTable = $("#data-outlets").mDatatable(outletOptions); + + // riders data table + var riderOptions = { + data: { + type: 'local', + source: riderRows, + saveState: { + cookie: false, + webstorage: false + } + }, + columns: [ + { + field: 'first_name', + title: 'First Name' + }, + { + field: 'last_name', + title: 'Last Name' + }, + { + field: 'contact_num', + title: 'Contact No.' + }, + { + field: 'plate_number', + title: 'Plate Number' + } + ], + pagination: false + }; + + var riderTable = $("#data-riders").mDatatable(riderOptions); }); {% endblock %} diff --git a/templates/job-order/form.html.twig b/templates/job-order/form.html.twig index ba19146c..1849f14d 100644 --- a/templates/job-order/form.html.twig +++ b/templates/job-order/form.html.twig @@ -625,7 +625,7 @@ $(function() { // timepicker $('.tp').timepicker({ - format: "dd M yyyy - HH:ii P", + format: "HH:ii P", minuteStep: 1, showMeridian: true, snapToStep: true, diff --git a/templates/outlet/form.html.twig b/templates/outlet/form.html.twig index 9c11bbd6..08ec8357 100644 --- a/templates/outlet/form.html.twig +++ b/templates/outlet/form.html.twig @@ -199,7 +199,15 @@ $("#m_gmap_address").keypress(function(e) { $(document).ready(function() { // timepickers - $('#timepicker_open, #timepicker_close').timepicker(); + $('#timepicker_open, #timepicker_close').timepicker({ + format: "HH:ii P", + minuteStep: 1, + showMeridian: true, + snapToStep: true, + bootcssVer: 3, + todayHighlight: true, + autoclose: true + }); // check if we need to set map {% if mode == 'update' %}