160 lines
6.1 KiB
PHP
160 lines
6.1 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">
|
|
@csrf
|
|
<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">Tindakan</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">
|
|
<a href="{{ route('pengguna.showrole',$role->id) }}" data-toggle="tooltip" data-placement="top" title="Kemaskini" style="margin-right:30px" ><i class="far fa-edit"></i></a>
|
|
<a class="confirmdel" href="{{ route('pengguna.deleterole',$role->id) }}" data-toggle="tooltip" data-placement="top" title="Padam" ><i class="far fa-trash-alt"></i></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
|
|
</table>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal fade" tabindex="-1" id="myModal">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">New Role</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form action="{{ route('pengguna.newrole') }}" method="POST" id="formnewrole">
|
|
@csrf
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="rolename">Role</label>
|
|
<input type="text" class="form-control" name="name" id="rolename" >
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="keterangan">Keterangan</label>
|
|
<textarea class="form-control" id="keterangan" name="keterangan" rows="3" ></textarea>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
|
|
<button type="button" class="btn btn-primary" onclick="newrole()">Simpan</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
//Enable tooltips everywhere
|
|
$(function () {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
})
|
|
function newrole() {
|
|
$("#formnewrole").submit();
|
|
}
|
|
$('a.confirmdel').confirm({
|
|
title: 'Confirmation',
|
|
content: 'Anda pasti?',
|
|
type: 'orange',
|
|
typeAnimated: true,
|
|
buttons: {
|
|
Delete: {
|
|
btnClass: 'btn-warning',
|
|
action: function () {
|
|
location.href = this.$target.attr('href');
|
|
}
|
|
},
|
|
Batal: {
|
|
btnClass: 'btn-default',
|
|
action: function () {}
|
|
}
|
|
}
|
|
});
|
|
|
|
var tablerole = $('#roles').DataTable({
|
|
"columnDefs": [
|
|
{
|
|
"targets": 0,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"targets": 3,
|
|
"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' );
|
|
// console.log('hye');
|
|
|
|
$('#myModal').modal("show");
|
|
$('#myModal').on('shown.bs.modal', function () {
|
|
$('#rolename').trigger('focus')
|
|
})
|
|
}
|
|
},
|
|
{
|
|
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
|