IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>List Of Students (For Image Upload)</strong></h2>
</div>
<div class="body table-responsive">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\AdmissionEntryController@imageUploadform'], 'class' => 'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-2 form-control-label">
<label for="classname">Financial Year</label>
</div>
<div class="col-sm-3">
<div class="form-group">
<?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>
</div>
</div>
<div class="col-sm-2">
<?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
</div>
</div>
<?php echo Form::close(); ?>
<br>
<table class="table table-bordered table-striped table-hover dataTable js-basic-example">
<thead>
<tr>
<th>S. No.</th>
<th>Upload Photo</th>
<th>EC No.</th>
<th>Name</th>
<th>Class</th>
<th>Section</th>
<!--<th>Admission No</th>-->
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<th scope="row"><?php echo e($i); ?></th>
<th>
<img style="border-radius: 60px; width: 100px;height: 100px; margin-top:10px;" id="uploadPreview<?php echo e($value->idStudent); ?>" name="image">
<input type="file" name="photo" id="image<?php echo e($value->idStudent); ?>" onchange="PreviewImage(<?php echo e($value->idStudent); ?>);">
<div id="photoerror<?php echo e($value->idStudent); ?>"></div>
</th>
<td><?php echo e($value->ecNo); ?></td>
<td><?php echo e($value->firstName); ?> <?php echo e($value->middleName); ?> <?php echo e($value->lastName); ?></td>
<td><?php echo e($value->classM->className); ?></td>
<td><?php echo e($value->section->sectionName); ?></td>
<!--<td><?php echo e($value->admissionNo); ?></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>
function PreviewImage(key) {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("image"+key).files[0]);
oFReader.onload = function (oFREvent) {
document.getElementById("uploadPreview"+key).src = oFREvent.target.result;
};
var image = $('#image'+key)[0].files[0];
var form = new FormData();
form.append('idStudent', key);
form.append('photo', image);
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type:"POST",
url: "<?php echo e(url('/school/imageupload')); ?>",
data: form,
dataType: 'json',
cache: false,
contentType: false,
processData: false,
success:function(data){
if( data[Object.keys(data)[0]] === 'SUCCESS' ){
//True Case i.e. passed validation
$('#photoerror'+ key).empty();
// window.location = "<?php echo e(url('comprates')); ?>";
}
else { //False Case: With error msg
$("#msg").html(data); //$msg is the id of empty msg
}
},
error: function(data){
var errors = data.responseJSON.errors;
$('#photoerror'+ key).empty();
// if(errors['ratePerUnit']=== undefined){
errorate = '<span class="help-block"><strong>'+errors['photo']+'</strong></span>';
$('#photoerror'+ key).html( errorate );
// }
}
});
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -