101 lines
5.1 KiB
PHP
Raw Normal View History

2024-06-20 16:42:33 +05:45
@extends('backend.template')
@section('content')
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ __('Edit Users') }}</h2>
<a href="{{ route('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
</div>
<div class="card-body">
<form action="{{ route('users.update', [$data->id]) }}" id="updateCustomForm" method="POST">
@csrf
@method('POST')
<input type="hidden" name="id" value="{{ $data->id }}" />
<div class="row">
<div class="col-lg-6 mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" id="name" name="name" class="form-control"
value="{{ $data->name }}">
</div>
<div class="col-lg-6 mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" id="email" name="email" class="form-control"
value="{{ $data->email }}">
</div>
<div class="col-lg-6 mb-3">
<label for="role" class="form-label">Roles</label>
<select id="role" name="role" autocomplete="role" class="form-select">
<option value="0"> Add Roles </option>
@foreach ($roles as $role)
<option value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
</select>
</div>
<div class="col-lg-6 mb-3">
<label for="permission" class="form-label">Permission</label>
<select id="permission" name="permission" autocomplete="permission-name"
class="form-select">
<option value="0"> Add Permission </option>
@foreach ($permissions as $permission)
<option value="{{ $permission->name }}">{{ $permission->name }}</option>
@endforeach
</select>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-update">Submit</button>
<a href="{{ route('users.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="row">
<div class="card">
<div class="card-header">
<h4>{{ __('Roles') }}</h4>
</div>
<div class="card-body">
@if ($data->roles)
@foreach ($data->roles as $user_role)
<form class="d-inline-block" method="POST"
action="{{ route('users.roles.remove', [$data->id, $user_role->id]) }}"
onsubmit="return confirm('Are you sure?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">{{ $user_role->name }}</button>
</form>
@endforeach
@endif
</div>
</div>
</div>
<div class="row">
<div class="card">
<div class="card-header">
<h4>{{ __('Permissions') }}</h4>
</div>
<div class="card-body">
@if ($data->permissions)
@foreach ($data->permissions as $user_permission)
<form class="d-inline-block" method="POST"
action="{{ route('users.permissions.revoke', [$data->id, $user_permission->id]) }}"
onsubmit="return confirm('Are you sure?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">{{ $user_permission->name }}</button>
</form>
@endforeach
@endif
</div>
</div>
</div>
</div>
</div>
@endsection