Files
autocrm/app/Filament/Tenant/Widgets/StatsOverview.php
T
Vasyka 2d447e6294 feat(i18n): fix widgets, pipeline & mechanic boards + missing translations
Follow-up to previous i18n pass — user reported many visible RO strings on
EN/RU locales because auto-wrap missed:
  - Stat::make() first-arg labels in StatsOverview, FinanceOverview, PlatformStats
  - $heading static in LowStockTable (converted to getHeading() method)
  - Pipeline board Blade view: 40+ literal strings wrapped with {{ __() }}
  - Mechanic board Blade view: statuses, buttons, block modal
  - PipelineBoard.php hardcoded tag labels, stage labels, notify strings
  - MechanicBoard.php confirmBlock notification

Added human RU + EN translations for the visible strings shown in the
screenshots (dashboard widgets, Client/Vehicle list breadcrumbs & columns,
pipeline board topbar/stats/filters/cards/detail panel/quick actions,
mechanic board stats/statuses/block modal). All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-15 05:31:26 +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'),
];
}
}