first
This commit is contained in:
150
resources/views/admin/audit-logs/index.blade.php
Normal file
150
resources/views/admin/audit-logs/index.blade.php
Normal file
@@ -0,0 +1,150 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Log Audit')
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="fw-bold mb-0"><i class="bi bi-journal-text me-2 text-primary"></i>Log Audit</h4>
|
||||
<a href="{{ route('admin.audit-logs.export', request()->query()) }}"
|
||||
class="btn btn-outline-success btn-sm">
|
||||
<i class="bi bi-download me-1"></i>Eksport CSV
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{-- Filter --}}
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<form method="GET" class="row g-2 align-items-center">
|
||||
<div class="col-md-2">
|
||||
<select class="form-select form-select-sm" name="action">
|
||||
<option value="">Semua Tindakan</option>
|
||||
@foreach($actions as $action)
|
||||
<option value="{{ $action }}" {{ request('action') === $action ? 'selected' : '' }}>
|
||||
{{ $action }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="text" class="form-control form-control-sm" name="search"
|
||||
value="{{ request('search') }}" placeholder="Cari tindakan / justifikasi...">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="date" class="form-control form-control-sm" name="date_from"
|
||||
value="{{ request('date_from') }}" placeholder="Dari tarikh">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="date" class="form-control form-control-sm" name="date_to"
|
||||
value="{{ request('date_to') }}" placeholder="Hingga tarikh">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-sm btn-outline-secondary" type="submit">
|
||||
<i class="bi bi-search me-1"></i>Cari
|
||||
</button>
|
||||
<a href="{{ route('admin.audit-logs.index') }}" class="btn btn-sm btn-outline-secondary ms-1">
|
||||
<i class="bi bi-x me-1"></i>Padam
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Table --}}
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Masa</th>
|
||||
<th>Oleh</th>
|
||||
<th>Tindakan</th>
|
||||
<th>Sasaran</th>
|
||||
<th>IP</th>
|
||||
<th>Butiran</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($logs as $log)
|
||||
<tr>
|
||||
<td class="text-nowrap small text-muted">
|
||||
{{ $log->created_at?->format('d/m/Y H:i:s') }}
|
||||
</td>
|
||||
<td>
|
||||
<span class="fw-semibold small">{{ $log->actor?->name ?? 'Sistem' }}</span>
|
||||
@if($log->actor_role)
|
||||
<span class="badge bg-light text-dark ms-1 small">{{ $log->actor_role }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<code class="small">{{ $log->action }}</code>
|
||||
</td>
|
||||
<td class="small">
|
||||
{{ $log->targetUser?->name ?? ($log->subject_type ? class_basename($log->subject_type).'#'.$log->subject_id : '—') }}
|
||||
</td>
|
||||
<td class="small text-muted">{{ $log->ip_address ?? '—' }}</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-outline-secondary py-0"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#logModal{{ $log->id }}">
|
||||
<i class="bi bi-eye"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{-- Detail Modal --}}
|
||||
<div class="modal fade" id="logModal{{ $log->id }}" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h6 class="modal-title"><code>{{ $log->action }}</code></h6>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body small">
|
||||
<table class="table table-sm">
|
||||
<tr><td width="30%">Masa</td><td>{{ $log->created_at?->format('d/m/Y H:i:s') }}</td></tr>
|
||||
<tr><td>Oleh</td><td>{{ $log->actor?->name ?? 'Sistem' }} ({{ $log->actor_role }})</td></tr>
|
||||
<tr><td>IP</td><td>{{ $log->ip_address ?? '—' }}</td></tr>
|
||||
<tr>
|
||||
<td>Justifikasi</td>
|
||||
<td>{{ $log->justification ?? '—' }}</td>
|
||||
</tr>
|
||||
@if($log->old_values)
|
||||
<tr>
|
||||
<td>Nilai Lama</td>
|
||||
<td><pre class="mb-0 small bg-light p-2 rounded">{{ json_encode($log->old_values, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) }}</pre></td>
|
||||
</tr>
|
||||
@endif
|
||||
@if($log->new_values)
|
||||
<tr>
|
||||
<td>Nilai Baru</td>
|
||||
<td><pre class="mb-0 small bg-light p-2 rounded">{{ json_encode($log->new_values, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) }}</pre></td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted py-4">
|
||||
<i class="bi bi-inbox fs-4 d-block mb-2"></i>Tiada rekod log.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($logs->hasPages())
|
||||
<div class="card-footer bg-white">
|
||||
{{ $logs->links() }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user