IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="card">
<div class="header">
<h2><strong><?php if(isset($doc)): ?>Edit <?php else: ?> Upload Document <?php endif; ?></strong> to Bus No : <?php echo e($bus->busNo); ?></h2>
</div>
<div class="body">
<?php if(isset($doc)): ?>
<?php echo Form::model( $doc, ['route' => ['buses.update', $doc->idBusDoc], 'method' => 'put','class'=>'form-horizontal'] ); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/busdocs','class'=>'form-horizontal','files'=>true]); ?>
<?php endif; ?>
<input type="hidden" name="idBus" value="<?php echo e($bus->idBus); ?>">
<div class="row clearfix">
<table class="table table-bordered">
<thead>
<tr>
<th>S.NO.</th>
<th>Document Type</th>
<th>Expiray Date</th>
<th>Upload Document</th>
<th></th>
</tr>
</thead>
<tbody id="optional_list">
<tr>
<td class="sno">1</td>
<td>
<?php echo Form::select('busdoc[1][idDocType]',$doctypes,null,['class' => 'form-control show-tick ms','required'=>'required']); ?>
</td>
<td>
<input class="form-control datepicker" type="text" name = "busdoc[1][expirayDate]" required="required">
</td>
<td>
<input type="file" name = "busdoc[1][document]" required="required" onkeypress = 'return isNumber(event)'>
</td>
</tr>
</tbody>
<tr>
<td colspan="4" style="text-align: right"><input type="button" class="add-row btn btn-sm btn-success" value="Add Row"></td>
</tr>
</table>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php if(isset($doc)): ?>
<?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php else: ?>
<?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php endif; ?>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>List Of Documents</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>Document Type</th>
<th>Expiray Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $busdocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($i); ?></td>
<td><?php echo e($var->doctype->documentType); ?></td>
<td><?php echo e($var->expirayDate); ?></td>
<td>
<a href='<?php echo e(url('/school/busdocs/'.$var->idBusDoc)); ?>' target="_blank" class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-edit"></i>View</a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($var->idBusDoc); ?>" 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).ready(function() {
var i = 1;
$(".add-row").click(function(){
i++;
var markup = '<tr><td class="sno">'+i+'</td>\
<td><select name="busdoc['+i+'][idDocType]" required = "required" class = "form-control show-tick ms"><?php $__currentLoopData = $doctypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>"><?php echo e($value); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></td>\n\
<td><input class="form-control datepicker" type="text" name="busdoc['+i+'][expirayDate]" required="required"></td>\n\
<td><input type="file" name="busdoc['+i+'][document]" required="required"></td>\n\
<td style="text-align:right;vertical-align: middle;"><input type="button" required="required" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
setTimeout(function(){
$('.datepicker').datepicker({
autoclose: true,
format: 'dd-mm-yyyy',
todayBtn:true,
todayHighlight:true,
orientation: 'auto'
});
}, 100);
$("#optional_list").append(markup);
});
$('#optional_list').on('click', 'input[type="button"]', function () {
$(this).closest('tr').remove();
i = $('.sno:last').text();
});
//Add Input field if others is selecyted
});
$(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 Document!",
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/busdocs/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Bus Document 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 -