104 lines
6.8 KiB
PHP
104 lines
6.8 KiB
PHP
<div class="mx-auto max-w-3xl space-y-6">
|
|
<div class="animate-rise">
|
|
<h1 class="text-2xl font-semibold tracking-tight text-ink">{{ __('admin_settings.title') }}</h1>
|
|
<p class="mt-1 text-sm text-muted">{{ __('admin_settings.subtitle') }}</p>
|
|
</div>
|
|
|
|
{{-- My account --}}
|
|
<form wire:submit="saveAccount" class="space-y-4 rounded-xl border border-line bg-surface p-6 shadow-xs animate-rise [animation-delay:60ms]">
|
|
<h2 class="font-semibold text-ink">{{ __('admin_settings.account_title') }}</h2>
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
<x-ui.input name="name" wire:model="name" :label="__('admin_settings.name')" />
|
|
<x-ui.input name="email" wire:model="email" :label="__('admin_settings.email')" type="email" />
|
|
</div>
|
|
<p class="text-xs text-faint">{{ __('admin_settings.twofa_hint') }}</p>
|
|
<div class="flex justify-end">
|
|
<x-ui.button variant="primary" type="submit" wire:loading.attr="disabled" wire:target="saveAccount">{{ __('admin_settings.save') }}</x-ui.button>
|
|
</div>
|
|
</form>
|
|
|
|
{{-- Staff & access (Owner-only) --}}
|
|
@if ($canManageStaff)
|
|
<div class="space-y-4 rounded-xl border border-line bg-surface p-6 shadow-xs animate-rise [animation-delay:120ms]">
|
|
<div>
|
|
<h2 class="font-semibold text-ink">{{ __('admin_settings.staff_title') }}</h2>
|
|
<p class="mt-1 text-sm text-muted">{{ __('admin_settings.staff_sub') }}</p>
|
|
</div>
|
|
|
|
{{-- Invite --}}
|
|
<form wire:submit="inviteStaff" class="grid grid-cols-1 gap-3 sm:grid-cols-[1fr_1fr_auto_auto] sm:items-end">
|
|
<div>
|
|
<label class="text-sm font-medium text-body" for="staffName">{{ __('admin_settings.name') }}</label>
|
|
<input id="staffName" type="text" wire:model="staffName" class="mt-1.5 w-full rounded-md border border-line-strong bg-surface px-3 py-2 text-sm text-ink" />
|
|
@error('staffName')<p class="mt-1 text-xs text-danger">{{ $message }}</p>@enderror
|
|
</div>
|
|
<div>
|
|
<label class="text-sm font-medium text-body" for="staffEmail">{{ __('admin_settings.email') }}</label>
|
|
<input id="staffEmail" type="email" wire:model="staffEmail" class="mt-1.5 w-full rounded-md border border-line-strong bg-surface px-3 py-2 text-sm text-ink" />
|
|
@error('staffEmail')<p class="mt-1 text-xs text-danger">{{ $message }}</p>@enderror
|
|
</div>
|
|
<div>
|
|
<label class="text-sm font-medium text-body" for="staffRole">{{ __('admin_settings.role') }}</label>
|
|
<select id="staffRole" wire:model="staffRole" class="mt-1.5 rounded-md border border-line-strong bg-surface px-3 py-2 text-sm text-body">
|
|
@foreach ($roles as $r)
|
|
@if ($r !== 'Owner' || $isOwner)
|
|
<option value="{{ $r }}">{{ __('admin_settings.role_'.\Illuminate\Support\Str::slug($r)) }}</option>
|
|
@endif
|
|
@endforeach
|
|
</select>
|
|
@error('staffRole')<p class="mt-1 text-xs text-danger">{{ $message }}</p>@enderror
|
|
</div>
|
|
<x-ui.button variant="primary" type="submit" wire:loading.attr="disabled" wire:target="inviteStaff">
|
|
<x-ui.icon name="plus" class="size-4" />{{ __('admin_settings.invite') }}
|
|
</x-ui.button>
|
|
</form>
|
|
<p class="text-xs text-faint">{{ __('admin_settings.invite_hint') }}</p>
|
|
|
|
{{-- Staff list --}}
|
|
<div class="overflow-hidden rounded-xl border border-line">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-sm">
|
|
<thead>
|
|
<tr class="border-b border-line bg-surface-2 text-left text-xs uppercase tracking-wide text-faint">
|
|
<th class="px-4 py-3 font-semibold">{{ __('admin_settings.col_person') }}</th>
|
|
<th class="px-4 py-3 font-semibold">{{ __('admin_settings.role') }}</th>
|
|
<th class="px-4 py-3 text-right font-semibold">{{ __('admin_settings.col_actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($staff as $s)
|
|
<tr wire:key="staff-{{ $s['id'] }}" class="border-b border-line last:border-0 hover:bg-surface-hover">
|
|
<td class="px-4 py-3">
|
|
<p class="font-medium text-ink">{{ $s['name'] }}
|
|
@if ($s['self'])<span class="ml-1 text-xs text-faint">({{ __('admin_settings.you') }})</span>@endif
|
|
</p>
|
|
<p class="text-xs text-muted">{{ $s['email'] }}</p>
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
@if ($s['self'])
|
|
<span class="text-body">{{ __('admin_settings.role_'.\Illuminate\Support\Str::slug($s['role'])) }}</span>
|
|
@else
|
|
<select wire:change="setStaffRole({{ $s['id'] }}, $event.target.value)" class="rounded-md border border-line-strong bg-surface px-2 py-1 text-xs text-body">
|
|
@foreach ($roles as $r)
|
|
@if ($r !== 'Owner' || $isOwner)
|
|
<option value="{{ $r }}" @selected($s['role'] === $r)>{{ __('admin_settings.role_'.\Illuminate\Support\Str::slug($r)) }}</option>
|
|
@endif
|
|
@endforeach
|
|
</select>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-3 text-right">
|
|
@unless ($s['self'])
|
|
<button type="button" wire:click="revokeStaff({{ $s['id'] }})" class="rounded-md border border-line px-2.5 py-1.5 text-xs font-semibold text-muted hover:border-danger hover:text-danger">{{ __('admin_settings.revoke') }}</button>
|
|
@endunless
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|