IMMREX7
@extends('schools.school_layout')
@section('content')
@if(isset($role))
@include('roles.edit')
@else
@include('roles.create')
@endif
<div class="col-sm-7">
<div class="card">
<div class="header">
<h2><strong>List Of Roles</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>S.No.</th>
<th>Name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
@foreach($roles as $role)
<tr>
<td>{{ $i }}</td>
<td>{{ $role->label }}</td>
<td>
<a href="{{ url('school/roles/' . $role->idRole . '/edit') }}" class="btn btn-raised btn-info waves-effect btn-round">Edit</a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="{{$role->idRole}}" data-type="confirm">DELETE</button>
<a href="{{ url('school/roles/' . $role->idRole . '/permissions') }}" class="btn btn-raised btn-success waves-effect btn-round">Assign Permissions</a>
</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 role!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "{{url('/school/roles/')}}" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Role 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>
@stop
Copyright © 2021 -