From 986ca397c03d96538da647917b6b3ca861cca4f1 Mon Sep 17 00:00:00 2001 From: Mekan1206 Date: Sun, 2 Aug 2026 21:49:41 +0500 Subject: [PATCH] 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. --- .../SickLeaves/Schemas/SickLeaveForm.php | 15 +++- .../SickLeaves/Schemas/SickLeaveInfolist.php | 85 ++++++++++++------- lang/en/hr.php | 3 +- lang/ru/hr.php | 3 +- lang/tk/hr.php | 3 +- 5 files changed, 69 insertions(+), 40 deletions(-) diff --git a/app/Filament/Resources/SickLeaves/Schemas/SickLeaveForm.php b/app/Filament/Resources/SickLeaves/Schemas/SickLeaveForm.php index 1710b18..cdf205b 100644 --- a/app/Filament/Resources/SickLeaves/Schemas/SickLeaveForm.php +++ b/app/Filament/Resources/SickLeaves/Schemas/SickLeaveForm.php @@ -12,14 +12,21 @@ class SickLeaveForm public static function configure(Schema $schema): Schema { return $schema + ->columns(3) ->components([ HrForm::employeeSelect(), - HrForm::leaveDatePicker('start_date', __('hr.fields.start_date')), - HrForm::leaveDatePicker('end_date', __('hr.fields.end_date')), - HrForm::leaveDaysDisplay(), + HrForm::leaveDatePicker('start_date', __('hr.fields.start_date')) + ->native(false), + HrForm::leaveDatePicker('end_date', __('hr.fields.end_date')) + ->native(false), + TextInput::make('medical_institution') ->label(__('hr.fields.institution')) - ->maxLength(255), + ->maxLength(255) + ->columnSpan(2), + + HrForm::leaveDaysDisplay(), + Textarea::make('reason') ->label(__('hr.fields.reason')) ->rows(3) diff --git a/app/Filament/Resources/SickLeaves/Schemas/SickLeaveInfolist.php b/app/Filament/Resources/SickLeaves/Schemas/SickLeaveInfolist.php index 2b870c5..5044caa 100644 --- a/app/Filament/Resources/SickLeaves/Schemas/SickLeaveInfolist.php +++ b/app/Filament/Resources/SickLeaves/Schemas/SickLeaveInfolist.php @@ -1,9 +1,12 @@ 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), ]); } } diff --git a/lang/en/hr.php b/lang/en/hr.php index 6a9922b..30fa853 100644 --- a/lang/en/hr.php +++ b/lang/en/hr.php @@ -119,7 +119,7 @@ return [ 'report_date' => 'Report Date', 'start_date' => 'Start Date', 'end_date' => 'End Date', - 'institution' => 'Institution', + 'institution' => 'Medical Institution', 'code' => 'Code', 'password' => 'Password', 'roles' => 'Roles', @@ -160,6 +160,7 @@ return [ 'dates' => 'Dates', 'approval' => 'Approval', 'metadata' => 'Metadata', + 'medical_details' => 'Medical Details', ], 'messages' => [ diff --git a/lang/ru/hr.php b/lang/ru/hr.php index 85365b8..f6639bd 100644 --- a/lang/ru/hr.php +++ b/lang/ru/hr.php @@ -119,7 +119,7 @@ return [ 'report_date' => 'Дата отчёта', 'start_date' => 'Дата начала', 'end_date' => 'Дата окончания', - 'institution' => 'Учреждение', + 'institution' => 'Медицинское учреждение', 'code' => 'Код', 'password' => 'Пароль', 'roles' => 'Роли', @@ -160,6 +160,7 @@ return [ 'dates' => 'Даты', 'approval' => 'Утверждение', 'metadata' => 'Метаданные', + 'medical_details' => 'Медицинские данные', ], 'messages' => [ diff --git a/lang/tk/hr.php b/lang/tk/hr.php index 6ad21a0..cd62796 100644 --- a/lang/tk/hr.php +++ b/lang/tk/hr.php @@ -119,7 +119,7 @@ return [ 'report_date' => 'Hasabat senesi', 'start_date' => 'Başlanan senesi', 'end_date' => 'Tamamlanan senesi', - 'institution' => 'Gurama', + 'institution' => 'Lukmançylyk gurama', 'code' => 'Kod', 'password' => 'Parol', 'roles' => 'Rollar', @@ -160,6 +160,7 @@ return [ 'dates' => 'Seneler', 'approval' => 'Tassyklama', 'metadata' => 'Maglumat', + 'medical_details' => 'Lukmançylyk maglumatlary', ], 'messages' => [