6e7c665433
Every card on the tenant main dashboard now links to a relevant page:
Operations widget (was 5 cards, now 7):
- Clienți → /app/clients
- Mașini → /app/vehicles
- Cereri noi → /app/leads pre-filtered by status=new
- Deal-uri active → /app/deals
- Programări azi → /app/calendar-board
- NEW: Fișe în lucru (in_work + awaiting_parts) → /app/work-orders filter
- NEW: Fișe gata predare (ready) → /app/work-orders filter
Finance widget (all 4 cards clickable now):
- Încasări → /app/payments
- Cheltuieli → /app/expenses
- Profit → /app/reports (with "Vezi raportul financiar" hint)
- Datorii → /app/work-orders pre-filtered by pay_status=unpaid
LowStockTable rows now navigate to /app/parts/{id}/edit on click and
have an explicit edit action for touch users.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
71 lines
2.7 KiB
PHP
71 lines
2.7 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 App\Models\Tenant\WorkOrder;
|
|
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();
|
|
$activeWos = WorkOrder::whereIn('status', ['in_work', 'awaiting_parts'])->count();
|
|
$readyWos = WorkOrder::where('status', 'ready')->count();
|
|
|
|
return [
|
|
Stat::make(__('Clienți'), Client::count())
|
|
->description(__('Total în baza de date'))
|
|
->icon('heroicon-o-users')
|
|
->color('primary')
|
|
->url(url('/app/clients')),
|
|
|
|
Stat::make(__('Mașini'), Vehicle::count())
|
|
->description(__('Total înregistrate'))
|
|
->icon('heroicon-o-truck')
|
|
->color('info')
|
|
->url(url('/app/vehicles')),
|
|
|
|
Stat::make(__('Cereri noi'), $newLeads)
|
|
->description(__('De procesat'))
|
|
->icon('heroicon-o-inbox-arrow-down')
|
|
->color($newLeads > 0 ? 'warning' : 'success')
|
|
->url(url('/app/leads') . '?tableFilters[status][value]=new'),
|
|
|
|
Stat::make(__('Deal-uri active'), $openDeals)
|
|
->description(__('În pipeline'))
|
|
->icon('heroicon-o-funnel')
|
|
->color('primary')
|
|
->url(url('/app/deals')),
|
|
|
|
Stat::make(__('Programări azi'), $todayAppointments)
|
|
->description(today()->format('d.m.Y'))
|
|
->icon('heroicon-o-calendar')
|
|
->color('success')
|
|
->url(url('/app/calendar-board')),
|
|
|
|
Stat::make(__('Fișe în lucru'), $activeWos)
|
|
->description(__('În serviciu sau așteaptă piese'))
|
|
->icon('heroicon-o-wrench-screwdriver')
|
|
->color($activeWos > 0 ? 'primary' : 'success')
|
|
->url(url('/app/work-orders') . '?tableFilters[status][value]=in_work'),
|
|
|
|
Stat::make(__('Fișe gata predare'), $readyWos)
|
|
->description(__('Așteaptă client'))
|
|
->icon('heroicon-o-check-circle')
|
|
->color($readyWos > 0 ? 'success' : 'gray')
|
|
->url(url('/app/work-orders') . '?tableFilters[status][value]=ready'),
|
|
];
|
|
}
|
|
}
|