Archived
1
0
Fork 0
This repository has been archived on 2026-06-16. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
wow-raid-bingo/resources/views/livewire/datatable.blade.php

59 lines
2 KiB
PHP

<div>
<table class="table-auto w-full">
<tr class="text-left border-b-2">
@foreach($columns as $key => $name)
<th class="border px-6 py-3 w-24">
@if (isset($sort_columns[$key]))
<div class="flex items-center justify-between cursor-pointer" wire:click="sort('{{ $key }}')">
<span class="hover:underline">{{ __($name) }}</span>
<x-sort-link name="{{ $key }}" :column="$sort" :dir="$dir" class="ml-2 text-gray-600 h-5" />
</div>
@else
{{ $name }}
@endif
</th>
@endforeach
@if($route_delete || $route_edit)
<th class="border px-6 py-3 w-4">{{ __('Actions') }}</th>
@endif
</tr>
<tbody>
@foreach($items as $item)
<tr class="odd:bg-gray-100">
@foreach(array_keys($columns) as $key)
<td class="border px-4 py-2">{{ Arr::get($item, $key) }}</td>
@endforeach
@if ($route_edit || $route_delete)
<td class="border px-4 py-2">
@if($route_edit)
<a href="{{ route($route_edit, [ $item ]) }}">
<x-icon name="heroicon-o-pencil" class="inline-block w-6 text-yellow-500"/>
</a>
@endif
@if($route_delete)
<x-ignite-form class="inline-block" id="dt-delete-{{$_instance->id}}-{{ $item->id }}" method="DELETE" action="{{ route($route_delete, [ $item ]) }}">
<a href="javascript:document.getElementById('dt-delete-{{$_instance->id}}-{{ $item->id }}').submit();">
<x-icon name="heroicon-o-trash" class="inline-block w-6 text-red-500"/>
</a>
</x-ignite-form>
@endif
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
@if ($items->hasPages())
<div class="mt-4">
{{ $items->links() }}
</div>
@endif
</div>