diff --git a/composer.lock b/composer.lock index dee3b3f..d27bb7b 100644 --- a/composer.lock +++ b/composer.lock @@ -1325,16 +1325,16 @@ }, { "name": "filament/actions", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", - "reference": "251f3bc3e21ac014de94d9aa147b7097b7e8f5b7" + "reference": "5c5fbb3366f320457545ff84a0e0308009e579c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/actions/zipball/251f3bc3e21ac014de94d9aa147b7097b7e8f5b7", - "reference": "251f3bc3e21ac014de94d9aa147b7097b7e8f5b7", + "url": "https://api.github.com/repos/filamentphp/actions/zipball/5c5fbb3366f320457545ff84a0e0308009e579c2", + "reference": "5c5fbb3366f320457545ff84a0e0308009e579c2", "shasum": "" }, "require": { @@ -1374,20 +1374,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-03-18T07:45:49+00:00" + "time": "2024-03-19T00:27:45+00:00" }, { "name": "filament/filament", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", - "reference": "d70bfad621f0664b6e5c49fe9fdfec33e4f75751" + "reference": "728c31d128b9cbb7d28a5ba19a63d39730064cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/panels/zipball/d70bfad621f0664b6e5c49fe9fdfec33e4f75751", - "reference": "d70bfad621f0664b6e5c49fe9fdfec33e4f75751", + "url": "https://api.github.com/repos/filamentphp/panels/zipball/728c31d128b9cbb7d28a5ba19a63d39730064cae", + "reference": "728c31d128b9cbb7d28a5ba19a63d39730064cae", "shasum": "" }, "require": { @@ -1439,20 +1439,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-03-17T21:52:59+00:00" + "time": "2024-03-19T15:24:45+00:00" }, { "name": "filament/forms", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "cf0be8a325cdc2d73bd2e87c1ef1e0683cb32aaf" + "reference": "75601e381da9c2b5cbd85f1fa9aa26778d564d4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/cf0be8a325cdc2d73bd2e87c1ef1e0683cb32aaf", - "reference": "cf0be8a325cdc2d73bd2e87c1ef1e0683cb32aaf", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/75601e381da9c2b5cbd85f1fa9aa26778d564d4d", + "reference": "75601e381da9c2b5cbd85f1fa9aa26778d564d4d", "shasum": "" }, "require": { @@ -1495,11 +1495,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-03-17T21:52:58+00:00" + "time": "2024-03-19T00:27:54+00:00" }, { "name": "filament/infolists", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", @@ -1550,16 +1550,16 @@ }, { "name": "filament/notifications", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", - "reference": "a25fe75eeebc61d4a6e2bfa88e9e501a5f8020bd" + "reference": "f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/notifications/zipball/a25fe75eeebc61d4a6e2bfa88e9e501a5f8020bd", - "reference": "a25fe75eeebc61d4a6e2bfa88e9e501a5f8020bd", + "url": "https://api.github.com/repos/filamentphp/notifications/zipball/f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5", + "reference": "f9a790ee2d5103ea87c88e6d545ea6ceb770cbe5", "shasum": "" }, "require": { @@ -1598,11 +1598,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-03-14T10:54:06+00:00" + "time": "2024-03-19T00:28:12+00:00" }, { "name": "filament/spatie-laravel-translatable-plugin", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", @@ -1647,7 +1647,7 @@ }, { "name": "filament/support", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", @@ -1704,16 +1704,16 @@ }, { "name": "filament/tables", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", - "reference": "fabf197f6dd7cb3163cc0702becf7284d322c436" + "reference": "5abd8e1baa5485aa4da499d632be7e2424ad6d4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/tables/zipball/fabf197f6dd7cb3163cc0702becf7284d322c436", - "reference": "fabf197f6dd7cb3163cc0702becf7284d322c436", + "url": "https://api.github.com/repos/filamentphp/tables/zipball/5abd8e1baa5485aa4da499d632be7e2424ad6d4c", + "reference": "5abd8e1baa5485aa4da499d632be7e2424ad6d4c", "shasum": "" }, "require": { @@ -1753,11 +1753,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-03-17T21:53:25+00:00" + "time": "2024-03-19T13:12:04+00:00" }, { "name": "filament/widgets", - "version": "v3.2.52", + "version": "v3.2.56", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", @@ -2293,16 +2293,16 @@ }, { "name": "lara-zeus/erebus", - "version": "1.x-dev", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/lara-zeus/erebus.git", - "reference": "0723dc3e700ee8f64a1ca4183bb8594b3f2551f0" + "reference": "22e57a00f344a756eec52a60d19d11a6e26f1fc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lara-zeus/erebus/zipball/0723dc3e700ee8f64a1ca4183bb8594b3f2551f0", - "reference": "0723dc3e700ee8f64a1ca4183bb8594b3f2551f0", + "url": "https://api.github.com/repos/lara-zeus/erebus/zipball/22e57a00f344a756eec52a60d19d11a6e26f1fc2", + "reference": "22e57a00f344a756eec52a60d19d11a6e26f1fc2", "shasum": "" }, "require": { @@ -2313,7 +2313,6 @@ "filament/filament": "^3.2", "jeffgreco13/filament-breezy": "^2.1", "lara-zeus/chaos": "^1.0", - "lara-zeus/tartarus": "^1.0", "php": "^8.1", "spatie/laravel-activitylog": "^4.7", "spatie/laravel-permission": "^6.4", @@ -2330,7 +2329,6 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0" }, - "default-branch": true, "type": "library", "extra": { "laravel": { @@ -2381,7 +2379,7 @@ "type": "github" } ], - "time": "2024-03-18T22:45:01+00:00" + "time": "2024-03-19T15:36:14+00:00" }, { "name": "lara-zeus/pontus", @@ -9616,16 +9614,16 @@ }, { "name": "orchestra/testbench", - "version": "v8.22.0", + "version": "v8.22.1", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "77e857d3f57c892dbe76e71d4212f5f03a66887f" + "reference": "2ab5afb6b4dbcc8ad132e60db4e6eb5f1069cb6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/77e857d3f57c892dbe76e71d4212f5f03a66887f", - "reference": "77e857d3f57c892dbe76e71d4212f5f03a66887f", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/2ab5afb6b4dbcc8ad132e60db4e6eb5f1069cb6d", + "reference": "2ab5afb6b4dbcc8ad132e60db4e6eb5f1069cb6d", "shasum": "" }, "require": { @@ -9633,7 +9631,7 @@ "fakerphp/faker": "^1.21", "laravel/framework": "^10.40", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^8.23", + "orchestra/testbench-core": "^8.23.4", "orchestra/workbench": "^1.4 || ^8.4", "php": "^8.1", "phpunit/phpunit": "^9.6 || ^10.1", @@ -9665,22 +9663,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v8.22.0" + "source": "https://github.com/orchestral/testbench/tree/v8.22.1" }, - "time": "2024-03-13T06:52:48+00:00" + "time": "2024-03-19T12:59:06+00:00" }, { "name": "orchestra/testbench-core", - "version": "v8.23.2", + "version": "v8.23.4", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "026e6779571b915c1b16fcaeaf43dd340de5b32f" + "reference": "a863b355bf73609121c1d2d08b3ffb8b27ecb8d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/026e6779571b915c1b16fcaeaf43dd340de5b32f", - "reference": "026e6779571b915c1b16fcaeaf43dd340de5b32f", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/a863b355bf73609121c1d2d08b3ffb8b27ecb8d0", + "reference": "a863b355bf73609121c1d2d08b3ffb8b27ecb8d0", "shasum": "" }, "require": { @@ -9759,7 +9757,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2024-03-18T13:52:09+00:00" + "time": "2024-03-19T11:18:56+00:00" }, { "name": "orchestra/workbench", diff --git a/resources/views/company/pages/company-settings.blade.php b/resources/views/company/pages/company-settings.blade.php new file mode 100644 index 0000000..eca8288 --- /dev/null +++ b/resources/views/company/pages/company-settings.blade.php @@ -0,0 +1,11 @@ + +
+ {{ $this->form }} + +
+ + {{ __('zeus-chaos::core.save') }} + +
+
+
diff --git a/resources/views/fields/color-picker.blade.php b/resources/views/fields/color-picker.blade.php new file mode 100644 index 0000000..416002f --- /dev/null +++ b/resources/views/fields/color-picker.blade.php @@ -0,0 +1,31 @@ + +
+ + + +
+ @php + $colors = collect(\Filament\Support\Colors\Color::all())->forget(['slate','zinc','neutral','stone'])->keys()->toArray(); + @endphp + @foreach($colors as $color) + @php + $setColor = \Illuminate\Support\Arr::toCssStyles([ + \Filament\Support\get_color_css_variables($color, shades: [500]), + ]); + @endphp + + + @endforeach +
+
+
diff --git a/resources/views/pages/deleter.blade.php b/resources/views/pages/deleter.blade.php new file mode 100644 index 0000000..ce096a2 --- /dev/null +++ b/resources/views/pages/deleter.blade.php @@ -0,0 +1,3 @@ + + {{ $this->table }} + diff --git a/src/Configuration.php b/src/Configuration.php index 58193ac..e27d110 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -11,6 +11,10 @@ trait Configuration */ protected Closure | string $navigationGroupLabel = 'Tartarus'; + protected array $tartarusModels = [ + //'Notification' => \LaraZeus\Tartarus\Models\Notification::class, + ]; + public function navigationGroupLabel(Closure | string $label): static { $this->navigationGroupLabel = $label; @@ -22,4 +26,21 @@ public function getNavigationGroupLabel(): Closure | string { return $this->evaluate($this->navigationGroupLabel); } + + public function tartarusModels(array $models): static + { + $this->tartarusModels = $models; + + return $this; + } + + public function getTartarusModels(): array + { + return $this->tartarusModels; + } + + public static function getModel(string $model): string + { + return (new static())::get()->getTartarusModels()[$model]; + } } diff --git a/src/Filament/Clusters/System/Resources/CompanyResource/Pages/CompanySettings.php b/src/Filament/Clusters/System/Resources/CompanyResource/Pages/CompanySettings.php index 8943491..fe35422 100644 --- a/src/Filament/Clusters/System/Resources/CompanyResource/Pages/CompanySettings.php +++ b/src/Filament/Clusters/System/Resources/CompanyResource/Pages/CompanySettings.php @@ -26,7 +26,7 @@ class CompanySettings extends Page protected static string $resource = CompanyResource::class; - protected static string $view = 'filament.admin.clusters.companies.pages.company-settings'; + protected static string $view = 'zeus-tartarus::company.pages.company-settings'; public static function langFile(): string { diff --git a/src/Filament/Clusters/System/Resources/EmailLogsResource.php b/src/Filament/Clusters/System/Resources/EmailLogsResource.php index 30492b2..bf7089f 100644 --- a/src/Filament/Clusters/System/Resources/EmailLogsResource.php +++ b/src/Filament/Clusters/System/Resources/EmailLogsResource.php @@ -23,10 +23,13 @@ class EmailLogsResource extends ChaosResource { - protected static ?string $model = Email::class; - protected static ?string $cluster = System::class; + public static function getModel(): string + { + return config('filament-email.resource.model'); + } + public static function form(Form $form): Form { return $form diff --git a/src/Filament/Pages/Deleter.php b/src/Filament/Pages/Deleter.php index 38335fb..cd469bd 100644 --- a/src/Filament/Pages/Deleter.php +++ b/src/Filament/Pages/Deleter.php @@ -28,7 +28,7 @@ class Deleter extends Page implements HasTable protected static ?string $navigationIcon = 'heroicon-o-document-text'; - protected static string $view = 'zeus-tartarus::filament.admin.pages.deleter'; + protected static string $view = 'zeus-tartarus::pages.deleter'; public static function langFile(): string { diff --git a/src/Filament/Pages/RegisterCompany.php b/src/Filament/Pages/RegisterCompany.php index c753d59..25e1e23 100644 --- a/src/Filament/Pages/RegisterCompany.php +++ b/src/Filament/Pages/RegisterCompany.php @@ -18,6 +18,8 @@ class RegisterCompany extends RegisterTenant public ?Model $tenant = null; + protected static ?string $slug = 'create-my-new-team'; + protected static string $view = 'zeus-tartarus::company.pages.create_company'; public static function getLabel(): string diff --git a/src/Filament/Schemata/Company/SettingsForm.php b/src/Filament/Schemata/Company/SettingsForm.php index 007ebe0..45fbf12 100644 --- a/src/Filament/Schemata/Company/SettingsForm.php +++ b/src/Filament/Schemata/Company/SettingsForm.php @@ -24,7 +24,7 @@ public static function mainSetting(): array ->label(__('Slug')), ViewField::make('primary_color') ->live() - ->view('filament.fields.color-picker'), + ->view('zeus-tartarus::fields.color-picker'), ]), ]; } diff --git a/src/Middleware/InitTenant.php b/src/Middleware/InitTenant.php new file mode 100644 index 0000000..3021e84 --- /dev/null +++ b/src/Middleware/InitTenant.php @@ -0,0 +1,36 @@ +makeSubdomain($request->getHost()); + + if ($subdomain === 'www') { + return redirect()->away(config('note.central_domain')); + } + $company = Company::where('subdomain', $subdomain)->first(); + + abort_if($company === null, 404); + + $request->session()->put('company', $company); + + URL::defaults(['domain' => $subdomain]); + + return $next($request); + } + + protected function makeSubdomain(string $hostname): string + { + return explode('.', $hostname)[0]; + } +} diff --git a/src/Providers/FilamentPanelProvider.php b/src/Providers/FilamentPanelProvider.php index 3c7acf8..9c6ea58 100644 --- a/src/Providers/FilamentPanelProvider.php +++ b/src/Providers/FilamentPanelProvider.php @@ -22,6 +22,8 @@ use Illuminate\Session\Middleware\AuthenticateSession; use Illuminate\Session\Middleware\StartSession; use Illuminate\View\Middleware\ShareErrorsFromSession; +use LaraZeus\Erebus\Filament\Clusters\Employees\Resources\NotificationResource; +use LaraZeus\Erebus\Filament\Pages\UserProfile; use LaraZeus\Tartarus\Middleware\SetLang; use Livewire\Livewire; @@ -66,16 +68,17 @@ public static function panel(Panel $panel): Panel // nav ->userMenuItems([ MenuItem::make() + ->visible(fn () => tenant() !== null) ->label(fn () => __('My Profile')) ->icon('heroicon-o-user-circle') - ->url(static fn () => url('/user')), + ->url(static fn () => UserProfile::getUrl()), // wtf, error in register - /*MenuItem::make() - //->visible(fn () => tenant() !== null) + MenuItem::make() + ->visible(fn () => tenant() !== null) ->label(fn () => __('All Notifications')) ->icon('carbon-notification') - ->url(static fn () => NotificationResource::getUrl(tenant: tenant())),*/ + ->url(static fn () => NotificationResource::getUrl(tenant: tenant())), ]) ->middleware([ EncryptCookies::class, diff --git a/src/TartarusServiceProvider.php b/src/TartarusServiceProvider.php index 6913db7..78af59a 100644 --- a/src/TartarusServiceProvider.php +++ b/src/TartarusServiceProvider.php @@ -3,6 +3,8 @@ namespace LaraZeus\Tartarus; use LaraZeus\Tartarus\Console\InstallCommand; +use LaraZeus\Tartarus\Filament\Pages\RegisterCompany; +use Livewire\Livewire; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; @@ -20,4 +22,9 @@ public function configurePackage(Package $package): void ]) ->hasTranslations(); } + + public function packageBooted(): void + { + Livewire::component('register-company', RegisterCompany::class); + } } diff --git a/src/helpers.php b/src/helpers.php index 9151e0a..e8421da 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,7 +3,7 @@ use Filament\Facades\Filament; if (! function_exists('tenant')) { - function tenant(?string $key = null): ?LaraZeus\Tartarus\Models\Company + function tenant(?string $key = null): mixed { /** * @var \LaraZeus\Tartarus\Models\Company $getTenant