From b004742d47dfa9ad64d38c2c60c73c5d82c98b62 Mon Sep 17 00:00:00 2001 From: salam Date: Thu, 14 Aug 2025 10:26:40 +0200 Subject: [PATCH] basic install --- app/Providers/Filament/AdminPanelProvider.php | 49 ++++++------ composer.json | 1 + composer.lock | 75 ++++++++++++++++++- package-lock.json | 4 +- package.json | 4 +- public/images/nuh-d.svg | 5 ++ public/images/nuh-odds-d.svg | 12 +++ public/images/nuh-odds.svg | 15 ++++ public/images/nuh.svg | 5 ++ resources/css/filament/admin/theme.css | 5 ++ resources/svg/nuh.svg | 15 ++++ routes/web.php | 8 +- vite.config.js | 6 +- 13 files changed, 169 insertions(+), 35 deletions(-) create mode 100644 public/images/nuh-d.svg create mode 100644 public/images/nuh-odds-d.svg create mode 100644 public/images/nuh-odds.svg create mode 100644 public/images/nuh.svg create mode 100644 resources/css/filament/admin/theme.css create mode 100644 resources/svg/nuh.svg diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 74799dd8..67a1289d 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -2,16 +2,18 @@ namespace App\Providers\Filament; +use Awcodes\LightSwitch\Enums\Alignment; +use Awcodes\LightSwitch\LightSwitchPlugin; use Filament\Actions\Action; use Filament\Http\Middleware\Authenticate; use Filament\Http\Middleware\AuthenticateSession; use Filament\Http\Middleware\DisableBladeIconComponents; use Filament\Http\Middleware\DispatchServingFilamentEvent; -use Filament\Navigation\NavigationItem; use Filament\Pages\Dashboard; use Filament\Panel; use Filament\PanelProvider; use Filament\Support\Colors\Color; +use Filament\Support\Enums\Width; use Filament\Widgets\AccountWidget; use Filament\Widgets\FilamentInfoWidget; use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; @@ -19,6 +21,7 @@ use Illuminate\Cookie\Middleware\EncryptCookies; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Session\Middleware\StartSession; +use Illuminate\Support\Facades\Auth; use Illuminate\View\Middleware\ShareErrorsFromSession; use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; @@ -30,31 +33,36 @@ class AdminPanelProvider extends PanelProvider return $panel ->default() ->id('admin') - ->path('admin') + ->path('') ->login() + ->passwordReset() + ->brandLogo(asset('images/nuh.svg')) + ->darkModeBrandLogo(asset('images/nuh-d.svg')) + ->favicon(asset('images/nuh.svg')) + ->brandLogoHeight('1.8rem') + ->unsavedChangesAlerts() ->colors([ - 'primary' => Color::Amber, + 'primary' => Color::Slate, ]) + ->viteTheme('resources/css/filament/admin/theme.css') ->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages') ->pages([ Dashboard::class, ]) + ->maxContentWidth(Width::ScreenTwoExtraLarge) + ->breadcrumbs(false) + ->topNavigation() + ->userMenuItems([ + 'profile' => Action::make('profile') + ->label(fn () => Auth::user()->name) + ->url(fn (): string => EditProfilePage::getUrl()) + ->icon('heroicon-m-user-circle'), + ]) ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets') ->widgets([ AccountWidget::class, FilamentInfoWidget::class, - ])->navigationItems([ - NavigationItem::make('Analytics') - ->url('https://filament.pirsch.io', shouldOpenInNewTab: true) - ->icon('heroicon-o-presentation-chart-line') - ->group('Reports') - ->sort(3), - NavigationItem::make('dashboard') - ->label(fn (): string => __('filament-panels::pages/dashboard.title')) - ->url(fn (): string => Dashboard::getUrl()) - ->isActiveWhen(fn () => original_request()->routeIs('filament.admin.pages.dashboard')), - // ... ]) ->middleware([ EncryptCookies::class, @@ -70,17 +78,8 @@ class AdminPanelProvider extends PanelProvider ->authMiddleware([ Authenticate::class, ])->plugins([ - FilamentEditProfilePlugin::make() - ->userMenuItems([ - 'profile' => Action::make('profile') - ->label(fn () => auth()->user()->name) - ->url(fn (): string => EditProfilePage::getUrl()) - ->icon('heroicon-m-user-circle') - // If you are using tenancy need to check with the visible method where ->company() is the relation between the user and tenancy model as you called - ->visible(function (): bool { - return auth()->user()->company()->exists(); - }), - ]), + FilamentEditProfilePlugin::make()->shouldRegisterNavigation(false), + LightSwitchPlugin::make()->position(Alignment::BottomCenter), ]); } } diff --git a/composer.json b/composer.json index 432d9415..274d4477 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "license": "MIT", "require": { "php": "^8.2", + "awcodes/light-switch": "^2.0", "bezhansalleh/filament-shield": "^v4.0.0-beta2", "filament/filament": "^4.0", "joaopaulolndev/filament-edit-profile": "^2.0", diff --git a/composer.lock b/composer.lock index e193a970..6d1fd0e7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bdb8d4ab7ba25aa7dcfa1ce740c728d1", + "content-hash": "442b2905594dbc3ebef8325604a8c72e", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -72,6 +72,79 @@ }, "time": "2025-07-30T15:45:57+00:00" }, + { + "name": "awcodes/light-switch", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/awcodes/light-switch.git", + "reference": "c5eb8cb9ca26dcaa38d49e0e8fe6f85994326d74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awcodes/light-switch/zipball/c5eb8cb9ca26dcaa38d49e0e8fe6f85994326d74", + "reference": "c5eb8cb9ca26dcaa38d49e0e8fe6f85994326d74", + "shasum": "" + }, + "require": { + "filament/filament": "^4.0", + "php": "^8.2", + "spatie/laravel-package-tools": "^1.15.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "orchestra/testbench": "^9.0|^10.0", + "pestphp/pest": "^3.7", + "pestphp/pest-plugin-laravel": "^3.0", + "pestphp/pest-plugin-livewire": "^3.0", + "rector/rector": "^2.0", + "spatie/laravel-ray": "^1.29" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Awcodes\\LightSwitch\\LightSwitchServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Awcodes\\LightSwitch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Adam Weston", + "email": "awcodes1@gmail.com", + "role": "Developer" + } + ], + "description": "Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels", + "homepage": "https://github.com/awcodes/light-switch", + "keywords": [ + "awcodes", + "filament", + "laravel", + "light-switch", + "plugin" + ], + "support": { + "issues": "https://github.com/awcodes/light-switch/issues", + "source": "https://github.com/awcodes/light-switch" + }, + "funding": [ + { + "url": "https://github.com/awcodes", + "type": "github" + } + ], + "time": "2025-08-12T15:52:00+00:00" + }, { "name": "bezhansalleh/filament-shield", "version": "4.0.0-beta2", diff --git a/package-lock.json b/package-lock.json index 585bc4cb..8f67cc5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,11 +5,11 @@ "packages": { "": { "devDependencies": { - "@tailwindcss/vite": "^4.0.0", + "@tailwindcss/vite": "^4.1.11", "axios": "^1.11.0", "concurrently": "^9.0.1", "laravel-vite-plugin": "^2.0.0", - "tailwindcss": "^4.0.0", + "tailwindcss": "^4.1.11", "vite": "^7.0.4" } }, diff --git a/package.json b/package.json index a5707d81..0e8b1fd4 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,11 @@ "dev": "vite" }, "devDependencies": { - "@tailwindcss/vite": "^4.0.0", + "@tailwindcss/vite": "^4.1.11", "axios": "^1.11.0", "concurrently": "^9.0.1", "laravel-vite-plugin": "^2.0.0", - "tailwindcss": "^4.0.0", + "tailwindcss": "^4.1.11", "vite": "^7.0.4" } } diff --git a/public/images/nuh-d.svg b/public/images/nuh-d.svg new file mode 100644 index 00000000..ff97f9ec --- /dev/null +++ b/public/images/nuh-d.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/images/nuh-odds-d.svg b/public/images/nuh-odds-d.svg new file mode 100644 index 00000000..e3772f9a --- /dev/null +++ b/public/images/nuh-odds-d.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/public/images/nuh-odds.svg b/public/images/nuh-odds.svg new file mode 100644 index 00000000..ab0905d5 --- /dev/null +++ b/public/images/nuh-odds.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/public/images/nuh.svg b/public/images/nuh.svg new file mode 100644 index 00000000..d781d2b0 --- /dev/null +++ b/public/images/nuh.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css new file mode 100644 index 00000000..1a777896 --- /dev/null +++ b/resources/css/filament/admin/theme.css @@ -0,0 +1,5 @@ +@import '../../../../vendor/filament/filament/resources/css/theme.css'; + +@source '../../../../app/Filament/**/*'; +@source '../../../../resources/views/filament/**/*'; +@source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php'; \ No newline at end of file diff --git a/resources/svg/nuh.svg b/resources/svg/nuh.svg new file mode 100644 index 00000000..ab0905d5 --- /dev/null +++ b/resources/svg/nuh.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/routes/web.php b/routes/web.php index 86a06c53..3ef83351 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,7 @@