58 lines
3.0 KiB
PHP
Raw Normal View History

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Users Management') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg p-6">
@if(session('message'))
<x-bladewind::alert type="{{ session('type') }}">{{ session('message') }}</x-bladewind::alert>
@endif
<div class="flex justify-between mb-4">
<h2 class="text-lg font-semibold">{{__('User List')}}</h2>
<x-bladewind.button tag="a" href="{{ route('users.create') }}" color="green" icon="plus-small" >{{__('Create New User')}}</x-bladewind.button>
</div>
<x-bladewind.table divider="thin" has_shadow="true">
<x-slot name="header">
<th>{{__('No')}}</th>
<th>{{__('Name')}}</th>
<th>{{__('Email')}}</th>
<th>{{__('Roles')}}</th>
<th>{{__('Action')}}</th>
</x-slot>
@foreach ($data as $key => $user)
<tr >
<td >{{ ++$i }}</td>
<td >{{ $user->name }}</td>
<td >{{ $user->email }}</td>
<td >
@if(!empty($user->getRoleNames()))
@foreach($user->getRoleNames() as $v)
<span class="bg-green-500 text-white px-2 py-2 rounded">{{ $v }}</span>
@endforeach
@endif
</td>
<td >
<x-bladewind.button tag="a" href="{{ route('users.show',$user->id) }}" size="tiny" color="cyan" icon="list-bullet" >{{__('Show')}}</x-bladewind.button>
<x-bladewind.button tag="a" href="{{route('users.edit',$user->id)}}" size="tiny" color="yellow" icon="pencil-square" >{{__('Edit')}}</x-bladewind.button>
<form method="POST" action="{{ route('users.destroy', $user->id) }}" class="inline" onsubmit="return confirm('Are you sure?');">
@csrf
@method('DELETE')
<x-bladewind.button can_submit="true" size="tiny" color="red" icon="trash" >{{__('Delete')}}</x-bladewind.button>
</form>
</td>
</tr>
@endforeach
</x-bladewind.table>
<div class="mt-4">
{!! $data->links('pagination::tailwind') !!}
</div>
</div>
</div>
</div>
</x-app-layout>