table.blade.php 3.36 KB
Newer Older
1
2
3
4
{{-- Actual Table --}}
<div class="row">
    @if($paginatedData->total() === 0)
        <div class="col-auto m-auto">
5
            <h1 class="text-center display-4">
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
                No data.
            </h1>
        </div>
    @else
        <table class="table table-bordered" role="grid" style="width: 100%;">
            <thead>
            <tr role="rowheader">
                @foreach($headers as $headerTitle=>$header)
                    <th>
                        {{ $headerTitle }}
                    </th>
                @endforeach
                @if(isset($controls))
                    <th>
                        Actions
                    </th>
                @endif
            </tr>
            </thead>
            <tbody>
            @foreach($paginatedData as $row)
                <tr role="row">
                    @foreach($headers as $header)
Jacob Priddy's avatar
Jacob Priddy committed
29
30
31
32
33
34
35
36
37
38
39
40
                        @if($header === 'user_id')
                            <td>
                                <a href="{{ route('web.admin.users.index', ['query' => $row[$header]]) }}">
                                    {{ user($row[$header])['display_name'] }} (ID: {{ $row[$header] }})
                                </a>
                            </td>
                        @elseif($header === 'door_id')
                            <td>
                                <a href="{{ route('web.admin.doors.index', ['query' => $row[$header]]) }}">
                                    {{ door($row[$header])['name'] }} (ID: {{ $row[$header] }})
                                </a>
                            </td>
41
42
43
44
45
46
                        @elseif($header === 'door_shallow_link')
                            <td>
                                <a href="{{ route('web.admin.doors.index', ['query' => $row[$header]]) }}">
                                    {{ $row[$header] }}
                                </a>
                            </td>
47
48
49
50
51
52
                        @elseif($header === 'schedule_id')
                            <td>
                                <a href="{{ route('web.admin.schedules.edit', ['scheduleId' => $row[$header]]) }}">
                                    {{ $row[$header] }}
                                </a>
                            </td>
Jacob Priddy's avatar
Jacob Priddy committed
53
54
55
56
57
                        @else
                            <td>
                                {{ $row[$header] }}
                            </td>
                        @endif
58
59
                    @endforeach
                    @if(isset($controls))
60
61
                        <td class="text-center">
                            <div class="d-inline-flex flex-row">
62
63
                                @include('partials.controls.' . $controls, ['id' => $row['id']])
                            </div>
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
                        </td>
                    @endif
                </tr>
            @endforeach
            </tbody>
        </table>
    @endif
</div>

{{-- Pagination information--}}
@if ($paginatedData->total())
    <div class="row">
        <div class="col-sm-12 col-md-5">
            <div>
                Showing {{ $paginatedData->firstItem() }} to {{ $paginatedData->lastItem() }}
                of {{ $paginatedData->total() }} entries
            </div>
        </div>
        <div class="col-sm-12 col-md-7">
            <div class="m-auto">
                {!! $paginatedData->links() !!}
            </div>
        </div>
    </div>
@endif