Andrew Wallo 1 year ago
parent
commit
5ed0d301de

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Appearance.php View File

49
         return translate(static::$title);
49
         return translate(static::$title);
50
     }
50
     }
51
 
51
 
52
-    public function getMaxContentWidth(): MaxWidth
52
+    public function getMaxContentWidth(): MaxWidth | string | null
53
     {
53
     {
54
         return MaxWidth::ScreenTwoExtraLarge;
54
         return MaxWidth::ScreenTwoExtraLarge;
55
     }
55
     }

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/CompanyDefault.php View File

59
         return translate(static::$title);
59
         return translate(static::$title);
60
     }
60
     }
61
 
61
 
62
-    public function getMaxContentWidth(): MaxWidth
62
+    public function getMaxContentWidth(): MaxWidth | string | null
63
     {
63
     {
64
         return MaxWidth::ScreenTwoExtraLarge;
64
         return MaxWidth::ScreenTwoExtraLarge;
65
     }
65
     }

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/CompanyProfile.php View File

62
         return translate(static::$title);
62
         return translate(static::$title);
63
     }
63
     }
64
 
64
 
65
-    public function getMaxContentWidth(): MaxWidth
65
+    public function getMaxContentWidth(): MaxWidth | string | null
66
     {
66
     {
67
         return MaxWidth::ScreenTwoExtraLarge;
67
         return MaxWidth::ScreenTwoExtraLarge;
68
     }
68
     }

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Invoice.php View File

63
         return translate(static::$title);
63
         return translate(static::$title);
64
     }
64
     }
65
 
65
 
66
-    public function getMaxContentWidth(): MaxWidth
66
+    public function getMaxContentWidth(): MaxWidth | string | null
67
     {
67
     {
68
         return MaxWidth::ScreenTwoExtraLarge;
68
         return MaxWidth::ScreenTwoExtraLarge;
69
     }
69
     }

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Localization.php View File

60
         return translate(static::$title);
60
         return translate(static::$title);
61
     }
61
     }
62
 
62
 
63
-    public function getMaxContentWidth(): MaxWidth
63
+    public function getMaxContentWidth(): MaxWidth | string | null
64
     {
64
     {
65
         return MaxWidth::ScreenTwoExtraLarge;
65
         return MaxWidth::ScreenTwoExtraLarge;
66
     }
66
     }

+ 1
- 1
app/Filament/Components/PanelShiftDropdown.php View File

193
             $panels['main']['items'][] = [
193
             $panels['main']['items'][] = [
194
                 'panelId' => $companySettingsId,
194
                 'panelId' => $companySettingsId,
195
                 'label' => 'Company Settings',
195
                 'label' => 'Company Settings',
196
-                'icon' => 'heroicon-m-building-office-2',
196
+                'icon' => 'heroicon-s-building-office-2',
197
             ];
197
             ];
198
 
198
 
