Currency dropdown + logo on login/topbar via brandLogo closure

- Onboarding + Settings: Forms\Components\Select for currency
  (MDL/EUR/USD/RON/UAH/RUB) instead of TextInput
- TenantPanel: brandName/brandLogo/favicon as closures resolving from
  tenant. Logo now visible on login page, topbar, sidebar (Filament
  v5 brandLogo handles all 3 spots automatically)
- Favicon falls back to logo if favicon not separately uploaded
- Removed manual SIDEBAR_LOGO_BEFORE injection (replaced by brandLogo)
- Removed manual <link rel=icon> in HEAD_END (replaced by ->favicon)
This commit is contained in:
2026-05-08 07:50:12 +00:00
parent 93a69dd826
commit 8f324b7b8e
3 changed files with 33 additions and 23 deletions
+13 -2
View File
@@ -64,8 +64,19 @@ class Onboarding extends Page
->label('Oraș')->maxLength(60), ->label('Oraș')->maxLength(60),
Forms\Components\TextInput::make('phone') Forms\Components\TextInput::make('phone')
->label('Telefon principal')->tel()->maxLength(40), ->label('Telefon principal')->tel()->maxLength(40),
Forms\Components\TextInput::make('currency') Forms\Components\Select::make('currency')
->label('Monedă')->required()->maxLength(8), ->label('Monedă')
->options([
'MDL' => 'MDL — Leu moldovenesc',
'EUR' => 'EUR — Euro',
'USD' => 'USD — US Dollar',
'RON' => 'RON — Leu românesc',
'UAH' => 'UAH — Hryvnia',
'RUB' => 'RUB — Rublă',
])
->default('MDL')
->required()
->searchable(),
]), ]),
Schemas\Components\Section::make('Pas 2 — Brand & limbă') Schemas\Components\Section::make('Pas 2 — Brand & limbă')
->visible(fn () => $this->step === 2) ->visible(fn () => $this->step === 2)
+12 -1
View File
@@ -76,7 +76,18 @@ class Settings extends Page
->label('Limbă default') ->label('Limbă default')
->options(['ro' => 'Română', 'ru' => 'Русский', 'en' => 'English']) ->options(['ro' => 'Română', 'ru' => 'Русский', 'en' => 'English'])
->required(), ->required(),
Forms\Components\TextInput::make('currency')->label('Monedă')->maxLength(8)->required(), Forms\Components\Select::make('currency')
->label('Monedă')
->options([
'MDL' => 'MDL — Leu moldovenesc',
'EUR' => 'EUR — Euro',
'USD' => 'USD — US Dollar',
'RON' => 'RON — Leu românesc',
'UAH' => 'UAH — Hryvnia',
'RUB' => 'RUB — Rublă',
])
->required()
->searchable(),
Forms\Components\ColorPicker::make('theme_color')->label('Culoare brand'), Forms\Components\ColorPicker::make('theme_color')->label('Culoare brand'),
]), ]),
Schemas\Components\Section::make('Servicii & tarif') Schemas\Components\Section::make('Servicii & tarif')
+8 -20
View File
@@ -33,7 +33,14 @@ class TenantPanelProvider extends PanelProvider
->id('tenant') ->id('tenant')
->path('app') ->path('app')
->login() ->login()
->brandName('AutoCRM') ->brandName(fn () => app(\App\Tenancy\TenantManager::class)->current()?->display_name
?? app(\App\Tenancy\TenantManager::class)->current()?->name
?? 'AutoCRM')
->brandLogo(fn () => app(\App\Tenancy\TenantManager::class)->current()?->getLogoUrl() ?: null)
->brandLogoHeight('2.5rem')
->favicon(fn () => app(\App\Tenancy\TenantManager::class)->current()?->getFaviconUrl()
?: app(\App\Tenancy\TenantManager::class)->current()?->getLogoUrl()
?: null)
->colors([ ->colors([
'primary' => Color::Blue, 'primary' => Color::Blue,
]) ])
@@ -89,7 +96,6 @@ class TenantPanelProvider extends PanelProvider
$t = app(\App\Tenancy\TenantManager::class)->current(); $t = app(\App\Tenancy\TenantManager::class)->current();
$themeColor = $t?->settings['theme_color'] ?? '#3B82F6'; $themeColor = $t?->settings['theme_color'] ?? '#3B82F6';
$name = $t?->display_name ?? $t?->name ?? 'AutoCRM'; $name = $t?->display_name ?? $t?->name ?? 'AutoCRM';
$favicon = $t?->getFaviconUrl();
// Generate primary color shades from theme_color hex. // Generate primary color shades from theme_color hex.
$hex = ltrim($themeColor, '#'); $hex = ltrim($themeColor, '#');
if (strlen($hex) === 6) { if (strlen($hex) === 6) {
@@ -103,10 +109,6 @@ class TenantPanelProvider extends PanelProvider
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default"> <meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="{{ $name }}"> <meta name="apple-mobile-web-app-title" content="{{ $name }}">
@if ($favicon)
<link rel="icon" type="image/png" href="{{ $favicon }}">
<link rel="apple-touch-icon" href="{{ $favicon }}">
@endif
<style> <style>
:root { :root {
--primary-50: {{ "rgb({$r} {$g} {$b} / 0.05)" }}; --primary-50: {{ "rgb({$r} {$g} {$b} / 0.05)" }};
@@ -193,20 +195,6 @@ class TenantPanelProvider extends PanelProvider
</style> </style>
BLADE) BLADE)
) )
->renderHook(
PanelsRenderHook::SIDEBAR_LOGO_BEFORE,
fn (): string => Blade::render(<<<'BLADE'
@php
$t = app(\App\Tenancy\TenantManager::class)->current();
$logo = $t?->getLogoUrl();
@endphp
@if ($logo)
<div style="padding: 12px 16px; display: flex; justify-content: center; border-bottom: 1px solid rgba(0,0,0,.06);">
<img src="{{ $logo }}" alt="logo" style="max-height: 56px; max-width: 100%;">
</div>
@endif
BLADE)
)
->renderHook( ->renderHook(
PanelsRenderHook::BODY_END, PanelsRenderHook::BODY_END,
fn (): string => Blade::render(<<<'BLADE' fn (): string => Blade::render(<<<'BLADE'