Files
autocrm/app/Filament/Tenant/Widgets/StatsOverview.php
T
Vasyka f7fc69077b feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods
- Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args
- Wrap Section::make()/Fieldset::make()/Notification::make()->title() args
- Fix RelationManagers::getTitle() signature to match parent (Model, string)
- Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static)
- Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest
- Remove duplicate getters in 5 resources that had manual getModelLabel already

All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-15 05:04:24 +00:00

51 lines
1.6 KiB
PHP

<?php
namespace App\Filament\Tenant\Widgets;
use App\Models\Tenant\Appointment;
use App\Models\Tenant\Client;
use App\Models\Tenant\Deal;
use App\Models\Tenant\Lead;
use App\Models\Tenant\Vehicle;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
class StatsOverview extends BaseWidget
{
protected static ?int $sort = 1;
protected function getStats(): array
{
$newLeads = Lead::where('status', 'new')->count();
$openDeals = Deal::whereNotIn('stage', ['done', 'lost'])->count();
$todayAppointments = Appointment::whereDate('date', today())->count();
return [
Stat::make('Clienți', Client::count())
->description(__('Total în baza de date'))
->icon('heroicon-o-users')
->color('primary'),
Stat::make('Mașini', Vehicle::count())
->description(__('Total înregistrate'))
->icon('heroicon-o-truck')
->color('info'),
Stat::make('Cereri noi', $newLeads)
->description(__('De procesat'))
->icon('heroicon-o-inbox-arrow-down')
->color($newLeads > 0 ? 'warning' : 'success'),
Stat::make('Deal-uri active', $openDeals)
->description(__('În pipeline'))
->icon('heroicon-o-funnel')
->color('primary'),
Stat::make('Programări azi', $todayAppointments)
->description(today()->format('d.m.Y'))
->icon('heroicon-o-calendar')
->color('success'),
];
}
}