199
             $panels[$companySettingsId] = [
199
             $panels[$companySettingsId] = [

+ 19
- 0
app/Filament/User/Clusters/Account.php View File

1
+<?php
2
+
3
+namespace App\Filament\User\Clusters;
4
+
5
+use Filament\Clusters\Cluster;
6
+
7
+class Account extends Cluster
8
+{
9
+    protected static ?string $navigationIcon = 'heroicon-s-user';
10
+
11
+    protected static ?string $navigationLabel = 'My Account';
12
+
13
+    protected static ?string $clusterBreadcrumb = 'My Account';
14
+
15
+    public static function getNavigationUrl(): string
16
+    {
17
+        return static::getUrl(panel: 'user');
18
+    }
19
+}

+ 21
- 0
app/Filament/User/Clusters/Account/Pages/PersonalAccessTokens.php View File

1
+<?php
2
+
3
+namespace App\Filament\User\Clusters\Account\Pages;
4
+
5
+use App\Filament\User\Clusters\Account;
6
+use Filament\Support\Enums\MaxWidth;
7
+use Wallo\FilamentCompanies\Pages\User\PersonalAccessTokens as BasePersonalAccessTokens;
8
+
9
+class PersonalAccessTokens extends BasePersonalAccessTokens
10
+{
11
+    protected static ?string $cluster = Account::class;
12
+
13
+    protected static bool $shouldRegisterNavigation = true;
14
+
15
+    protected static ?int $navigationSort = 20;
16
+
17
+    public function getMaxContentWidth(): MaxWidth | string | null
18
+    {
19
+        return MaxWidth::ScreenTwoExtraLarge;
20
+    }
21
+}

+ 21
- 0
app/Filament/User/Clusters/Account/Pages/Profile.php View File

1
+<?php
2
+
3
+namespace App\Filament\User\Clusters\Account\Pages;
4
+
5
+use App\Filament\User\Clusters\Account;
6
+use Filament\Support\Enums\MaxWidth;
7
+use Wallo\FilamentCompanies\Pages\User\Profile as BaseProfile;
8
+
9
+class Profile extends BaseProfile
10
+{
11
+    protected static ?string $cluster = Account::class;
12
+
13
+    protected static bool $shouldRegisterNavigation = true;
14
+
15
+    protected static ?int $navigationSort = 10;
16
+
17
+    public function getMaxContentWidth(): MaxWidth | string | null
18
+    {
19
+        return MaxWidth::ScreenTwoExtraLarge;
20
+    }
21
+}

+ 15
- 0
app/Http/Responses/LoginResponse.php View File

1
+<?php
2
+
3
+namespace App\Http\Responses;
4
+
5
+use Filament\Facades\Filament;
6
+use Illuminate\Http\RedirectResponse;
7
+use Livewire\Features\SupportRedirects\Redirector;
8
+
9
+class LoginResponse extends \Filament\Http\Responses\Auth\LoginResponse
10
+{
11
+    public function toResponse($request): RedirectResponse | Redirector
12
+    {
13
+        return redirect()->to(Filament::getDefaultPanel()->getUrl());
14
+    }
15
+}

+ 10
- 1
app/Livewire/UpdateProfileInformation.php View File

132
             ->schema([
132
             ->schema([
133
                 Forms\Components\FileUpload::make('profile_photo_path')
133
                 Forms\Components\FileUpload::make('profile_photo_path')
134
                     ->label('Photo')
134
                     ->label('Photo')
135
-                    ->avatar()
136
                     ->extraAttributes([
135
                     ->extraAttributes([
137
                         'style' => 'width: 6rem; height: 6rem;',
136
                         'style' => 'width: 6rem; height: 6rem;',
138
                     ])
137
                     ])
138
+                    ->panelLayout('compact circle')
139
+                    ->removeUploadedFileButtonPosition('center bottom')
140
+                    ->uploadButtonPosition('center bottom')
141
+                    ->imageResizeMode('cover')
142
+                    ->imageResizeUpscale(false)
143
+                    ->imageResizeTargetHeight('500')
144
+                    ->imageResizeTargetWidth('500')
145
+                    ->imageCropAspectRatio('1:1')
146
+                    ->uploadProgressIndicatorPosition('center bottom')
147
+                    ->loadingIndicatorPosition('center bottom')
139
                     ->placeholder(static function () {
148
                     ->placeholder(static function () {
140
                         return new HtmlString('
149
                         return new HtmlString('
141
                             <div style="display: inline-block; cursor: pointer;">
150
                             <div style="display: inline-block; cursor: pointer;">

+ 2
- 31
app/Providers/AppServiceProvider.php View File

3
 namespace App\Providers;
3
 namespace App\Providers;
4
 
4
 
5
 use App\Services\DateRangeService;
5
 use App\Services\DateRangeService;
6
-use BezhanSalleh\PanelSwitch\PanelSwitch;
6
+use Filament\Http\Responses\Auth\Contracts\LoginResponse;
7
 use Filament\Notifications\Livewire\Notifications;
7
 use Filament\Notifications\Livewire\Notifications;
8
 use Filament\Support\Assets\Js;
8
 use Filament\Support\Assets\Js;
9
 use Filament\Support\Enums\Alignment;
9
 use Filament\Support\Enums\Alignment;
18
     public function register(): void
18
     public function register(): void
19
     {
19
     {
20
         $this->app->singleton(DateRangeService::class);
20
         $this->app->singleton(DateRangeService::class);
21
+        $this->app->singleton(LoginResponse::class, \App\Http\Responses\LoginResponse::class);
21
     }
22
     }
22
 
23
 
23
     /**
24
     /**
27
     {
28
     {
28
         Notifications::alignment(Alignment::Center);
29
         Notifications::alignment(Alignment::Center);
29
 
30
 
30
-        $this->configurePanelSwitch();
31
-
32
         FilamentAsset::register([
31
         FilamentAsset::register([
33
             Js::make('TopNavigation', __DIR__ . '/../../resources/js/TopNavigation.js'),
32
             Js::make('TopNavigation', __DIR__ . '/../../resources/js/TopNavigation.js'),
34
         ]);
33
         ]);
35
     }
34
     }
36
-
37
-    /**
38
-     * Configure the panel switch.
39
-     */
40
-    protected function configurePanelSwitch(): void
41
-    {
42
-        PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
43
-            $panelSwitch
44
-                ->modalHeading('Switch Panel')
45
-                ->modalWidth('md')
46
-                ->slideOver()
47
-                ->excludes(['admin'])
48
-                ->iconSize(16)
49
-                ->icons(function () {
50
-                    if (auth()->user()?->belongsToCompany(auth()->user()?->currentCompany)) {
51
-                        return [
52
-                            'user' => 'heroicon-o-user',
53
-                            'company' => 'heroicon-o-building-office',
54
-                        ];
55
-                    }
56
-
57
-                    return [
58
-                        'user' => 'heroicon-o-user',
59
-                        'company' => 'icon-building-add',
60
-                    ];
61
-                });
62
-        });
63
-    }
64
 }
35
 }

+ 22
- 18
app/Providers/Filament/UserPanelProvider.php View File

2
 
2
 
3
 namespace App\Providers\Filament;
3
 namespace App\Providers\Filament;
4
 
4
 
5
+use App\Filament\Components\PanelShiftDropdown;
6
+use App\Filament\User\Clusters\Account;
5
 use App\Http\Middleware\Authenticate;
7
 use App\Http\Middleware\Authenticate;
6
 use Exception;
8
 use Exception;
7
 use Filament\Http\Middleware\DisableBladeIconComponents;
9
 use Filament\Http\Middleware\DisableBladeIconComponents;
8
 use Filament\Http\Middleware\DispatchServingFilamentEvent;
10
 use Filament\Http\Middleware\DispatchServingFilamentEvent;
9
-use Filament\Navigation\MenuItem;
11
+use Filament\Navigation\NavigationBuilder;
10
 use Filament\Navigation\NavigationItem;
12
 use Filament\Navigation\NavigationItem;
11
 use Filament\Pages;
13
 use Filament\Pages;
12
 use Filament\Panel;
14
 use Filament\Panel;
13
 use Filament\PanelProvider;
15
 use Filament\PanelProvider;
14
 use Filament\Support\Colors\Color;
16
 use Filament\Support\Colors\Color;
15
-use Filament\Widgets;
16
 use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
17
 use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
17
 use Illuminate\Cookie\Middleware\EncryptCookies;
18
 use Illuminate\Cookie\Middleware\EncryptCookies;
18
 use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
19
 use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
33
         return $panel
34
         return $panel
34
             ->id('user')
35
             ->id('user')
35
             ->path('user')
36
             ->path('user')
36
-            ->userMenuItems([
37
-                'profile' => MenuItem::make()
38
-                    ->label('Profile')
39
-                    ->icon('heroicon-o-user-circle')
40
-                    ->url(static fn () => url(Profile::getUrl())),
41
-            ])
42
-            ->navigationItems([
43
-                NavigationItem::make('Personal Access Tokens')
44
-                    ->label(static fn (): string => __('filament-companies::default.navigation.links.tokens'))
45
-                    ->icon('heroicon-o-key')
46
-                    ->url(static fn () => url(PersonalAccessTokens::getUrl())),
47
-            ])
37
+            ->plugin(
38
+                PanelShiftDropdown::make()
39
+                    ->logoutItem()
40
+                    ->companySettings(false)
41
+                    ->navigation(function (NavigationBuilder $builder): NavigationBuilder {
42
+                        return $builder
43
+                            ->items([
44
+                                ...Account::getNavigationItems(),
45
+                                NavigationItem::make('company')
46
+                                    ->label('Company Dashboard')
47
+                                    ->icon('heroicon-s-building-office-2')
48
+                                    ->url(static fn (): string => Pages\Dashboard::getUrl(panel: 'company', tenant: auth()->user()->personalCompany())),
49
+                            ]);
50
+                    }),
51
+            )
48
             ->colors([
52
             ->colors([
49
                 'primary' => Color::Indigo,
53
                 'primary' => Color::Indigo,
50
             ])
54
             ])
55
+            ->navigation(false)
51
             ->viteTheme('resources/css/filament/user/theme.css')
56
             ->viteTheme('resources/css/filament/user/theme.css')
52
             ->discoverResources(in: app_path('Filament/User/Resources'), for: 'App\\Filament\\User\\Resources')
57
             ->discoverResources(in: app_path('Filament/User/Resources'), for: 'App\\Filament\\User\\Resources')
53
             ->discoverPages(in: app_path('Filament/User/Pages'), for: 'App\\Filament\\User\\Pages')
58
             ->discoverPages(in: app_path('Filament/User/Pages'), for: 'App\\Filament\\User\\Pages')
59
+            ->discoverClusters(in: app_path('Filament/User/Clusters'), for: 'App\\Filament\\User\\Clusters')
60
+            ->discoverWidgets(in: app_path('Filament/User/Widgets'), for: 'App\\Filament\\User\\Widgets')
54
             ->pages([
61
             ->pages([
55
-                Pages\Dashboard::class,
56
                 Profile::class,
62
                 Profile::class,
57
                 PersonalAccessTokens::class,
63
                 PersonalAccessTokens::class,
58
             ])
64
             ])
59
-            ->discoverWidgets(in: app_path('Filament/User/Widgets'), for: 'App\\Filament\\User\\Widgets')
60
             ->widgets([
65
             ->widgets([
61
-                Widgets\AccountWidget::class,
62
-                Widgets\FilamentInfoWidget::class,
66
+                //
63
             ])
67
             ])
64
             ->middleware([
68
             ->middleware([
65
                 EncryptCookies::class,
69
                 EncryptCookies::class,

+ 6
- 1
app/Providers/FilamentCompaniesServiceProvider.php View File

28
 use App\Filament\Company\Resources\Banking\AccountResource;
28
 use App\Filament\Company\Resources\Banking\AccountResource;
29
 use App\Filament\Company\Resources\Core\DepartmentResource;
29
 use App\Filament\Company\Resources\Core\DepartmentResource;
30
 use App\Filament\Components\PanelShiftDropdown;
30
 use App\Filament\Components\PanelShiftDropdown;
31
+use App\Filament\User\Clusters\Account;
31
 use App\Http\Middleware\ConfigureCurrentCompany;
32
 use App\Http\Middleware\ConfigureCurrentCompany;
32
 use App\Livewire\UpdatePassword;
33
 use App\Livewire\UpdatePassword;
33
 use App\Livewire\UpdateProfileInformation;
34
 use App\Livewire\UpdateProfileInformation;
102
             ->plugin(
103
             ->plugin(
103
                 PanelShiftDropdown::make()
104
                 PanelShiftDropdown::make()
104
                     ->logoutItem()
105
                     ->logoutItem()
105
-                    ->companySettings(),
106
+                    ->companySettings()
107
+                    ->navigation(function (NavigationBuilder $builder): NavigationBuilder {
108
+                        return $builder
109
+                            ->items(Account::getNavigationItems());
110
+                    }),
106
             )
111
             )
107
             ->colors([
112
             ->colors([
108
                 'primary' => Color::Indigo,
113
                 'primary' => Color::Indigo,

+ 0
- 1
composer.json View File

17
         "andrewdwallo/transmatic": "^1.1",
17
         "andrewdwallo/transmatic": "^1.1",
18
         "awcodes/filament-table-repeater": "^3.0",
18
         "awcodes/filament-table-repeater": "^3.0",
19
         "barryvdh/laravel-snappy": "^1.0",
19
         "barryvdh/laravel-snappy": "^1.0",
20
-        "bezhansalleh/filament-panel-switch": "^1.0",
21
         "filament/filament": "^3.2.115",
20
         "filament/filament": "^3.2.115",
22
         "guava/filament-clusters": "^1.1",
21
         "guava/filament-clusters": "^1.1",
23
         "guzzlehttp/guzzle": "^7.8",
22
         "guzzlehttp/guzzle": "^7.8",

+ 1
- 79
composer.lock View File

4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
         "This file is @generated automatically"
5
         "This file is @generated automatically"
6
     ],
6
     ],
7
-    "content-hash": "a745e09991b771592a6638bed644713c",
7
+    "content-hash": "16a2f09cb501fed46d806dc5c4cc51f7",
8
     "packages": [
8
     "packages": [
9
         {
9
         {
10
             "name": "akaunting/laravel-money",
10
             "name": "akaunting/laravel-money",
748
             ],
748
             ],
749
             "time": "2024-03-09T19:20:39+00:00"
749
             "time": "2024-03-09T19:20:39+00:00"
750
         },
750
         },
751
-        {
752
-            "name": "bezhansalleh/filament-panel-switch",
753
-            "version": "1.0.6",
754
-            "source": {
755
-                "type": "git",
756
-                "url": "https://github.com/bezhanSalleh/filament-panel-switch.git",
757
-                "reference": "91f9b2a7149bcc2564d68e3decb5771287105620"
758
-            },
759
-            "dist": {
760
-                "type": "zip",
761
-                "url": "https://api.github.com/repos/bezhanSalleh/filament-panel-switch/zipball/91f9b2a7149bcc2564d68e3decb5771287105620",
762
-                "reference": "91f9b2a7149bcc2564d68e3decb5771287105620",
763
-                "shasum": ""
764
-            },
765
-            "require": {
766
-                "filament/filament": "^3.0",
767
-                "php": "^8.1",
768
-                "spatie/laravel-package-tools": "^1.15.0"
769
-            },
770
-            "require-dev": {
771
-                "laravel/pint": "^1.0",
772
-                "nunomaduro/collision": "^7.9",
773
-                "orchestra/testbench": "^8.0",
774
-                "pestphp/pest": "^2.0",
775
-                "pestphp/pest-plugin-arch": "^2.0",
776
-                "pestphp/pest-plugin-laravel": "^2.0",
777
-                "spatie/laravel-ray": "^1.26"
778
-            },
779
-            "type": "library",
780
-            "extra": {
781
-                "laravel": {
782
-                    "providers": [
783
-                        "BezhanSalleh\\PanelSwitch\\PanelSwitchServiceProvider"
784
-                    ],
785
-                    "aliases": {
786
-                        "PanelSwitch": "BezhanSalleh\\PanelSwitch\\Facades\\PanelSwitch"
787
-                    }
788
-                }
789
-            },
790
-            "autoload": {
791
-                "psr-4": {
792
-                    "BezhanSalleh\\PanelSwitch\\": "src/",
793
-                    "BezhanSalleh\\PanelSwitch\\Database\\Factories\\": "database/factories/"
794
-                }
795
-            },
796
-            "notification-url": "https://packagist.org/downloads/",
797
-            "license": [
798
-                "MIT"
799
-            ],
800
-            "authors": [
801
-                {
802
-                    "name": "Bezhan Salleh",
803
-                    "email": "bezhan_salleh@yahoo.com",
804
-                    "role": "Developer"
805
-                }
806
-            ],
807
-            "description": "Easily Switch between your Filament Panels",
808
-            "homepage": "https://github.com/bezhansalleh/filament-panel-switch",
809
-            "keywords": [
810
-                "bezhanSalleh",
811
-                "filament",
812
-                "filament-panel-switch",
813
-                "panel-changer",
814
-                "panel-navigation",
815
-                "panel-switch"
816
-            ],
817
-            "support": {
818
-                "issues": "https://github.com/bezhansalleh/filament-panel-switch/issues",
819
-                "source": "https://github.com/bezhansalleh/filament-panel-switch"
820
-            },
821
-            "funding": [
822
-                {
823
-                    "url": "https://github.com/bezhanSalleh",
824
-                    "type": "github"
825
-                }
826
-            ],
827
-            "time": "2024-08-07T23:51:12+00:00"
828
-        },
829
         {
751
         {
830
             "name": "blade-ui-kit/blade-heroicons",
752
             "name": "blade-ui-kit/blade-heroicons",
831
             "version": "2.4.0",
753
             "version": "2.4.0",

+ 1
- 0
resources/css/filament/user/tailwind.config.js View File

5
     content: [
5
     content: [
6
         './app/Filament/User/**/*.php',
6
         './app/Filament/User/**/*.php',
7
         './resources/views/filament/user/**/*.blade.php',
7
         './resources/views/filament/user/**/*.blade.php',
8
+        './resources/views/components/**/*.blade.php',
8
         './vendor/filament/**/*.blade.php',
9
         './vendor/filament/**/*.blade.php',
9
         './vendor/andrewdwallo/filament-companies/resources/views/**/*.blade.php',
10
         './vendor/andrewdwallo/filament-companies/resources/views/**/*.blade.php',
10
         './vendor/bezhansalleh/filament-panel-switch/resources/views/panel-switch-menu.blade.php',
11
         './vendor/bezhansalleh/filament-panel-switch/resources/views/panel-switch-menu.blade.php',

+ 14
- 6
resources/views/components/panel-shift-dropdown.blade.php View File

1
 @php
1
 @php
2
+    $user = filament()->auth()->user();
2
     $items = filament()->getUserMenuItems();
3
     $items = filament()->getUserMenuItems();
3
     $logoutItem = $items['logout'] ?? null;
4
     $logoutItem = $items['logout'] ?? null;
4
     $currentTenant = filament()->getTenant();
5
     $currentTenant = filament()->getTenant();
15
     <div x-on:click="toggleDropdown" class="flex cursor-pointer">
16
     <div x-on:click="toggleDropdown" class="flex cursor-pointer">
16
         <button
17
         <button
17
             type="button"
18
             type="button"
18
-            class="fi-tenant-menu-trigger group flex w-full items-center justify-center gap-x-3 rounded-lg p-2 text-sm font-medium outline-none transition duration-75 hover:bg-gray-100 focus-visible:bg-gray-100 dark:hover:bg-white/5 dark:focus-visible:bg-white/5"
19
+            class="flex items-center justify-center gap-x-3 rounded-lg p-2 text-sm font-medium outline-none transition duration-75 hover:bg-gray-100 focus-visible:bg-gray-100 dark:hover:bg-white/5 dark:focus-visible:bg-white/5"
19
         >
20
         >
20
-            <x-filament-panels::avatar.tenant
21
-                :tenant="$currentTenant"
22
-                class="shrink-0"
23
-            />
21
+            @if($currentTenant)
22
+                <x-filament-panels::avatar.tenant
23
+                    :tenant="$currentTenant"
24
+                    class="shrink-0"
25
+                />
26
+            @else
27
+                <x-filament-panels::avatar.user
28
+                    :user="$user"
29
+                    class="shrink-0"
30
+                />
31
+            @endif
24
 
32
 
25
             <span class="grid justify-items-start text-start">
33
             <span class="grid justify-items-start text-start">
26
                 @if ($currentTenant instanceof \Filament\Models\Contracts\HasCurrentTenantLabel)
34
                 @if ($currentTenant instanceof \Filament\Models\Contracts\HasCurrentTenantLabel)
30
                 @endif
38
                 @endif
31
 
39
 
32
                 <span class="text-gray-950 dark:text-white">
40
                 <span class="text-gray-950 dark:text-white">
33
-                    {{ $currentTenantName }}
41
+                    {{ $currentTenantName ?? filament()->getUserName($user) }}
34
                 </span>
42
                 </span>
35
             </span>
43
             </span>
36
 
44
 

+ 0
- 0
resources/views/vendor/filament-panel-switch/.gitkeep View File


+ 0
- 107
resources/views/vendor/filament-panel-switch/panel-switch-menu.blade.php View File

1
-@php
2
-    $getUrlScheme = (string) app()->environment('production') ? 'https://' : 'http://';
3
-
4
-    $getPanelPath = fn (\Filament\Panel $panel): string => filled($domains = $panel->getDomains())
5
-            ? str(collect($domains)->first())->prepend($getUrlScheme)->toString()
6
-            : str($panel->getPath())->prepend('/')->toString();
7
-
8
-    $getHref = fn (\Filament\Panel $panel): ?string => $canSwitchPanels && $panel->getId() !== $currentPanel->getId()
9
-            ? $getPanelPath($panel)
10
-            : null;
11
-@endphp
12
-
13
-@if ($isSimple)
14
-    <x-filament::dropdown teleport placement="bottom-end">
15
-        <x-slot name="trigger">
16
-            <div x-data="{ open: false }" @click.outside="open = false">
17
-                <button type="button" @click="open = !open" class="flex items-center justify-center gap-x-2 rounded-lg px-3 py-2 text-sm font-semibold outline-none transition duration-75 hover:bg-gray-50 focus-visible:bg-gray-50 dark:hover:bg-white/5 dark:focus-visible:bg-white/5 text-gray-700 dark:text-gray-200">
18
-                    <span class="ml-4">{{  $labels[$currentPanel->getId()] ?? str($currentPanel->getId())->ucfirst() }}</span>
19
-                    <x-heroicon-m-chevron-down x-show="!open" class="w-5 h-5 text-gray-400 dark:text-gray-500" />
20
-                    <x-heroicon-m-chevron-up x-show="open" x-cloak class="w-5 h-5 text-gray-400 dark:text-gray-500" />
21
-                </button>
22
-            </div>
23
-        </x-slot>
24
-
25
-        <x-filament::dropdown.list>
26
-            @foreach ($panels as $panel)
27
-                <x-filament::dropdown.list.item
28
-                    :href="$getHref($panel)"
29
-                    :icon="$icons[$panel->getId()] ?? 'heroicon-s-square-2-stack'"
30
-                    tag="a"
31
-                >
32
-                    {{ $labels[$panel->getId()] ?? str($panel->getId())->ucfirst() }}
33
-                </x-filament::dropdown.list.item>
34
-            @endforeach
35
-        </x-filament::dropdown.list>
36
-    </x-filament::dropdown>
37
-@else
38
-    <style>
39
-        .panel-switch-modal .fi-modal-content {
40
-            align-items: center !important;
41
-            justify-content: center !important;
42
-        }
43
-    </style>
44
-    <x-filament::icon-button
45
-        x-data="{}"
46
-        icon="heroicon-o-square-3-stack-3d"
47
-        icon-alias="panels::panel-switch-modern-icon"
48
-        icon-size="lg"
49
-        @click="$dispatch('open-modal', { id: 'panel-switch' })"
50
-        label="Switch Panels"
51
-        class="text-gray-700 dark:text-primary-500"
52
-    />
53
-
54
-    <x-filament::modal
55
-        id="panel-switch"
56
-        :width="$modalWidth"
57
-        alignment="center"
58
-        display-classes="block"
59
-        :slide-over="$isSlideOver"
60
-        :sticky-header="$isSlideOver"
61
-        :heading="$heading"
62
-        class="panel-switch-modal"
63
-    >
64
-        <div
65
-            class="flex flex-wrap items-center justify-center gap-4 md:gap-6"
66
-        >
67
-            @foreach ($panels as $panel)
68
-                <!-- x-on:click="location.href = '{{ $getHref($panel) }}'" -->
69
-                <a
70
-                    href="{{ $getHref($panel) }}"
71
-                    class="flex flex-col items-center justify-center flex-1 hover:cursor-pointer group panel-switch-card"
72
-                >
73
-                    <div
74
-                        @class([
75
-                            "p-2 bg-white rounded-lg shadow-md dark:bg-gray-800 panel-switch-card-section",
76
-                            "group-hover:ring-2 group-hover:ring-primary-600" => $panel->getId() !== $currentPanel->getId(),
77
-                            "ring-2 ring-primary-600" => $panel->getId() === $currentPanel->getId(),
78
-                        ])
79
-                    >
80
-                        @if ($renderIconAsImage)
81
-                            <img
82
-                                class="rounded-lg panel-switch-card-image"
83
-                                style="width: {{ $iconSize * 4 }}px; height: {{ $iconSize * 4 }}px;"
84
-                                src="{{ $icons[$panel->getId()] ?? 'https://raw.githubusercontent.com/bezhanSalleh/filament-panel-switch/3.x/art/banner.jpg' }}"
85
-                                alt="Panel Image"
86
-                            >
87
-                        @else
88
-                            @php
89
-                                $iconName = $icons[$panel->getId()] ?? 'heroicon-s-square-2-stack' ;
90
-                            @endphp
91
-                            @svg($iconName, 'text-primary-600 panel-switch-card-icon', ['style' => 'width: ' . ($iconSize * 4) . 'px; height: ' . ($iconSize * 4). 'px;'])
92
-                        @endif
93
-                    </div>
94
-                    <span
95
-                        @class([
96
-                            "mt-2 text-sm font-medium text-center text-gray-400 dark:text-gray-200 break-words panel-switch-card-title",
97
-                            "text-gray-400 dark:text-gray-200 group-hover:text-primary-600 group-hover:dark:text-primary-400" => $panel->getId() !== $currentPanel->getId(),
98
-                            "text-primary-600 dark:text-primary-400" => $panel->getId() === $currentPanel->getId(),
99
-                        ])
100
-                    >
101
-                        {{ $labels[$panel->getId()] ?? str($panel->getId())->ucfirst()}}
102
-                    </span>
103
-                </a>
104
-            @endforeach
105
-        </div>
106
-    </x-filament::modal>
107
-@endif

+ 3
- 4
resources/views/vendor/filament-panels/components/user-menu.blade.php View File

12
     $items = \Illuminate\Support\Arr::except($items, ['account', 'logout', 'profile']);
12
     $items = \Illuminate\Support\Arr::except($items, ['account', 'logout', 'profile']);
13
 
13
 
14
     $hasPanelShiftDropdown = filament()->hasPlugin('panel-shift-dropdown');
14
     $hasPanelShiftDropdown = filament()->hasPlugin('panel-shift-dropdown');
15
-    $hasTenant = filament()->getTenant() !== null;
16
 @endphp
15
 @endphp
17
 
16
 
18
 
17
 
19
-@if($hasTenant)
18
+@if($hasPanelShiftDropdown)
20
     {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_BEFORE) }}
19
     {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_BEFORE) }}
21
 @endif
20
 @endif
22
 
21
 
35
                 type="button"
34
                 type="button"
36
                 class="shrink-0"
35
                 class="shrink-0"
37
             >
36
             >
38
-                <x-filament-panels::avatar.user :user="$user" />
37
+                <x-filament-panels::avatar.user :user="$user"/>
39
             </button>
38
             </button>
40
         </x-slot>
39
         </x-slot>
41
 
40
 
68
 
67
 
69
         @if (filament()->hasDarkMode() && (! filament()->hasDarkModeForced()))
68
         @if (filament()->hasDarkMode() && (! filament()->hasDarkModeForced()))
70
             <x-filament::dropdown.list>
69
             <x-filament::dropdown.list>
71
-                <x-filament-panels::theme-switcher />
70
+                <x-filament-panels::theme-switcher/>
72
             </x-filament::dropdown.list>
71
             </x-filament::dropdown.list>
73
         @endif
72
         @endif
74
 
73
 

Loading…
Cancel
Save