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

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Pages;
use App\Enums\ImportType;
use App\Enums\NavigationGroup;
use App\Jobs\ProcessImportJob;
use App\Services\Import\ImportService;
use BackedEnum;
@@ -32,14 +33,10 @@ class ImportWizard extends Page
{
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedArrowUpTray;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static ?string $navigationLabel = 'Import Wizard';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::System;
protected static ?int $navigationSort = 2;
protected static ?string $title = 'Import Wizard';
protected static ?string $slug = 'import-wizard';
/**
@@ -55,6 +52,16 @@ class ImportWizard extends Page
/** @var array<string, mixed>|null */
public ?array $importResult = null;
public static function getNavigationLabel(): string
{
return __('hr.resources.import_wizard');
}
public function getTitle(): string|Htmlable
{
return __('hr.import.title');
}
public function mount(): void
{
$this->form->fill([
@@ -76,17 +83,17 @@ class ImportWizard extends Page
{
return $schema->components([
Wizard::make([
Step::make('Upload')
->description('Select import type and upload an Excel file')
Step::make(__('hr.import.upload'))
->description(__('hr.import.upload_description'))
->schema([
Select::make('import_type')
->label('Import Type')
->label(__('hr.import.import_type'))
->options(ImportType::class)
->required()
->live()
->afterStateUpdated(fn () => $this->resetColumnMapping()),
FileUpload::make('file')
->label('Excel File')
->label(__('hr.import.excel_file'))
->disk(config('hr.file_uploads.disk'))
->directory(config('hr.file_uploads.directory') . '/imports')
->acceptedFileTypes([
@@ -97,29 +104,29 @@ class ImportWizard extends Page
->required()
->afterStateUpdated(fn () => $this->loadHeaders()),
]),
Step::make('Map Columns')
->description('Match spreadsheet columns to system fields')
Step::make(__('hr.import.map_columns'))
->description(__('hr.import.map_columns_description'))
->schema([
Section::make('Column Mapping')
Section::make(__('hr.import.column_mapping'))
->schema(fn (): array => $this->getColumnMappingFields()),
]),
Step::make('Preview')
->description('Review the first 10 rows with validation')
Step::make(__('hr.import.preview_step'))
->description(__('hr.import.preview_description'))
->schema([
Placeholder::make('preview_table')
->label('Preview')
->label(__('hr.import.preview'))
->content(fn (): HtmlString => new HtmlString($this->getPreviewHtml())),
]),
Step::make('Import')
->description('Run the import and review results')
Step::make(__('hr.import.import_step'))
->description(__('hr.import.import_description'))
->schema([
Placeholder::make('import_results')
->label('Import Results')
->label(__('hr.import.import_results'))
->content(fn (): HtmlString => new HtmlString($this->getResultsHtml())),
]),
])
->alpineSubmitHandler('$wire.runImport()')
->submitAction(new HtmlString('<button type="submit" class="fi-btn fi-btn-primary">Start Import</button>'))
->submitAction(new HtmlString('<button type="submit" class="fi-btn fi-btn-primary">' . e(__('hr.import.start_import')) . '</button>'))
->skippable(false),
]);
}
@@ -146,8 +153,8 @@ class ImportWizard extends Page
if ($filePath === null) {
Notification::make()
->title('Upload required')
->body('Please upload an Excel file before importing.')
->title(__('hr.import.upload_required_title'))
->body(__('hr.import.upload_required_body'))
->danger()
->send();
@@ -165,8 +172,8 @@ class ImportWizard extends Page
);
Notification::make()
->title('Import queued')
->body('Your import has been queued and will be processed shortly.')
->title(__('hr.import.import_queued_title'))
->body(__('hr.import.import_queued_body'))
->success()
->send();
}
@@ -197,14 +204,14 @@ class ImportWizard extends Page
}
/**
* @return array<int, Select>
* @return array<int, Select|Placeholder>
*/
protected function getColumnMappingFields(): array
{
if ($this->headers === []) {
return [
Placeholder::make('mapping_hint')
->content('Upload a file in step 1 to load column headers.'),
->content(__('hr.import.mapping_hint')),
];
}
@@ -228,7 +235,7 @@ class ImportWizard extends Page
$path = $this->resolveStoredFilePath();
if ($path === null) {
return '<p class="text-sm text-gray-500">Upload a file to preview rows.</p>';
return '<p class="text-sm text-gray-500">' . e(__('hr.import.upload_to_preview')) . '</p>';
}
$importType = ImportType::from($this->data['import_type'] ?? ImportType::Employees->value);
@@ -238,18 +245,18 @@ class ImportWizard extends Page
$validation = $importService->validatePreview($importType, $mappedRows);
if ($mappedRows === []) {
return '<p class="text-sm text-gray-500">No rows found in the uploaded file.</p>';
return '<p class="text-sm text-gray-500">' . e(__('hr.import.no_rows')) . '</p>';
}
$fields = array_keys($importType->fields());
$html = '<div class="overflow-x-auto"><table class="fi-ta-table w-full text-sm"><thead><tr>';
$html .= '<th class="px-3 py-2 text-left">Row</th>';
$html .= '<th class="px-3 py-2 text-left">' . e(__('hr.import.row')) . '</th>';
foreach ($fields as $field) {
$html .= '<th class="px-3 py-2 text-left">' . e($importType->fields()[$field]) . '</th>';
}
$html .= '<th class="px-3 py-2 text-left">Validation</th></tr></thead><tbody>';
$html .= '<th class="px-3 py-2 text-left">' . e(__('hr.import.validation')) . '</th></tr></thead><tbody>';
foreach ($mappedRows as $index => $row) {
$errors = $validation[$index]['errors'] ?? [];
@@ -263,7 +270,7 @@ class ImportWizard extends Page
$html .= '<td class="px-3 py-2">';
if ($errors === []) {
$html .= '<span class="text-success-600">Valid</span>';
$html .= '<span class="text-success-600">' . e(__('hr.import.valid')) . '</span>';
} else {
$html .= '<span class="text-danger-600">' . e(implode(' ', $errors)) . '</span>';
}
@@ -281,17 +288,17 @@ class ImportWizard extends Page
$this->refreshImportResult();
if ($this->importResult === null) {
return '<p class="text-sm text-gray-500">Submit the import to see results here after processing completes.</p>';
return '<p class="text-sm text-gray-500">' . e(__('hr.import.submit_to_see_results')) . '</p>';
}
$html = '<div class="space-y-2 text-sm">';
$html .= '<p><strong>Total rows:</strong> ' . $this->importResult['total'] . '</p>';
$html .= '<p><strong>Imported:</strong> ' . $this->importResult['imported'] . '</p>';
$html .= '<p><strong>Skipped (duplicates):</strong> ' . $this->importResult['skipped'] . '</p>';
$html .= '<p><strong>Failed:</strong> ' . $this->importResult['failed'] . '</p>';
$html .= '<p><strong>' . e(__('hr.import.total_rows')) . ':</strong> ' . $this->importResult['total'] . '</p>';
$html .= '<p><strong>' . e(__('hr.import.imported')) . ':</strong> ' . $this->importResult['imported'] . '</p>';
$html .= '<p><strong>' . e(__('hr.import.skipped_duplicates')) . ':</strong> ' . $this->importResult['skipped'] . '</p>';
$html .= '<p><strong>' . e(__('hr.import.failed')) . ':</strong> ' . $this->importResult['failed'] . '</p>';
if (($this->importResult['errors'] ?? []) !== []) {
$html .= '<div class="mt-3"><strong>Errors:</strong><ul class="list-disc ps-5">';
$html .= '<div class="mt-3"><strong>' . e(__('hr.import.errors')) . ':</strong><ul class="list-disc ps-5">';
foreach ($this->importResult['errors'] as $error) {
$html .= '<li>' . e($error) . '</li>';
@@ -324,9 +331,4 @@ class ImportWizard extends Page
return $this->storedFilePath;
}
public function getTitle(): string|Htmlable
{
return 'Import Wizard';
}
}

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ActivityLogs;
use App\Enums\NavigationGroup;
use App\Filament\Resources\ActivityLogs\Pages\ListActivityLogs;
use App\Filament\Resources\ActivityLogs\Pages\ViewActivityLog;
use App\Filament\Resources\ActivityLogs\Schemas\ActivityLogInfolist;
@@ -22,18 +23,27 @@ class ActivityLogResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClipboardDocumentList;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::System;
protected static ?int $navigationSort = 3;
protected static ?string $navigationLabel = 'Audit Log';
protected static ?string $modelLabel = 'Activity Log';
protected static ?string $pluralModelLabel = 'Activity Logs';
protected static ?string $slug = 'activity-logs';
public static function getNavigationLabel(): string
{
return __('hr.resources.audit_log');
}
public static function getModelLabel(): string
{
return __('hr.resources.activity_log');
}
public static function getPluralModelLabel(): string
{
return __('hr.resources.activity_logs');
}
public static function form(Schema $schema): Schema
{
return $schema;

View File

@@ -15,28 +15,28 @@ class ActivityLogInfolist
{
return $schema
->components([
Section::make('Activity Details')
Section::make(__('hr.sections.activity_details'))
->schema([
TextEntry::make('created_at')
->label('Date')
->label(__('hr.fields.date'))
->dateTime(),
TextEntry::make('description'),
TextEntry::make('event')
->badge(),
TextEntry::make('log_name')
->label('Log Name'),
->label(__('hr.fields.log_name')),
TextEntry::make('subject_type')
->label('Subject Type')
->label(__('hr.fields.subject_type'))
->formatStateUsing(fn (?string $state): string => $state ? class_basename($state) : '—'),
TextEntry::make('subject_id')
->label('Subject ID'),
->label(__('hr.fields.subject_id')),
TextEntry::make('causer.name')
->label('Causer'),
->label(__('hr.fields.causer')),
KeyValueEntry::make('properties.attributes')
->label('Changes')
->label(__('hr.fields.changes'))
->visible(fn ($record): bool => filled($record->properties['attributes'] ?? null)),
KeyValueEntry::make('properties.old')
->label('Previous Values')
->label(__('hr.fields.previous_values'))
->visible(fn ($record): bool => filled($record->properties['old'] ?? null)),
])
->columns(2),

View File

@@ -25,7 +25,7 @@ class ActivityLogsTable
return $table
->columns([
TextColumn::make('created_at')
->label('Date')
->label(__('hr.fields.date'))
->dateTime()
->sortable(),
TextColumn::make('description')
@@ -36,15 +36,15 @@ class ActivityLogsTable
->searchable()
->sortable(),
TextColumn::make('subject_type')
->label('Subject Type')
->label(__('hr.fields.subject_type'))
->formatStateUsing(fn (?string $state): string => $state ? class_basename($state) : '—')
->searchable()
->sortable(),
TextColumn::make('subject_id')
->label('Subject ID')
->label(__('hr.fields.subject_id'))
->sortable(),
TextColumn::make('causer.name')
->label('Causer')
->label(__('hr.fields.causer'))
->searchable()
->sortable(),
TextColumn::make('log_name')
@@ -53,14 +53,14 @@ class ActivityLogsTable
->defaultSort('created_at', 'desc')
->filters([
SelectFilter::make('subject_type')
->label('Subject Type')
->label(__('hr.fields.subject_type'))
->options([
Employee::class => 'Employee',
Vacation::class => 'Vacation',
Bonus::class => 'Bonus',
DisciplinaryReport::class => 'Disciplinary Report',
Department::class => 'Department',
User::class => 'User',
Employee::class => __('hr.audit.employee'),
Vacation::class => __('hr.audit.vacation'),
Bonus::class => __('hr.audit.bonus'),
DisciplinaryReport::class => __('hr.audit.disciplinary_report'),
Department::class => __('hr.audit.department'),
User::class => __('hr.audit.user'),
]),
SelectFilter::make('event')
->options(fn (): array => \Spatie\Activitylog\Models\Activity::query()
@@ -69,16 +69,16 @@ class ActivityLogsTable
->pluck('event', 'event')
->all()),
SelectFilter::make('causer')
->label('Causer')
->label(__('hr.fields.causer'))
->relationship('causer', 'name')
->searchable()
->preload(),
Filter::make('created_at')
->schema([
DatePicker::make('from')
->label('From'),
->label(__('hr.fields.from')),
DatePicker::make('until')
->label('Until'),
->label(__('hr.fields.until')),
])
->query(function (Builder $query, array $data): Builder {
return $query

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Bonuses;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Bonuses\Pages\CreateBonus;
use App\Filament\Resources\Bonuses\Pages\EditBonus;
use App\Filament\Resources\Bonuses\Pages\ListBonuses;
@@ -27,7 +28,7 @@ class BonusResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCurrencyDollar;
protected static string | UnitEnum | null $navigationGroup = 'Records';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;
protected static ?int $navigationSort = 3;

View File

@@ -13,7 +13,7 @@ class BonusInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('bonus_date')
->date(),
TextEntry::make('bonus_type')

View File

@@ -22,14 +22,14 @@ class BonusesTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('bonus_date')
->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())
@@ -56,7 +56,7 @@ class BonusesTable
])
->filters([
SelectFilter::make('bonus_type')
->label('Type')
->label(__('hr.fields.type'))
->options(BonusType::class),
TrashedFilter::make(),
])

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Departments;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Departments\Pages\CreateDepartment;
use App\Filament\Resources\Departments\Pages\EditDepartment;
use App\Filament\Resources\Departments\Pages\ListDepartments;
@@ -27,7 +28,7 @@ class DepartmentResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBuildingOffice2;
protected static string | UnitEnum | null $navigationGroup = 'Organization';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Organization;
protected static ?int $navigationSort = 1;

View File

@@ -24,7 +24,7 @@ class DepartmentForm
->rows(3)
->columnSpanFull(),
Toggle::make('is_active')
->label('Active')
->label(__('hr.fields.active'))
->default(true)
->required(),
]);

View File

@@ -29,9 +29,9 @@ class DepartmentsTable
->limit(50)
->toggleable(),
TextColumn::make('is_active')
->label('Status')
->label(__('hr.fields.status'))
->badge()
->formatStateUsing(fn (bool $state): string => $state ? 'Active' : 'Inactive')
->formatStateUsing(fn (bool $state): string => $state ? __('enums.employment_status.active') : __('enums.employment_status.inactive'))
->color(fn (bool $state): string => $state ? 'success' : 'danger')
->sortable(),
TextColumn::make('created_at')
@@ -49,10 +49,10 @@ class DepartmentsTable
])
->filters([
TernaryFilter::make('is_active')
->label('Status')
->placeholder('All departments')
->trueLabel('Active')
->falseLabel('Inactive'),
->label(__('hr.fields.status'))
->placeholder(__('hr.filters.all_departments'))
->trueLabel(__('enums.employment_status.active'))
->falseLabel(__('enums.employment_status.inactive')),
TrashedFilter::make(),
])
->recordActions([

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\DisciplinaryReports;
use App\Enums\NavigationGroup;
use App\Filament\Resources\DisciplinaryReports\Pages\CreateDisciplinaryReport;
use App\Filament\Resources\DisciplinaryReports\Pages\EditDisciplinaryReport;
use App\Filament\Resources\DisciplinaryReports\Pages\ListDisciplinaryReports;
@@ -27,7 +28,7 @@ class DisciplinaryReportResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedExclamationTriangle;
protected static string | UnitEnum | null $navigationGroup = 'Records';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;
protected static ?int $navigationSort = 1;

View File

@@ -32,7 +32,7 @@ class DisciplinaryReportForm
->required()
->native(false),
HrForm::fileUpload('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);

View File

@@ -13,7 +13,7 @@ class DisciplinaryReportInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('report_date')
->date(),
TextEntry::make('title'),

View File

@@ -23,7 +23,7 @@ class DisciplinaryReportsTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('report_date')
@@ -39,12 +39,12 @@ class DisciplinaryReportsTable
->searchable()
->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'))
->sortable()
->toggleable(),
TextColumn::make('created_at')

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\EmployeeDocuments;
use App\Enums\NavigationGroup;
use App\Filament\Resources\EmployeeDocuments\Pages\CreateEmployeeDocument;
use App\Filament\Resources\EmployeeDocuments\Pages\EditEmployeeDocument;
use App\Filament\Resources\EmployeeDocuments\Pages\ListEmployeeDocuments;
@@ -27,7 +28,7 @@ class EmployeeDocumentResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocument;
protected static string | UnitEnum | null $navigationGroup = 'Records';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;
protected static ?int $navigationSort = 5;

View File

@@ -23,7 +23,7 @@ class EmployeeDocumentForm
->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),

View File

@@ -13,7 +13,7 @@ class EmployeeDocumentInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('document_type')
->badge(),
TextEntry::make('title'),

View File

@@ -24,11 +24,11 @@ class EmployeeDocumentsTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
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())
@@ -56,13 +56,13 @@ class EmployeeDocumentsTable
])
->filters([
SelectFilter::make('document_type')
->label('Type')
->label(__('hr.fields.type'))
->options(DocumentType::class),
TrashedFilter::make(),
])
->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

@@ -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'),

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Explanations;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Explanations\Pages\CreateExplanation;
use App\Filament\Resources\Explanations\Pages\EditExplanation;
use App\Filament\Resources\Explanations\Pages\ListExplanations;
@@ -27,7 +28,7 @@ class ExplanationResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentText;
protected static string | UnitEnum | null $navigationGroup = 'Records';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;
protected static ?int $navigationSort = 2;

View File

@@ -26,7 +26,7 @@ class ExplanationForm
->rows(4)
->columnSpanFull(),
HrForm::fileUpload('attachment_path')
->label('Attachment')
->label(__('hr.fields.attachment'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);

View File

@@ -13,7 +13,7 @@ class ExplanationInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('explanation_date')
->date(),
TextEntry::make('reason'),

View File

@@ -20,7 +20,7 @@ class ExplanationsTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('explanation_date')
@@ -33,7 +33,7 @@ class ExplanationsTable
->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

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Gifts;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Gifts\Pages\CreateGift;
use App\Filament\Resources\Gifts\Pages\EditGift;
use App\Filament\Resources\Gifts\Pages\ListGifts;
@@ -27,7 +28,7 @@ class GiftResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedGift;
protected static string | UnitEnum | null $navigationGroup = 'Records';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Records;
protected static ?int $navigationSort = 4;

View File

@@ -19,7 +19,7 @@ class GiftForm
->required()
->default(now()),
TextInput::make('gift_name')
->label('Gift Name')
->label(__('hr.fields.gift_name'))
->required()
->maxLength(255),
TextInput::make('value')

View File

@@ -13,7 +13,7 @@ class GiftInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('gift_date')
->date(),
TextEntry::make('gift_name'),

View File

@@ -19,14 +19,14 @@ class GiftsTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('gift_date')
->date()
->sortable(),
TextColumn::make('gift_name')
->label('Gift')
->label(__('hr.fields.gift'))
->searchable()
->sortable(),
TextColumn::make('value')

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Positions;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Positions\Pages\CreatePosition;
use App\Filament\Resources\Positions\Pages\EditPosition;
use App\Filament\Resources\Positions\Pages\ListPositions;
@@ -27,7 +28,7 @@ class PositionResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBriefcase;
protected static string | UnitEnum | null $navigationGroup = 'Organization';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Organization;
protected static ?int $navigationSort = 2;

View File

@@ -22,18 +22,18 @@ class ShiftForm
->maxLength(50)
->unique(ignoreRecord: true),
TimePicker::make('starts_at')
->label('Starts at')
->label(__('hr.fields.starts_at'))
->required()
->seconds(false),
TimePicker::make('ends_at')
->label('Ends at')
->label(__('hr.fields.ends_at'))
->required()
->seconds(false),
Textarea::make('description')
->rows(3)
->columnSpanFull(),
Toggle::make('is_active')
->label('Active')
->label(__('hr.fields.active'))
->default(true)
->required(),
]);

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Shifts;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Shifts\Pages\CreateShift;
use App\Filament\Resources\Shifts\Pages\EditShift;
use App\Filament\Resources\Shifts\Pages\ListShifts;
@@ -27,7 +28,7 @@ class ShiftResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClock;
protected static string | UnitEnum | null $navigationGroup = 'Organization';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::Organization;
protected static ?int $navigationSort = 3;

View File

@@ -26,20 +26,20 @@ class ShiftsTable
->searchable()
->sortable(),
TextColumn::make('starts_at')
->label('Starts')
->label(__('hr.fields.starts'))
->time()
->sortable(),
TextColumn::make('ends_at')
->label('Ends')
->label(__('hr.fields.ends'))
->time()
->sortable(),
TextColumn::make('description')
->limit(50)
->toggleable(),
TextColumn::make('is_active')
->label('Status')
->label(__('hr.fields.status'))
->badge()
->formatStateUsing(fn (bool $state): string => $state ? 'Active' : 'Inactive')
->formatStateUsing(fn (bool $state): string => $state ? __('enums.employment_status.active') : __('enums.employment_status.inactive'))
->color(fn (bool $state): string => $state ? 'success' : 'danger')
->sortable(),
TextColumn::make('created_at')
@@ -57,10 +57,10 @@ class ShiftsTable
])
->filters([
TernaryFilter::make('is_active')
->label('Status')
->placeholder('All shifts')
->trueLabel('Active')
->falseLabel('Inactive'),
->label(__('hr.fields.status'))
->placeholder(__('hr.filters.all_shifts'))
->trueLabel(__('enums.employment_status.active'))
->falseLabel(__('enums.employment_status.inactive')),
TrashedFilter::make(),
])
->recordActions([

View File

@@ -14,8 +14,8 @@ class SickLeaveForm
return $schema
->components([
HrForm::employeeSelect(),
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),
@@ -23,7 +23,7 @@ class SickLeaveForm
->rows(3)
->columnSpanFull(),
HrForm::fileUpload('document_path')
->label('Medical Document')
->label(__('hr.fields.medical_document'))
->acceptedFileTypes(['application/pdf', 'image/*'])
->maxSize(10240),
]);

View File

@@ -13,7 +13,7 @@ class SickLeaveInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('start_date')
->date(),
TextEntry::make('end_date')

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\SickLeaves;
use App\Enums\NavigationGroup;
use App\Filament\Resources\SickLeaves\Pages\CreateSickLeave;
use App\Filament\Resources\SickLeaves\Pages\EditSickLeave;
use App\Filament\Resources\SickLeaves\Pages\ListSickLeaves;
@@ -27,7 +28,7 @@ class SickLeaveResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedHeart;
protected static string | UnitEnum | null $navigationGroup = 'Leave Management';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::LeaveManagement;
protected static ?int $navigationSort = 2;

View File

@@ -20,7 +20,7 @@ class SickLeavesTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('start_date')
@@ -36,7 +36,7 @@ class SickLeavesTable
->searchable()
->toggleable(),
IconColumn::make('document_path')
->label('Document')
->label(__('hr.fields.document'))
->boolean()
->trueIcon('heroicon-o-document-check')
->falseIcon('heroicon-o-document')

View File

@@ -13,8 +13,8 @@ class UnpaidLeaveForm
return $schema
->components([
HrForm::employeeSelect(),
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)

View File

@@ -13,7 +13,7 @@ class UnpaidLeaveInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('start_date')
->date(),
TextEntry::make('end_date')

View File

@@ -28,7 +28,7 @@ class UnpaidLeavesTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('start_date')
@@ -47,7 +47,7 @@ class UnpaidLeavesTable
->searchable()
->sortable(),
TextColumn::make('approver.name')
->label('Approved By')
->label(__('hr.fields.approved_by'))
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('approved_at')
->dateTime()
@@ -70,12 +70,12 @@ class UnpaidLeavesTable
SelectFilter::make('status')
->options(ApprovalStatus::class),
Filter::make('date_range')
->label('Date Range')
->label(__('hr.fields.date_range'))
->schema([
DatePicker::make('start_from')
->label('Start from'),
->label(__('hr.fields.start_from')),
DatePicker::make('start_until')
->label('Start until'),
->label(__('hr.fields.start_until')),
])
->query(function (Builder $query, array $data): Builder {
return $query
@@ -92,7 +92,7 @@ class UnpaidLeavesTable
])
->recordActions([
Action::make('approve')
->label('Approve')
->label(__('hr.actions.approve'))
->icon('heroicon-o-check-badge')
->color('success')
->requiresConfirmation()
@@ -101,7 +101,7 @@ class UnpaidLeavesTable
$unpaidLeaveService->approve($record, Auth::user());
}),
Action::make('reject')
->label('Reject')
->label(__('hr.actions.reject'))
->icon('heroicon-o-x-mark')
->color('danger')
->requiresConfirmation()

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\UnpaidLeaves;
use App\Enums\NavigationGroup;
use App\Filament\Resources\UnpaidLeaves\Pages\CreateUnpaidLeave;
use App\Filament\Resources\UnpaidLeaves\Pages\EditUnpaidLeave;
use App\Filament\Resources\UnpaidLeaves\Pages\ListUnpaidLeaves;
@@ -27,7 +28,7 @@ class UnpaidLeaveResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;
protected static string | UnitEnum | null $navigationGroup = 'Leave Management';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::LeaveManagement;
protected static ?int $navigationSort = 3;

View File

@@ -19,7 +19,7 @@ class UserForm
->required()
->maxLength(255),
TextInput::make('email')
->label('Email address')
->label(__('hr.fields.email_address'))
->email()
->required()
->maxLength(255)
@@ -34,7 +34,14 @@ class UserForm
->relationship('department', 'name')
->searchable()
->preload()
->label('Department (for managers)'),
->label(__('hr.fields.department_for_managers')),
Select::make('locale')
->label(__('hr.fields.locale'))
->options(collect(config('hr.supported_locales'))
->mapWithKeys(fn (string $locale): array => [$locale => config('hr.locale_labels')[$locale]])
->all())
->required()
->default(config('hr.default_locale')),
Select::make('roles')
->relationship('roles', 'name')
->multiple()

View File

@@ -13,7 +13,7 @@ class UserInfolist
->components([
TextEntry::make('name'),
TextEntry::make('email')
->label('Email address'),
->label(__('hr.fields.email_address')),
TextEntry::make('email_verified_at')
->dateTime()
->placeholder('-'),
@@ -24,7 +24,7 @@ class UserInfolist
->dateTime()
->placeholder('-'),
TextEntry::make('department.name')
->label('Department')
->label(__('hr.fields.department'))
->placeholder('-'),
]);
}

View File

@@ -18,7 +18,7 @@ class UsersTable
TextColumn::make('name')
->searchable(),
TextColumn::make('email')
->label('Email address')
->label(__('hr.fields.email_address'))
->searchable(),
TextColumn::make('email_verified_at')
->dateTime()

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Users;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Users\Pages\CreateUser;
use App\Filament\Resources\Users\Pages\EditUser;
use App\Filament\Resources\Users\Pages\ListUsers;
@@ -17,6 +18,7 @@ use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class UserResource extends Resource
{
@@ -24,7 +26,7 @@ class UserResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
protected static string|\UnitEnum|null $navigationGroup = 'System';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::System;
protected static ?int $navigationSort = 2;

View File

@@ -20,16 +20,16 @@ class VacationForm
->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),
]);

View File

@@ -13,7 +13,7 @@ class VacationInfolist
return $schema
->components([
TextEntry::make('employee.id')
->label('Employee'),
->label(__('hr.fields.employee')),
TextEntry::make('type')
->badge(),
TextEntry::make('start_date')

View File

@@ -30,7 +30,7 @@ class VacationsTable
return $table
->columns([
TextColumn::make('employee.full_name')
->label('Employee')
->label(__('hr.fields.employee'))
->searchable()
->sortable(),
TextColumn::make('type')
@@ -55,7 +55,7 @@ class VacationsTable
->searchable()
->sortable(),
TextColumn::make('approver.name')
->label('Approved By')
->label(__('hr.fields.approved_by'))
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('approved_at')
->dateTime()
@@ -80,12 +80,12 @@ class VacationsTable
SelectFilter::make('type')
->options(VacationType::class),
Filter::make('date_range')
->label('Date Range')
->label(__('hr.fields.date_range'))
->schema([
DatePicker::make('start_from')
->label('Start from'),
->label(__('hr.fields.start_from')),
DatePicker::make('start_until')
->label('Start until'),
->label(__('hr.fields.start_until')),
])
->query(function (Builder $query, array $data): Builder {
return $query
@@ -102,7 +102,7 @@ class VacationsTable
])
->recordActions([
Action::make('approve')
->label('Approve')
->label(__('hr.actions.approve'))
->icon('heroicon-o-check-badge')
->color('success')
->requiresConfirmation()
@@ -111,7 +111,7 @@ class VacationsTable
$vacationService->approve($record, Auth::user());
}),
Action::make('reject')
->label('Reject')
->label(__('hr.actions.reject'))
->icon('heroicon-o-x-mark')
->color('danger')
->requiresConfirmation()

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\Vacations;
use App\Enums\NavigationGroup;
use App\Filament\Resources\Vacations\Pages\CreateVacation;
use App\Filament\Resources\Vacations\Pages\EditVacation;
use App\Filament\Resources\Vacations\Pages\ListVacations;
@@ -27,7 +28,7 @@ class VacationResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSun;
protected static string | UnitEnum | null $navigationGroup = 'Leave Management';
protected static string|UnitEnum|null $navigationGroup = NavigationGroup::LeaveManagement;
protected static ?int $navigationSort = 1;

View File

@@ -18,7 +18,7 @@ class ExportExcelAction
public static function make(string $name, string $exportClass, string $filename): Action
{
return Action::make($name)
->label('Export')
->label(__('hr.actions.export'))
->icon('heroicon-o-arrow-down-tray')
->action(fn (): BinaryFileResponse => Excel::download(new $exportClass, $filename));
}
@@ -29,7 +29,7 @@ class ExportExcelAction
public static function bulk(string $name, string $exportClass, string $filename): BulkAction
{
return BulkAction::make($name)
->label('Export Selected')
->label(__('hr.actions.export_selected'))
->icon('heroicon-o-arrow-down-tray')
->action(function (Collection $records) use ($exportClass, $filename): BinaryFileResponse {
$ids = $records->pluck('id')->all();

View File

@@ -15,7 +15,7 @@ class ExportPdfAction
public static function employeeProfile(): Action
{
return Action::make('exportPdf')
->label('Export PDF')
->label(__('hr.actions.export_pdf'))
->icon('heroicon-o-document-arrow-down')
->action(fn (Employee $record, PdfExportService $pdf) => $pdf->employeeProfile($record));
}
@@ -23,7 +23,7 @@ class ExportPdfAction
public static function employeeLeaveSummary(): Action
{
return Action::make('exportLeavePdf')
->label('Leave Summary PDF')
->label(__('hr.actions.leave_summary_pdf'))
->icon('heroicon-o-document-text')
->action(fn (Employee $record, PdfExportService $pdf) => $pdf->leaveSummary($record));
}
@@ -31,7 +31,7 @@ class ExportPdfAction
public static function employeeList(): Action
{
return Action::make('exportPdf')
->label('Export PDF')
->label(__('hr.actions.export_pdf'))
->icon('heroicon-o-document-arrow-down')
->action(fn (PdfExportService $pdf) => $pdf->employeeList(
Employee::query()->with(['department', 'position', 'shift'])->orderBy('full_name')->get()
@@ -41,7 +41,7 @@ class ExportPdfAction
public static function employeeListBulk(): BulkAction
{
return BulkAction::make('exportPdf')
->label('Export PDF')
->label(__('hr.actions.export_pdf'))
->icon('heroicon-o-document-arrow-down')
->action(fn (Collection $records, PdfExportService $pdf) => $pdf->employeeList(
Employee::query()

View File

@@ -35,7 +35,7 @@ class HrForm
public static function leaveDaysDisplay(): TextInput
{
return TextInput::make('days')
->label('Days')
->label(__('hr.fields.days'))
->numeric()
->disabled()
->dehydrated(false)

View File

@@ -9,10 +9,13 @@ use Filament\Widgets\ChartWidget;
class DepartmentDistributionChart extends ChartWidget
{
protected ?string $heading = 'Employees by Department';
protected int | string | array $columnSpan = 1;
public function getHeading(): ?string
{
return __('hr.widgets.employees_by_department');
}
protected function getType(): string
{
return 'doughnut';
@@ -28,7 +31,7 @@ class DepartmentDistributionChart extends ChartWidget
return [
'datasets' => [
[
'label' => 'Employees',
'label' => __('hr.widgets.employees'),
'data' => $departments->pluck('employees_count')->all(),
'backgroundColor' => [
'#3b82f6',

View File

@@ -14,7 +14,10 @@ use Filament\Widgets\StatsOverviewWidget\Stat;
class HrStatsOverviewWidget extends StatsOverviewWidget
{
protected ?string $heading = 'HR Overview';
public function getHeading(): ?string
{
return __('hr.widgets.hr_overview');
}
protected function getStats(): array
{
@@ -36,28 +39,28 @@ class HrStatsOverviewWidget extends StatsOverviewWidget
->count();
return [
Stat::make('Total Employees', Employee::query()->count())
->description('All employees in the system')
Stat::make(__('hr.stats.total_employees'), Employee::query()->count())
->description(__('hr.stats.total_employees_desc'))
->descriptionIcon('heroicon-o-users')
->color('primary'),
Stat::make('Active', Employee::query()->where('employment_status', EmploymentStatus::Active)->count())
->description('Currently active employees')
Stat::make(__('hr.stats.active'), Employee::query()->where('employment_status', EmploymentStatus::Active)->count())
->description(__('hr.stats.active_desc'))
->descriptionIcon('heroicon-o-check-circle')
->color('success'),
Stat::make('Inactive', Employee::query()->where('employment_status', EmploymentStatus::Inactive)->count())
->description('Inactive employees')
Stat::make(__('hr.stats.inactive'), Employee::query()->where('employment_status', EmploymentStatus::Inactive)->count())
->description(__('hr.stats.inactive_desc'))
->descriptionIcon('heroicon-o-pause-circle')
->color('gray'),
Stat::make('On Vacation Today', $onVacationToday)
->description('Approved vacations in progress')
Stat::make(__('hr.stats.on_vacation_today'), $onVacationToday)
->description(__('hr.stats.on_vacation_today_desc'))
->descriptionIcon('heroicon-o-sun')
->color('warning'),
Stat::make('On Sick Leave Today', $onSickLeaveToday)
->description('Employees on sick leave')
Stat::make(__('hr.stats.on_sick_leave_today'), $onSickLeaveToday)
->description(__('hr.stats.on_sick_leave_today_desc'))
->descriptionIcon('heroicon-o-heart')
->color('danger'),
Stat::make('Pending Requests', $pendingRequests)
->description('Vacation requests awaiting approval')
Stat::make(__('hr.stats.pending_requests'), $pendingRequests)
->description(__('hr.stats.pending_requests_desc'))
->descriptionIcon('heroicon-o-clock')
->color('info'),
];

View File

@@ -6,12 +6,16 @@ namespace App\Filament\Widgets;
use App\Models\Employee;
use Filament\Widgets\ChartWidget;
class MonthlyHiringChart extends ChartWidget
{
protected ?string $heading = 'Monthly Hiring (Last 12 Months)';
protected int | string | array $columnSpan = 1;
public function getHeading(): ?string
{
return __('hr.widgets.monthly_hiring');
}
protected function getType(): string
{
return 'bar';
@@ -35,7 +39,7 @@ class MonthlyHiringChart extends ChartWidget
return [
'datasets' => [
[
'label' => 'New Hires',
'label' => __('hr.widgets.new_hires'),
'data' => $data,
'backgroundColor' => '#3b82f6',
],

View File

@@ -10,10 +10,13 @@ use Filament\Widgets\ChartWidget;
class MonthlyLeaveChart extends ChartWidget
{
protected ?string $heading = 'Vacation Days by Month';
protected int | string | array $columnSpan = 1;
public function getHeading(): ?string
{
return __('hr.widgets.vacation_days_by_month');
}
protected function getType(): string
{
return 'bar';
@@ -37,7 +40,7 @@ class MonthlyLeaveChart extends ChartWidget
return [
'datasets' => [
[
'label' => 'Vacation Days',
'label' => __('hr.widgets.vacation_days'),
'data' => $data,
'backgroundColor' => '#f59e0b',
],

View File

@@ -13,10 +13,13 @@ use Illuminate\Database\Eloquent\Builder;
class RecentReportsWidget extends TableWidget
{
protected static ?string $heading = 'Recent Disciplinary Reports';
protected int | string | array $columnSpan = 'full';
public function getHeading(): ?string
{
return __('hr.widgets.recent_disciplinary_reports');
}
public function table(Table $table): Table
{
return $table
@@ -28,7 +31,7 @@ class RecentReportsWidget extends TableWidget
)
->columns([
TextColumn::make('employee.full_name')
->label('Employee'),
->label(__('hr.fields.employee')),
TextColumn::make('report_date')
->date(),
TextColumn::make('title')
@@ -38,7 +41,7 @@ class RecentReportsWidget extends TableWidget
->color(fn (DisciplinarySeverity $state): string => $state->color())
->formatStateUsing(fn (DisciplinarySeverity $state): string => $state->label()),
TextColumn::make('creator.name')
->label('Created By'),
->label(__('hr.fields.created_by')),
])
->paginated(false);
}

View File

@@ -11,10 +11,13 @@ use Filament\Widgets\TableWidget;
use Illuminate\Database\Eloquent\Builder;
class UpcomingBirthdaysWidget extends TableWidget
{
protected static ?string $heading = 'Upcoming Birthdays (30 Days)';
protected int | string | array $columnSpan = 1;
public function getHeading(): ?string
{
return __('hr.widgets.upcoming_birthdays');
}
public function table(Table $table): Table
{
return $table
@@ -25,13 +28,13 @@ class UpcomingBirthdaysWidget extends TableWidget
)
->columns([
TextColumn::make('full_name')
->label('Employee'),
->label(__('hr.fields.employee')),
TextColumn::make('birth_date')
->label('Birthday')
->label(__('hr.fields.birthday'))
->date()
->formatStateUsing(fn (Employee $record): string => $record->birth_date?->format('M d') ?? '—'),
TextColumn::make('department.name')
->label('Department'),
->label(__('hr.fields.department')),
])
->paginated(false);
}

View File

@@ -13,10 +13,13 @@ use Illuminate\Database\Eloquent\Builder;
class UpcomingLeaveWidget extends TableWidget
{
protected static ?string $heading = 'Upcoming Approved Leave (14 Days)';
protected int | string | array $columnSpan = 1;
public function getHeading(): ?string
{
return __('hr.widgets.upcoming_leave');
}
public function table(Table $table): Table
{
return $table
@@ -30,13 +33,13 @@ class UpcomingLeaveWidget extends TableWidget
)
->columns([
TextColumn::make('employee.full_name')
->label('Employee'),
->label(__('hr.fields.employee')),
TextColumn::make('start_date')
->date(),
TextColumn::make('end_date')
->date(),
TextColumn::make('days')
->label('Days'),
->label(__('hr.fields.days')),
])
->paginated(false);
}