IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<div class="header">
<h2><strong>Assign Route to Bus</strong></h2>
</div>
<div class="body">
<?php echo Form::open(['url' => 'school/busroute', 'class' => 'form-horizontal','files'=>true]); ?>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname" class="required">Select Bus</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<?php echo Form::select('idBus',$buses,null,['class' => 'form-control show-tick ms','required'=>'required']); ?>
<?php if($errors->has('idBus')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idBus')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname" class="required">Select Route</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<?php if($errors->has('route')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('route')); ?></strong>
</label>
<?php endif; ?>
<div style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">
<?php $__currentLoopData = $routes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;">
<input type="checkbox" name="routes[]" value="<?php echo e($key); ?>">
<label><?php echo e($value); ?></label>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-7">
<div class="card">
<div class="header">
<h2><strong>Buses with Routes</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<th>S. No.</th>
<th>Bus No.</th>
<th>Bus Route</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $busroutes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<th scope="row"><?php echo e($i); ?></th>
<td><?php echo e($value->bus->busNo); ?></td>
<td>
<?php $routes = \App\BusRoute::where('idBus','=',$value->idBus)->get();?>
<?php $__currentLoopData = $routes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php echo e($v->route->routeName); ?>,
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</td>
<td>
<a href="<?php echo e(url('/school/busroute/'.$value->idBus.'/edit')); ?>" class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-edit"></i>Edit</a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idBusRoute); ?>" data-type="confirm">DELETE</button>
</td>
</tr>
<?php $i++; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).on('click', '.js-sweetalert', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
swal({
title: "Are you sure?",
text: "Are You sure you want to delete this Bus Routes!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "<?php echo e(url('/school/busroute/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Bus Route has been successfully deleted",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -