translate base

This commit is contained in:
Mekan1206
2026-07-31 18:08:08 +05:00
parent a794dacd39
commit 581cb8241c
413 changed files with 9087 additions and 428 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Employees;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Employees\Pages\CreateEmployee;
use App\Filament\Resources\Employees\Pages\EditEmployee;
use App\Filament\Resources\Employees\Pages\ListEmployees;
@@ -36,7 +37,7 @@ class EmployeeResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
protected static string | UnitEnum | null $navigationGroup = 'Employees';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Employees;
protected static ?int $navigationSort = 1;
@@ -80,9 +81,9 @@ class EmployeeResource extends Resource
{
/** @var Employee $record */
return [
'Employee #' => $record->employee_number,
'Department' => $record->department?->name ?? '—',
'Position' => $record->position?->name ?? '—',
__('hr.fields.employee_number') => $record->employee_number,
__('hr.fields.department') => $record->department?->name ?? '—',
__('hr.fields.position') => $record->position?->name ?? '—',
];
}

View File

@@ -27,7 +27,10 @@ class BonusesRelationManager extends RelationManager
{
protected static string $relationship = 'bonuses';
protected static ?string $title = 'Bonuses';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.bonuses");
}
public function form(Schema $schema): Schema
{
@@ -61,7 +64,7 @@ class BonusesRelationManager extends RelationManager
->date()
->sortable(),
TextColumn::make('bonus_type')
->label('Type')
->label(__('hr.fields.type'))
->badge()
->color(fn (BonusType $state): string => $state->color())
->formatStateUsing(fn (BonusType $state): string => $state->label())
@@ -75,7 +78,7 @@ class BonusesRelationManager extends RelationManager
])
->filters([
SelectFilter::make('bonus_type')
->label('Type')
->label(__('hr.fields.type'))
->options(BonusType::class),
TrashedFilter::make(),
])

View File

