|
2 | 2 | <div class="py-1 bg-white rounded-md shadow">
|
3 | 3 | <div class="w-full bg-white rounded-md shadow">
|
4 | 4 |
|
5 |
| - <div class="flex items-center px-4 py-2"> |
6 |
| - <div class="w-4/12"> |
7 |
| - <h1 class="uppercase">Data Table - {{ $table_name }}</h1> |
| 5 | + <div class="flex flex-wrap items-center px-4 py-2"> |
| 6 | + <div class="w-full md:w-3/12"> |
| 7 | + <h1 class="uppercase"> |
| 8 | + {{ $table_name }} |
| 9 | + <span class="xs:hidden"> - Data Table</span> <br> |
| 10 | + </h1> |
8 | 11 | </div>
|
9 |
| - <div class="w-full"> |
| 12 | + <div class="w-full md:w-9/12"> |
10 | 13 | <input wire:model='search' type="text" class="w-full px-4 py-1 bg-white border border-gray-300 rounded-full" placeholder="Search in {{ implode(',', $cols['searchable']) }} ...">
|
11 | 14 | </div>
|
12 | 15 | </div>
|
|
15 | 18 |
|
16 | 19 | {{-- secont row -------- add new - columns customization - per_page --}}
|
17 | 20 |
|
18 |
| - <div class="flex flex-wrap items-center justify-between py-1 border-t border-b border-gray-200" > |
19 |
| - <div class="flex gap-2 px-4"> |
| 21 | + <div class="flex flex-wrap items-center justify-between border-t py-1" > |
| 22 | + <div class="flex gap-2 px-2"> |
| 23 | + @if (count($addNew) > 0) |
20 | 24 | <x-btui-smodal title="Add New">
|
21 | 25 | <x-slot name="trigger">
|
22 | 26 | <x-btui-button size="sm">Add New</x-btui-button>
|
23 | 27 | </x-slot>
|
24 | 28 |
|
25 |
| - @if(count($addNew) > 0) |
| 29 | + @if(count($addNew) > 0 && $addNew['component'] != '' && count($addNew['params']) > 0) |
26 | 30 | @livewire($addNew['component'],$addNew['params'])
|
27 | 31 | @else
|
28 | 32 | <div class="p-4 text-sm bg-red-400">No! Livewire Component Not found!</div>
|
29 | 33 | @endif
|
30 | 34 |
|
31 | 35 | </x-btui-smodal>
|
32 |
| - <div wire:click='$set("colbox", {{ !$colbox }})' class="flex items-center justify-start gap-2 px-2 bg-gray-100 rounded-md cursor-pointer"> |
33 |
| - <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
34 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" /> |
35 |
| - </svg> |
36 |
| - <p class="">Columns</p> |
| 36 | + @endif |
| 37 | + @if ($customize) |
| 38 | + <div wire:click='$set("colbox", {{ !$colbox }})' |
| 39 | + class="flex items-center justify-start gap-2 px-2 pt-1 bg-gray-100 rounded-t-md cursor-pointer |
| 40 | + {{ ($colbox) ? 'pb-3 -mb-2' : 'rounded-b-md pb-1' }} |
| 41 | + "> |
| 42 | + |
| 43 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-500" viewBox="0 0 20 20" fill="currentColor"> |
| 44 | + <path fill-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd" /> |
| 45 | + </svg> |
| 46 | + <p class="text-sm">Customize Table</p> |
| 47 | + |
| 48 | + @if ($colbox) |
| 49 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600" viewBox="0 0 20 20" fill="currentColor"> |
| 50 | + <path fill-rule="evenodd" d="M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 010 1.414z" clip-rule="evenodd" /> |
| 51 | + </svg> |
| 52 | + @else |
| 53 | + <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600" viewBox="0 0 20 20" fill="currentColor"> |
| 54 | + <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" /> |
| 55 | + </svg> |
| 56 | + @endif |
| 57 | + |
37 | 58 | </div>
|
| 59 | + @endif |
| 60 | + |
38 | 61 | </div>
|
39 | 62 |
|
40 | 63 | <div class="flex items-center justify-end gap-2 px-4">
|
|
65 | 88 | @endif
|
66 | 89 |
|
67 | 90 | {{-- filterable area -------------------------------------------- --}}
|
68 |
| - <div class="w-full p-2 shadow-sm"> |
69 |
| - <div class="flex flex-wrap gap-1"> |
| 91 | + <div class="w-full shadow-sm border-t border-gray-200 bg-gray-200"> |
| 92 | + <div class="flex flex-grow gap-2 overflow-x-auto"> |
| 93 | + |
| 94 | + @php |
| 95 | + //dd($selectedCols) |
| 96 | + @endphp |
| 97 | + |
70 | 98 | @foreach($columns as $col)
|
71 | 99 | @if($selectedCols[$col]['filterable'])
|
72 |
| - <div class="w-3/12 bg-gray-100 rounded p-2"> |
| 100 | + <div class="w-full sm:w-5/12 lg:w-3/12 xl:w-2/12 p-2"> |
73 | 101 |
|
74 |
| - <label class="capitalize">{{ $selectedCols[$col]['label'] }}</label> |
| 102 | + <label class="capitalize text-sm">{{ $selectedCols[$col]['label'] }}</label> |
75 | 103 | <x-btui-select size="sm"
|
76 | 104 | :options="$selectedCols[$col]['filterable_options']"
|
77 | 105 | wire:model="filters.{{$col}}" />
|
|
85 | 113 | {{-- table area ------------------------------------------------- --}}
|
86 | 114 |
|
87 | 115 | @if($data->count() > 0)
|
88 |
| - <div class="w-full pb-4 overflow-x-auto"> |
89 |
| - <table class="w-full bg-white rounded-md shadow-sm"> |
| 116 | + <div class="w-full overflow-x-auto"> |
| 117 | + <table class="w-full bg-white rounded-md shadow-inner z-50"> |
90 | 118 | <thead>
|
91 | 119 | <tr class="border-b divide-x bg-gray-50 ">
|
92 | 120 | @foreach ($columns as $col)
|
|
115 | 143 |
|
116 | 144 | </th>
|
117 | 145 |
|
| 146 | + |
118 | 147 | @endforeach
|
| 148 | + |
| 149 | + <th></th> |
119 | 150 | </tr>
|
120 | 151 | </thead>
|
121 | 152 |
|
|
130 | 161 | <td wire:key='data-{{ $d->id }}-{{ $col }}' id="cell" class="px-4 py-2 text-sm {{ in_array($col, $lowercase) ? '' : 'capitalize' }} ">
|
131 | 162 |
|
132 | 163 | <x-dt-inline-edit>
|
| 164 | + |
133 | 165 | <div class="">
|
134 | 166 | @if(method_exists(new $this->model(), 'onViewFilter'))
|
135 | 167 | {{ (new $this->model())->onViewFilter($col,$d[$col]) }}
|
|
149 | 181 | @endif
|
150 | 182 |
|
151 | 183 | @slot('form')
|
| 184 | + |
152 | 185 | <div class="flex items-center justify-start gap-2 ">
|
153 | 186 |
|
154 | 187 | <div style="width:80%;min-width:200px;">
|
155 | 188 |
|
156 | 189 | @if($selectedCols[$col]['editable'])
|
157 | 190 |
|
158 |
| - @isset($cols['editable'][$col]) |
| 191 | + @if($selectedCols[$col]['editable-options']['inputtype'] == 'text' ) |
159 | 192 |
|
160 |
| - @if($cols['editable'][$col]['inputtype'] == 'text' ) |
161 |
| - <x-btui-input id="editable-content-{{ $d['id'] }}-{{ $col }}" value="{{ $d[$col] }}" size="sm" /> |
162 |
| - @elseif($cols['editable'][$col]['inputtype'] == 'select') |
163 |
| - <x-btui-select size="sm" :options="$cols['editable'][$col]['options']" id="editable-content-{{ $d['id'] }}-{{ $col }}" value="{{ $d[$col] }}" /> |
164 |
| - @else |
165 |
| - <textarea rows="1" class="w-full px-2 border border-gray-300 rounded" id="editable-content-{{ $d['id'] }}-{{ $col }}">{{ $d[$col] }}</textarea> |
166 |
| - @endif |
| 193 | + <x-btui-input id="editable-content-{{ $d['id'] }}-{{ $col }}" |
| 194 | + value="{{ $d[$col] }}" size="sm" /> |
| 195 | + |
| 196 | + @elseif($selectedCols[$col]['editable-options']['inputtype'] == 'select') |
| 197 | + |
| 198 | + <x-btui-select size="sm" :options="$selectedCols[$col]['editable-options']['params']" |
| 199 | + id="editable-content-{{ $d['id'] }}-{{ $col }}" value="{{ $d[$col] }}" /> |
| 200 | + |
| 201 | + @else |
| 202 | + |
| 203 | + <textarea rows="1" class="w-full px-2 border border-gray-300 rounded" |
| 204 | + id="editable-content-{{ $d['id'] }}-{{ $col }}">{{ $d[$col] }}</textarea> |
| 205 | + |
| 206 | + @endif |
167 | 207 |
|
168 |
| - @else |
169 |
| - <textarea rows="1" class="w-full px-2 border border-gray-300 rounded" id="editable-content-{{ $d['id'] }}-{{ $col }}">{{ $d[$col] }}</textarea> |
170 |
| - @endisset |
171 | 208 |
|
172 | 209 | @endif
|
173 | 210 |
|
|
185 | 222 | @endforeach
|
186 | 223 |
|
187 | 224 | {{-- delete - options ----------------------------- --}}
|
188 |
| - <td class="pr-1 bg-gray-100"> |
| 225 | + <td class="pr-1 bg-gray-100 min-w-min"> |
189 | 226 |
|
190 | 227 | <x-dt-inline-edit form-width="w-64">
|
191 | 228 | @slot('trigger')
|
|
0 commit comments