summaryrefslogtreecommitdiff
path: root/resources/views/table.blade.php
blob: 741a27f21bc1f04bd49dc81f99bdaa341811bd40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<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)
                    <col @class([$column->getColClass()]) />
                @endforeach
            </colgroup>
            <thead>
                <tr>
                    @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>
                    @endforeach
                </tr>
            </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>
    </x-dynamic-component>

</div>