34 lines
2.4 KiB
PHP
Executable File
34 lines
2.4 KiB
PHP
Executable File
<x-layouts::app :title="__('Create User')">
|
|
<div class="hd-page-shell space-y-5">
|
|
<section class="hd-page-hero"><div><div class="hd-eyebrow">User administration</div><h1>Create user</h1><p>Create a Helpdesk account and assign its access level.</p></div><a class="hd-action" href="{{ route('user-management.index') }}">Back</a></section>
|
|
@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.store') }}" class="hd-panel p-6 space-y-6">@csrf
|
|
|
|
<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 justify-end"><button class="hd-action hd-action-green" type="submit"><i class="fa-solid fa-floppy-disk"></i> Create user</button></div></form>
|
|
</div>
|
|
</x-layouts::app>
|