Files
preregister/resources/views/admin/users/index.blade.php

69 lines
3.8 KiB
PHP

@extends('layouts.admin')
@section('title', __('Users'))
@section('mobile_title', __('Users'))
@section('content')
<div class="mx-auto max-w-5xl">
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Users') }}</h1>
<p class="mt-1 text-sm text-slate-600">{{ __('Backend accounts and roles.') }}</p>
</div>
@can('create', \App\Models\User::class)
<a href="{{ route('admin.users.create') }}"
class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500">
{{ __('New user') }}
</a>
@endcan
</div>
<div class="overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-slate-200 text-left text-sm">
<thead class="bg-slate-50">
<tr>
<th class="px-4 py-3 font-semibold text-slate-700">{{ __('Name') }}</th>
<th class="px-4 py-3 font-semibold text-slate-700">{{ __('Email') }}</th>
<th class="px-4 py-3 font-semibold text-slate-700">{{ __('Role') }}</th>
<th class="px-4 py-3 text-right font-semibold text-slate-700">{{ __('Actions') }}</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@foreach ($users as $user)
<tr class="hover:bg-slate-50/80">
<td class="px-4 py-3 font-medium text-slate-900">{{ $user->name }}</td>
<td class="px-4 py-3 text-slate-600">{{ $user->email }}</td>
<td class="px-4 py-3">
<span class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium {{ $user->role === 'superadmin' ? 'bg-violet-100 text-violet-800' : 'bg-slate-100 text-slate-700' }}">
{{ $user->role === 'superadmin' ? __('Superadmin') : __('User') }}
</span>
</td>
<td class="whitespace-nowrap px-4 py-3 text-right">
@can('update', $user)
<a href="{{ route('admin.users.edit', $user) }}" class="text-indigo-600 hover:text-indigo-500">{{ __('Edit') }}</a>
@endcan
@can('delete', $user)
<form action="{{ route('admin.users.destroy', $user) }}" method="post" class="ml-3 inline"
onsubmit="return confirm({{ json_encode(__('Delete this user? This cannot be undone.')) }});">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-500">{{ __('Delete') }}</button>
</form>
@endcan
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if ($users->hasPages())
<div class="border-t border-slate-200 px-4 py-3">
{{ $users->links() }}
</div>
@endif
</div>
</div>
@endsection