Andrew Wallo 1 рік тому
джерело
коміт
5ed0d301de

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Appearance.php Переглянути файл

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

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/CompanyDefault.php Переглянути файл

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

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/CompanyProfile.php Переглянути файл

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

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Invoice.php Переглянути файл

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

+ 1
- 1
app/Filament/Company/Clusters/Settings/Pages/Localization.php Переглянути файл

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

+ 1
- 1
app/Filament/Components/PanelShiftDropdown.php Переглянути файл

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

+ 19
- 0
app/Filament/User/Clusters/Account.php Переглянути файл

@@ -0,0 +1,19 @@
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 Переглянути файл

@@ -0,0 +1,21 @@
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 Переглянути файл

@@ -0,0 +1,21 @@
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 Переглянути файл

@@ -0,0 +1,15 @@
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 Переглянути файл

@@ -132,10 +132,19 @@ class UpdateProfileInformation extends Component implements HasForms
132 132
             ->schema([
133 133
                 Forms\Components\FileUpload::make('profile_photo_path')
134 134
                     ->label('Photo')
135
-                    ->avatar()
136 135
                     ->extraAttributes([
137 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 148
                     ->placeholder(static function () {
140 149
                         return new HtmlString('
141 150
                             <div style="display: inline-block; cursor: pointer;">

+ 2
- 31
app/Providers/AppServiceProvider.php Переглянути файл

@@ -3,7 +3,7 @@
3 3
 namespace App\Providers;
4 4
 
5 5
 use App\Services\DateRangeService;
6
-use BezhanSalleh\PanelSwitch\PanelSwitch;
6
+use Filament\Http\Responses\Auth\Contracts\LoginResponse;
7 7
 use Filament\Notifications\Livewire\Notifications;
8 8
 use Filament\Support\Assets\Js;
9 9
 use Filament\Support\Enums\Alignment;
@@ -18,6 +18,7 @@ class AppServiceProvider extends ServiceProvider
18 18
     public function register(): void
19 19
     {
20 20
         $this->app->singleton(DateRangeService::class);
21
+        $this->app->singleton(LoginResponse::class, \App\Http\Responses\LoginResponse::class);
21 22
     }
22 23
 
23 24
     /**
@@ -27,38 +28,8 @@ class AppServiceProvider extends ServiceProvider
27 28
     {
28 29
         Notifications::alignment(Alignment::Center);
29 30
 
30
-        $this->configurePanelSwitch();
31
-
32 31
         FilamentAsset::register([
33 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 Переглянути файл

@@ -2,17 +2,18 @@
2 2
 
3 3
 namespace App\Providers\Filament;
4 4
 
5
+use App\Filament\Components\PanelShiftDropdown;
6
+use App\Filament\User\Clusters\Account;
5 7
 use App\Http\Middleware\Authenticate;
6 8
 use Exception;
7 9
 use Filament\Http\Middleware\DisableBladeIconComponents;
8 10
 use Filament\Http\Middleware\DispatchServingFilamentEvent;
9
-use Filament\Navigation\MenuItem;
11
+use Filament\Navigation\NavigationBuilder;
10 12
 use Filament\Navigation\NavigationItem;
11 13
 use Filament\Pages;
12 14
 use Filament\Panel;
13 15
 use Filament\PanelProvider;
14 16
 use Filament\Support\Colors\Color;
15
-use Filament\Widgets;
16 17
 use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
17 18
 use Illuminate\Cookie\Middleware\EncryptCookies;
18 19
 use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
@@ -33,33 +34,36 @@ class UserPanelProvider extends PanelProvider
33 34
         return $panel
34 35
             ->id('user')
35 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 52
             ->colors([
49 53
                 'primary' => Color::Indigo,
50 54
             ])
55
+            ->navigation(false)
51 56
             ->viteTheme('resources/css/filament/user/theme.css')
52 57
             ->discoverResources(in: app_path('Filament/User/Resources'), for: 'App\\Filament\\User\\Resources')
53 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 61
             ->pages([
55
-                Pages\Dashboard::class,
56 62
                 Profile::class,
57 63
                 PersonalAccessTokens::class,
58 64
             ])
59
-            ->discoverWidgets(in: app_path('Filament/User/Widgets'), for: 'App\\Filament\\User\\Widgets')
60 65
             ->widgets([
61
-                Widgets\AccountWidget::class,
62
-                Widgets\FilamentInfoWidget::class,
66
+                //
63 67
             ])
64 68
             ->middleware([
65 69
                 EncryptCookies::class,

+ 6
- 1
app/Providers/FilamentCompaniesServiceProvider.php Переглянути файл

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

+ 0
- 1
composer.json Переглянути файл

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

+ 1
- 79
composer.lock Переглянути файл

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "a745e09991b771592a6638bed644713c",
7
+    "content-hash": "16a2f09cb501fed46d806dc5c4cc51f7",
8 8
     "packages": [
9 9
         {
10 10
             "name": "akaunting/laravel-money",
@@ -748,84 +748,6 @@
748 748
             ],
749 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 752
             "name": "blade-ui-kit/blade-heroicons",
831 753
             "version": "2.4.0",

+ 1
- 0
resources/css/filament/user/tailwind.config.js Переглянути файл

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

+ 14
- 6
resources/views/components/panel-shift-dropdown.blade.php Переглянути файл

@@ -1,4 +1,5 @@
1 1
 @php
2
+    $user = filament()->auth()->user();
2 3
     $items = filament()->getUserMenuItems();
3 4
     $logoutItem = $items['logout'] ?? null;
4 5
     $currentTenant = filament()->getTenant();
@@ -15,12 +16,19 @@
15 16
     <div x-on:click="toggleDropdown" class="flex cursor-pointer">
16 17
         <button
17 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 33
             <span class="grid justify-items-start text-start">
26 34
                 @if ($currentTenant instanceof \Filament\Models\Contracts\HasCurrentTenantLabel)
@@ -30,7 +38,7 @@
30 38
                 @endif
31 39
 
32 40
                 <span class="text-gray-950 dark:text-white">
33
-                    {{ $currentTenantName }}
41
+                    {{ $currentTenantName ?? filament()->getUserName($user) }}
34 42
                 </span>
35 43
             </span>
36 44
 

+ 0
- 0
resources/views/vendor/filament-panel-switch/.gitkeep Переглянути файл


+ 0
- 107
resources/views/vendor/filament-panel-switch/panel-switch-menu.blade.php Переглянути файл

@@ -1,107 +0,0 @@
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 Переглянути файл

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

Завантаження…
Відмінити
Зберегти