New Branch Structure
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<x-layouts.app :title="__('Create user')">
|
||||
<div class="mx-auto max-w-2xl space-y-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-zinc-950 dark:text-zinc-100">Create user</h1>
|
||||
<p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Add a backend user and assign roles.</p>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('administration.users.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
@csrf
|
||||
|
||||
<flux:input name="name" :label="__('Name')" :value="old('name')" required autofocus />
|
||||
<flux:input name="email" type="email" :label="__('Email')" :value="old('email')" required />
|
||||
<flux:input name="password" type="password" :label="__('Password')" required />
|
||||
<flux:input name="password_confirmation" type="password" :label="__('Confirm password')" required />
|
||||
|
||||
<div class="space-y-2">
|
||||
<div class="text-sm font-medium text-zinc-700 dark:text-zinc-300">Roles</div>
|
||||
<div class="grid gap-2 sm:grid-cols-2">
|
||||
@foreach ($roles as $role)
|
||||
<label class="flex items-center gap-2 rounded-lg border border-zinc-200 px-3 py-2 text-sm dark:border-zinc-700">
|
||||
<input type="checkbox" name="roles[]" value="{{ $role }}" @checked(in_array($role, old('roles', []), true))>
|
||||
<span>{{ $role }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-3">
|
||||
<flux:button :href="route('administration.users.index')" wire:navigate>Cancel</flux:button>
|
||||
<flux:button variant="primary" type="submit">Create user</flux:button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -0,0 +1,35 @@
|
||||
<x-layouts.app :title="__('Edit user')">
|
||||
<div class="mx-auto max-w-2xl space-y-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-zinc-950 dark:text-zinc-100">Edit user</h1>
|
||||
<p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Update account details and roles.</p>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('administration.users.update', $user) }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<flux:input name="name" :label="__('Name')" :value="old('name', $user->name)" required autofocus />
|
||||
<flux:input name="email" type="email" :label="__('Email')" :value="old('email', $user->email)" required />
|
||||
<flux:input name="password" type="password" :label="__('New password')" />
|
||||
<flux:input name="password_confirmation" type="password" :label="__('Confirm new password')" />
|
||||
|
||||
<div class="space-y-2">
|
||||
<div class="text-sm font-medium text-zinc-700 dark:text-zinc-300">Roles</div>
|
||||
<div class="grid gap-2 sm:grid-cols-2">
|
||||
@foreach ($roles as $role)
|
||||
<label class="flex items-center gap-2 rounded-lg border border-zinc-200 px-3 py-2 text-sm dark:border-zinc-700">
|
||||
<input type="checkbox" name="roles[]" value="{{ $role }}" @checked(in_array($role, old('roles', $user->roles->pluck('name')->all()), true))>
|
||||
<span>{{ $role }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-3">
|
||||
<flux:button :href="route('administration.users.index')" wire:navigate>Cancel</flux:button>
|
||||
<flux:button variant="primary" type="submit">Save changes</flux:button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -0,0 +1,62 @@
|
||||
<x-layouts.app :title="__('Users')">
|
||||
<div class="space-y-6">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-zinc-950 dark:text-zinc-100">Users</h1>
|
||||
<p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Create, edit and soft delete backend user accounts.</p>
|
||||
</div>
|
||||
|
||||
<flux:button :href="route('administration.users.create')" variant="primary" wire:navigate>
|
||||
Create user
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
@if (session('status'))
|
||||
<div class="rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800 dark:border-emerald-900/60 dark:bg-emerald-950/40 dark:text-emerald-200">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<table class="min-w-full divide-y divide-zinc-200 text-sm dark:divide-zinc-700">
|
||||
<thead class="bg-zinc-50 text-left text-xs font-semibold uppercase tracking-wide text-zinc-600 dark:bg-zinc-950 dark:text-zinc-400">
|
||||
<tr>
|
||||
<th class="px-4 py-3">Name</th>
|
||||
<th class="px-4 py-3">Email</th>
|
||||
<th class="px-4 py-3">Roles</th>
|
||||
<th class="px-4 py-3 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">
|
||||
@forelse ($users as $user)
|
||||
<tr>
|
||||
<td class="px-4 py-3 font-medium text-zinc-950 dark:text-zinc-100">{{ $user->name }}</td>
|
||||
<td class="px-4 py-3 text-zinc-600 dark:text-zinc-400">{{ $user->email }}</td>
|
||||
<td class="px-4 py-3 text-zinc-600 dark:text-zinc-400">
|
||||
{{ $user->roles->pluck('name')->join(', ') ?: '—' }}
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex justify-end gap-2">
|
||||
<flux:button size="sm" :href="route('administration.users.edit', $user)" wire:navigate>Edit</flux:button>
|
||||
<form method="POST" action="{{ route('administration.users.destroy', $user) }}">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<flux:button size="sm" variant="danger" type="submit">Delete</flux:button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="px-4 py-8 text-center text-zinc-600 dark:text-zinc-400">No users found.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if (method_exists($users, 'links'))
|
||||
{{ $users->links() }}
|
||||
@endif
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -0,0 +1,35 @@
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300" for="name">Name</label>
|
||||
<input id="name" name="name" value="{{ old('name', $user?->name) }}" class="mt-1 w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-950 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100" required>
|
||||
@error('name') <p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300" for="email">Email</label>
|
||||
<input id="email" name="email" type="email" value="{{ old('email', $user?->email) }}" class="mt-1 w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-950 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100" required>
|
||||
@error('email') <p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300" for="password">Password</label>
|
||||
<input id="password" name="password" type="password" class="mt-1 w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-950 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100" {{ $user ? '' : 'required' }}>
|
||||
@error('password') <p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300" for="password_confirmation">Confirm password</label>
|
||||
<input id="password_confirmation" name="password_confirmation" type="password" class="mt-1 w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-950 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100" {{ $user ? '' : 'required' }}>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="block text-sm font-medium text-zinc-700 dark:text-zinc-300">Roles</span>
|
||||
<div class="mt-2 space-y-2">
|
||||
@foreach ($roles as $role)
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700 dark:text-zinc-300">
|
||||
<input type="checkbox" name="roles[]" value="{{ $role->name }}" @checked(in_array($role->name, old('roles', $user?->roles->pluck('name')->all() ?? []), true)) class="rounded border-zinc-300 dark:border-zinc-700">
|
||||
{{ $role->name }}
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
@error('roles') <p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
Reference in New Issue
Block a user