59 lines
3.5 KiB
PHP
59 lines
3.5 KiB
PHP
@foreach($items as $item)
|
|
<tr>
|
|
@foreach($fields as $field => $props)
|
|
@if($field != 'actions')
|
|
<td>
|
|
@switch($props['type'])
|
|
@case('image')
|
|
<img src="{{ $item->{$field} }}" class="img-thumbnail">
|
|
@break
|
|
@case('text')
|
|
@case('select')
|
|
{{ isset($item->{$field}) ? $item->{$field} : '' }}
|
|
@break
|
|
@case('date')
|
|
{{ date("d M Y", strtotime($item->{$field})) }}
|
|
@break
|
|
|
|
@endswitch
|
|
</td>
|
|
@else
|
|
<td>
|
|
@foreach($props['buttons'] as $key => $button)
|
|
@switch($button)
|
|
@case('edit')
|
|
<a href="{{$base_url}}/edit?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-square-edit-outline text-warning"></i></a>
|
|
@break
|
|
@case('delete')
|
|
<a href="{{$base_url}}/delete?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-delete text-danger"></i></a>
|
|
@break
|
|
@default
|
|
@php
|
|
$querystring = $button['querystring'];
|
|
foreach((array)$item as $k => $v) {
|
|
if(strpos($querystring,'{'.strtoupper($k).'}') !== false)
|
|
$querystring = str_replace('{'.strtoupper($k).'}', $v, $querystring);
|
|
}
|
|
@endphp
|
|
<a href="{{$base_url}}/{{$key}}?{{$querystring}}" class="action-icon"> <i class="mdi mdi-{{$button['icon']}}"></i></a>
|
|
@endswitch
|
|
@endforeach
|
|
</td>
|
|
@endif
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
|
|
|
|
|
|
<tfoot>
|
|
<tr>
|
|
@foreach($fields as $field => $props)
|
|
<th>
|
|
@if($field != 'actions')
|
|
<input type="text" placeholder="Search" class="form-control" />
|
|
@endif
|
|
</th>
|
|
@endforeach
|
|
</tr>
|
|
</tfoot> |