File: //home/cafsindia/allyindian_com/sbltt/application/views/driver/form.php
<ul class="nav nav-tabs" data-tabs="tabs" style='background-color:#d84f57;'>
<li class="active" role="presentation" style='margin-left:10px;'>
<a data-toggle="tab" href="#suspence">Suspence</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#diesel">Diesel</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#feed_back">Feedback</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="suspence">
<div class="col-md-12" style='padding:8px;margin-bottom:4px;'>
<?php echo form_open('driver/save_suspence/',array('id'=>'save_suspence','class'=>'form-inline')); ?>
<div class="form-group" style='width:19.5%;'>
<?php echo form_label("Select Date", 'date', array('class' => 'control-label required')); ?>
<select class='form-control input-sm' id='suspence_date' name='suspence_date'>
<option value="">--Select Date--</option>
<?php
$from_date = date('d-m-Y',strtotime($booking_info->from_date));
$to_date = date('d-m-Y',strtotime($booking_info->to_date));
$from = strtotime($from_date);
$to = strtotime($to_date);
for($i=$from; $i<=$to; $i+=86400) {
$bet_date = date("d-m-Y", $i);
echo "<option value='$bet_date'>$bet_date</option>";
}
?>
</select>
</div>
<div class="form-group">
<?php echo form_label("Suspence Type", 'cust_type', array('class' => 'control-label required')); ?>
<?php
$suspence_info = array('' => '--Suspence Type--','Toll' => 'Toll','Parking' => 'Parking','Kickbacks' => 'Kickbacks','Permit' => 'Permit','RTO' => 'RTO','TAX' => 'TAX','Driver' => 'Driver','Cleaner' => 'Cleaner','Others' => 'Others');
echo form_dropdown(array(
'name' => 'suspence_info',
'id' => 'suspence_info',
'class' => 'form-control input-sm'), $suspence_info);
?>
</div>
<div class="form-group" style='width:19.5%;'>
<?php echo form_label("Suspence Amount", 'suspence_amount', array('class' => 'control-label')); ?>
<?php
echo form_input(array(
'name' => 'suspence_amount',
'id' => 'suspence_amount',
'class' => 'form-control input-sm number',
'value' => '')
);
?>
</div>
<?php
echo form_input(array('type'=>'hidden','name'=>'suspence_vch_id','id'=>'suspence_vch_id','value'=>$booking_info->op_vehicle_id));
echo form_input(array('type'=>'hidden','name'=>'suspence_op_id','id'=>'suspence_op_id','value'=>$booking_info->operation_id));
echo form_input(array('type'=>'hidden','name'=>'suspence_id','id'=>'suspence_id','value'=>''));
?>
<button type='submit' class='btn btn-primary btn-sm' style='background:#d84f57;border:1px solid #d84f57;padding:6px 30px;margin-top:16px;' id='catering_add'>Add / Update</button>
<?php echo form_close(); ?>
<h5 style='color:#d84f57;'>Suspence Information</h5>
<table class="table table-hover table-striped table-bordered" id='suspence_table'>
<thead>
<tr>
<th>Date</th>
<th>Reson</th>
<th>Amount</th>
<th>Edit</th>
</tr>
</thead>
<tbody id="suspence_list">
<?php
$tot_suspence = 0;
foreach($suspence_list as $suspence){
$suspence_id = $suspence->suspence_id;
$suspence_date = date("d-m-Y", strtotime($suspence->suspence_date));
$vehicle_no = $suspence->vehicle_no;
$suspence_info = $suspence->suspence_info;
$suspence_amt = $suspence->suspence_amt;
$tot_suspence += $suspence_amt;
echo "<tr>
<td style='white-space: nowrap;'>$suspence_date</td>
<td>$suspence_info</td>
<td>$suspence_amt</td>
<td><a style='cursor: pointer;' onclick=get_suspence('$suspence_id')>Edit</a></td>
</tr>";
}
echo "<tr><td colspan='2' style='font-weight:bold;'>Total Amount</td><td colspan='2' style='font-weight:bold;'>$tot_suspence</td></tr>";
?>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="diesel">
<div class="col-md-12" style='padding:8px;margin-bottom:4px;'>
<?php echo form_open('driver/save_diesel/',array('id'=>'save_diesel','class'=>'form-inline')); ?>
<div class="form-group" style='width:13.5%;'>
<?php echo form_label("Select Date", 'date', array('class' => 'control-label required')); ?>
<select class='form-control input-sm' id='diesel_date' name='diesel_date'>
<option value="">--Select Date--</option>
<?php
$from_date = date('d-m-Y',strtotime($booking_info->from_date));
$to_date = date('d-m-Y',strtotime($booking_info->to_date));
$from = strtotime($from_date);
$to = strtotime($to_date);
for($i=$from; $i<=$to; $i+=86400) {
$bet_date = date("d-m-Y", $i);
echo "<option value='$bet_date'>$bet_date</option>";
}
?>
</select>
</div>
<div class="form-group" style='width:13.5%;'>
<?php echo form_label("Start KM", 'start_km', array('class' => 'control-label')); ?>
<?php
echo form_input(array(
'name' => 'start_km',
'id' => 'start_km',
'class' => 'form-control input-sm number',
'value' => $starting_km)
);
?>
</div>
<div class="form-group" style='width:13.5%;'>
<?php echo form_label("End KM", 'end_km', array('class' => 'control-label')); ?>
<?php
echo form_input(array(
'name' => 'end_km',
'id' => 'end_km',
'class' => 'form-control input-sm number',
'value' => '')
);
?>
</div>
<div class="form-group" style='width:13.5%;'>
<?php echo form_label("Quantity", 'diesel_quantity', array('class' => 'control-label')); ?>
<?php
echo form_input(array(
'name' => 'diesel_quantity',
'id' => 'diesel_quantity',
'class' => 'form-control input-sm number',
'value' => '')
);
?>
</div>
<div class="form-group" style='width:13.5%;'>
<?php echo form_label("Amount", 'diesel_amt', array('class' => 'control-label')); ?>
<?php
echo form_input(array(
'name' => 'diesel_amt',
'id' => 'diesel_amt',
'class' => 'form-control input-sm number',
'value' => '')
);
?>
</div>
<?php
echo form_input(array('type'=>'hidden','name'=>'diesel_vch_id','id'=>'diesel_vch_id','value'=>$booking_info->op_vehicle_id));
echo form_input(array('type'=>'hidden','name'=>'diesel_op_id','id'=>'diesel_op_id','value'=>$booking_info->operation_id));
echo form_input(array('type'=>'hidden','name'=>'diesel_id','id'=>'diesel_id','value'=>''));
?>
<button type='submit' class='btn btn-primary btn-sm' style='background:#d84f57;border:1px solid #d84f57;padding:6px 30px;margin-top:16px;' id='catering_add'>Add / Update</button>
<?php echo form_close(); ?>
<h5 style='color:#d84f57;'>Diesel Information</h5>
<table class="table table-hover table-striped table-bordered" id='diesel_table'>
<thead>
<tr>
<th>Date</th>
<th style='white-space: nowrap;'>Start KM</th>
<th style='white-space: nowrap;'>End KM</th>
<th>Quantity</th>
<th>Amount</th>
<th>Edit</th>
</tr>
</thead>
<tbody id="diesel_list">
<?php
$tot_diesel = 0;
foreach($diesel_list as $diesel){
$diesel_id = $diesel->diesel_id;
$diesel_date = date("d-m-Y", strtotime($diesel->diesel_date));
$vehicle_no = $diesel->vehicle_no;
$start_km = $diesel->start_km;
$end_km = $diesel->end_km;
$diesel_quantity = $diesel->diesel_quantity;
$diesel_amt = $diesel->diesel_amt;
$diesel_op_id = $diesel->diesel_op_id;
$tot_diesel += $diesel_amt;
echo "<tr>
<td style='white-space: nowrap;'>$diesel_date</td>
<td>$start_km</td>
<td>$end_km</td>
<td>$diesel_quantity</td>
<td>$diesel_amt</td>
<td><a style='cursor: pointer;' onclick=get_diesel('$diesel_id')>Edit</a></td>
</tr>";
}
echo "<tr><td colspan='4' style='font-weight:bold;'>Total Amount</td><td colspan='2' style='font-weight:bold;'>$tot_diesel</td></tr>";
?>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="feed_back">
<div class="col-md-12" style='padding:8px;margin-bottom:4px;'>
<?php echo form_open('driver/save_feed_back/',array('id'=>'save_feed_back','class'=>'form-inline')); ?>
<table class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th>Quality Assessment</td>
<th>Rating</th>
</tr>
</thead>
<tr>
<td style='vertical-align: middle;'>Quality of the vehicle</td>
<td style='vertical-align: middle;'>
<?php
$feed_back_info = array('' => '--Select--','Very_Good' => 'Very Good','Good' => 'Good','Fair' => 'Fair');
echo form_dropdown(array('name' => 'vch_quality','id' => 'vch_quality','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;'>TV & DVD Condition</td>
<td style='vertical-align: middle;'>
<?php
echo form_dropdown(array('name' => 'vch_media','id' => 'vch_media','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;'>Seat Condition</td>
<td style='vertical-align: middle;'>
<?php
echo form_dropdown(array('name' => 'vch_seat','id' => 'vch_seat','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;'>Driving Skills</td>
<td style='vertical-align: middle;'>
<?php
echo form_dropdown(array('name' => 'driving_skill','id' => 'driving_skill','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;'>Behaviour of driver</td>
<td style='vertical-align: middle;'>
<?php
echo form_dropdown(array('name' => 'driver_behaviour','id' => 'driver_behaviour','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;'>Sightseen Covered</td>
<td style='vertical-align: middle;'>
<?php
echo form_dropdown(array('name' => 'sightseeing','id' => 'sightseeing','style' => 'margin-bottom: 0px;','class' => 'form-control input-sm'), $feed_back_info);
?>
</td>
</tr>
<tr>
<td style='vertical-align: middle;' colspan='2'>
<textarea placeholder="Remarks" name="remarks" id="remarks" class="form-control" rows="4"></textarea>
</td>
</tr>
</table>
<?php
echo form_input(array('type'=>'hidden','name'=>'feed_vch_id','id'=>'feed_vch_id','value'=>$booking_info->op_vehicle_id));
echo form_input(array('type'=>'hidden','name'=>'feed_op_id','id'=>'feed_op_id','value'=>$booking_info->operation_id));
echo form_input(array('type'=>'hidden','name'=>'feed_op_line_id','id'=>'feed_op_line_id','value'=>$booking_info->op_line_id));
?>
<button type='submit' class='btn btn-primary btn-sm' style='background:#d84f57;border:1px solid #d84f57;padding:6px 30px;margin-top:16px;' id='catering_add'>Add / Update</button>
<?php echo form_close(); ?>
</div>
</div>
</div>
<style>
.modal-body {
max-height: calc(100vh - 212px);
overflow-y: auto;
height: 520px;
padding: 0px;
}
.nav>li>a {
position: relative;
display: block;
padding: 10px 10px;
}
.form-inline .form-group {
width: 18.5%;
margin-bottom: 0px;
margin-right: 9px;
}
</style>
<?php echo form_close(); ?>
<script type="text/javascript">
$(document).ready(function(){
$(".number").bind('keyup', function(e) {
this.value = this.value.replace(/[^0-9_.]/g,'');
});
$('#save_feed_back').validate($.extend({
submitHandler: function (form){
$('#save_feed_back').attr('disabled','disabled');
$(form).ajaxSubmit({
success: function(rslt){
message = rslt.message;
alert(message);
$(function () {
$('.modal').modal('toggle');
});
},
dataType: 'json'
});
},
rules:{
vch_quality: "required",
vch_media: "required",
vch_seat: "required",
driving_skill: "required",
driver_behaviour: "required",
sightseeing: "required",
}
}));
$('#save_suspence').validate($.extend({
submitHandler: function (form){
$('#save_suspence').attr('disabled','disabled');
$(form).ajaxSubmit({
success: function(rslt){
var tr = "";
for(i = 0; i < rslt.suspence_list.length; i++) {
suspence_id = rslt.suspence_list[i].suspence_id;
suspence_date = rslt.suspence_list[i].suspence_date;
vehicle_no = rslt.suspence_list[i].vehicle_no;
suspence_vch_id = rslt.suspence_list[i].suspence_vch_id;
suspence_info = rslt.suspence_list[i].suspence_info;
suspence_amt = rslt.suspence_list[i].suspence_amt;
suspence_date = moment(suspence_date).format('DD-MM-YYYY');
edit = "<a style='cursor: pointer;' onclick=get_suspence('"+suspence_id+"')>Edit</a>";
tr += "<tr><td style='white-space: nowrap;'>"+suspence_date+"</td><td>"+suspence_info+"</td><td>"+suspence_amt+"</td><td>"+edit+"</td></tr>";
}
amount = rslt.amount.suspence_amount;
tr +="<tr><td colspan='2' style='font-weight:bold;'>Total Amount</td><td colspan='2' style='font-weight:bold;'>"+amount+"</td></tr>";
$("#suspence_list").html(tr);
$("#suspence_id").val("");
$("#suspence_date").val("");
$("#suspence_info").val("");
$("#suspence_amount").val("");
},
dataType: 'json'
});
},
rules:{
suspence_date: "required",
suspence_vch_id: "required",
suspence_info: "required",
suspence_amount: "required",
}
}));
$('#save_diesel').validate($.extend({
submitHandler: function (form){
$('#save_diesel').attr('disabled','disabled');
$(form).ajaxSubmit({
success: function(rslt){
var tr = "";
for(i = 0; i < rslt.diesel_list.length; i++) {
diesel_id = rslt.diesel_list[i].diesel_id;
diesel_vch_id = rslt.diesel_list[i].diesel_vch_id;
diesel_date = rslt.diesel_list[i].diesel_date;
vehicle_no = rslt.diesel_list[i].vehicle_no;
start_km = rslt.diesel_list[i].start_km;
end_km = rslt.diesel_list[i].end_km;
diesel_quantity = rslt.diesel_list[i].diesel_quantity;
diesel_amt = rslt.diesel_list[i].diesel_amt;
diesel_op_id = rslt.diesel_list[i].diesel_op_id;
diesel_date = moment(diesel_date).format('DD-MM-YYYY');
edit = "<a style='cursor: pointer;' onclick=get_diesel('"+diesel_id+"')>Edit</a>";
tr += "<tr><td style='white-space: nowrap;'>"+diesel_date+"</td><td>"+start_km+"</td><td>"+end_km+"</td><td>"+diesel_quantity+"</td><td>"+diesel_amt+"</td><td>"+edit+"</td></tr>";
}
amount = rslt.amount.diesel_amount;
tr +="<tr><td colspan='4' style='font-weight:bold;'>Total Amount</td><td colspan='2' style='font-weight:bold;'>"+amount+"</td></tr>";
$("#diesel_list").html(tr);
$("#diesel_id").val("");
$("#diesel_date").val("");
$("#start_km").val("");
$("#end_km").val("");
$("#diesel_quantity").val("");
$("#diesel_amt").val("");
},
dataType: 'json'
});
},
rules:{
diesel_date: "required",
diesel_vch_id: "required",
start_km: "required",
end_km: "required",
diesel_quantity: "required",
diesel_amt: "required",
}
}));
});
function get_suspence(suspence_id){
if(suspence_id !== ""){
$.ajax({
type: "POST",
url: '<?php echo site_url($controller_name . "/get_suspence"); ?>',
data: {suspence_id:suspence_id},
success: function(data) {
var rslt = JSON.parse(data);
suspence_id = rslt.sus_data[0].suspence_id;
suspence_date = rslt.sus_data[0].suspence_date;
suspence_vch_id = rslt.sus_data[0].suspence_vch_id;
suspence_info = rslt.sus_data[0].suspence_info;
suspence_amt = rslt.sus_data[0].suspence_amt;
suspence_date = moment(suspence_date).format('DD-MM-YYYY');
$("#suspence_id").val(suspence_id);
$("#suspence_date").val(suspence_date);
$("#suspence_info").val(suspence_info);
$("#suspence_amount").val(suspence_amt);
},
});
}
}
function get_diesel(diesel_id){
if(diesel_id !== ""){
$.ajax({
type: "POST",
url: '<?php echo site_url($controller_name . "/get_diesel"); ?>',
data: {diesel_id:diesel_id},
success: function(data) {
var rslt = JSON.parse(data);
diesel_id = rslt.diesel_data[0].diesel_id;
diesel_vch_id = rslt.diesel_data[0].diesel_vch_id;
diesel_date = rslt.diesel_data[0].diesel_date;
start_km = rslt.diesel_data[0].start_km;
end_km = rslt.diesel_data[0].end_km;
diesel_quantity = rslt.diesel_data[0].diesel_quantity;
diesel_amt = rslt.diesel_data[0].diesel_amt;
diesel_op_id = rslt.diesel_data[0].diesel_op_id;
diesel_date = moment(diesel_date).format('DD-MM-YYYY');
$("#diesel_id").val(diesel_id);
$("#diesel_vch_id").val(diesel_vch_id);
$("#diesel_date").val(diesel_date);
$("#start_km").val(start_km);
$("#end_km").val(end_km);
$("#diesel_quantity").val(diesel_quantity);
$("#diesel_amt").val(diesel_amt);
},
});
}
}
</script>