Implement roles management;

Add user profile;
Improve Ui;
Clean code;
Minor fix;
Typo;
This commit is contained in:
c.girardi
2024-02-21 16:56:08 +01:00
parent fca756b556
commit e6f3fcbb4e
27 changed files with 708 additions and 138 deletions

View File

@@ -9,7 +9,7 @@
</div>
</div>
<div class="card-body">
<form action="{{ route('users.store') }}" method="post">
<form action="{{ route('users.store') }}" method="post" enctype="multipart/form-data">
@csrf
<div class="mb-3 row">
@@ -59,17 +59,17 @@
<div class="mb-3 row">
<label for="roles" class="col-md-4 col-form-label text-md-end text-start">Roles</label>
<div class="col-md-6">
<select class="form-select @error('roles') is-invalid @enderror" multiple
<select class="form-select select-roles @error('roles') is-invalid @enderror" multiple
aria-label="Roles" id="roles" name="roles[]">
@forelse ($roles as $role)
@if ($role!='Super Admin')
@if ($role!='ADMIN')
<option
value="{{ $role }}" {{ in_array($role, old('roles') ?? []) ? 'selected' : '' }}>
{{ $role }}
</option>
@else
@if (Auth::user()->hasRole('Super Admin'))
@if (Auth::user()->hasRole('ADMIN'))
<option
value="{{ $role }}" {{ in_array($role, old('roles') ?? []) ? 'selected' : '' }}>
{{ $role }}
@@ -87,6 +87,16 @@
</div>
</div>
<div class="mb-3 row">
<label for="roles" class="col-md-4 col-form-label text-md-end text-start">Profile Picture</label>
<div class="col-md-6">
<input class="form-control @error('image') is-invalid @enderror" type="file" name="image">
@if ($errors->has('image'))
<span class="text-danger">{{ $errors->first('image') }}</span>
@endif
</div>
</div>
<div class="mb-3 row">
<input type="submit" class="col-md-3 offset-md-5 btn btn-primary" value="Add User">
</div>
@@ -94,4 +104,15 @@
</form>
</div>
</div>
@push('body-scripts')
<script id="create-user" type="application/javascript">
$('.select-roles').select2({
theme: "bootstrap-5",
width: '100%',
});
</script>
@endpush
</x-app-layout>