Files
ChatbotAI/resources/views/admin/audit-logs/index.blade.php
2026-05-18 08:56:23 +08:00

101 lines
3.7 KiB
PHP

@extends('layouts.admin')
@section('title', 'Log Audit')
@section('breadcrumb')
<li class="breadcrumb-item active">Log Audit</li>
@endsection
@section('content')
<div class="d-flex align-items-center justify-content-between mb-4">
<h4 class="mb-0 fw-bold">Log Audit Sistem</h4>
<small class="text-muted">Log tidak boleh diubah atau dipadam</small>
</div>
{{-- Filter --}}
<div class="card border-0 shadow-sm mb-4">
<div class="card-body py-3">
<form method="GET" class="row g-2 align-items-end">
<div class="col-md-3">
<select name="event" class="form-select form-select-sm">
<option value="">Semua Event</option>
@foreach($eventTypes as $event)
<option value="{{ $event }}" {{ request('event') == $event ? 'selected' : '' }}>
{{ $event }}
</option>
@endforeach
</select>
</div>
<div class="col-md-2">
<input type="date" name="date_from" class="form-control form-control-sm"
value="{{ request('date_from') }}" placeholder="Dari">
</div>
<div class="col-md-2">
<input type="date" name="date_to" class="form-control form-control-sm"
value="{{ request('date_to') }}" placeholder="Hingga">
</div>
<div class="col-auto">
<button type="submit" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-search me-1"></i>Tapis
</button>
</div>
</form>
</div>
</div>
<div class="card border-0 shadow-sm">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th class="ps-3">Event</th>
<th>Deskripsi</th>
<th>Pengguna</th>
<th>IP</th>
<th>Tarikh</th>
<th class="text-end pe-3">Detail</th>
</tr>
</thead>
<tbody>
@forelse($logs as $log)
<tr>
<td class="ps-3">
<code class="small" style="font-size:.75rem">{{ $log->event }}</code>
</td>
<td>
<small>{{ $log->description ?? '—' }}</small>
</td>
<td>
<small>{{ $log->user?->name ?? 'Sistem' }}</small>
</td>
<td>
<small class="text-muted">{{ $log->ip_address ?? '—' }}</small>
</td>
<td>
<small class="text-muted" title="{{ $log->created_at->format('d/m/Y H:i:s') }}">
{{ $log->created_at->diffForHumans() }}
</small>
</td>
<td class="text-end pe-3">
<a href="{{ route('admin.audit-logs.show', $log) }}"
class="btn btn-sm btn-outline-secondary">
<i class="bi bi-info-circle"></i>
</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="text-center text-muted py-5">Tiada log ditemui.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($logs->hasPages())
<div class="card-footer bg-white border-top py-3">
{{ $logs->links() }}
</div>
@endif
</div>
@endsection