68 lines
2.5 KiB
PHP
68 lines
2.5 KiB
PHP
<?php
|
|
|
|
use App\Models\Log;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Volt\Component;
|
|
|
|
new #[Layout('layouts.app')] class extends Component
|
|
{
|
|
public Collection $logs;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->getLogs();
|
|
}
|
|
|
|
public function getLogs(): void
|
|
{
|
|
// TODO: look into pagination for this.
|
|
$this->logs = Log::with(['user', 'quote', 'requestedQuote'])->get()->sortByDesc('created_at');
|
|
}
|
|
}; ?>
|
|
|
|
<div class="px-4 sm:px-6 lg:px-8">
|
|
<div class="-mx-4 mt-10 ring-1 ring-gray-300 sm:mx-0 sm:rounded-lg bg-nexi-primary dark:bg-zinc-800 transition-colors duration-300">
|
|
<table class="min-w-full divide-y divide-gray-300">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col"
|
|
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-nexi-black dark:text-gray-200 sm:pl-6">
|
|
User
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Logs
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Type
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($logs as $log)
|
|
<tr>
|
|
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-nexi-black dark:text-gray-200 sm:pl-0">
|
|
{{ $log?->user->fullName() ?? 'N/A' }}
|
|
</td>
|
|
<td class="whitespace-nowrap px-3 py-4 text-sm text-nexi-black dark:text-gray-200">
|
|
{{ $log->content }}
|
|
</td>
|
|
<td class="whitespace-nowrap px-3 py-4 text-sm text-nexi-black dark:text-gray-200">
|
|
@if (!empty($log->quote_id))
|
|
Quote - {{ $log->quote_id }}
|
|
@elseif (!empty($log->requested_quote_id))
|
|
Requsted Quote - ID: {{ $log->requested_quote_id }}
|
|
@else
|
|
N/A
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|