123 lines
4.5 KiB
PHP
123 lines
4.5 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-11 mx-auto card p-4">
|
|
@if ($message = Session::get('success'))
|
|
<div class="alert alert-success">
|
|
<p>{{ $message }}</p>
|
|
</div>
|
|
@endif
|
|
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
|
|
<input type="hidden" name="type" value="Permission">
|
|
<table class="table table-striped" id="roles">
|
|
<thead class="bg-primary text-white">
|
|
<tr>
|
|
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
|
|
<th>Roles</th>
|
|
<th>Keterangan</th>
|
|
<th class="text-center">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($allpermission as $role)
|
|
<tr>
|
|
<td><input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata[]" value="{{ $role->id }}"></td>
|
|
<td>{{ $role->name }}</td>
|
|
<td>{{ $role->description }}</td>
|
|
<td class="text-center">
|
|
<form action="{{ route('pengguna.deleterole',$role->id) }}" method="POST" id="formdelrole-{{$role->id}}">
|
|
@csrf
|
|
<a href="{{ route('pengguna.showrole',$role->id) }}"><i class="far fa-edit"></i></a>
|
|
<a href="{{ route('pengguna.showrole',$role->id) }}"><i class="far fa-eye"></i></a>
|
|
<a onclick="confirm({{$role->id}})"><i class="far fa-trash-alt"></i></a>
|
|
</form>
|
|
{{-- <a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a> --}}
|
|
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
|
|
</table>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function confirm(id) {
|
|
// console.log(id);
|
|
$.confirm({
|
|
title: 'Confirmation',
|
|
content: 'Anda pasti?',
|
|
type: 'orange',
|
|
typeAnimated: true,
|
|
buttons: {
|
|
Delete: {
|
|
btnClass: 'btn-warning',
|
|
action: function () {
|
|
$("#formdelrole-"+id).submit();
|
|
}
|
|
},
|
|
Batal: {
|
|
btnClass: 'btn-default',
|
|
action: function () {}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
var tablerole = $('#roles').DataTable({
|
|
"columnDefs": [
|
|
{
|
|
"targets": 0,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"targets": 2,
|
|
"orderable": false
|
|
}
|
|
],
|
|
order: [[1, 'asc']],
|
|
"info": false,
|
|
"lengthChange": false,
|
|
"pageLength": 15,
|
|
dom: 'Bfrtip',
|
|
buttons: [
|
|
{
|
|
className: 'btn btn-outline-success pl-4 pr-4 btn-sm adduser',
|
|
text: '<i class="fas fa-plus" id="test"></i>',
|
|
titleAttr: 'Tambah Role',
|
|
action: function ( e, dt, node, config ) {
|
|
alert( 'Button activated' );
|
|
}
|
|
},
|
|
{
|
|
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
|
|
titleAttr: 'Export to CSV',
|
|
text: '<i class="fas fa-download"></i>',
|
|
action: function ( e, dt, node, config ) {
|
|
$("#exportform").submit();
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
$('.adduser').tooltip();
|
|
$('.export').tooltip();
|
|
// $( '.dt-buttons').addClass('btn-group');
|
|
$( '.adduser').removeClass('dt-button');
|
|
$( '.export').removeClass('dt-button');
|
|
|
|
|
|
function selectall(cb) {
|
|
tablerole.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
|
|
$(this).prop('checked', cb.checked);
|
|
})
|
|
}
|
|
</script>
|
|
|
|
@endsection
|