101 lines
4.7 KiB
PHP
101 lines
4.7 KiB
PHP
<div class="container mx-auto py-6">
|
|
@if (session()->has('success'))
|
|
<div class="alert alert-success mb-4">{{ session('success') }}</div>
|
|
@endif
|
|
@if (session()->has('error'))
|
|
<div class="alert alert-danger mb-4">{{ session('error') }}</div>
|
|
@endif
|
|
@if (session()->has('info'))
|
|
<div class="alert alert-info mb-4">{{ session('info') }}</div>
|
|
@endif
|
|
|
|
<div wire:loading wire:target="fetchData" class="position-fixed top-0 start-0 w-100 h-100 bg-dark bg-opacity-50 text-white d-flex align-items-center justify-content-center" style="z-index: 1050;">
|
|
Loading...
|
|
</div>
|
|
|
|
<div class="row justify-content-between align-items-end pb-4">
|
|
<div class="col-auto">
|
|
@if ($url['csv'])
|
|
<input type="text" placeholder="Date Range Picker Placeholder" class="form-control" style="width: 300px;">
|
|
@else
|
|
<div class="input-group" style="width: 300px;">
|
|
<span class="input-group-text"><i class="bi bi-search"></i></span>
|
|
<input type="text" wire:model.debounce.1000ms="searchFilter" class="form-control" placeholder="Search">
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="col-auto">
|
|
<button wire:click="clearAll" class="btn btn-secondary me-2">Clear filters</button>
|
|
@if ($url['csv'])
|
|
<span>Export Dropdown Placeholder</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
@foreach($columns as $column)
|
|
<th wire:click="setSort('{{ $column['dataIndex'] }}')" class="cursor-pointer {{ $sortBy === $column['dataIndex'] ? 'bg-primary-subtle' : '' }}">
|
|
{{ $column['title'] }}
|
|
<span>
|
|
<i class="bi bi-caret-up-fill {{ $sortOrder === 'asc' ? 'text-primary' : 'text-muted' }}"></i>
|
|
<i class="bi bi-caret-down-fill {{ $sortOrder === 'desc' ? 'text-primary' : 'text-muted' }}"></i>
|
|
</span>
|
|
</th>
|
|
@endforeach
|
|
@if($apiDelete)
|
|
<th>Action</th>
|
|
@endif
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($data as $record)
|
|
<tr>
|
|
@foreach($columns as $column)
|
|
<td>{{ $record[$column['dataIndex']] ?? '' }}</td>
|
|
@endforeach
|
|
@if($apiDelete)
|
|
<td>
|
|
@foreach($column['buttons'] ?? [] as $action)
|
|
@if($action['key'] === 'delete' && $record['editable'] !== false)
|
|
<button wire:click="delete({{ $record[$keyValue] }})" class="btn btn-danger btn-sm me-1">Delete</button>
|
|
@elseif(in_array($action['key'], ['edit', 'view', 'location']))
|
|
<button wire:click="redirect('{{ $action['key'] }}', {{ $record[$keyValue] }})" class="btn btn-primary btn-sm me-1">{{ ucfirst($action['key']) }}</button>
|
|
@endif
|
|
@endforeach
|
|
</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if($total > 0)
|
|
<div class="row justify-content-between align-items-center mt-4">
|
|
<div class="col-auto">
|
|
@if($apiDelete)
|
|
<button wire:click="handleBatchDelete" class="btn btn-danger" {{ count($selectedRowKeys) === 0 ? 'disabled' : '' }}>
|
|
Delete
|
|
</button>
|
|
<span class="ms-2">
|
|
{{ count($selectedRowKeys) > 0 ? "Selected " . count($selectedRowKeys) . " item(s)" : '' }}
|
|
</span>
|
|
@endif
|
|
</div>
|
|
<div class="col-auto">
|
|
<nav aria-label="Page navigation">
|
|
<ul class="pagination">
|
|
@for($i = 1; $i <= ceil($total / $perPage); $i++)
|
|
<li class="page-item {{ $currentPage === $i ? 'active' : '' }}">
|
|
<button wire:click="updatePage({{ $i }})" class="page-link">{{ $i }}</button>
|
|
</li>
|
|
@endfor
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div> |