From 326d827543e18374ded1a5844f56e44790f6ac14 Mon Sep 17 00:00:00 2001 From: salam Date: Tue, 23 Sep 2025 12:02:39 +0200 Subject: [PATCH] cluster --- .../Administration/AdministrationCluster.php | 15 ++++ .../Clusters/Verwaltung/VerwaltungCluster.php | 15 ++++ .../Gutachters/GutachterResource.php | 7 +- .../KontoOptions/KontoOptionResource.php | 6 +- .../Resources/Kontos/KontoResource.php | 5 ++ .../Resources/Kontos/Tables/KontosTable.php | 79 ++++++++++++++----- .../Permissions/PermissionResource.php | 6 +- app/Filament/Resources/Users/UserResource.php | 8 +- app/Models/Konto.php | 3 + app/Providers/Filament/AdminPanelProvider.php | 1 + composer.lock | 28 ++++--- config/filament-shield.php | 4 +- ...0001_01_01_000000__create_kontos_table.php | 5 +- ...10_05_062328_create_auftraggeber_table.php | 34 ++++++++ database/seeders/KontoSeeder.php | 6 +- .../filament-shield/de/filament-shield.php | 2 +- resources/views/layouts/nav.blade.php | 2 +- resources/views/pages/welcome.blade.php | 2 +- 18 files changed, 178 insertions(+), 50 deletions(-) create mode 100644 app/Filament/Clusters/Administration/AdministrationCluster.php create mode 100644 app/Filament/Clusters/Verwaltung/VerwaltungCluster.php create mode 100644 database/migrations/2025_10_05_062328_create_auftraggeber_table.php diff --git a/app/Filament/Clusters/Administration/AdministrationCluster.php b/app/Filament/Clusters/Administration/AdministrationCluster.php new file mode 100644 index 0000000..9aa250c --- /dev/null +++ b/app/Filament/Clusters/Administration/AdministrationCluster.php @@ -0,0 +1,15 @@ +columns([ // TextColumn::make('id'), - TextColumn::make('konto_gender')->label('Geschlecht'), + // TextColumn::make('konto_gender')->label('Geschlecht'), // TextColumn::make('konto_title')->label('Title'), // TextColumn::make('konto_first_name')->label('Vorname'), - TextColumn::make('konto_option.name') - ->badge() - ->label('Plan & Zahlung') - ->description(fn ($record): string => $record->konto_option->payment_plan->name), - TextColumn::make('konto_company')->label('Firma'), - IconColumn::make('konto_agb_akzeptiert') - ->label('AGB') - ->boolean() - ->trueIcon(Heroicon::OutlinedCheckBadge) - ->falseIcon(Heroicon::OutlinedXMark), + // IconColumn::make('konto_agb_akzeptiert') + // ->label('AGB') + // ->boolean() + // ->trueIcon(Heroicon::OutlinedCheckBadge) + // ->falseIcon(Heroicon::OutlinedXMark), + + // PhoneColumn::make('konto_phone') + // ->label('Telefon') + // ->displayFormat(PhoneInputNumberType::INTERNATIONAL), + // TextColumn::make('konto_email') + // ->copyable() + // ->copyMessage('E-Mail wurde kopiert') + // ->copyMessageDuration(1500) + // ->label('E-mail'), + + TextColumn::make('konto_company')->label('Firma') + ->description(fn ($record): string => $record->konto_address.', '.$record->konto_location), + + TextColumn::make('konto_option.name') + ->icon(Heroicon::CurrencyEuro) + // ->iconColor('success') + // ->badge() + ->label('Plan') + ->description(fn ($record): string => $record->konto_option->payment_plan->name), + + TextColumn::make('konto_gutachten_abgeschlossen') + ->size(TextSize::Large) + ->weight(FontWeight::Bold) + ->label('Abgeschlossen') + ->color('primary') + ->description('Gutachten') + ->alignCenter(), + TextColumn::make('konto_gutachten_zahl') + ->size(TextSize::Large) + ->weight(FontWeight::Bold) + ->label('Freigeschalted') + ->color('success') + ->description('Gutachten') + ->alignCenter(), - PhoneColumn::make('konto_phone') - ->label('Telefon') - ->displayFormat(PhoneInputNumberType::INTERNATIONAL), - TextColumn::make('konto_email') - ->copyable() - ->copyMessage('E-Mail wurde kopiert') - ->copyMessageDuration(1500) - ->label('E-mail'), ]) ->recordActions([ EditAction::make(), + Action::make('Laden') + ->icon('heroicon-m-bolt') + ->color('warning') + ->schema([ + TextInput::make('subject')->required(), + RichEditor::make('body')->required(), + ]) + ->action(function (array $data) { + Mail::to($this->client) + ->send(new GenericEmail( + subject: $data['subject'], + body: $data['body'], + )); + }), ]); } } diff --git a/app/Filament/Resources/Permissions/PermissionResource.php b/app/Filament/Resources/Permissions/PermissionResource.php index 18e23ae..e0e3b20 100644 --- a/app/Filament/Resources/Permissions/PermissionResource.php +++ b/app/Filament/Resources/Permissions/PermissionResource.php @@ -2,6 +2,7 @@ namespace App\Filament\Resources\Permissions; +use App\Filament\Clusters\Administration\AdministrationCluster; use App\Filament\Resources\Permissions\Pages\CreatePermission; use App\Filament\Resources\Permissions\Pages\EditPermission; use App\Filament\Resources\Permissions\Pages\ListPermissions; @@ -12,15 +13,14 @@ use BackedEnum; use Filament\Resources\Resource; use Filament\Schemas\Schema; use Filament\Tables\Table; -use UnitEnum; class PermissionResource extends Resource { protected static ?string $model = Permission::class; - protected static string|BackedEnum|null $navigationIcon = 'lucide-toggle-right'; + protected static ?string $cluster = AdministrationCluster::class; - protected static string|UnitEnum|null $navigationGroup = 'Administration'; + protected static string|BackedEnum|null $navigationIcon = 'lucide-toggle-right'; protected static ?string $recordTitleAttribute = 'name'; diff --git a/app/Filament/Resources/Users/UserResource.php b/app/Filament/Resources/Users/UserResource.php index 8f9ccc4..d5ee1b0 100644 --- a/app/Filament/Resources/Users/UserResource.php +++ b/app/Filament/Resources/Users/UserResource.php @@ -2,6 +2,7 @@ namespace App\Filament\Resources\Users; +use App\Filament\Clusters\Verwaltung\VerwaltungCluster; use App\Filament\Resources\Users\Pages\CreateUser; use App\Filament\Resources\Users\Pages\EditUser; use App\Filament\Resources\Users\Pages\ListUsers; @@ -14,18 +15,19 @@ use Filament\Schemas\Schema; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; -use UnitEnum; class UserResource extends Resource { protected static ?string $model = User::class; + protected static ?int $navigationSort = 3; + + protected static ?string $cluster = VerwaltungCluster::class; + // protected static bool $shouldSkipAuthorization = true; protected static string|BackedEnum|null $navigationIcon = 'lucide-user'; - // protected static string|UnitEnum|null $navigationGroup = 'Gutachten'; - protected static ?string $recordTitleAttribute = 'name'; protected static ?string $navigationLabel = 'Benutzer'; diff --git a/app/Models/Konto.php b/app/Models/Konto.php index 7ea6a0a..2fa6e8b 100644 --- a/app/Models/Konto.php +++ b/app/Models/Konto.php @@ -27,6 +27,9 @@ class Konto extends Model 'konto_uid_number', 'konto_agb_akzeptiert', 'konto_option_id', + 'konto_gutachten_zahl', + 'konto_gutachten_zeit', + 'konto_gutachten_abgeschlossen', ]; public function konto_option(): HasOne diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 2415396..a9173ff 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -67,6 +67,7 @@ class AdminPanelProvider extends PanelProvider ->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages') ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets') + ->discoverClusters(in: app_path('Filament/Clusters'), for: 'App\\Filament\\Clusters') ->viteTheme('resources/css/filament/admin/theme.css') ->pages([ Dashboard::class, diff --git a/composer.lock b/composer.lock index 88df070..8ee6f64 100644 --- a/composer.lock +++ b/composer.lock @@ -4518,24 +4518,26 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v3.0.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" + "reference": "5e9b582660b997de205a84c02a3aac7c060900c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/5e9b582660b997de205a84c02a3aac7c060900c9", + "reference": "5e9b582660b997de205a84c02a3aac7c060900c9", "shasum": "" }, "require": { "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^9", - "vimeo/psalm": "^4|^5" + "infection/infection": "^0", + "nikic/php-fuzzer": "^0", + "phpunit/phpunit": "^9|^10|^11", + "vimeo/psalm": "^4|^5|^6" }, "type": "library", "autoload": { @@ -4581,20 +4583,20 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2024-05-08T12:36:18+00:00" + "time": "2025-09-22T21:00:33+00:00" }, { "name": "phiki/phiki", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/phikiphp/phiki.git", - "reference": "fe51fe6dc31856cd776fd1b04ee74053a4271644" + "reference": "160785c50c01077780ab217e5808f00ab8f05a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phikiphp/phiki/zipball/fe51fe6dc31856cd776fd1b04ee74053a4271644", - "reference": "fe51fe6dc31856cd776fd1b04ee74053a4271644", + "url": "https://api.github.com/repos/phikiphp/phiki/zipball/160785c50c01077780ab217e5808f00ab8f05a13", + "reference": "160785c50c01077780ab217e5808f00ab8f05a13", "shasum": "" }, "require": { @@ -4640,7 +4642,7 @@ "description": "Syntax highlighting using TextMate grammars in PHP.", "support": { "issues": "https://github.com/phikiphp/phiki/issues", - "source": "https://github.com/phikiphp/phiki/tree/v2.0.3" + "source": "https://github.com/phikiphp/phiki/tree/v2.0.4" }, "funding": [ { @@ -4652,7 +4654,7 @@ "type": "other" } ], - "time": "2025-09-19T11:50:41+00:00" + "time": "2025-09-20T17:21:02+00:00" }, { "name": "phpoption/phpoption", diff --git a/config/filament-shield.php b/config/filament-shield.php index 44a15af..c24ca7a 100644 --- a/config/filament-shield.php +++ b/config/filament-shield.php @@ -1,5 +1,7 @@ [ 'slug' => 'shield/roles', 'show_model_path' => true, - 'cluster' => null, + 'cluster' => AdministrationCluster::class, 'tabs' => [ 'pages' => true, 'widgets' => true, diff --git a/database/migrations/0001_01_01_000000__create_kontos_table.php b/database/migrations/0001_01_01_000000__create_kontos_table.php index 6ade294..3ef99d0 100644 --- a/database/migrations/0001_01_01_000000__create_kontos_table.php +++ b/database/migrations/0001_01_01_000000__create_kontos_table.php @@ -25,8 +25,11 @@ return new class extends Migration $table->string('konto_country')->nullable(); $table->string('konto_phone')->nullable(); $table->string('konto_uid_number')->nullable(); - $table->string('konto_option_id')->default(1); $table->boolean('konto_agb_akzeptiert')->default(false); + $table->string('konto_option_id')->default(1); + $table->string('konto_gutachten_zahl')->default(0); + $table->timestamp('konto_gutachten_zeit')->nullable(); + $table->string('konto_gutachten_abgeschlossen')->default(1); $table->timestamps(); }); } diff --git a/database/migrations/2025_10_05_062328_create_auftraggeber_table.php b/database/migrations/2025_10_05_062328_create_auftraggeber_table.php new file mode 100644 index 0000000..f9eb136 --- /dev/null +++ b/database/migrations/2025_10_05_062328_create_auftraggeber_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignId('konto_id')->constrained(); + $table->string('name'); + $table->string('logo'); + $table->text('adresse')->nullable(); + $table->string('kontaktperson')->nullable(); + $table->string('email')->email()->nullable(); + $table->string('telefon')->tel()->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('auftraggebers'); + } +}; diff --git a/database/seeders/KontoSeeder.php b/database/seeders/KontoSeeder.php index 605093d..b544760 100644 --- a/database/seeders/KontoSeeder.php +++ b/database/seeders/KontoSeeder.php @@ -12,10 +12,10 @@ class KontoSeeder extends Seeder */ public function run(): void { - $sql = "INSERT INTO `kontos` (`id`, `konto_title`, `konto_gender`, `konto_first_name`, `konto_last_name`, `konto_company`, `konto_email`, `konto_address`, `konto_location`, `konto_plz`, `konto_country`, `konto_phone`, `konto_uid_number`, `konto_agb_akzeptiert`, `created_at`, `updated_at`) + $sql = "INSERT INTO `kontos` (`id`, `konto_title`, `konto_gender`, `konto_first_name`, `konto_last_name`, `konto_company`, `konto_email`, `konto_address`, `konto_location`, `konto_plz`, `konto_country`, `konto_phone`, `konto_uid_number`, `konto_agb_akzeptiert`, `konto_option_id`, `konto_gutachten_zahl`, `konto_gutachten_zeit`, `konto_gutachten_abgeschlossen`, `created_at`, `updated_at`) VALUES - ('1', 'Architekt', 'Herr', 'Bruno', 'Kunz', 'Architekt Kunz', 'test@atrat.cc', 'Pradlerstraße 11', 'Innbsruck', '6020', 'Österreich', '0512 457328', 'ATU 234578', '1', NULL, NULL), - ('2', 'Architekt', 'Herr', 'Sepp', 'Unterlugauer', 'Architekt Unterlugauer', 'test2@atrat.cc', 'Seestraße 1', 'Innbsruck', '6020', 'Österreich', '0512 457328', 'ATU 234578', '1', NULL, NULL); + ('1', 'Architekt', 'Herr', 'Hanno', 'Vogl-Fernheim', 'Architekt Vogl-Fernheim', 'office@vogl-fernheim.eu', 'Richardsweg 1', 'Innsbruck', '6020', 'Österreich', '+43 0512 560303', 'ATU 61718733', '1', '1', '1', NULL, '1', NULL, NULL), + ('2', 'Staatl. bef. u. beeideter Ziviltechniker', 'Herr', 'Christoph', 'Falkner', 'Christoph Falkner', 'christophfalkner@me.com', 'Adele-Obermayr-Straße 2', 'Innsbruck', '6020', 'Österreich', '+43 650 92210248', 'ATU56874500', '1', '1', '1', NULL, '1', NULL, NULL); "; DB::unprepared($sql); } diff --git a/lang/vendor/filament-shield/de/filament-shield.php b/lang/vendor/filament-shield/de/filament-shield.php index 608a6e4..b36bf88 100644 --- a/lang/vendor/filament-shield/de/filament-shield.php +++ b/lang/vendor/filament-shield/de/filament-shield.php @@ -31,7 +31,7 @@ return [ |-------------------------------------------------------------------------- */ - 'nav.group' => 'Administration', + 'nav.group' => '', 'nav.role.icon' => 'heroicon-o-shield-check', 'nav.role.label' => 'Rollen', 'resource.label.role' => 'Rolle', diff --git a/resources/views/layouts/nav.blade.php b/resources/views/layouts/nav.blade.php index 42dc18e..708fc49 100644 --- a/resources/views/layouts/nav.blade.php +++ b/resources/views/layouts/nav.blade.php @@ -1,4 +1,4 @@ -