1
0
tinklu-it-projektas/resources/views/users/index.blade.php
2023-10-29 17:33:32 +02:00

56 lines
2.6 KiB
PHP

<x-app-layout>
<div class="max-w-2xl mx-auto p-4 sm:p-6 lg:p-8">
<form method="POST" action="{{ route('users.store') }}">
@csrf
<x-user-fields />
<x-primary-button class="mt-4">{{ __('Create user') }}</x-primary-button>
</form>
{{-- <div class="mt-6 bg-white shadown-sm rounded-lg divide-y"> --}}
<table class="mt-6 border border-gray-300 w-full text-left">
<tr>
<th class="border border-gray-300 p-1">{{ __("Name") }}</th>
<th class="border border-gray-300 p-1">{{ __("Email") }}</th>
<th class="border border-gray-300 p-1">{{ __("Role") }}</th>
<th class="border border-gray-300 p-1"></th>
</tr>
@foreach ($users as $user)
<tr>
<td class="border border-gray-300 p-1">{{ $user->name }}</td>
<td class="border border-gray-300 p-1">{{ $user->email }}</td>
<td class="border border-gray-300 p-1">{{ __($user->role) }}</td>
<td class="border border-gray-300 p-1">
<x-dropdown>
<x-slot name="trigger">
<button>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-400" viewBox="0 0 20 20" fill="currentColor">
<path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z" />
</svg>
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('users.edit', $user)">
{{ __("Edit") }}
</x-dropdown-link>
@if (!$user->is(auth()->user()))
<form method="POST" action="{{ route("users.destroy", $user) }}">
@csrf
@method("delete")
<x-dropdown-link :href="route('users.destroy', $user)" onclick="event.preventDefault(); this.closest('form').submit();">
{{ __("Delete") }}
</x-dropdown-link>
</form>
@endif
</x-slot>
</x-dropdown>
</td>
</tr>
@endforeach
</table>
{{-- </div> --}}
</div>
</x-app-layout>