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:
Mekan1206 committed 2026-08-02 22:08:33 +05:00
1 parent a9f7dc1076
commit 9e623d2d29
10 files changed
+205 -110

No files matched your search

@@ -20,7 +20,8 @@ public static function configure(Schema $schema): Schema
DatePicker::make('bonus_date') DatePicker::make('bonus_date')
->label(__('hr.fields.bonus_date')) ->label(__('hr.fields.bonus_date'))
->required() ->required()
->default(now()), ->default(now())
->native(false),
Select::make('bonus_type') Select::make('bonus_type')
->label(__('hr.fields.bonus_type')) ->label(__('hr.fields.bonus_type'))
->options(BonusType::class) ->options(BonusType::class)
@@ -1,9 +1,13 @@
<?php <?php
declare(strict_types=1);
namespace App\Filament\Resources\Bonuses\Schemas; namespace App\Filament\Resources\Bonuses\Schemas;
use App\Enums\BonusType;
use App\Models\Bonus; use App\Models\Bonus;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
class BonusInfolist class BonusInfolist
@@ -12,33 +16,47 @@ public static function configure(Schema $schema): Schema
{ {
return $schema return $schema
->components([ ->components([
TextEntry::make('employee.id') Section::make(__('hr.sections.basic_info'))
->label(__('hr.fields.employee')), ->schema([
TextEntry::make('bonus_date') TextEntry::make('employee.full_name')
->label(__('hr.fields.bonus_date')) ->label(__('hr.fields.employee')),
->date(), TextEntry::make('bonus_date')
TextEntry::make('bonus_type') ->label(__('hr.fields.bonus_date'))
->label(__('hr.fields.bonus_type')) ->date('d.m.Y'),
->badge(), TextEntry::make('bonus_type')
TextEntry::make('amount') ->label(__('hr.fields.bonus_type'))
->label(__('hr.fields.amount')) ->badge()
->numeric(), ->color(fn (BonusType $state): string => $state->color())
TextEntry::make('reason') ->formatStateUsing(fn (BonusType $state): string => $state->label()),
->label(__('hr.fields.reason')) ])
->placeholder('-') ->columns(3),
->columnSpanFull(), Section::make(__('hr.sections.bonus_details'))
TextEntry::make('created_at') ->schema([
->label(__('hr.fields.created_at')) TextEntry::make('amount')
->dateTime() ->label(__('hr.fields.amount'))
->placeholder('-'), ->money('TMT'),
TextEntry::make('updated_at') TextEntry::make('reason')
->label(__('hr.fields.updated_at')) ->label(__('hr.fields.reason'))
->dateTime() ->placeholder('—')
->placeholder('-'), ->columnSpanFull(),
TextEntry::make('deleted_at') ])
->label(__('hr.fields.deleted_at')) ->columns(2),
->dateTime() Section::make(__('hr.sections.metadata'))
->visible(fn (Bonus $record): bool => $record->trashed()), ->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 (Bonus $record): bool => $record->trashed()),
])
->columns(2),
]); ]);
} }
} }
@@ -20,7 +20,9 @@ public static function configure(Schema $schema): Schema
DatePicker::make('report_date') DatePicker::make('report_date')
->label(__('hr.fields.report_date')) ->label(__('hr.fields.report_date'))
->required() ->required()
->native(false)
->default(now()), ->default(now()),
TextInput::make('title') TextInput::make('title')
->label(__('hr.fields.title')) ->label(__('hr.fields.title'))
->required() ->required()
@@ -1,10 +1,15 @@
<?php <?php
declare(strict_types=1);
namespace App\Filament\Resources\DisciplinaryReports\Schemas; namespace App\Filament\Resources\DisciplinaryReports\Schemas;
use App\Enums\DisciplinarySeverity;
use App\Models\DisciplinaryReport; use App\Models\DisciplinaryReport;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
use Filament\Infolists\Components\ImageEntry;
class DisciplinaryReportInfolist class DisciplinaryReportInfolist
{ {
@@ -12,38 +17,61 @@ public static function configure(Schema $schema): Schema
{ {
return $schema return $schema
->components([ ->components([
TextEntry::make('employee.id') Section::make(__('hr.sections.basic_info'))
->label(__('hr.fields.employee')), ->schema([
TextEntry::make('report_date') TextEntry::make('employee.full_name')
->label(__('hr.fields.report_date')) ->label(__('hr.fields.employee')),
->date(), TextEntry::make('report_date')
TextEntry::make('title') ->label(__('hr.fields.report_date'))
->label(__('hr.fields.title')), ->date('d.m.Y'),
TextEntry::make('description') TextEntry::make('severity')
->label(__('hr.fields.description')) ->label(__('hr.fields.severity'))
->columnSpanFull(), ->badge()
TextEntry::make('severity') ->color(fn (DisciplinarySeverity $state): string => $state->color())
->label(__('hr.fields.severity')) ->formatStateUsing(fn (DisciplinarySeverity $state): string => $state->label()),
->badge(), ])
TextEntry::make('attachment_path') ->columns(3),
->label(__('hr.fields.attachment')) Section::make(__('hr.sections.metadata'))
->placeholder('-'), ->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') TextEntry::make('created_by')
->label(__('hr.fields.created_by')) ->label(__('hr.fields.created_by'))
->numeric() ->formatStateUsing(fn($state, DisciplinaryReport $record): string => $record->creator?->name ?? '—'),
->placeholder('-'), ])
TextEntry::make('created_at') ->columns(2),
->label(__('hr.fields.created_at')) Section::make(__('hr.sections.report_details'))
->dateTime() ->schema([
->placeholder('-'), TextEntry::make('title')
TextEntry::make('updated_at') ->label(__('hr.fields.title'))
->label(__('hr.fields.updated_at')) ->weight('bold')
->dateTime() ->size('lg')
->placeholder('-'), ->hiddenLabel(),
TextEntry::make('deleted_at')
->label(__('hr.fields.deleted_at')) TextEntry::make('description')
->dateTime() ->label(__('hr.fields.description'))
->visible(fn (DisciplinaryReport $record): bool => $record->trashed()), ->placeholder('—')
->columnSpanFull()
->hiddenLabel(),
ImageEntry::make('attachment_path')
->square()
->size(80)
->label(__('hr.fields.attachment'))
->visible(fn(?string $state): bool => filled($state)),
])
->columns(2),
]); ]);
} }
} }
@@ -1,9 +1,12 @@
<?php <?php
declare(strict_types=1);
namespace App\Filament\Resources\Explanations\Schemas; namespace App\Filament\Resources\Explanations\Schemas;
use App\Models\Explanation; use App\Models\Explanation;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
class ExplanationInfolist class ExplanationInfolist
@@ -12,31 +15,46 @@ public static function configure(Schema $schema): Schema
{ {
return $schema return $schema
->components([ ->components([
TextEntry::make('employee.id') Section::make(__('hr.sections.basic_info'))
->label(__('hr.fields.employee')), ->schema([
TextEntry::make('explanation_date') TextEntry::make('employee.full_name')
->label(__('hr.fields.explanation_date')) ->label(__('hr.fields.employee')),
->date(), TextEntry::make('explanation_date')
TextEntry::make('reason') ->label(__('hr.fields.explanation_date'))
->label(__('hr.fields.reason')), ->date('d.m.Y'),
TextEntry::make('description') ])
->label(__('hr.fields.description')) ->columns(2),
->columnSpanFull(), Section::make(__('hr.sections.explanation_details'))
TextEntry::make('attachment_path') ->schema([
->label(__('hr.fields.attachment')) TextEntry::make('reason')
->placeholder('-'), ->label(__('hr.fields.reason'))
TextEntry::make('created_at') ->placeholder('—')
->label(__('hr.fields.created_at')) ->columnSpanFull(),
->dateTime() TextEntry::make('description')
->placeholder('-'), ->label(__('hr.fields.description'))
TextEntry::make('updated_at') ->placeholder('—')
->label(__('hr.fields.updated_at')) ->columnSpanFull(),
->dateTime() TextEntry::make('attachment_path')
->placeholder('-'), ->label(__('hr.fields.attachment'))
TextEntry::make('deleted_at') ->formatStateUsing(fn (?string $state): string => filled($state) ? basename($state) : '—'),
->label(__('hr.fields.deleted_at')) ])
->dateTime() ->columns(2),
->visible(fn (Explanation $record): bool => $record->trashed()), 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 (Explanation $record): bool => $record->trashed()),
])
->columns(2),
]); ]);
} }
} }
@@ -18,7 +18,8 @@ public static function configure(Schema $schema): Schema
DatePicker::make('gift_date') DatePicker::make('gift_date')
->label(__('hr.fields.gift_date')) ->label(__('hr.fields.gift_date'))
->required() ->required()
->default(now()), ->default(now())
->native(false),
TextInput::make('gift_name') TextInput::make('gift_name')
->label(__('hr.fields.gift_name')) ->label(__('hr.fields.gift_name'))
->required() ->required()
@@ -1,9 +1,12 @@
<?php <?php
declare(strict_types=1);
namespace App\Filament\Resources\Gifts\Schemas; namespace App\Filament\Resources\Gifts\Schemas;
use App\Models\Gift; use App\Models\Gift;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
class GiftInfolist class GiftInfolist
@@ -12,32 +15,44 @@ public static function configure(Schema $schema): Schema
{ {
return $schema return $schema
->components([ ->components([
TextEntry::make('employee.id') Section::make(__('hr.sections.basic_info'))
->label(__('hr.fields.employee')), ->schema([
TextEntry::make('gift_date') TextEntry::make('employee.full_name')
->label(__('hr.fields.gift_date')) ->label(__('hr.fields.employee')),
->date(), TextEntry::make('gift_date')
TextEntry::make('gift_name') ->label(__('hr.fields.gift_date'))
->label(__('hr.fields.gift_name')), ->date('d.m.Y'),
TextEntry::make('value') TextEntry::make('gift_name')
->label(__('hr.fields.value')) ->label(__('hr.fields.gift_name')),
->numeric(), ])
TextEntry::make('reason') ->columns(3),
->label(__('hr.fields.reason')) Section::make(__('hr.sections.gift_details'))
->placeholder('-') ->schema([
->columnSpanFull(), TextEntry::make('value')
TextEntry::make('created_at') ->label(__('hr.fields.value'))
->label(__('hr.fields.created_at')) ->money('TMT'),
->dateTime() TextEntry::make('reason')
->placeholder('-'), ->label(__('hr.fields.reason'))
TextEntry::make('updated_at') ->placeholder('—')
->label(__('hr.fields.updated_at')) ->columnSpanFull(),
->dateTime() ])
->placeholder('-'), ->columns(2),
TextEntry::make('deleted_at') Section::make(__('hr.sections.metadata'))
->label(__('hr.fields.deleted_at')) ->schema([
->dateTime() TextEntry::make('created_at')
->visible(fn (Gift $record): bool => $record->trashed()), ->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 (Gift $record): bool => $record->trashed()),
])
->columns(2),
]); ]);
} }
} }
+4
View File
@@ -161,6 +161,10 @@
'approval' => 'Approval', 'approval' => 'Approval',
'metadata' => 'Metadata', 'metadata' => 'Metadata',
'medical_details' => 'Medical Details', 'medical_details' => 'Medical Details',
'report_details' => 'Report Details',
'explanation_details' => 'Explanation Details',
'bonus_details' => 'Bonus Details',
'gift_details' => 'Gift Details',
], ],
'messages' => [ 'messages' => [
+4
View File
@@ -161,6 +161,10 @@
'approval' => 'Утверждение', 'approval' => 'Утверждение',
'metadata' => 'Метаданные', 'metadata' => 'Метаданные',
'medical_details' => 'Медицинские данные', 'medical_details' => 'Медицинские данные',
'report_details' => 'Детали отчёта',
'explanation_details' => 'Детали объяснительной',
'bonus_details' => 'Детали премии',
'gift_details' => 'Детали подарка',
], ],
'messages' => [ 'messages' => [
+4
View File
@@ -161,6 +161,10 @@
'approval' => 'Tassyklama', 'approval' => 'Tassyklama',
'metadata' => 'Maglumat', 'metadata' => 'Maglumat',
'medical_details' => 'Lukmançylyk maglumatlary', 'medical_details' => 'Lukmançylyk maglumatlary',
'report_details' => 'Hasabat jikme-jiklikleri',
'explanation_details' => 'Düşündiriş jikme-jiklikleri',
'bonus_details' => 'Baýrak jikme-jiklikleri',
'gift_details' => 'Sowgat jikme-jiklikleri',
], ],
'messages' => [ 'messages' => [