update patch 1
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
.form-check-label {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('admin-content')
|
||||
|
||||
<!-- page title area start -->
|
||||
<div class="page-title-area">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-sm-6">
|
||||
<div class="breadcrumbs-area clearfix">
|
||||
<h4 class="page-title pull-left">User Create</h4>
|
||||
<ul class="breadcrumbs pull-left">
|
||||
<li><a href="{{ route('admin.dashboard') }}">Dashboard</a></li>
|
||||
<li><a href="{{ route('admin.users.index') }}">All Users</a></li>
|
||||
<li><span>Create User</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 clearfix">
|
||||
@include('backend.layouts.partials.logout')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- page title area end -->
|
||||
|
||||
<div class="main-content-inner">
|
||||
<div class="row">
|
||||
<!-- data table start -->
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title">Create New User</h4>
|
||||
@include('backend.layouts.partials.messages')
|
||||
|
||||
<form action="{{ route('admin.users.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="name">User Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Enter Name">
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="email">User Email</label>
|
||||
<input type="text" class="form-control" id="email" name="email" placeholder="Enter Email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Enter Password">
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password_confirmation">Confirm Password</label>
|
||||
<input type="password" class="form-control" id="password_confirmation" name="password_confirmation" placeholder="Enter Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password">Assign Roles</label>
|
||||
<select name="roles[]" id="roles" class="form-control select2" multiple>
|
||||
@foreach ($roles as $role)
|
||||
<option value="{{ $role->name }}">{{ $role->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-4 pr-4 pl-4">Save User</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- data table end -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
|
||||
|
||||
<style>
|
||||
.form-check-label {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('admin-content')
|
||||
|
||||
<!-- page title area start -->
|
||||
<div class="page-title-area">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-sm-6">
|
||||
<div class="breadcrumbs-area clearfix">
|
||||
<h4 class="page-title pull-left">User Create</h4>
|
||||
<ul class="breadcrumbs pull-left">
|
||||
<li><a href="{{ route('admin.dashboard') }}">Dashboard</a></li>
|
||||
<li><a href="{{ route('admin.users.index') }}">All Users</a></li>
|
||||
<li><span>Edit User - {{ $user->name }}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 clearfix">
|
||||
@include('backend.layouts.partials.logout')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- page title area end -->
|
||||
|
||||
<div class="main-content-inner">
|
||||
<div class="row">
|
||||
<!-- data table start -->
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title">Edit User - {{ $user->name }}</h4>
|
||||
@include('backend.layouts.partials.messages')
|
||||
|
||||
<form action="{{ route('admin.users.update', $user->id) }}" method="POST">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="name">User Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Enter Name" value="{{ $user->name }}">
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="email">User Email</label>
|
||||
<input type="text" class="form-control" id="email" name="email" placeholder="Enter Email" value="{{ $user->email }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Enter Password">
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password_confirmation">Confirm Password</label>
|
||||
<input type="password" class="form-control" id="password_confirmation" name="password_confirmation" placeholder="Enter Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password">Assign Roles</label>
|
||||
<select name="roles[]" id="roles" class="form-control select2" multiple>
|
||||
@foreach ($roles as $role)
|
||||
<option value="{{ $role->name }}" {{ $user->hasRole($role->name) ? 'selected' : '' }}>{{ $role->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-4 pr-4 pl-4">Save User</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- data table end -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<!-- Start datatable css -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.jqueryui.min.css">
|
||||
@endsection
|
||||
|
||||
|
||||
@section('admin-content')
|
||||
|
||||
<!-- page title area start -->
|
||||
<div class="page-title-area">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-sm-6">
|
||||
<div class="breadcrumbs-area clearfix">
|
||||
<h4 class="page-title pull-left">Users</h4>
|
||||
<ul class="breadcrumbs pull-left">
|
||||
<li><a href="{{ route('admin.dashboard') }}">Dashboard</a></li>
|
||||
<li><span>All Users</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 clearfix">
|
||||
@include('backend.layouts.partials.logout')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- page title area end -->
|
||||
|
||||
<div class="main-content-inner">
|
||||
<div class="row">
|
||||
<!-- data table start -->
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">Users List</h4>
|
||||
<p class="float-right mb-2">
|
||||
<a class="btn btn-primary text-white" href="{{ route('admin.users.create') }}">Create New User</a>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
<div class="data-tables">
|
||||
@include('backend.layouts.partials.messages')
|
||||
<table id="dataTable" class="text-center">
|
||||
<thead class="bg-light text-capitalize">
|
||||
<tr>
|
||||
<th width="5%">Sl</th>
|
||||
<th width="10%">Name</th>
|
||||
<th width="10%">Email</th>
|
||||
<th width="40%">Roles</th>
|
||||
<th width="15%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($users as $user)
|
||||
<tr>
|
||||
<td>{{ $loop->index+1 }}</td>
|
||||
<td>{{ $user->name }}</td>
|
||||
<td>{{ $user->email }}</td>
|
||||
<td>
|
||||
@foreach ($user->roles as $role)
|
||||
<span class="badge badge-info mr-1">
|
||||
{{ $role->name }}
|
||||
</span>
|
||||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-success text-white" href="{{ route('admin.users.edit', $user->id) }}">Edit</a>
|
||||
|
||||
<a class="btn btn-danger text-white" href="{{ route('admin.users.destroy', $user->id) }}"
|
||||
onclick="event.preventDefault(); document.getElementById('delete-form-{{ $user->id }}').submit();">
|
||||
Delete
|
||||
</a>
|
||||
|
||||
<form id="delete-form-{{ $user->id }}" action="{{ route('admin.users.destroy', $user->id) }}" method="POST" style="display: none;">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- data table end -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('scripts')
|
||||
<!-- Start datatable js -->
|
||||
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.18/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
/*================================
|
||||
datatable active
|
||||
==================================*/
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: true
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,55 @@
|
||||
<script>
|
||||
/**
|
||||
* Check all the permissions
|
||||
*/
|
||||
$("#checkPermissionAll").click(function(){
|
||||
if($(this).is(':checked')){
|
||||
// check all the checkbox
|
||||
$('input[type=checkbox]').prop('checked', true);
|
||||
}else{
|
||||
// un check all the checkbox
|
||||
$('input[type=checkbox]').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
function checkPermissionByGroup(className, checkThis){
|
||||
const groupIdName = $("#"+checkThis.id);
|
||||
const classCheckBox = $('.'+className+' input');
|
||||
|
||||
if(groupIdName.is(':checked')){
|
||||
classCheckBox.prop('checked', true);
|
||||
}else{
|
||||
classCheckBox.prop('checked', false);
|
||||
}
|
||||
implementAllChecked();
|
||||
}
|
||||
|
||||
function checkSinglePermission(groupClassName, groupID, countTotalPermission) {
|
||||
const classCheckbox = $('.'+groupClassName+ ' input');
|
||||
const groupIDCheckBox = $("#"+groupID);
|
||||
|
||||
// if there is any occurance where something is not selected then make selected = false
|
||||
if($('.'+groupClassName+ ' input:checked').length == countTotalPermission){
|
||||
groupIDCheckBox.prop('checked', true);
|
||||
}else{
|
||||
groupIDCheckBox.prop('checked', false);
|
||||
}
|
||||
implementAllChecked();
|
||||
}
|
||||
|
||||
function implementAllChecked() {
|
||||
const countPermissions = {{ count($all_permissions) }};
|
||||
const countPermissionGroups = {{ count($permission_groups) }};
|
||||
|
||||
// console.log((countPermissions + countPermissionGroups));
|
||||
// console.log($('input[type="checkbox"]:checked').length);
|
||||
|
||||
if($('input[type="checkbox"]:checked').length >= (countPermissions + countPermissionGroups)){
|
||||
$("#checkPermissionAll").prop('checked', true);
|
||||
}else{
|
||||
$("#checkPermissionAll").prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user