Add outlet and rider lists to hub + fix minute stepping for timepickers
This commit is contained in:
parent
d86b9f33a0
commit
4db255d2f6
3 changed files with 212 additions and 74 deletions
|
|
@ -32,39 +32,33 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('hub_update_submit', {'id': obj.getId()}) : url('hub_create_submit') }}">
|
||||
<form id="row-form" class="m-form m-form--label-align-right" method="post" action="{{ mode == 'update' ? url('hub_update_submit', {'id': obj.getId()}) : url('hub_create_submit') }}">
|
||||
|
||||
<div class="m-portlet__body">
|
||||
<ul id="customer-tabs" class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#hub-info">Hub Info</a>
|
||||
</li>
|
||||
{% if mode == 'update' %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#outlets">Outlets</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#riders">Assigned Riders</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="hub-info" role="tabpanel">
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-6">
|
||||
<label for="name" data-field="name">
|
||||
Name
|
||||
</label>
|
||||
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName() }}">
|
||||
<div class="form-control-feedback hide" data-field="name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-8">
|
||||
<label for="address" data-field="address">
|
||||
Address
|
||||
</label>
|
||||
<textarea class="form-control m-input" id="address" rows="3" name="address">{{ obj.getAddress }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="address"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-8">
|
||||
<label for="contact_nums" data-field="contact_nums">
|
||||
Contact Numbers
|
||||
</label>
|
||||
<textarea class="form-control m-input" id="contact_nums" rows="3" name="contact_nums">{{ obj.getContactNumbers }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="contact_nums"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-4">
|
||||
<div class="col-lg-3">
|
||||
<label for="time_open">
|
||||
Time Open
|
||||
</label>
|
||||
|
|
@ -76,7 +70,7 @@
|
|||
</div>
|
||||
<div class="form-control-feedback hide" data-field="time_open"></div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="col-lg-3">
|
||||
<label for="time_close">
|
||||
Time Close
|
||||
</label>
|
||||
|
|
@ -89,7 +83,22 @@
|
|||
<div class="form-control-feedback hide" data-field="time_close"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-6">
|
||||
<label for="address" data-field="address">
|
||||
Address
|
||||
</label>
|
||||
<textarea class="form-control m-input" id="address" rows="4" name="address">{{ obj.getAddress }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="address"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label for="contact_nums" data-field="contact_nums">
|
||||
Contact Numbers
|
||||
</label>
|
||||
<textarea class="form-control m-input" id="contact_nums" rows="4" name="contact_nums">{{ obj.getContactNumbers }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="contact_nums"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-12">
|
||||
<label>
|
||||
|
|
@ -108,8 +117,24 @@
|
|||
<div id="m_gmap" style="height:600px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{% if mode == 'update' %}
|
||||
<div class="tab-pane" id="outlets" role="tabpanel">
|
||||
<div class="form-group m-form__group row form-group-inner row">
|
||||
<div class="col-lg-12">
|
||||
<div id="data-outlets"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="riders" role="tabpanel">
|
||||
<div class="form-group m-form__group row form-group-inner row">
|
||||
<div class="col-lg-12">
|
||||
<div id="data-riders"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
|
|
@ -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": "<br>"})|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);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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' %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue