IMMREX7
@extends('schools.school_layout')
@section('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; ?>
@foreach($employees as $value)
<tr>
<th scope="row">{{$i}}</th>
<td> <img src="{{ asset('storage/schools/'.$value->idSchool.'/employees/'.$value->photo)}}" height="60"></td>
<td>{{$value->department->departmentName or ''}}</td>
<td>{{$value->designation->designationName or ''}}</td>
<td>{{$value->enrollmentNo}}</td>
<td>{{$value->firstName}} {{$value->middleName}} {{$value->lastName}}</td>
<td>{{$value->guardianName}}</td>
<td>{{$value->address}}</td>
<td>{{$value->mobile}}</td>
<td>{{$value->email}}</td>
<td>{{$value->dob}}</td>
<td>{{$value->doj}}</td>
<td>{{$value->pwd}}</td>
<td>
@if($value->isActive == "Y")
<button class="btn btn-danger waves-effect btn-round js-status" data-id="{{$value->idEmployee}}" data-type="inactive">Deactivate</button>
@else
<button class="btn btn-success waves-effect btn-round js-status" data-id="{{$value->idEmployee}}" data-type="active">Activate</button>
@endif
<a href="{{ 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="{{ 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="{{$value->idEmployee}}" data-type="confirm">DELETE</button>
</td>
</tr>
<?php $i++; ?>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@stop
@section('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: "{{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: "{{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>
@stop
Copyright © 2021 -