diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/views/components/wrapper.blade.php | 1 | ||||
-rw-r--r-- | resources/views/table.blade.php | 94 |
2 files changed, 53 insertions, 42 deletions
diff --git a/resources/views/components/wrapper.blade.php b/resources/views/components/wrapper.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/resources/views/components/wrapper.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/table.blade.php b/resources/views/table.blade.php index 8812b0c..741a27f 100644 --- a/resources/views/table.blade.php +++ b/resources/views/table.blade.php @@ -1,51 +1,61 @@ -<div> - @foreach($toolbars as $toolbar) - {{ $toolbar?->render() }} - @endforeach - <table class="table"> - <colgroup> - @foreach($columns as $column) - <col @class([$column->getColClass()]) /> - @endforeach - </colgroup> - <thead> - <tr> +<div @class($rootClass)> + + <x-dynamic-component :component="$toolbarsWrapperComponent"> + @foreach($toolbars as $toolbar) + {{ $toolbar?->render() }} + @endforeach + </x-dynamic-component> + + <x-dynamic-component :component="$tableWrapperComponent"> + <table @class($tableClass)> + <colgroup> @foreach($columns as $column) - <th - scope="col" - > - <div - @class([ - 'ordered' => $column->isSortable(), - 'ordered-asc' => $column->name === $order && $orderDirection === 'asc', - 'ordered-desc' => $column->name === $order && $orderDirection === 'desc', - ]) - @if($column->isSortable()) - wire:click="orderBy('{{ $column->name }}')" - @endif - > - {{ $column->getTitle() }} - </div> - </th> + <col @class([$column->getColClass()]) /> @endforeach - </tr> - </thead> - <tbody> - @foreach($data as $row) + </colgroup> + <thead> <tr> @foreach($columns as $column) - {{ $column->view($row) }} + <th + scope="col" + > + <div + @class([ + 'ordered' => $column->isSortable(), + 'ordered-asc' => $column->name === $order && $orderDirection === 'asc', + 'ordered-desc' => $column->name === $order && $orderDirection === 'desc', + ]) + @if($column->isSortable()) + wire:click="orderBy('{{ $column->name }}')" + @endif + > + {{ $column->getTitle() }} + </div> + </th> @endforeach </tr> - @endforeach - </tbody> - </table> - <div class="table-pagination d-flex justify-content-between align-items-center"> - {{ $data->links() }} - <div> - {{ __('Showing') }} {{ $data->count() }} - {{ __('of') }} {{ $data->total() }} + </thead> + <tbody> + @foreach($data as $row) + <tr> + @foreach($columns as $column) + {{ $column->view($row) }} + @endforeach + </tr> + @endforeach + </tbody> + </table> + </x-dynamic-component> + + <x-dynamic-component :component="$paginationWrapperComponent"> + <div class="table-pagination d-flex justify-content-between align-items-center"> + {{ $data->links() }} + <div> + {{ __('Showing') }} {{ $data->count() }} + {{ __('of') }} {{ $data->total() }} + </div> </div> - </div> + </x-dynamic-component> + </div> |