f7fc69077b
- 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>
68 lines
1.7 KiB
PHP
68 lines
1.7 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';
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return __('nav.label.VIN-căutare');
|
|
}
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return __('nav.group.Depozit');
|
|
}
|
|
|
|
protected static ?int $navigationSort = 41;
|
|
|
|
protected static ?string $title = null;
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return __('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();
|
|
}
|
|
}
|