Refactor VacationForm and VacationInfolist to enhance date picker functionality and improve localization. Introduce new sections in VacationInfolist for better organization of information, and add missing labels in multiple languages for improved user experience.
This commit is contained in:
@@ -21,10 +21,13 @@ class VacationForm
|
|||||||
->options(VacationType::class)
|
->options(VacationType::class)
|
||||||
->required()
|
->required()
|
||||||
->native(false),
|
->native(false),
|
||||||
HrForm::leaveDatePicker('start_date', __('hr.fields.start_date')),
|
HrForm::leaveDatePicker('start_date', __('hr.fields.start_date'))
|
||||||
HrForm::leaveDatePicker('end_date', __('hr.fields.end_date')),
|
->native(false),
|
||||||
|
HrForm::leaveDatePicker('end_date', __('hr.fields.end_date'))
|
||||||
|
->native(false),
|
||||||
DatePicker::make('return_date')
|
DatePicker::make('return_date')
|
||||||
->label(__('hr.fields.return_date')),
|
->label(__('hr.fields.return_date'))
|
||||||
|
->native(false),
|
||||||
HrForm::leaveDaysDisplay(),
|
HrForm::leaveDaysDisplay(),
|
||||||
Textarea::make('reason')
|
Textarea::make('reason')
|
||||||
->label(__('hr.fields.reason'))
|
->label(__('hr.fields.reason'))
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Filament\Resources\Vacations\Schemas;
|
namespace App\Filament\Resources\Vacations\Schemas;
|
||||||
|
|
||||||
|
use App\Enums\ApprovalStatus;
|
||||||
|
use App\Enums\VacationType;
|
||||||
use App\Models\Vacation;
|
use App\Models\Vacation;
|
||||||
|
use Filament\Infolists\Components\ImageEntry;
|
||||||
use Filament\Infolists\Components\TextEntry;
|
use Filament\Infolists\Components\TextEntry;
|
||||||
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
class VacationInfolist
|
class VacationInfolist
|
||||||
@@ -12,54 +18,73 @@ class VacationInfolist
|
|||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
TextEntry::make('employee.id')
|
Section::make(__('hr.sections.basic_info'))
|
||||||
->label(__('hr.fields.employee')),
|
->schema([
|
||||||
TextEntry::make('type')
|
TextEntry::make('employee.full_name')
|
||||||
->label(__('hr.fields.type'))
|
->label(__('hr.fields.employee')),
|
||||||
->badge(),
|
TextEntry::make('type')
|
||||||
TextEntry::make('start_date')
|
->label(__('hr.fields.type'))
|
||||||
->label(__('hr.fields.start_date'))
|
->badge()
|
||||||
->date(),
|
->color(fn (VacationType $state): string => $state->color())
|
||||||
TextEntry::make('end_date')
|
->formatStateUsing(fn (VacationType $state): string => $state->label()),
|
||||||
->label(__('hr.fields.end_date'))
|
TextEntry::make('status')
|
||||||
->date(),
|
->label(__('hr.fields.status'))
|
||||||
TextEntry::make('return_date')
|
->badge()
|
||||||
->label(__('hr.fields.return_date'))
|
->color(fn (ApprovalStatus $state): string => $state->color())
|
||||||
->date()
|
->formatStateUsing(fn (ApprovalStatus $state): string => $state->label()),
|
||||||
->placeholder('-'),
|
])
|
||||||
TextEntry::make('days')
|
->columns(3),
|
||||||
->label(__('hr.fields.days'))
|
Section::make(__('hr.sections.dates'))
|
||||||
->numeric(),
|
->schema([
|
||||||
TextEntry::make('status')
|
TextEntry::make('start_date')
|
||||||
->label(__('hr.fields.status'))
|
->label(__('hr.fields.start_date'))
|
||||||
->badge(),
|
->date('d.m.Y'),
|
||||||
TextEntry::make('reason')
|
TextEntry::make('end_date')
|
||||||
->label(__('hr.fields.reason'))
|
->label(__('hr.fields.end_date'))
|
||||||
->placeholder('-')
|
->date('d.m.Y'),
|
||||||
->columnSpanFull(),
|
TextEntry::make('return_date')
|
||||||
TextEntry::make('attachment_path')
|
->label(__('hr.fields.return_date'))
|
||||||
->label(__('hr.fields.attachment'))
|
->date('d.m.Y')
|
||||||
->placeholder('-'),
|
->placeholder('—'),
|
||||||
TextEntry::make('approved_by')
|
TextEntry::make('days')
|
||||||
->label(__('hr.fields.approved_by'))
|
->label(__('hr.fields.days'))
|
||||||
->numeric()
|
->suffix(' '.__('hr.messages.days_suffix')),
|
||||||
->placeholder('-'),
|
])
|
||||||
TextEntry::make('approved_at')
|
->columns(2),
|
||||||
->label(__('hr.fields.approved_at'))
|
Section::make(__('hr.sections.approval'))
|
||||||
->dateTime()
|
->schema([
|
||||||
->placeholder('-'),
|
TextEntry::make('reason')
|
||||||
TextEntry::make('created_at')
|
->label(__('hr.fields.reason'))
|
||||||
->label(__('hr.fields.created_at'))
|
->placeholder('—')
|
||||||
->dateTime()
|
->columnSpanFull(),
|
||||||
->placeholder('-'),
|
TextEntry::make('attachment_path')
|
||||||
TextEntry::make('updated_at')
|
->label(__('hr.fields.attachment'))
|
||||||
->label(__('hr.fields.updated_at'))
|
->formatStateUsing(fn (?string $state): string => filled($state) ? basename($state) : '—'),
|
||||||
->dateTime()
|
TextEntry::make('approved_by')
|
||||||
->placeholder('-'),
|
->label(__('hr.fields.approved_by'))
|
||||||
TextEntry::make('deleted_at')
|
->formatStateUsing(fn ($state, Vacation $record): string => $record->approver?->name ?? '—'),
|
||||||
->label(__('hr.fields.deleted_at'))
|
])
|
||||||
->dateTime()
|
->columns(2),
|
||||||
->visible(fn (Vacation $record): bool => $record->trashed()),
|
Section::make(__('hr.sections.metadata'))
|
||||||
|
->schema([
|
||||||
|
TextEntry::make('approved_at')
|
||||||
|
->label(__('hr.fields.approved_at'))
|
||||||
|
->dateTime('d.m.Y H:i')
|
||||||
|
->placeholder('—'),
|
||||||
|
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 (Vacation $record): bool => $record->trashed()),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,10 @@ return [
|
|||||||
'upcoming_approved_leave' => 'Upcoming Approved Leave',
|
'upcoming_approved_leave' => 'Upcoming Approved Leave',
|
||||||
'other_leave_types' => 'Other Leave Types',
|
'other_leave_types' => 'Other Leave Types',
|
||||||
'activity_details' => 'Activity Details',
|
'activity_details' => 'Activity Details',
|
||||||
|
'basic_info' => 'Basic Information',
|
||||||
|
'dates' => 'Dates',
|
||||||
|
'approval' => 'Approval',
|
||||||
|
'metadata' => 'Metadata',
|
||||||
],
|
],
|
||||||
|
|
||||||
'messages' => [
|
'messages' => [
|
||||||
|
|||||||
@@ -156,6 +156,10 @@ return [
|
|||||||
'upcoming_approved_leave' => 'Предстоящий одобренный отпуск',
|
'upcoming_approved_leave' => 'Предстоящий одобренный отпуск',
|
||||||
'other_leave_types' => 'Другие типы отпусков',
|
'other_leave_types' => 'Другие типы отпусков',
|
||||||
'activity_details' => 'Детали активности',
|
'activity_details' => 'Детали активности',
|
||||||
|
'basic_info' => 'Основная информация',
|
||||||
|
'dates' => 'Даты',
|
||||||
|
'approval' => 'Утверждение',
|
||||||
|
'metadata' => 'Метаданные',
|
||||||
],
|
],
|
||||||
|
|
||||||
'messages' => [
|
'messages' => [
|
||||||
|
|||||||
@@ -156,6 +156,10 @@ return [
|
|||||||
'upcoming_approved_leave' => 'Ýakynlaşýan tassyklanan dynç alyş',
|
'upcoming_approved_leave' => 'Ýakynlaşýan tassyklanan dynç alyş',
|
||||||
'other_leave_types' => 'Beýleki rugsat görnüşleri',
|
'other_leave_types' => 'Beýleki rugsat görnüşleri',
|
||||||
'activity_details' => 'Işjeňlik jikme-jiklikleri',
|
'activity_details' => 'Işjeňlik jikme-jiklikleri',
|
||||||
|
'basic_info' => 'Esasy maglumat',
|
||||||
|
'dates' => 'Seneler',
|
||||||
|
'approval' => 'Tassyklama',
|
||||||
|
'metadata' => 'Maglumat',
|
||||||
],
|
],
|
||||||
|
|
||||||
'messages' => [
|
'messages' => [
|
||||||
|
|||||||
Reference in New Issue
Block a user