Refactor employee management by implementing automatic employee number generation, updating national ID handling, and enhancing localization for gender and nationality fields across various resources. Adjust form components and validation logic to improve user experience and data integrity.

This commit is contained in:
Mekan1206 committed 2026-08-02 21:06:37 +05:00
1 parent 28cbef8eb5
commit eed46157cd
25 files changed
+1175 -51

No files matched your search

@@ -9,6 +9,7 @@
use App\Models\Employee;
use App\Models\Vacation;
use App\Services\Employee\EmployeeStatisticsService;
use App\Support\Countries;
use Filament\Infolists\Components\ImageEntry;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
@@ -42,6 +43,7 @@ public static function configure(Schema $schema): Schema
->label(__('hr.fields.full_name')),
TextEntry::make('national_id')
->label(__('hr.fields.national_id'))
->formatStateUsing(fn (?string $state): string => Countries::name($state) ?? $state ?? '—')
->placeholder('—'),
TextEntry::make('gender')
->label(__('hr.fields.gender'))
@@ -153,16 +155,16 @@ public static function configure(Schema $schema): Schema
TextEntry::make('leave_balance_taken')
->label(__('hr.fields.days_taken'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationTaken)
->suffix(' ' . __('hr.messages.days_suffix')),
->suffix(' '.__('hr.messages.days_suffix')),
TextEntry::make('leave_balance_remaining')
->label(__('hr.fields.days_remaining'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationRemaining)
->suffix(' ' . __('hr.messages.days_suffix'))
->suffix(' '.__('hr.messages.days_suffix'))
->color('success'),
TextEntry::make('leave_balance_total')
->label(__('hr.fields.annual_allowance'))
->state(fn (): int => (int) config('hr.annual_leave_days'))
->suffix(' ' . __('hr.messages.days_suffix')),
->suffix(' '.__('hr.messages.days_suffix')),
])
->columns(3),
Section::make(__('hr.sections.upcoming_approved_leave'))