Refactor SickLeaveForm and SickLeaveInfolist to enhance layout and organization. Introduce new sections in SickLeaveInfolist for better information categorization, update date picker functionality, and improve localization for medical institution labels across multiple languages.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\SickLeaves\Schemas;
|
||||
|
||||
use App\Models\SickLeave;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SickLeaveInfolist
|
||||
@@ -12,39 +15,55 @@ class SickLeaveInfolist
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('employee.id')
|
||||
->label(__('hr.fields.employee')),
|
||||
TextEntry::make('start_date')
|
||||
->label(__('hr.fields.start_date'))
|
||||
->date(),
|
||||
TextEntry::make('end_date')
|
||||
->label(__('hr.fields.end_date'))
|
||||
->date(),
|
||||
TextEntry::make('days')
|
||||
->label(__('hr.fields.days'))
|
||||
->numeric(),
|
||||
TextEntry::make('medical_institution')
|
||||
->label(__('hr.fields.institution'))
|
||||
->placeholder('-'),
|
||||
TextEntry::make('reason')
|
||||
->label(__('hr.fields.reason'))
|
||||
->placeholder('-')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('document_path')
|
||||
->label(__('hr.fields.medical_document'))
|
||||
->placeholder('-'),
|
||||
TextEntry::make('created_at')
|
||||
->label(__('hr.fields.created_at'))
|
||||
->dateTime()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('updated_at')
|
||||
->label(__('hr.fields.updated_at'))
|
||||
->dateTime()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('deleted_at')
|
||||
->label(__('hr.fields.deleted_at'))
|
||||
->dateTime()
|
||||
->visible(fn (SickLeave $record): bool => $record->trashed()),
|
||||
Section::make(__('hr.sections.basic_info'))
|
||||
->schema([
|
||||
TextEntry::make('employee.full_name')
|
||||
->label(__('hr.fields.employee')),
|
||||
])
|
||||
->columns(1),
|
||||
Section::make(__('hr.sections.dates'))
|
||||
->schema([
|
||||
TextEntry::make('start_date')
|
||||
->label(__('hr.fields.start_date'))
|
||||
->date('d.m.Y'),
|
||||
TextEntry::make('end_date')
|
||||
->label(__('hr.fields.end_date'))
|
||||
->date('d.m.Y'),
|
||||
TextEntry::make('days')
|
||||
->label(__('hr.fields.days'))
|
||||
->suffix(' '.__('hr.messages.days_suffix')),
|
||||
])
|
||||
->columns(2),
|
||||
Section::make(__('hr.sections.medical_details'))
|
||||
->schema([
|
||||
TextEntry::make('medical_institution')
|
||||
->label(__('hr.fields.institution'))
|
||||
->placeholder('—'),
|
||||
TextEntry::make('document_path')
|
||||
->label(__('hr.fields.medical_document'))
|
||||
->formatStateUsing(fn (?string $state): string => filled($state) ? basename($state) : '—'),
|
||||
TextEntry::make('reason')
|
||||
->label(__('hr.fields.reason'))
|
||||
->placeholder('—')
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columns(2),
|
||||
Section::make(__('hr.sections.metadata'))
|
||||
->schema([
|
||||
TextEntry::make('created_at')
|
||||
->label(__('hr.fields.created_at'))
|
||||
->dateTime('d.m.Y H:i')
|
||||
->placeholder('—'),
|
||||
TextEntry::make('updated_at')
|
||||
->label(__('hr.fields.updated_at'))
|
||||
->dateTime('d.m.Y H:i')
|
||||
->placeholder('—'),
|
||||
TextEntry::make('deleted_at')
|
||||
->label(__('hr.fields.deleted_at'))
|
||||
->dateTime('d.m.Y H:i')
|
||||
->visible(fn (SickLeave $record): bool => $record->trashed()),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user