translate base
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user