@@ -29,7 +29,10 @@ class DisciplinaryReportsRelationManager extends RelationManager
{
protected static string $relationship = 'disciplinaryReports';
protected static ?string $title = 'Disciplinary Reports';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.disciplinary_reports");
}
public function form(Schema $schema): Schema
{
@@ -50,7 +53,7 @@ class DisciplinaryReportsRelationManager extends RelationManager
->required()
->native(false),
HrForm::fileUpload('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);
@@ -73,12 +76,12 @@ class DisciplinaryReportsRelationManager extends RelationManager
->formatStateUsing(fn (DisciplinarySeverity $state): string => $state->label())
->sortable(),
IconColumn::make('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->boolean()
->trueIcon('heroicon-o-paper-clip')
->falseIcon('heroicon-o-minus'),
TextColumn::make('creator.name')
->label('Created By')
->label(__('hr.fields.created_by'))
->toggleable(),
])
->filters([

View File

@@ -29,7 +29,10 @@ class DocumentsRelationManager extends RelationManager
{
protected static string $relationship = 'documents';
protected static ?string $title = 'Employee Documents';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.employee_documents");
}
public function form(Schema $schema): Schema
{
@@ -43,7 +46,7 @@ class DocumentsRelationManager extends RelationManager
->required()
->maxLength(255),
HrForm::fileUpload('file_path')
->label('Document')
->label(__('hr.fields.document'))
->required()
->acceptedFileTypes(['application/pdf', 'image/*', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'])
->maxSize(15360),
@@ -56,7 +59,7 @@ class DocumentsRelationManager extends RelationManager
->recordTitleAttribute('title')
->columns([
TextColumn::make('document_type')
->label('Type')
->label(__('hr.fields.type'))
->badge()
->color(fn (DocumentType $state): string => $state->color())
->formatStateUsing(fn (DocumentType $state): string => $state->label())
@@ -71,7 +74,7 @@ class DocumentsRelationManager extends RelationManager
])
->filters([
SelectFilter::make('document_type')
->label('Type')
->label(__('hr.fields.type'))
->options(DocumentType::class),
TrashedFilter::make(),
])
@@ -80,7 +83,7 @@ class DocumentsRelationManager extends RelationManager
])
->recordActions([
Action::make('download')
->label('Download')
->label(__('hr.actions.download'))
->icon('heroicon-o-arrow-down-tray')
->visible(fn (EmployeeDocument $record): bool => filled($record->file_path))
->action(function (EmployeeDocument $record) {

View File

@@ -26,7 +26,10 @@ class ExplanationsRelationManager extends RelationManager
{
protected static string $relationship = 'explanations';
protected static ?string $title = 'Explanations';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.explanations");
}
public function form(Schema $schema): Schema
{
@@ -43,7 +46,7 @@ class ExplanationsRelationManager extends RelationManager
->rows(4)
->columnSpanFull(),
HrForm::fileUpload('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);
@@ -64,7 +67,7 @@ class ExplanationsRelationManager extends RelationManager
->limit(50)
->toggleable(),
IconColumn::make('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->boolean()
->trueIcon('heroicon-o-paper-clip')
->falseIcon('heroicon-o-minus'),

View File

@@ -24,7 +24,10 @@ class GiftsRelationManager extends RelationManager
{
protected static string $relationship = 'gifts';
protected static ?string $title = 'Gifts';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.gifts");
}
public function form(Schema $schema): Schema
{
@@ -34,7 +37,7 @@ class GiftsRelationManager extends RelationManager
->required()
->default(now()),
TextInput::make('gift_name')
->label('Gift Name')
->label(__('hr.fields.gift_name'))
->required()
->maxLength(255),
TextInput::make('value')
@@ -59,7 +62,7 @@ class GiftsRelationManager extends RelationManager
->date()
->sortable(),
TextColumn::make('gift_name')
->label('Gift')
->label(__('hr.fields.gift'))
->searchable()
->sortable(),
TextColumn::make('value')

View File

@@ -25,14 +25,17 @@ class SickLeavesRelationManager extends RelationManager
{
protected static string $relationship = 'sickLeaves';
protected static ?string $title = 'Sick Leaves';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.sick_leaves");
}
public function form(Schema $schema): Schema
{
return $schema
->components([
HrForm::leaveDatePicker('start_date', 'Start Date'),
HrForm::leaveDatePicker('end_date', 'End Date'),
HrForm::leaveDatePicker('start_date', __(hr.fields.start_date)),
HrForm::leaveDatePicker('end_date', __(hr.fields.end_date)),
HrForm::leaveDaysDisplay(),
TextInput::make('medical_institution')
->maxLength(255),
@@ -40,7 +43,7 @@ class SickLeavesRelationManager extends RelationManager
->rows(3)
->columnSpanFull(),
HrForm::fileUpload('document_path')
->label('Medical Document')
->label(__('hr.fields.medical_document'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);
@@ -64,7 +67,7 @@ class SickLeavesRelationManager extends RelationManager
->searchable()
->toggleable(),
IconColumn::make('document_path')
->label('Document')
->label(__('hr.fields.document'))
->boolean()
->trueIcon('heroicon-o-document-check')
->falseIcon('heroicon-o-document'),

View File

@@ -29,14 +29,17 @@ class UnpaidLeavesRelationManager extends RelationManager
{
protected static string $relationship = 'unpaidLeaves';
protected static ?string $title = 'Unpaid Leaves';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.unpaid_leaves");
}
public function form(Schema $schema): Schema
{
return $schema
->components([
HrForm::leaveDatePicker('start_date', 'Start Date'),
HrForm::leaveDatePicker('end_date', 'End Date'),
HrForm::leaveDatePicker('start_date', __(hr.fields.start_date)),
HrForm::leaveDatePicker('end_date', __(hr.fields.end_date)),
HrForm::leaveDaysDisplay(),
Textarea::make('reason')
->rows(3)
@@ -64,7 +67,7 @@ class UnpaidLeavesRelationManager extends RelationManager
->formatStateUsing(fn (ApprovalStatus $state): string => $state->label())
->sortable(),
TextColumn::make('approver.name')
->label('Approved By')
->label(__('hr.fields.approved_by'))
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
@@ -77,7 +80,7 @@ class UnpaidLeavesRelationManager extends RelationManager
])
->recordActions([
Action::make('approve')
->label('Approve')
->label(__('hr.actions.approve'))
->icon('heroicon-o-check-badge')
->color('success')
->requiresConfirmation()
@@ -86,7 +89,7 @@ class UnpaidLeavesRelationManager extends RelationManager
$unpaidLeaveService->approve($record, Auth::user());
}),
Action::make('reject')
->label('Reject')
->label(__('hr.actions.reject'))
->icon('heroicon-o-x-mark')
->color('danger')
->requiresConfirmation()

View File

@@ -32,7 +32,10 @@ class VacationsRelationManager extends RelationManager
{
protected static string $relationship = 'vacations';
protected static ?string $title = 'Vacations';
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
{
return __("hr.relation_managers.vacations");
}
public function form(Schema $schema): Schema
{
@@ -42,16 +45,16 @@ class VacationsRelationManager extends RelationManager
->options(VacationType::class)
->required()
->native(false),
HrForm::leaveDatePicker('start_date', 'Start Date'),
HrForm::leaveDatePicker('end_date', 'End Date'),
HrForm::leaveDatePicker('start_date', __(hr.fields.start_date)),
HrForm::leaveDatePicker('end_date', __(hr.fields.end_date)),
DatePicker::make('return_date')
->label('Return Date'),
->label(__('hr.fields.return_date')),
HrForm::leaveDaysDisplay(),
Textarea::make('reason')
->rows(3)
->columnSpanFull(),
HrForm::fileUpload('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);
@@ -82,7 +85,7 @@ class VacationsRelationManager extends RelationManager
->formatStateUsing(fn (ApprovalStatus $state): string => $state->label())
->sortable(),
TextColumn::make('approver.name')
->label('Approved By')
->label(__('hr.fields.approved_by'))
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
@@ -97,7 +100,7 @@ class VacationsRelationManager extends RelationManager
])
->recordActions([
Action::make('approve')
->label('Approve')
->label(__('hr.actions.approve'))
->icon('heroicon-o-check-badge')
->color('success')
->requiresConfirmation()
@@ -106,7 +109,7 @@ class VacationsRelationManager extends RelationManager
$vacationService->approve($record, Auth::user());
}),
Action::make('reject')
->label('Reject')
->label(__('hr.actions.reject'))
->icon('heroicon-o-x-mark')
->color('danger')
->requiresConfirmation()

View File

@@ -19,12 +19,12 @@ class EmployeeForm
{
return $schema
->components([
Tabs::make('Employee')
Tabs::make(__('hr.tabs.employee'))
->tabs([
Tab::make('Personal')
Tab::make(__('hr.tabs.personal'))
->schema([
HrForm::fileUpload('profile_photo_path')
->label('Photo')
->label(__('hr.fields.photo'))
->image()
->avatar()
->imageEditor(),
@@ -36,7 +36,7 @@ class EmployeeForm
->required()
->maxLength(255),
TextInput::make('national_id')
->label('National ID')
->label(__('hr.fields.national_id'))
->maxLength(50),
Select::make('gender')
->options(Gender::class)
@@ -53,7 +53,7 @@ class EmployeeForm
->columnSpanFull(),
])
->columns(2),
Tab::make('Employment')
Tab::make(__('hr.tabs.employment'))
->schema([
Select::make('department_id')
->relationship('department', 'name')

View File

@@ -22,14 +22,14 @@ class EmployeeInfolist
{
return $schema
->components([
Tabs::make('Employee Details')
Tabs::make(__('hr.sections.employee_details'))
->tabs([
Tab::make('Overview')
Tab::make(__('hr.sections.overview'))
->schema([
Section::make('Profile')
Section::make(__('hr.sections.profile'))
->schema([
ImageEntry::make('profile_photo_path')
->label('Photo')
->label(__('hr.fields.photo'))
->disk(config('hr.file_uploads.disk'))
->visibility('private')
->circular()
@@ -37,10 +37,10 @@ class EmployeeInfolist
->placeholder('—')
->columnSpanFull(),
TextEntry::make('employee_number')
->label('Employee #'),
->label(__('hr.fields.employee_number')),
TextEntry::make('full_name'),
TextEntry::make('national_id')
->label('National ID')
->label(__('hr.fields.national_id'))
->placeholder('—'),
TextEntry::make('gender')
->badge()
@@ -54,18 +54,18 @@ class EmployeeInfolist
->columnSpanFull(),
])
->columns(2),
Section::make('Organization')
Section::make(__('hr.navigation.organization'))
->schema([
TextEntry::make('department.name')
->label('Department')
->label(__('hr.fields.department'))
->badge()
->color('info'),
TextEntry::make('position.name')
->label('Position')
->label(__('hr.fields.position'))
->badge()
->color('primary'),
TextEntry::make('shift.name')
->label('Shift')
->label(__('hr.fields.shift'))
->badge()
->color('gray'),
TextEntry::make('employment_status')
@@ -75,19 +75,19 @@ class EmployeeInfolist
->icon(fn (EmploymentStatus $state): string => $state->icon()),
])
->columns(2),
Section::make('Employment Timeline')
Section::make(__('hr.sections.employment_timeline'))
->schema([
TextEntry::make('hire_date')
->label('Hire Date')
->label(__('hr.fields.hire_date'))
->date()
->icon('heroicon-o-calendar'),
TextEntry::make('termination_date')
->label('Termination Date')
->label(__('hr.fields.termination_date'))
->date()
->placeholder('—')
->icon('heroicon-o-calendar-days'),
TextEntry::make('tenure')
->label('Tenure')
->label(__('hr.fields.tenure'))
->state(fn (Employee $record): string => $record->hire_date
? $record->hire_date->diffForHumans(now(), true)
: '—'),
@@ -97,78 +97,78 @@ class EmployeeInfolist
])
->columns(2),
]),
Tab::make('Statistics')
Tab::make(__('hr.sections.statistics'))
->schema([
Section::make('Leave & Attendance')
Section::make(__('hr.sections.leave_attendance'))
->schema([
TextEntry::make('stats_vacation_taken')
->label('Vacation Taken (days)')
->label(__('hr.fields.vacation_taken_days'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationTaken)
->numeric()
->icon('heroicon-o-sun'),
TextEntry::make('stats_vacation_remaining')
->label('Vacation Remaining (days)')
->label(__('hr.fields.vacation_remaining_days'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationRemaining)
->numeric()
->color('success')
->icon('heroicon-o-calendar'),
TextEntry::make('stats_sick_leave_count')
->label('Sick Leave Records')
->label(__('hr.fields.sick_leave_records'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->sickLeaveCount)
->numeric()
->icon('heroicon-o-heart'),
])
->columns(3),
Section::make('HR Records')
Section::make(__('hr.sections.hr_records'))
->schema([
TextEntry::make('stats_reports_count')
->label('Disciplinary Reports')
->label(__('hr.fields.disciplinary_reports'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->reportsCount)
->numeric()
->icon('heroicon-o-exclamation-triangle'),
TextEntry::make('stats_bonuses_total')
->label('Total Bonuses')
->label(__('hr.fields.total_bonuses'))
->state(fn (Employee $record): float => app(EmployeeStatisticsService::class)->summary($record)->bonusesTotal)
->money('TMT')
->icon('heroicon-o-banknotes'),
TextEntry::make('stats_gifts_count')
->label('Gifts Received')
->label(__('hr.fields.gifts_received'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->giftsCount)
->numeric()
->icon('heroicon-o-gift'),
])
->columns(3),
]),
Tab::make('Leave Summary')
Tab::make(__('hr.sections.leave_summary'))
->schema([
Section::make('Annual Leave Balance')
Section::make(__('hr.sections.annual_leave_balance'))
->schema([
TextEntry::make('leave_balance_taken')
->label('Days Taken')
->label(__('hr.fields.days_taken'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationTaken)
->suffix(' days'),
->suffix(' ' . __('hr.messages.days_suffix')),
TextEntry::make('leave_balance_remaining')
->label('Days Remaining')
->label(__('hr.fields.days_remaining'))
->state(fn (Employee $record): int => app(EmployeeStatisticsService::class)->summary($record)->vacationRemaining)
->suffix(' days')
->suffix(' ' . __('hr.messages.days_suffix'))
->color('success'),
TextEntry::make('leave_balance_total')
->label('Annual Allowance')
->label(__('hr.fields.annual_allowance'))
->state(fn (): int => (int) config('hr.annual_leave_days'))
->suffix(' days'),
->suffix(' ' . __('hr.messages.days_suffix')),
])
->columns(3),
Section::make('Upcoming Approved Leave')
Section::make(__('hr.sections.upcoming_approved_leave'))
->schema([
TextEntry::make('upcoming_leave')
->label('Scheduled Vacations')
->label(__('hr.fields.scheduled_vacations'))
->state(function (Employee $record): string {
$upcoming = app(EmployeeStatisticsService::class)
->summary($record)
->upcomingLeave;
if ($upcoming->isEmpty()) {
return 'No upcoming approved leave';
return __('hr.messages.no_upcoming_approved_leave');
}
return $upcoming
@@ -184,14 +184,14 @@ class EmployeeInfolist
->listWithLineBreaks()
->columnSpanFull(),
]),
Section::make('Other Leave Types')
Section::make(__('hr.sections.other_leave_types'))
->schema([
TextEntry::make('unpaid_leaves_count')
->label('Unpaid Leave Records')
->label(__('hr.fields.unpaid_leave_records'))
->state(fn (Employee $record): int => $record->unpaidLeaves()->count())
->numeric(),
TextEntry::make('explanations_count')
->label('Explanations')
->label(__('hr.fields.explanations'))
->state(fn (Employee $record): int => $record->explanations()->count())
->numeric(),
])

View File

@@ -28,14 +28,14 @@ class EmployeesTable
return $table
->columns([
TextColumn::make('employee_number')
->label('Number')
->label(__('hr.fields.number'))
->searchable()
->sortable(),
TextColumn::make('full_name')
->searchable()
->sortable(),
TextColumn::make('national_id')
->label('National ID')
->label(__('hr.fields.national_id'))
->searchable()
->toggleable(),
TextColumn::make('gender')
@@ -47,25 +47,25 @@ class EmployeesTable
->searchable()
->toggleable(),
TextColumn::make('department.name')
->label('Department')
->label(__('hr.fields.department'))
->badge()
->color('info')
->searchable()
->sortable(),
TextColumn::make('position.name')
->label('Position')
->label(__('hr.fields.position'))
->badge()
->color('primary')
->searchable()
->sortable(),
TextColumn::make('shift.name')
->label('Shift')
->label(__('hr.fields.shift'))
->badge()
->color('gray')
->searchable()
->sortable(),
TextColumn::make('employment_status')
->label('Status')
->label(__('hr.fields.status'))
->badge()
->color(fn (EmploymentStatus $state): string => $state->color())
->formatStateUsing(fn (EmploymentStatus $state): string => $state->label())
@@ -93,22 +93,22 @@ class EmployeesTable
])
->filters([
SelectFilter::make('department_id')
->label('Department')
->label(__('hr.fields.department'))
->relationship('department', 'name')
->searchable()
->preload(),
SelectFilter::make('position_id')
->label('Position')
->label(__('hr.fields.position'))
->relationship('position', 'name')
->searchable()
->preload(),
SelectFilter::make('shift_id')
->label('Shift')
->label(__('hr.fields.shift'))
->relationship('shift', 'name')
->searchable()
->preload(),
SelectFilter::make('employment_status')
->label('Employment Status')
->label(__('hr.fields.employment_status'))
->options(EmploymentStatus::class),
TrashedFilter::make(),
])
@@ -120,11 +120,11 @@ class EmployeesTable
BulkActionGroup::make([
ExportExcelAction::bulk('exportSelected', \App\Exports\EmployeesExport::class, 'employees.xlsx'),
BulkAction::make('changeDepartment')
->label('Change Department')
->label(__('hr.actions.change_department'))
->icon('heroicon-o-building-office-2')
->schema([
Select::make('department_id')
->label('Department')
->label(__('hr.fields.department'))
->options(fn (): array => Department::query()->orderBy('name')->pluck('name', 'id')->all())
->searchable()
->required(),

View File

@@ -22,23 +22,23 @@ class EmployeeStatsWidget extends StatsOverviewWidget
$summary = app(EmployeeStatisticsService::class)->summary($this->record);
return [
Stat::make('Vacation Taken', (string) $summary->vacationTaken)
->description("{$summary->vacationRemaining} days remaining")
Stat::make(__('hr.fields.vacation_taken_days'), (string) $summary->vacationTaken)
->description("{$summary->vacationRemaining} " . __('hr.fields.days_remaining'))
->descriptionIcon('heroicon-o-calendar')
->color('primary')
->icon('heroicon-o-sun'),
Stat::make('Sick Leaves', (string) $summary->sickLeaveCount)
->description('Total records')
Stat::make(__('hr.relation_managers.sick_leaves'), (string) $summary->sickLeaveCount)
->description(__('hr.fields.sick_leave_records'))
->descriptionIcon('heroicon-o-heart')
->color('warning')
->icon('heroicon-o-heart'),
Stat::make('Disciplinary Reports', (string) $summary->reportsCount)
->description('On file')
Stat::make(__('hr.fields.disciplinary_reports'), (string) $summary->reportsCount)
->description(__('hr.fields.disciplinary_reports'))
->descriptionIcon('heroicon-o-exclamation-triangle')
->color('danger')
->icon('heroicon-o-exclamation-triangle'),
Stat::make('Total Bonuses', number_format($summary->bonusesTotal, 2).' TMT')
->description("{$summary->giftsCount} gifts received")
Stat::make(__('hr.fields.total_bonuses'), number_format($summary->bonusesTotal, 2).' TMT')
->description("{$summary->giftsCount} " . __('hr.fields.gifts_received'))
->descriptionIcon('heroicon-o-gift')
->color('success')
->icon('heroicon-o-banknotes'),