first change
This commit is contained in:
27
Modules/User/resources/views/role/create.blade.php
Normal file
27
Modules/User/resources/views/role/create.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb />
|
||||
|
||||
@if ($errors->any())
|
||||
<x-flash-message type="danger" :messages="$errors->all()" />
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('role.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('user::role.partials.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
@@ -0,0 +1,7 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="{{ route('role.edit', $id) }}" class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
|
||||
<a href="javascript:void(0);" data-link="{{ route('role.destroy', $id) }}" class="link-danger fs-15 remove-item"><i
|
||||
class="ri-delete-bin-line"></i>
|
||||
</a>
|
||||
</div>
|
27
Modules/User/resources/views/role/edit.blade.php
Normal file
27
Modules/User/resources/views/role/edit.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb />
|
||||
|
||||
@if ($errors->any())
|
||||
<x-flash-message type="danger" :messages="$errors->all()" />
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{ html()->modelForm($role, 'PUT')->route('role.update', $role->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('user::role.partials.form')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
46
Modules/User/resources/views/role/index.blade.php
Normal file
46
Modules/User/resources/views/role/index.blade.php
Normal file
@@ -0,0 +1,46 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
|
||||
<x-dashboard.breadcumb />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Role Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('role.create') }}" class="btn btn-primary waves-effect waves-light text-white"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'S.N',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
],
|
||||
['title' => 'Name', 'data' => 'name', 'name' => 'name'],
|
||||
['title' => 'Guard', 'data' => 'guard_name', 'name' => 'guard_name'],
|
||||
[
|
||||
'title' => 'Action',
|
||||
'data' => 'action',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-data-table-script :route="route('role.index')" :reorder="null" :columns="$columns" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
97
Modules/User/resources/views/role/partials/form.blade.php
Normal file
97
Modules/User/resources/views/role/partials/form.blade.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<div class="row gy-4">
|
||||
|
||||
<div class="col-lg-4">
|
||||
{{ html()->label('Name')->class('form-label') }}
|
||||
{{ html()->text('name')->class('form-control')->placeholder('Enter Role Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
{{ html()->label('Guard Name')->class('form-label') }}
|
||||
{{ html()->text('guard_name', 'web')->class('form-control bg-primary-subtle')->isReadonly(true) }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
<div class="form-check form-switch form-switch-lg mt-3">
|
||||
{{ html()->checkbox('all_permissions_check')->class('form-check-input')->id('all-check') }}
|
||||
{{ html()->label('Select All')->class('form-check-label')->for('all-check') }}
|
||||
</div>
|
||||
{{ html()->p()->text('Enable all Permissions for this role')->class('fs-6 text-muted mt-1 text-nowrap') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
<x-form-buttons :editable=$editable label='Assign' :href="route('role.index')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row flex-wrap gap-2">
|
||||
@foreach ($permissionLists as $key => $permission)
|
||||
<div class="card card-body w-20 bg-white">
|
||||
<div class="form-check form-switch form-switch-custom form-switch-success mb-3">
|
||||
<input class="form-check-input parent-switch" type="checkbox" role="switch" id="check_{{ $key }}">
|
||||
<label class="form-check-label ms-2" for="{check_{$key}}">{{ Str::ucfirst($key) }}</label>
|
||||
</div>
|
||||
<fieldset class="rounded-2">
|
||||
<div class="list-group">
|
||||
@foreach ($permission as $index => $item)
|
||||
<div class="form-check form-check-success">
|
||||
{{ html()->checkbox('permissions[]')->id('permission_' . $index)->value($index)->class('form-check-input child-checkbox')->checked($editable && in_array($index, $permissionIDsArray)) }}
|
||||
{{ html()->label(Str::ucfirst($item))->for('permission_' . $index)->class('form-check-label ms-2') }}
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
@push('js')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.child-checkbox').trigger('change');
|
||||
|
||||
$('.parent-switch').change(function() {
|
||||
let childCheckboxes = $(this).closest('.card').find('.child-checkbox');
|
||||
childCheckboxes.prop('checked', this.checked);
|
||||
});
|
||||
|
||||
$('.child-checkbox').change(function() {
|
||||
let parentSwitch = $(this).closest('.card').find('.parent-switch');
|
||||
let childCheckboxes = $(this).closest('.card').find('.child-checkbox');
|
||||
let allChecked = true;
|
||||
childCheckboxes.each(function() {
|
||||
if (!$(this).prop('checked')) {
|
||||
allChecked = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
parentSwitch.prop('checked', allChecked);
|
||||
});
|
||||
|
||||
$('#all-check').change(function() {
|
||||
let childCheckboxes = $('.child-checkbox');
|
||||
childCheckboxes.prop('checked', this.checked);
|
||||
|
||||
childCheckboxes.prop('checked', this.checked).trigger('change');
|
||||
});
|
||||
|
||||
$('.child-checkbox, .parent-switch').change(function() {
|
||||
let allCheck = $('#all-check');
|
||||
let childCheckboxes = $('.child-checkbox');
|
||||
let allChecked = true;
|
||||
|
||||
childCheckboxes.each((index, checkBox) => {
|
||||
if (!$(checkBox).prop('checked')) {
|
||||
allChecked = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
allCheck.prop('checked', allChecked);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@endpush
|
16
Modules/User/resources/views/role/partials/view.blade.php
Normal file
16
Modules/User/resources/views/role/partials/view.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalgridLabel">View User</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('user::partials.user.action', ['btnType' => 'View'])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user