ifnex/04_Laravel/app/Providers/Filament/AdminPanelProvider.php
Kazem Alghasi 91984dbde3 feat(ui): redesign admin dashboard with layered grid and custom branding
Implement a comprehensive overhaul of the Filament admin dashboard,
introducing a structured 12-column responsive grid layout and enhanced
visual identity.

Key changes include:
- Redesigned Dashboard layout with a 4-layer progressive disclosure
  architecture (KPIs, Exchange Rates, Data Tables, and Trends).
- Introduced custom IFNEX design tokens via CSS, including branded
  stat cards, status badges, and improved sidebar typography.
- Enhanced FinanceOverviewWidget with real-time trend analysis and
  sparkline-ready data structures.
- Refactored RecentShipments and RecentTransactions widgets to use
  custom Blade templates for a more polished, consistent UI.
- Integrated brand assets including the company logo and custom
  authentication pages.
- Added global number formatting helpers and integrated them into
  financial widgets.
- Updated AdminPanelProvider to support custom login pages and
  brand-specific header/footer hooks.
2026-10-03 11:08:50 +03:30

105 lines
4.5 KiB
PHP

<?php
namespace App\Providers\Filament;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('panel')
->login(\App\Filament\Pages\Auth\Login::class)
->brandName('IFNEX Logistics')
// لوگوی برند در نوار بالا — همان لوگوی صفحه لاگین
->brandLogo(asset('images/ifnex-logo.png'))
->brandLogoHeight('2.5rem')
->colors([
'primary' => Color::Amber,
'gray' => [
50 => '#f8fafc',
100 => '#f1f5f9',
200 => '#e2e8f0',
300 => '#cbd5e1',
400 => '#94a3b8',
500 => '#64748b',
600 => '#475569',
700 => '#334155',
800 => '#1e293b',
900 => '#1a1a2e',
950 => '#0f172a',
],
'danger' => Color::Red,
'info' => Color::Blue,
'success' => Color::Emerald,
'warning' => Color::Amber,
])
->font('Vazirmatn')
->spa()
->sidebarCollapsibleOnDesktop()
->darkMode(true)
->databaseNotifications()
->globalSearchKeyBindings(['command+k', 'ctrl+k'])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
// ─── ترتیب و گروه‌بندی منوی ناوبری ───
->navigationGroups([
'عملیات',
'مالی',
'تنظیمات',
'گزارش‌ها',
'ابزارها',
])
// ─── بارگذاری استایل سفارشی IFNEX به‌عنوان تم فیلمنت ───
// ->viteTheme('resources/css/filament.css') // موقتاً غیرفعال تا npm run build
// ⚠️ Pages\Dashboard::class اینجا ثبت نشود — App\Filament\Pages\Dashboard
// از طریق discoverPages کشف می‌شود؛ ثبت صریح داشبورد پایه باعث می‌شود
// نسخه پایه (با کل استخر ویجت‌های کشف‌شده) بر override سه‌لایه غلبه کند
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
\App\Filament\Widgets\RecentShipmentsWidget::class,
\App\Filament\Widgets\ExchangeRateWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
])
->renderHook(
'panels::head.start',
fn () => view('filament.hooks.head')
)
->renderHook(
\Filament\View\PanelsRenderHook::FOOTER,
fn () => '<div style="text-align:center;padding:10px 0;font-size:12px;color:#94a3b8;">'
. 'قدرت گرفته از <a href="https://vernasoft.ir" target="_blank" rel="noopener" '
. 'style="color:#f59e0b;font-weight:600;text-decoration:none;">ورنا سافت</a></div>'
);
}
}