Files
autocrm/app/Filament/Tenant/Pages/VinSearch.php
T
Vasyka 4b3201ca1c Batch 2: Workload heatmap + Site PSauto + VIN search
═══ Workload heatmap (Încărcare STO) ═══
- /app/workload custom Page (group Analiză)
- Săptămână (Lu-Du) × posturi → matrice ore programate
- Heatmap colorat: verde→galben→roșu pe ratio capacity (10h/zi)
- Navigare săpt anterior/curent/următor
- Programări fără pod → row '— fără pod —' separat

═══ Site PSauto (landing public) ═══
- / pe tenant subdomain → resources/views/site/landing.blade.php
- Hero cu logo + nume + slogan; gradient theme color
- Servicii (din settings.services) — grid card-uri
- Locație/contact + program lucru standardizat
- Mărci suportate (din settings.cars)
- CTA: phone + email
- Footer cu tenant name + powered by AutoCRM

═══ VIN search ═══
- VinDecoder service: WMI hardcoded (24 producători EU/Asia/USA)
  + year codes (2001-2026) — pure offline, fără API extern
- /app/vin-search Page (group Depozit) cu:
  • Input VIN cu uppercase + monospace
  • Decode → producător/țară/an/serial
  • Match VIN-uri din baza Vehicles
  • Search piese din catalog (live debounce 300ms)
- Rezultatele linkează la editor Vehicle/Part

Total tenant routes: 102.
2026-05-07 17:16:09 +00:00

57 lines
1.5 KiB
PHP

<?php
namespace App\Filament\Tenant\Pages;
use App\Models\Tenant\Part;
use App\Models\Tenant\Vehicle;
use App\Services\VinDecoder;
use Filament\Pages\Page;
class VinSearch extends Page
{
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-magnifying-glass';
protected static ?string $navigationLabel = 'VIN-căutare';
protected static string|\UnitEnum|null $navigationGroup = 'Depozit';
protected static ?int $navigationSort = 41;
protected static ?string $title = 'VIN căutare & piese';
protected string $view = 'filament.tenant.pages.vin-search';
public string $vin = '';
public ?array $decoded = null;
public string $partsQuery = '';
public function decode(): void
{
if (! $this->vin) return;
$this->decoded = app(VinDecoder::class)->decode($this->vin);
}
public function vehicleMatches(): \Illuminate\Support\Collection
{
if (! $this->vin) return collect();
return Vehicle::with('client')
->where('vin', 'like', '%' . $this->vin . '%')
->limit(10)->get();
}
public function partsResults(): \Illuminate\Support\Collection
{
$q = trim($this->partsQuery);
if ($q === '') return collect();
return Part::where('is_active', true)
->where(function ($query) use ($q) {
$query->where('name', 'like', "%{$q}%")
->orWhere('article', 'like', "%{$q}%")
->orWhere('brand', 'like', "%{$q}%");
})
->limit(20)->get();
}
}