129 lines
6.5 KiB
PHP
129 lines
6.5 KiB
PHP
@extends('layouts.app')
|
|
@section('title', 'Tambah Roles Akses')
|
|
@section('content')
|
|
<!-- Breadcrumb -->
|
|
<div class="card bg-info-subtle shadow-none position-relative overflow-hidden mb-4">
|
|
<div class="card-body px-4 py-3">
|
|
<div class="row align-items-center">
|
|
<div class="col-9">
|
|
<h4 class="fw-semibold mb-8">Tambah Roles & Permission</h4>
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item" aria-current="page">
|
|
<a href="{{ URL::to('admin/roles') }}" class="badge text-bg-light text-primary">
|
|
Kembali ke halaman sebelumnya
|
|
</a>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- End Breadcrumb -->
|
|
|
|
<div class="row d-flex align-items-strech">
|
|
<div class="col-lg-12 mx-auto">
|
|
<div class="card">
|
|
<div class="card-header d-flex align-items-center">
|
|
<h4 class="card-title mb-0">Tambah Pengguna</h4>
|
|
<div class="card-actions cursor-pointer ms-auto d-flex button-group">
|
|
<a href="{{ route('roles.refresh-routes') }}" class="btn btn-sm btn-secondary">
|
|
<i class="ti ti-refresh"></i> refresh routes
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="card-body border-top">
|
|
@if (count($errors) > 0)
|
|
<div class="alert alert-danger">
|
|
<strong>Whoops!</strong> There were some problems with your input.<br><br>
|
|
<ul>
|
|
@foreach ($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('roles.store') }}" id="formCreate">
|
|
@method('post')
|
|
@csrf
|
|
<div class="row">
|
|
<div class="col-xs-12 col-sm-12 col-md-12 mt-2">
|
|
<div class="form-group">
|
|
<strong>Name:</strong>
|
|
<input type="text" class="form-control" placeholder="Role Name" name="name">
|
|
</div>
|
|
</div>
|
|
<h5 for="permissions" class="form-label mt-3 mb-3">Assign Permissions</h5>
|
|
<h6 for="permissions" class="form-label mt-3 mb-3">Check All Permission <input type="checkbox"
|
|
name="all_permission" class="check" id="allpermission"></h6>
|
|
|
|
<div class="row">
|
|
@foreach ($permissions as $key => $permission)
|
|
<div class="col-md-4">
|
|
<h5>{{ $key }}</h5>
|
|
<table class="table table-hover table-bordered">
|
|
<tr id="checkboxnya" style="background: grey !important">
|
|
<td scope="col" width="1%" style="background: grey !important">
|
|
<input type="checkbox" name="all_permission" class="check"
|
|
id="allpermission">
|
|
</td>
|
|
<td scope="col" width="20%" style="background: grey !important">
|
|
Name</td>
|
|
<td scope="col" width="1%" style="background: grey !important">
|
|
Route</td>
|
|
<td scope="col" width="1%" style="background: grey !important">
|
|
Guard</td>
|
|
</tr>
|
|
@foreach ($permission as $item)
|
|
<tr>
|
|
<td>
|
|
<input type="checkbox" name="permission[{{ $item->name }}]"
|
|
value="{{ $item->name }}" class='permission'>
|
|
</td>
|
|
<td>{{ $item->desc }}</td>
|
|
<td>{{ $item->name }}</td>
|
|
<td>{{ $item->guard_name }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</table>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="col-xs-12 col-sm-12 col-md-12 text-end mt-3">
|
|
<a href="{{ route('roles.index') }}" class="btn btn-info">Batalkan</a>
|
|
<button type="submit" class="btn btn-primary">Submit</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@stop
|
|
|
|
@push('scripts')
|
|
<script>
|
|
$('input[type="checkbox"].check').on('change', function() {
|
|
var check = this;
|
|
$(check).closest('tr').nextUntil('tr[id]').find('input[type="checkbox"]').prop(
|
|
'checked',
|
|
check
|
|
.checked);
|
|
});
|
|
$(document).ready(function() {
|
|
$('#allpermission').click(function() {
|
|
if ($(this).is(':checked')) {
|
|
$('.check').prop('checked', true);
|
|
$('.permission').prop('checked', true);
|
|
} else {
|
|
$('.check').prop('checked', false);
|
|
$('.permission').prop('checked', false);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|