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,84 +32,109 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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">
|
<div class="m-portlet__body">
|
||||||
<div class="form-group m-form__group row no-border">
|
<ul id="customer-tabs" class="nav nav-tabs" role="tablist">
|
||||||
<div class="col-lg-8">
|
<li class="nav-item">
|
||||||
<label for="name" data-field="name">
|
<a class="nav-link active" data-toggle="tab" href="#hub-info">Hub Info</a>
|
||||||
Name
|
</li>
|
||||||
</label>
|
{% if mode == 'update' %}
|
||||||
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName() }}">
|
<li class="nav-item">
|
||||||
<div class="form-control-feedback hide" data-field="name"></div>
|
<a class="nav-link" data-toggle="tab" href="#outlets">Outlets</a>
|
||||||
</div>
|
</li>
|
||||||
</div>
|
<li class="nav-item">
|
||||||
<div class="form-group m-form__group row no-border">
|
<a class="nav-link" data-toggle="tab" href="#riders">Assigned Riders</a>
|
||||||
<div class="col-lg-8">
|
</li>
|
||||||
<label for="address" data-field="address">
|
{% endif %}
|
||||||
Address
|
</ul>
|
||||||
</label>
|
<div class="tab-content">
|
||||||
<textarea class="form-control m-input" id="address" rows="3" name="address">{{ obj.getAddress }}</textarea>
|
<div class="tab-pane active" id="hub-info" role="tabpanel">
|
||||||
<div class="form-control-feedback hide" data-field="address"></div>
|
<div class="form-group m-form__group row no-border">
|
||||||
</div>
|
<div class="col-lg-6">
|
||||||
</div>
|
<label for="name" data-field="name">
|
||||||
<div class="form-group m-form__group row">
|
Name
|
||||||
<div class="col-lg-8">
|
</label>
|
||||||
<label for="contact_nums" data-field="contact_nums">
|
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName() }}">
|
||||||
Contact Numbers
|
<div class="form-control-feedback hide" data-field="name"></div>
|
||||||
</label>
|
</div>
|
||||||
<textarea class="form-control m-input" id="contact_nums" rows="3" name="contact_nums">{{ obj.getContactNumbers }}</textarea>
|
<div class="col-lg-3">
|
||||||
<div class="form-control-feedback hide" data-field="contact_nums"></div>
|
<label for="time_open">
|
||||||
</div>
|
Time Open
|
||||||
</div>
|
</label>
|
||||||
|
<div class="input-group timepicker">
|
||||||
<div class="form-group m-form__group row">
|
<input id="timepicker_open" type="text" name="time_open" class="form-control m-input" readonly placeholder="Select time" type="text" value="{{ obj.getTimeOpen.format('g:i A') }}" />
|
||||||
<div class="col-lg-4">
|
<span class="input-group-addon">
|
||||||
<label for="time_open">
|
<i class="la la-clock-o"></i>
|
||||||
Time Open
|
</span>
|
||||||
</label>
|
</div>
|
||||||
<div class="input-group timepicker">
|
<div class="form-control-feedback hide" data-field="time_open"></div>
|
||||||
<input id="timepicker_open" type="text" name="time_open" class="form-control m-input" readonly placeholder="Select time" type="text" value="{{ obj.getTimeOpen.format('g:i A') }}" />
|
</div>
|
||||||
<span class="input-group-addon">
|
<div class="col-lg-3">
|
||||||
<i class="la la-clock-o"></i>
|
<label for="time_close">
|
||||||
</span>
|
Time Close
|
||||||
|
</label>
|
||||||
|
<div class="input-group timepicker">
|
||||||
|
<input id="timepicker_close" type="text" name="time_close" class="form-control m-input" readonly placeholder="Select time" type="text" value="{{ obj.getTimeClose.format('g:i A') }}" />
|
||||||
|
<span class="input-group-addon">
|
||||||
|
<i class="la la-clock-o"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-control-feedback hide" data-field="time_close"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-control-feedback hide" data-field="time_open"></div>
|
<div class="form-group m-form__group row no-border">
|
||||||
</div>
|
<div class="col-lg-6">
|
||||||
<div class="col-lg-4">
|
<label for="address" data-field="address">
|
||||||
<label for="time_close">
|
Address
|
||||||
Time Close
|
</label>
|
||||||
</label>
|
<textarea class="form-control m-input" id="address" rows="4" name="address">{{ obj.getAddress }}</textarea>
|
||||||
<div class="input-group timepicker">
|
<div class="form-control-feedback hide" data-field="address"></div>
|
||||||
<input id="timepicker_close" type="text" name="time_close" class="form-control m-input" readonly placeholder="Select time" type="text" value="{{ obj.getTimeClose.format('g:i A') }}" />
|
</div>
|
||||||
<span class="input-group-addon">
|
<div class="col-lg-6">
|
||||||
<i class="la la-clock-o"></i>
|
<label for="contact_nums" data-field="contact_nums">
|
||||||
</span>
|
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>
|
||||||
<div class="form-control-feedback hide" data-field="time_close"></div>
|
<div class="form-group m-form__group row">
|
||||||
</div>
|
<div class="col-lg-12">
|
||||||
</div>
|
<label>
|
||||||
|
Map Coordinates
|
||||||
<div class="form-group m-form__group row">
|
</label>
|
||||||
<div class="col-lg-12">
|
<input type="hidden" id="map_lat" name="coord_lat" value="">
|
||||||
<label>
|
<input type="hidden" id="map_lng" name="coord_lng" value="">
|
||||||
Map Coordinates
|
<div class="input-group">
|
||||||
</label>
|
<input type="text" class="form-control" id="m_gmap_address" placeholder="Search">
|
||||||
<input type="hidden" id="map_lat" name="coord_lat" value="">
|
<span class="input-group-btn">
|
||||||
<input type="hidden" id="map_lng" name="coord_lng" value="">
|
<button class="btn btn-primary" id="m_gmap_btn">
|
||||||
<div class="input-group">
|
<i class="fa fa-search"></i>
|
||||||
<input type="text" class="form-control" id="m_gmap_address" placeholder="Search">
|
</button>
|
||||||
<span class="input-group-btn">
|
</span>
|
||||||
<button class="btn btn-primary" id="m_gmap_btn">
|
</div>
|
||||||
<i class="fa fa-search"></i>
|
<div id="m_gmap" style="height:600px;"></div>
|
||||||
</button>
|
</div>
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="m_gmap" style="height:600px;"></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>
|
</div>
|
||||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
<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() {
|
$(document).ready(function() {
|
||||||
// timepickers
|
// 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
|
// check if we need to set map
|
||||||
{% if mode == 'update' %}
|
{% if mode == 'update' %}
|
||||||
|
|
@ -268,6 +301,103 @@ $(function() {
|
||||||
$("[data-field]").removeClass('has-danger');
|
$("[data-field]").removeClass('has-danger');
|
||||||
$(".form-control-feedback[data-field]").addClass('hide');
|
$(".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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ $(function() {
|
||||||
|
|
||||||
// timepicker
|
// timepicker
|
||||||
$('.tp').timepicker({
|
$('.tp').timepicker({
|
||||||
format: "dd M yyyy - HH:ii P",
|
format: "HH:ii P",
|
||||||
minuteStep: 1,
|
minuteStep: 1,
|
||||||
showMeridian: true,
|
showMeridian: true,
|
||||||
snapToStep: true,
|
snapToStep: true,
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,15 @@ $("#m_gmap_address").keypress(function(e) {
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// timepickers
|
// 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
|
// check if we need to set map
|
||||||
{% if mode == 'update' %}
|
{% if mode == 'update' %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue