Files
2026-09-02 17:08:57 +00:00

36 lines
2.8 KiB
PHP
Executable File

<x-layouts::app :title="__('Edit User')">
<div class="hd-page-shell space-y-5">
<section class="hd-page-hero"><div><div class="hd-eyebrow">User administration</div><h1>Edit {{ $user->name }}</h1><p>Update identity and Helpdesk access.</p></div><a class="hd-action" href="{{ route('user-management.index') }}">Back</a></section>
@if(session('status'))<div class="hd-alert hd-alert-success">{{ session('status') }}</div>@endif
@if($errors->any())<div class="hd-alert hd-alert-danger"><ul>@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>@endif
<form method="POST" action="{{ route('user-management.update', $user) }}" class="hd-panel p-6 space-y-6">@csrf @method('PUT')
<div class="hd-form-grid">
<label class="hd-field"><span>Name</span><input name="name" value="{{ old('name', $user->name ?? '') }}" required></label>
<label class="hd-field"><span>Email</span><input type="email" name="email" value="{{ old('email', $user->email ?? '') }}" required></label>
<label class="hd-field"><span>Password {{ isset($user) ? '(leave blank to keep current)' : '' }}</span><input type="password" name="password" {{ isset($user) ? '' : 'required' }}></label>
<label class="hd-field"><span>Confirm password</span><input type="password" name="password_confirmation" {{ isset($user) ? '' : 'required' }}></label>
</div>
<div class="hd-role-options">
<label><input type="checkbox" name="helpdesk_agent" value="1" @checked(old('helpdesk_agent', $user->helpdesk_agent ?? false))> <span><strong>Helpdesk agent</strong><small>Can manage tickets and workflow.</small></span></label>
<label><input type="checkbox" name="helpdesk_admin" value="1" @checked(old('helpdesk_admin', $user->helpdesk_admin ?? false))> <span><strong>Administrator</strong><small>Full Helpdesk, settings and user administration.</small></span></label>
</div>
<div>
<h2 class="mb-3 text-lg font-semibold">Custom roles</h2>
<div class="hd-role-options">
@foreach($roles as $roleOption)
<label>
<input type="checkbox" name="roles[]" value="{{ $roleOption->id }}"
@checked(in_array($roleOption->id, old('roles', isset($user) ? $user->roles->pluck('id')->all() : [])))>
<span><strong>{{ $roleOption->name }}</strong><small>{{ $roleOption->description ?: $roleOption->slug }}</small></span>
</label>
@endforeach
</div>
</div>
<div class="flex flex-wrap justify-between gap-3"><div></div><button class="hd-action hd-action-blue" type="submit"><i class="fa-solid fa-floppy-disk"></i> Save changes</button></div></form>
@if(auth()->id() !== $user->id)<form method="POST" action="{{ route('user-management.destroy', $user) }}" onsubmit="return confirm('Delete this user?')">@csrf @method('DELETE')<button class="hd-action hd-action-red" type="submit">Delete user</button></form>@endif
</div>
</x-layouts::app>