46 lines
1.9 KiB
PHP
46 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\ActivityLogs\Schemas;
|
|
|
|
use Filament\Infolists\Components\KeyValueEntry;
|
|
use Filament\Infolists\Components\TextEntry;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class ActivityLogInfolist
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make(__('hr.sections.activity_details'))
|
|
->schema([
|
|
TextEntry::make('created_at')
|
|
->label(__('hr.fields.date'))
|
|
->dateTime(),
|
|
TextEntry::make('description'),
|
|
TextEntry::make('event')
|
|
->badge(),
|
|
TextEntry::make('log_name')
|
|
->label(__('hr.fields.log_name')),
|
|
TextEntry::make('subject_type')
|
|
->label(__('hr.fields.subject_type'))
|
|
->formatStateUsing(fn (?string $state): string => $state ? class_basename($state) : '—'),
|
|
TextEntry::make('subject_id')
|
|
->label(__('hr.fields.subject_id')),
|
|
TextEntry::make('causer.name')
|
|
->label(__('hr.fields.causer')),
|
|
KeyValueEntry::make('properties.attributes')
|
|
->label(__('hr.fields.changes'))
|
|
->visible(fn ($record): bool => filled($record->properties['attributes'] ?? null)),
|
|
KeyValueEntry::make('properties.old')
|
|
->label(__('hr.fields.previous_values'))
|
|
->visible(fn ($record): bool => filled($record->properties['old'] ?? null)),
|
|
])
|
|
->columns(2),
|
|
]);
|
|
}
|
|
}
|