Refactor Bonus, DisciplinaryReport, Gift, and Explanation schemas to enhance layout and organization. Introduce sections for better categorization of information, improve date picker functionality, and update localization for various fields across multiple languages.
This commit is contained in:
@@ -20,7 +20,9 @@ class DisciplinaryReportForm
|
||||
DatePicker::make('report_date')
|
||||
->label(__('hr.fields.report_date'))
|
||||
->required()
|
||||
->native(false)
|
||||
->default(now()),
|
||||
|
||||
TextInput::make('title')
|
||||
->label(__('hr.fields.title'))
|
||||
->required()
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\DisciplinaryReports\Schemas;
|
||||
|
||||
use App\Enums\DisciplinarySeverity;
|
||||
use App\Models\DisciplinaryReport;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Infolists\Components\ImageEntry;
|
||||
|
||||
class DisciplinaryReportInfolist
|
||||
{
|
||||
@@ -12,38 +17,61 @@ class DisciplinaryReportInfolist
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('employee.id')
|
||||
->label(__('hr.fields.employee')),
|
||||
TextEntry::make('report_date')
|
||||
->label(__('hr.fields.report_date'))
|
||||
->date(),
|
||||
TextEntry::make('title')
|
||||
->label(__('hr.fields.title')),
|
||||
TextEntry::make('description')
|
||||
->label(__('hr.fields.description'))
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('severity')
|
||||
->label(__('hr.fields.severity'))
|
||||
->badge(),
|
||||
TextEntry::make('attachment_path')
|
||||
->label(__('hr.fields.attachment'))
|
||||
->placeholder('-'),
|
||||
Section::make(__('hr.sections.basic_info'))
|
||||
->schema([
|
||||
TextEntry::make('employee.full_name')
|
||||
->label(__('hr.fields.employee')),
|
||||
TextEntry::make('report_date')
|
||||
->label(__('hr.fields.report_date'))
|
||||
->date('d.m.Y'),
|
||||
TextEntry::make('severity')
|
||||
->label(__('hr.fields.severity'))
|
||||
->badge()
|
||||
->color(fn (DisciplinarySeverity $state): string => $state->color())
|
||||
->formatStateUsing(fn (DisciplinarySeverity $state): string => $state->label()),
|
||||
])
|
||||
->columns(3),
|
||||
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(DisciplinaryReport $record): bool => $record->trashed()),
|
||||
|
||||
TextEntry::make('created_by')
|
||||
->label(__('hr.fields.created_by'))
|
||||
->numeric()
|
||||
->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 (DisciplinaryReport $record): bool => $record->trashed()),
|
||||
->formatStateUsing(fn($state, DisciplinaryReport $record): string => $record->creator?->name ?? '—'),
|
||||
])
|
||||
->columns(2),
|
||||
Section::make(__('hr.sections.report_details'))
|
||||
->schema([
|
||||
TextEntry::make('title')
|
||||
->label(__('hr.fields.title'))
|
||||
->weight('bold')
|
||||
->size('lg')
|
||||
->hiddenLabel(),
|
||||
|
||||
TextEntry::make('description')
|
||||
->label(__('hr.fields.description'))
|
||||
->placeholder('—')
|
||||
->columnSpanFull()
|
||||
->hiddenLabel(),
|
||||
|
||||
ImageEntry::make('attachment_path')
|
||||
->square()
|
||||
->size(80)
|
||||
->label(__('hr.fields.attachment'))
|
||||
->visible(fn(?string $state): bool => filled($state)),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user