@extends('layout.main') @use('App\Services\Konfigurasi\FormatLogAktivitas', 'Format') @use('App\Models\Pertanian\Petani') @section('content')
Log Aktivitas
Jejak perubahan data, status petani, dan login pengguna.
{{-- Filter --}}
@error('dari')
{{ $message }}
@enderror
@error('sampai')
{{ $message }}
@enderror
@if (request()->hasAny(['jenis', 'search', 'dari', 'sampai'])) Reset @endif
{{-- Tabel log --}}
@forelse ($aktivitas as $item) @php $j = $jenis[$item->log_name] ?? ['label' => $item->log_name ?? '-', 'warna' => 'secondary']; $prop = $item->properties ?? collect(); $baru = $prop['attributes'] ?? []; $lama = $prop['old'] ?? null; $petaniId = $item->subject_type === Petani::class ? $item->subject_id : ($prop['petani_id'] ?? null); $namaData = $prop['label'] ?? null; @endphp @empty @endforelse
Waktu Pengguna Jenis Aktivitas Rincian
{{ $item->created_at->translatedFormat('d M Y') }} {{ $item->created_at->format('H:i:s') }} @if ($item->causer) {{ $item->causer->name }} {{ $item->causer->role?->label() }} @else Sistem / tamu @endif {{ $j['label'] }} {{ $item->description }} @if ($item->subject_type && $item->subject_type !== Petani::class) #{{ $item->subject_id }}{{ $namaData ? ' ยท ' . $namaData : '' }} @endif @if ($petaniId) {{ $namaPetani[$petaniId] ?? $namaData ?? 'Petani #' . $petaniId }} @endif @if ($item->log_name === 'verifikasi') {{ Format::status($prop['dari'] ?? null) }} {{ Format::status($prop['ke'] ?? null) }} @if (! empty($prop['catatan']))
Catatan: {{ $prop['catatan'] }}
@endif @elseif ($item->log_name === 'auth') IP: {{ $prop['ip'] ?? '-' }} @if (! empty($prop['identitas'])) Login: {{ $prop['identitas'] }} @endif @elseif ($baru) @php $isian = collect($baru)->when(! $lama, fn ($c) => $c->reject(fn ($v) => $v === null || $v === '')); $batas = $lama ? $isian->count() : 5; @endphp
    @foreach ($isian->take($batas) as $kolom => $nilai)
  • {{ Format::kolom($kolom) }}: @if ($lama) {{ Format::nilai($kolom, $lama[$kolom] ?? null) }} @endif {{ Format::nilai($kolom, $nilai) }}
  • @endforeach @if ($isian->count() > $batas)
  • +{{ $isian->count() - $batas }} isian lainnya
  • @endif
@else - @endif
Belum ada aktivitas yang tercatat.
{{ $aktivitas->links('pagination::simple-bootstrap-5') }}
@endsection