IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>List Of Employee</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover dataTable" id='tableexp'>
<thead>
<tr>
<th>S. No.</th>
<th>Photo</th>
<th>Department</th>
<th>Designation</th>
<th>Enrollment No</th>
<th>Name</th>
<th>Guardian Name</th>
<th>Address</th>
<th>Mobile</th>
<th>Email</th>
<th>Date Of Birth</th>
<th>Date Of Joining</th>
<th>Password</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<th scope="row"><?php echo e($i); ?></th>
<td> <img src="<?php echo e(asset('storage/schools/'.$value->idSchool.'/employees/'.$value->photo)); ?>" height="60"></td>
<td><?php echo e(isset($value->department->departmentName) ? $value->department->departmentName : ''); ?></td>
<td><?php echo e(isset($value->designation->designationName) ? $value->designation->designationName : ''); ?></td>
<td><?php echo e($value->enrollmentNo); ?></td>
<td><?php echo e($value->firstName); ?> <?php echo e($value->middleName); ?> <?php echo e($value->lastName); ?></td>
<td><?php echo e($value->guardianName); ?></td>
<td><?php echo e($value->address); ?></td>
<td><?php echo e($value->mobile); ?></td>
<td><?php echo e($value->email); ?></td>
<td><?php echo e($value->dob); ?></td>
<td><?php echo e($value->doj); ?></td>
<td><?php echo e($value->pwd); ?></td>
<td>
<?php if($value->isActive == "Y"): ?>
<button class="btn btn-danger waves-effect btn-round js-status" data-id="<?php echo e($value->idEmployee); ?>" data-type="inactive">Deactivate</button>
<?php else: ?>
<button class="btn btn-success waves-effect btn-round js-status" data-id="<?php echo e($value->idEmployee); ?>" data-type="active">Activate</button>
<?php endif; ?>
<a href="<?php echo e(url('school/employees/' . $value->idEmployee.'/view')); ?>" class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-eye"></i>View</a>
<a href="<?php echo e(url('school/employees/' . $value->idEmployee . '/edit')); ?>" class="btn btn-warning btn-info waves-effect btn-round">Edit </a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idEmployee); ?>" 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 employee!",
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/employees/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Employee has been successfully deleted",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
$(document).on('click', '.js-status', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
var status = $(this).data('type');
swal({
title: "Are you sure?",
text: "Are You sure you want to change the status this employee!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "POST",
url: "<?php echo e(url('/school/employees-status/')); ?>",
data: {id:id,status:status}
})
.done(function(data) {
swal({
title: "Status",
text: "Employee has been successfully updated",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
$(function () {
$('#tableexp').DataTable({
dom: 'Bfrtip',
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
left: 1
},
buttons: [
{ extend: 'csv', text: 'Export to Excel',title:'Employee List',
exportOptions: {
columns: [0,1,2,3,4,5,6,7,8,9,10,11]
}}
]
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -