Refactor UnpaidLeaveForm and UnpaidLeaveInfolist to improve layout and organization. Introduce sections in UnpaidLeaveInfolist for better categorization of information, enhance date picker functionality, and improve localization for various fields.
This commit is contained in:
@@ -13,8 +13,10 @@ class UnpaidLeaveForm
|
|||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
HrForm::employeeSelect(),
|
HrForm::employeeSelect(),
|
||||||
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),
|
||||||
HrForm::leaveDaysDisplay(),
|
HrForm::leaveDaysDisplay(),
|
||||||
Textarea::make('reason')
|
Textarea::make('reason')
|
||||||
->label(__('hr.fields.reason'))
|
->label(__('hr.fields.reason'))
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Filament\Resources\UnpaidLeaves\Schemas;
|
namespace App\Filament\Resources\UnpaidLeaves\Schemas;
|
||||||
|
|
||||||
|
use App\Enums\ApprovalStatus;
|
||||||
use App\Models\UnpaidLeave;
|
use App\Models\UnpaidLeave;
|
||||||
use Filament\Infolists\Components\TextEntry;
|
use Filament\Infolists\Components\TextEntry;
|
||||||
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
class UnpaidLeaveInfolist
|
class UnpaidLeaveInfolist
|
||||||
@@ -12,44 +16,61 @@ class UnpaidLeaveInfolist
|
|||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
TextEntry::make('employee.id')
|
Section::make(__('hr.sections.basic_info'))
|
||||||
->label(__('hr.fields.employee')),
|
->schema([
|
||||||
TextEntry::make('start_date')
|
TextEntry::make('employee.full_name')
|
||||||
->label(__('hr.fields.start_date'))
|
->label(__('hr.fields.employee')),
|
||||||
->date(),
|
TextEntry::make('status')
|
||||||
TextEntry::make('end_date')
|
->label(__('hr.fields.status'))
|
||||||
->label(__('hr.fields.end_date'))
|
->badge()
|
||||||
->date(),
|
->color(fn (ApprovalStatus $state): string => $state->color())
|
||||||
TextEntry::make('days')
|
->formatStateUsing(fn (ApprovalStatus $state): string => $state->label()),
|
||||||
->label(__('hr.fields.days'))
|
])
|
||||||
->numeric(),
|
->columns(2),
|
||||||
TextEntry::make('reason')
|
Section::make(__('hr.sections.dates'))
|
||||||
->label(__('hr.fields.reason'))
|
->schema([
|
||||||
->placeholder('-')
|
TextEntry::make('start_date')
|
||||||
->columnSpanFull(),
|
->label(__('hr.fields.start_date'))
|
||||||
TextEntry::make('status')
|
->date('d.m.Y'),
|
||||||
->label(__('hr.fields.status'))
|
TextEntry::make('end_date')
|
||||||
->badge(),
|
->label(__('hr.fields.end_date'))
|
||||||
TextEntry::make('approved_by')
|
->date('d.m.Y'),
|
||||||
->label(__('hr.fields.approved_by'))
|
TextEntry::make('days')
|
||||||
->numeric()
|
->label(__('hr.fields.days'))
|
||||||
->placeholder('-'),
|
->suffix(' '.__('hr.messages.days_suffix')),
|
||||||
TextEntry::make('approved_at')
|
])
|
||||||
->label(__('hr.fields.approved_at'))
|
->columns(2),
|
||||||
->dateTime()
|
Section::make(__('hr.sections.approval'))
|
||||||
->placeholder('-'),
|
->schema([
|
||||||
TextEntry::make('created_at')
|
TextEntry::make('reason')
|
||||||
->label(__('hr.fields.created_at'))
|
->label(__('hr.fields.reason'))
|
||||||
->dateTime()
|
->placeholder('—')
|
||||||
->placeholder('-'),
|
->columnSpanFull(),
|
||||||
TextEntry::make('updated_at')
|
TextEntry::make('approved_by')
|
||||||
->label(__('hr.fields.updated_at'))
|
->label(__('hr.fields.approved_by'))
|
||||||
->dateTime()
|
->formatStateUsing(fn ($state, UnpaidLeave $record): string => $record->approver?->name ?? '—'),
|
||||||
->placeholder('-'),
|
])
|
||||||
TextEntry::make('deleted_at')
|
->columns(2),
|
||||||
->label(__('hr.fields.deleted_at'))
|
Section::make(__('hr.sections.metadata'))
|
||||||
->dateTime()
|
->schema([
|
||||||
->visible(fn (UnpaidLeave $record): bool => $record->trashed()),
|
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 (UnpaidLeave $record): bool => $record->trashed()),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user