feat: tambah AuditSeeder dan perbaiki tampilan audit agar human-readable

This commit is contained in:
2026-04-03 07:41:07 +07:00
parent 3c99dfdc26
commit 060d669d5c
4 changed files with 119 additions and 11 deletions
@@ -2,10 +2,11 @@
namespace App\Filament\Resources\Audits\Schemas;
use App\Models\Activity;
use App\Models\CashRecord;
use App\Models\User;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class AuditForm
@@ -17,12 +18,28 @@ class AuditForm
->options(User::pluck('name', 'id'))
->searchable()
->required(),
TextInput::make('model_type')->label('Tipe Model')->required(),
TextInput::make('model_id')->label('ID Model')->numeric()->required(),
Select::make('issue_type')->label('Jenis Temuan')
->options(['warning' => 'Peringatan', 'critical' => 'Kritis'])
Select::make('model_type')->label('Tipe Objek')
->options([
'App\\Models\\CashRecord' => 'Transaksi Kas',
'App\\Models\\Activity' => 'Kegiatan',
'App\\Models\\User' => 'Anggota',
])
->required()
->live(),
Select::make('model_id')->label('Objek')
->options(fn ($get) => match ($get('model_type')) {
'App\\Models\\CashRecord' => CashRecord::get()
->mapWithKeys(fn ($r) => [$r->id => "{$r->description} — Rp " . number_format($r->amount, 0, ',', '.')]),
'App\\Models\\Activity' => Activity::pluck('title', 'id'),
'App\\Models\\User' => User::pluck('name', 'id'),
default => [],
})
->searchable()
->required(),
Textarea::make('description')->label('Deskripsi')->rows(3)->required()->columnSpanFull(),
Select::make('issue_type')->label('Jenis Temuan')
->options(['warning' => '⚠️ Peringatan', 'critical' => '🚨 Kritis'])
->required(),
Textarea::make('description')->label('Deskripsi Temuan')->rows(3)->required()->columnSpanFull(),
Select::make('status')
->options(['open' => 'Terbuka', 'resolved' => 'Selesai'])
->default('open')