Deploy 1: i18n + Notifications + Global Search + Tests
- SetLocale middleware (ro/ru/en, session-first, user-persisted)
- Lang switcher in topbar (Filament render hook USER_MENU_BEFORE)
- POST /locale/{lang} route persists to user.locale + session
- Database notifications enabled on tenant panel (30s polling)
- GlobalSearch (Cmd+K / Ctrl+K) on Client, Vehicle, WorkOrder, Lead, Part
- Tests: TenantIsolation (4), AuthFlow (2), WorkOrderCalc (3), MarkupRule (3)
This commit is contained in:
@@ -26,6 +26,21 @@ class ClientResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['name', 'phone', 'phone_alt', 'email', 'company_name'];
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultDetails(\Illuminate\Database\Eloquent\Model $record): array
|
||||
{
|
||||
return [
|
||||
'Telefon' => $record->phone,
|
||||
'Status' => $record->status,
|
||||
];
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
|
||||
@@ -30,6 +30,19 @@ class LeadResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['name', 'phone', 'email', 'channel'];
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultDetails(\Illuminate\Database\Eloquent\Model $record): array
|
||||
{
|
||||
return [
|
||||
'Telefon' => $record->phone,
|
||||
'Status' => $record->status,
|
||||
];
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
|
||||
@@ -29,6 +29,19 @@ class PartResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 40;
|
||||
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['name', 'sku', 'brand', 'category'];
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultDetails(\Illuminate\Database\Eloquent\Model $record): array
|
||||
{
|
||||
return [
|
||||
'Stoc' => (int) $record->stock . ' ' . ($record->unit ?? 'buc'),
|
||||
'Preț' => number_format((float) $record->sell_price, 2),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
$low = static::getModel()::query()
|
||||
|
||||
@@ -27,6 +27,24 @@ class VehicleResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['plate', 'vin', 'brand', 'model'];
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultTitle(\Illuminate\Database\Eloquent\Model $record): string
|
||||
{
|
||||
return trim(($record->brand ?? '') . ' ' . ($record->model ?? '') . ' — ' . ($record->plate ?? $record->vin ?? '?'));
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultDetails(\Illuminate\Database\Eloquent\Model $record): array
|
||||
{
|
||||
return [
|
||||
'Client' => $record->client?->name ?? '—',
|
||||
'An' => $record->year ?? '—',
|
||||
];
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
|
||||
@@ -34,6 +34,25 @@ class WorkOrderResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 30;
|
||||
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['number', 'description', 'vehicle.plate', 'vehicle.vin', 'client.name', 'client.phone'];
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultTitle(\Illuminate\Database\Eloquent\Model $record): string
|
||||
{
|
||||
return '#' . ($record->number ?? $record->id) . ' · ' . ($record->vehicle?->plate ?? '?');
|
||||
}
|
||||
|
||||
public static function getGlobalSearchResultDetails(\Illuminate\Database\Eloquent\Model $record): array
|
||||
{
|
||||
return [
|
||||
'Client' => $record->client?->name ?? '—',
|
||||
'Status' => $record->status,
|
||||
'Total' => number_format((float) $record->total, 2),
|
||||
];
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
|
||||
Reference in New Issue
Block a user