60 lines
2.3 KiB
PHP
60 lines
2.3 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex items-center justify-between">
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
|
{{ __('Roles') }}
|
|
</h2>
|
|
<a href="{{ route('roles.create') }}">
|
|
<x-primary-button>{{ __('New Role') }}</x-primary-button>
|
|
</a>
|
|
</div>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
@if (session('status') === 'role-created')
|
|
<div
|
|
x-data="{ show: true }"
|
|
x-show="show"
|
|
x-transition
|
|
x-init="setTimeout(() => show = false, 3000)"
|
|
class="mb-4 p-4 bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 text-sm rounded-lg"
|
|
>
|
|
{{ __('Role created successfully.') }}
|
|
</div>
|
|
@endif
|
|
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
|
<div
|
|
class="p-6"
|
|
x-data="{
|
|
loading: false,
|
|
async paginate(url) {
|
|
this.loading = true;
|
|
const response = await fetch(url, {
|
|
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
|
});
|
|
this.$refs.tableContainer.innerHTML = await response.text();
|
|
this.loading = false;
|
|
}
|
|
}"
|
|
@click.prevent="
|
|
const link = $event.target.closest('a[href]');
|
|
if (link && $refs.tableContainer.contains(link)) {
|
|
paginate(link.href);
|
|
}
|
|
"
|
|
>
|
|
<div x-show="loading" class="text-center py-4 text-gray-500 dark:text-gray-400">
|
|
{{ __('Loading...') }}
|
|
</div>
|
|
|
|
<div x-ref="tableContainer" x-show="!loading">
|
|
@include('roles._table')
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|