translate base
This commit is contained in:
@@ -13,9 +13,9 @@ enum ApprovalStatus: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Pending => 'Pending',
|
||||
self::Approved => 'Approved',
|
||||
self::Rejected => 'Rejected',
|
||||
self::Pending => __('enums.approval_status.pending'),
|
||||
self::Approved => __('enums.approval_status.approved'),
|
||||
self::Rejected => __('enums.approval_status.rejected'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ enum BonusType: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Performance => 'Performance',
|
||||
self::Holiday => 'Holiday',
|
||||
self::Retention => 'Retention',
|
||||
self::Other => 'Other',
|
||||
self::Performance => __('enums.bonus_type.performance'),
|
||||
self::Holiday => __('enums.bonus_type.holiday'),
|
||||
self::Retention => __('enums.bonus_type.retention'),
|
||||
self::Other => __('enums.bonus_type.other'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ enum DisciplinarySeverity: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Low => 'Low',
|
||||
self::Medium => 'Medium',
|
||||
self::High => 'High',
|
||||
self::Low => __('enums.disciplinary_severity.low'),
|
||||
self::Medium => __('enums.disciplinary_severity.medium'),
|
||||
self::High => __('enums.disciplinary_severity.high'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ enum DocumentType: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Passport => 'Passport',
|
||||
self::Contract => 'Contract',
|
||||
self::MedicalCertificate => 'Medical Certificate',
|
||||
self::EducationCertificate => 'Education Certificate',
|
||||
self::Other => 'Other',
|
||||
self::Passport => __('enums.document_type.passport'),
|
||||
self::Contract => __('enums.document_type.contract'),
|
||||
self::MedicalCertificate => __('enums.document_type.medical_certificate'),
|
||||
self::EducationCertificate => __('enums.document_type.education_certificate'),
|
||||
self::Other => __('enums.document_type.other'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ enum EmploymentStatus: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Active => 'Active',
|
||||
self::Inactive => 'Inactive',
|
||||
self::Terminated => 'Terminated',
|
||||
self::OnLeave => 'On Leave',
|
||||
self::Active => __('enums.employment_status.active'),
|
||||
self::Inactive => __('enums.employment_status.inactive'),
|
||||
self::Terminated => __('enums.employment_status.terminated'),
|
||||
self::OnLeave => __('enums.employment_status.on_leave'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ enum Gender: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Male => 'Male',
|
||||
self::Female => 'Female',
|
||||
self::Other => 'Other',
|
||||
self::Male => __('enums.gender.male'),
|
||||
self::Female => __('enums.gender.female'),
|
||||
self::Other => __('enums.gender.other'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ enum ImportType: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Employees => 'Employees',
|
||||
self::Vacations => 'Vacations',
|
||||
self::Bonuses => 'Bonuses',
|
||||
self::Reports => 'Disciplinary Reports',
|
||||
self::Employees => __('enums.import_type.employees'),
|
||||
self::Vacations => __('enums.import_type.vacations'),
|
||||
self::Bonuses => __('enums.import_type.bonuses'),
|
||||
self::Reports => __('enums.import_type.reports'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,43 +28,43 @@ enum ImportType: string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Employees => [
|
||||
'employee_number' => 'Employee Number',
|
||||
'full_name' => 'Full Name',
|
||||
'national_id' => 'National ID',
|
||||
'gender' => 'Gender',
|
||||
'birth_date' => 'Birth Date',
|
||||
'phone' => 'Phone',
|
||||
'address' => 'Address',
|
||||
'department' => 'Department',
|
||||
'position' => 'Position',
|
||||
'shift' => 'Shift',
|
||||
'employment_status' => 'Employment Status',
|
||||
'hire_date' => 'Hire Date',
|
||||
'notes' => 'Notes',
|
||||
'employee_number' => __('hr.fields.employee_number'),
|
||||
'full_name' => __('hr.fields.full_name'),
|
||||
'national_id' => __('hr.fields.national_id'),
|
||||
'gender' => __('hr.fields.gender'),
|
||||
'birth_date' => __('hr.fields.birth_date'),
|
||||
'phone' => __('hr.fields.phone'),
|
||||
'address' => __('hr.fields.address'),
|
||||
'department' => __('hr.fields.department'),
|
||||
'position' => __('hr.fields.position'),
|
||||
'shift' => __('hr.fields.shift'),
|
||||
'employment_status' => __('hr.fields.employment_status'),
|
||||
'hire_date' => __('hr.fields.hire_date'),
|
||||
'notes' => __('hr.fields.notes'),
|
||||
],
|
||||
self::Vacations => [
|
||||
'employee_number' => 'Employee Number',
|
||||
'type' => 'Type',
|
||||
'start_date' => 'Start Date',
|
||||
'end_date' => 'End Date',
|
||||
'return_date' => 'Return Date',
|
||||
'days' => 'Days',
|
||||
'status' => 'Status',
|
||||
'reason' => 'Reason',
|
||||
'employee_number' => __('hr.fields.employee_number'),
|
||||
'type' => __('hr.fields.type'),
|
||||
'start_date' => __('hr.fields.start_date'),
|
||||
'end_date' => __('hr.fields.end_date'),
|
||||
'return_date' => __('hr.fields.return_date'),
|
||||
'days' => __('hr.fields.days'),
|
||||
'status' => __('hr.fields.status'),
|
||||
'reason' => __('hr.fields.reason'),
|
||||
],
|
||||
self::Bonuses => [
|
||||
'employee_number' => 'Employee Number',
|
||||
'bonus_date' => 'Bonus Date',
|
||||
'bonus_type' => 'Bonus Type',
|
||||
'amount' => 'Amount',
|
||||
'reason' => 'Reason',
|
||||
'employee_number' => __('hr.fields.employee_number'),
|
||||
'bonus_date' => __('hr.fields.bonus_date'),
|
||||
'bonus_type' => __('hr.fields.bonus_type'),
|
||||
'amount' => __('hr.fields.amount'),
|
||||
'reason' => __('hr.fields.reason'),
|
||||
],
|
||||
self::Reports => [
|
||||
'employee_number' => 'Employee Number',
|
||||
'report_date' => 'Report Date',
|
||||
'title' => 'Title',
|
||||
'description' => 'Description',
|
||||
'severity' => 'Severity',
|
||||
'employee_number' => __('hr.fields.employee_number'),
|
||||
'report_date' => __('hr.fields.report_date'),
|
||||
'title' => __('hr.fields.title'),
|
||||
'description' => __('hr.fields.description'),
|
||||
'severity' => __('hr.fields.severity'),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
21
app/Enums/NavigationGroup.php
Normal file
21
app/Enums/NavigationGroup.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum NavigationGroup: string implements HasLabel
|
||||
{
|
||||
case Organization = 'organization';
|
||||
case Employees = 'employees';
|
||||
case LeaveManagement = 'leave_management';
|
||||
case Records = 'records';
|
||||
case System = 'system';
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return __('hr.navigation.' . $this->value);
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ enum VacationType: string
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Annual => 'Annual',
|
||||
self::Marriage => 'Marriage',
|
||||
self::Study => 'Study',
|
||||
self::Other => 'Other',
|
||||
self::Annual => __('enums.vacation_type.annual'),
|
||||
self::Marriage => __('enums.vacation_type.marriage'),
|
||||
self::Study => __('enums.vacation_type.study'),
|
||||
self::Other => __('enums.vacation_type.other'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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(),
|
||||
])
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class DepartmentForm
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
Toggle::make('is_active')
|
||||
->label('Active')
|
||||
->label(__('hr.fields.active'))
|
||||
->default(true)
|
||||
->required(),
|
||||
]);
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 ?? '—',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
])
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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(),
|
||||
])
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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(),
|
||||
]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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('-'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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'),
|
||||
];
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
#[Fillable(['name', 'email', 'password', 'department_id'])]
|
||||
#[Fillable(['name', 'email', 'password', 'department_id', 'locale'])]
|
||||
#[Hidden(['password', 'remember_token'])]
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
|
||||
@@ -31,11 +31,11 @@ class DisciplinaryReportCreatedNotification extends Notification implements Shou
|
||||
$employee = $this->report->employee;
|
||||
|
||||
return (new MailMessage)
|
||||
->subject('New Disciplinary Report Created')
|
||||
->line("A new disciplinary report has been created for {$employee->full_name}.")
|
||||
->line("Title: {$this->report->title}")
|
||||
->line("Severity: {$this->report->severity->label()}")
|
||||
->line("Date: {$this->report->report_date->toDateString()}");
|
||||
->subject(__('notifications.disciplinary_report_created.subject'))
|
||||
->line(__('notifications.disciplinary_report_created.line_created', ['name' => $employee->full_name]))
|
||||
->line(__('notifications.disciplinary_report_created.title') . ': ' . $this->report->title)
|
||||
->line(__('notifications.disciplinary_report_created.severity') . ': ' . $this->report->severity->label())
|
||||
->line(__('notifications.disciplinary_report_created.date') . ': ' . $this->report->report_date->toDateString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,9 +29,12 @@ class EmployeeTerminatedNotification extends Notification implements ShouldQueue
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject('Employee Terminated')
|
||||
->line("{$this->employee->full_name} ({$this->employee->employee_number}) has been terminated.")
|
||||
->line("Termination date: {$this->employee->termination_date?->toDateString()}");
|
||||
->subject(__('notifications.employee_terminated.subject'))
|
||||
->line(__('notifications.employee_terminated.line_terminated', [
|
||||
'name' => $this->employee->full_name,
|
||||
'number' => $this->employee->employee_number,
|
||||
]))
|
||||
->line(__('notifications.employee_terminated.termination_date') . ': ' . $this->employee->termination_date?->toDateString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,11 +31,11 @@ class VacationApprovedNotification extends Notification implements ShouldQueue
|
||||
$employee = $this->vacation->employee;
|
||||
|
||||
return (new MailMessage)
|
||||
->subject('Vacation Request Approved')
|
||||
->line("The vacation request for {$employee->full_name} has been approved.")
|
||||
->line("Type: {$this->vacation->type->label()}")
|
||||
->line("Dates: {$this->vacation->start_date->toDateString()} to {$this->vacation->end_date->toDateString()}")
|
||||
->line("Days: {$this->vacation->days}");
|
||||
->subject(__('notifications.vacation_approved.subject'))
|
||||
->line(__('notifications.vacation_approved.line_approved', ['name' => $employee->full_name]))
|
||||
->line(__('notifications.vacation_approved.type') . ': ' . $this->vacation->type->label())
|
||||
->line(__('notifications.vacation_approved.dates') . ': ' . $this->vacation->start_date->toDateString() . ' – ' . $this->vacation->end_date->toDateString())
|
||||
->line(__('notifications.vacation_approved.days') . ': ' . $this->vacation->days);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,11 +31,11 @@ class VacationSubmittedNotification extends Notification implements ShouldQueue
|
||||
$employee = $this->vacation->employee;
|
||||
|
||||
return (new MailMessage)
|
||||
->subject('New Vacation Request Submitted')
|
||||
->line("A new vacation request has been submitted for {$employee->full_name}.")
|
||||
->line("Type: {$this->vacation->type->label()}")
|
||||
->line("Dates: {$this->vacation->start_date->toDateString()} to {$this->vacation->end_date->toDateString()}")
|
||||
->line("Days: {$this->vacation->days}");
|
||||
->subject(__('notifications.vacation_submitted.subject'))
|
||||
->line(__('notifications.vacation_submitted.line_submitted', ['name' => $employee->full_name]))
|
||||
->line(__('notifications.vacation_submitted.type') . ': ' . $this->vacation->type->label())
|
||||
->line(__('notifications.vacation_submitted.dates') . ': ' . $this->vacation->start_date->toDateString() . ' – ' . $this->vacation->end_date->toDateString())
|
||||
->line(__('notifications.vacation_submitted.days') . ': ' . $this->vacation->days);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,9 @@ use App\Policies\SickLeavePolicy;
|
||||
use App\Policies\UnpaidLeavePolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use App\Policies\VacationPolicy;
|
||||
use BezhanSalleh\LanguageSwitch\Events\LocaleChanged;
|
||||
use BezhanSalleh\LanguageSwitch\LanguageSwitch;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -72,5 +75,17 @@ class AppServiceProvider extends ServiceProvider
|
||||
UnpaidLeave::observe(UnpaidLeaveObserver::class);
|
||||
DisciplinaryReport::observe(DisciplinaryReportObserver::class);
|
||||
EmployeeDocument::observe(EmployeeDocumentObserver::class);
|
||||
|
||||
LanguageSwitch::configureUsing(function (LanguageSwitch $switch): void {
|
||||
$switch
|
||||
->locales(config('hr.supported_locales'))
|
||||
->labels(config('hr.locale_labels'))
|
||||
->displayLocale('native')
|
||||
->userPreferredLocale(fn () => auth()->user()?->locale);
|
||||
});
|
||||
|
||||
Event::listen(function (LocaleChanged $event): void {
|
||||
auth()->user()?->update(['locale' => $event->locale]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use App\Enums\NavigationGroup;
|
||||
use App\Filament\Pages\Dashboard;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
@@ -28,19 +29,15 @@ class AdminPanelProvider extends PanelProvider
|
||||
->default()
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->viteTheme('resources/css/filament/admin/theme.css')
|
||||
->login()
|
||||
->brandName(config('hr.company_name'))
|
||||
->viteTheme('resources/css/filament/admin/theme.css')
|
||||
->colors([
|
||||
'primary' => Color::Blue,
|
||||
'gray' => Color::Slate,
|
||||
])
|
||||
->navigationGroups([
|
||||
'Organization',
|
||||
'Employees',
|
||||
'Leave Management',
|
||||
'Records',
|
||||
'System',
|
||||
])
|
||||
->navigationGroups(NavigationGroup::class)
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
|
||||
->pages([
|
||||
@@ -50,7 +47,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
->widgets([])
|
||||
->plugins([
|
||||
FilamentShieldPlugin::make()
|
||||
->navigationGroup('System'),
|
||||
->navigationGroup(NavigationGroup::System),
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
|
||||
Reference in New Issue
Block a user