update patch 1
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<style>
|
||||
.form-check-label {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ $pageInfo['title'] }}</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{ $pageInfo['path'] }}">{{ $pageInfo['title'] }}</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title">{{ $pageInfo['title'] }}</h4>
|
||||
@include('backend.layouts.partials.messages')
|
||||
|
||||
<form action="{{ route('admin.admins.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="name">Full Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name"
|
||||
placeholder="Enter Name" required autofocus value="{{ old('name') }}">
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="email">Email</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
placeholder="Enter Email" required value="{{ old('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-6">
|
||||
<label for="password">Assign Roles</label>
|
||||
<select name="roles[]" id="roles" class="form-control select2" multiple
|
||||
required>
|
||||
@foreach ($roles as $role)
|
||||
<option value="{{ $role->name }}">{{ $role->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-6">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username"
|
||||
placeholder="Enter Username" required value="{{ old('username') }}">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-4 pr-4 pl-4">Save</button>
|
||||
<a href="{{ route('admin.admins.index') }}"
|
||||
class="btn btn-secondary mt-4 pr-4 pl-4">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,112 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<style>
|
||||
.form-check-label {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ $pageInfo['title'] }}</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{ $pageInfo['path'] }}">{{ $pageInfo['title'] }}</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title">Edit Admin - {{ $admin->name }}</h4>
|
||||
@include('backend.layouts.partials.messages')
|
||||
|
||||
<form action="{{ route('admin.admins.update', $admin->id) }}" method="POST">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="name">Admin Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name"
|
||||
placeholder="Enter Name" value="{{ $admin->name }}" required autofocus>
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="email">Admin Email</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
placeholder="Enter Email" value="{{ $admin->email }}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 col-sm-12">
|
||||
<label for="password">Password (Optional)</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 (Optional)</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-6">
|
||||
<label for="password">Assign Roles</label>
|
||||
<select name="roles[]" id="roles" class="form-control select2" multiple
|
||||
required>
|
||||
@foreach ($roles as $role)
|
||||
<option value="{{ $role->name }}"
|
||||
{{ $admin->hasRole($role->name) ? 'selected' : '' }}>
|
||||
{{ $role->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6 col-sm-6">
|
||||
<label for="username">Admin Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username"
|
||||
placeholder="Enter Username" required value="{{ $admin->username }}">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-4 pr-4 pl-4">Save</button>
|
||||
<a href="{{ route('admin.admins.index') }}"
|
||||
class="btn btn-secondary mt-4 pr-4 pl-4">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,107 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
{{ $pageInfo['title'] }}
|
||||
@endsection
|
||||
|
||||
|
||||
@section('admin-content')
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ $pageInfo['title'] }}</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{ $pageInfo['path'] }}">{{ $pageInfo['title'] }}</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-5">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title float-left">{{ $pageInfo['title'] }}</h4>
|
||||
<p class="float-right mb-2">
|
||||
@if (auth()->user()->can('admin.edit'))
|
||||
<a class="btn btn-primary text-white" href="{{ route('admin.admins.create') }}">
|
||||
Add New User Access
|
||||
</a>
|
||||
@endif
|
||||
</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 ($admins as $admin)
|
||||
<tr>
|
||||
<td>{{ $loop->index + 1 }}</td>
|
||||
<td>{{ $admin->name }}</td>
|
||||
<td>{{ $admin->email }}</td>
|
||||
<td>
|
||||
@foreach ($admin->roles as $role)
|
||||
<span class="badge badge-info mr-1">
|
||||
{{ $role->name }}
|
||||
</span>
|
||||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
@if (auth()->user()->can('admin.edit'))
|
||||
<a class="btn btn-success text-white"
|
||||
href="{{ route('admin.admins.edit', $admin->id) }}">Edit</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('admin.delete'))
|
||||
<a class="btn btn-danger text-white" href="javascript:void(0);"
|
||||
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $admin->id }}').submit(); }">
|
||||
{{ __('Delete') }}
|
||||
</a>
|
||||
|
||||
<form id="delete-form-{{ $admin->id }}"
|
||||
action="{{ route('admin.admins.destroy', $admin->id) }}"
|
||||
method="POST" style="display: none;">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
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