ifnex/04_Laravel/app/Filament/Widgets/DashboardInfoWidget.php
Kazem Alghasi c54530d8da refactor(admin): optimize dashboard layout and enhance sidebar UX
Refactor the Filament admin dashboard by decoupling the recent shipments
logic into a dedicated widget and improving the sidebar navigation
experience. Additionally, implement several improvements to the
WordPress theme for better client-side usability.

Laravel/Filament:
- Extract `RecentShipmentsWidget` from `DashboardInfoWidget` to improve
  modularization and dashboard performance.
- Update widget sorting and layout to accommodate the new structure.
- Inject custom CSS and Alpine.js logic into the admin head to provide
  sidebar group toggling and a "collapse all" utility.
- Improve sidebar group label visibility and hover states.

WordPress:
- Implement `ifnex_login_url()` to support Polylang-aware, language-specific
  login pages.
- Hide the WordPress admin bar for non-administrator users to provide a
  cleaner client interface.
- Add conditional rendering for the registration link in the login
  template based on WordPress user registration settings.
2026-10-03 07:01:54 +03:30

34 lines
913 B
PHP

<?php
namespace App\Filament\Widgets;
use Filament\Widgets\Widget;
use Morilog\Jalali\Jalalian;
/**
* کارت کوچک تاریخ/ساعت/خوش‌آمد — گوشه داشبورد.
* جدول «آخرین سفارشات» به RecentShipmentsWidget جدا منتقل شده است.
*/
class DashboardInfoWidget extends Widget
{
protected static ?int $sort = 1;
protected static bool $isLazy = false;
protected int | string | array $columnSpan = 1;
protected static string $view = 'filament.widgets.dashboard-info';
protected function getViewData(): array
{
$now = now();
return [
'gregorianDate' => $now->format('l, j F Y'),
'jalaliDate' => Jalalian::fromCarbon($now)->format('l، d F Y'),
'time' => $now->format('H:i'),
'userName' => auth()->user()?->name ?? 'کاربر',
];
}
}