refactoring into clusters
This commit is contained in:
1 parent
042a5a8b58
commit
48deb69379
97 files changed
+186
-198
No files matched your search
+55
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages\ListInhaltsverzeichnis;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Schemas\InhaltsverzeichnisForm;
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\Tables\InhaltsverzeichnisTable;
|
||||
use App\Models\Inhaltsverzeichnis;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class InhaltsverzeichnisResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Inhaltsverzeichnis::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-list';
|
||||
|
||||
protected static ?string $navigationLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $modelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Inhaltsverzeichnis';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return InhaltsverzeichnisForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return InhaltsverzeichnisTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListInhaltsverzeichnis::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateInhaltsverzeichnis extends CreateRecord
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditInhaltsverzeichnis extends EditRecord
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Inhaltsverzeichnis\InhaltsverzeichnisResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListInhaltsverzeichnis extends ListRecords
|
||||
{
|
||||
protected static string $resource = InhaltsverzeichnisResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->modalHeading('Kapitel hinzufügen')
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Schemas;
|
||||
|
||||
use App\Models\Inhaltselement;
|
||||
use App\Models\Textblock;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class InhaltsverzeichnisForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Überschrift')
|
||||
->tabs([
|
||||
Tab::make('Überschrift')
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('ueberschrift_verbergen')
|
||||
->label('Überschrift im Gutachten verbergen'),
|
||||
TextInput::make('name')
|
||||
->prefixIcon('phosphor-article')
|
||||
->required()
|
||||
->label('Überschrift')
|
||||
->columnSpan(2),
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->prefixIcon('phosphor-list-numbers')
|
||||
->placeholder('3.21')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->belowContent([
|
||||
'Bei "0" wird der Index nicht angezeigt',
|
||||
])
|
||||
->columnSpan(2),
|
||||
// TextInput::make('seite')
|
||||
// ->label('Seitenzahl')
|
||||
// ->numeric()
|
||||
// ->default(0)
|
||||
// ->belowContent([
|
||||
// 'Bei "0" wird die Seitenzahl automatisch generiert',
|
||||
// ])
|
||||
// ->columnSpan(1),
|
||||
Section::make('Benutzer Hilfe')
|
||||
->icon('phosphor-chat-text')
|
||||
->schema([
|
||||
TextInput::make('hilfe_titel')
|
||||
->aboveLabel([
|
||||
'Erklärungen des Inhalts beim Bearbeiten des Gutachtens',
|
||||
])
|
||||
->afterLabel(['optional'])
|
||||
->label('Überschrift')
|
||||
->columnSpanFull(),
|
||||
Textarea::make('hilfe_description')
|
||||
->afterLabel(['optional'])
|
||||
->label('Beschreibung'),
|
||||
FileUpload::make('hilfe_image')
|
||||
->afterLabel(['optional'])
|
||||
->image()
|
||||
->label('Bild')
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('gutachten_hilfe')
|
||||
->visibility('public')
|
||||
->columnSpanFull(),
|
||||
|
||||
])
|
||||
->secondary()
|
||||
->compact()
|
||||
->collapsed()
|
||||
->columnSpanFull(),
|
||||
])->columns(3),
|
||||
Tab::make('Inhaltselement')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('inhaltselement_id')
|
||||
->label('Inhaltselement')
|
||||
->prefixIcon('phosphor-table')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Inhaltselement::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
Tab::make('Textblock')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('textblock_id')
|
||||
->label('Textblock')
|
||||
// ->description('Ausgabe Textblock vor Tabelle')
|
||||
->prefixIcon('phosphor-article')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Textblock::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
])->vertical()->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Inhaltsverzeichnis\Tables;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class InhaltsverzeichnisTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->heading('Inhaltsverzeichnis')
|
||||
->description('Vorlage zum Erstellen von neuen Projekte. Das Inhaltsverzeichnis ist unterteilt in drei Abschnitte (Filter).')
|
||||
->columns([
|
||||
TextColumn::make('ordnungszahl')
|
||||
->label('Index')
|
||||
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
|
||||
IconColumn::make('neue_seite')
|
||||
->tooltip('Start neue Seite')
|
||||
->color('primary')
|
||||
->label('Start')
|
||||
->icon(fn (string $state): string => match ($state) {
|
||||
'1' => 'phosphor-file-plus',
|
||||
default => ''
|
||||
}),
|
||||
TextColumn::make('name')
|
||||
->color('primary')
|
||||
->label('Überschrift')
|
||||
->wrap(),
|
||||
TextColumn::make('inhaltselement.name')
|
||||
->label('Element')
|
||||
->wrap(),
|
||||
TextColumn::make('textblock.name')
|
||||
->wrap(),
|
||||
TextInputColumn::make('seite')
|
||||
->extraInputAttributes(['onClick' => 'this.select()'])
|
||||
->alignCenter()
|
||||
->tooltip('Bei 0 wird keine Seitenzahl ausgegeben.')
|
||||
->getStateUsing(fn ($record): string => $record->seite == 0 ? '' : $record->seite),
|
||||
])
|
||||
// ->paginated(false)
|
||||
->defaultPaginationPageOption(5)
|
||||
->persistFiltersInSession()
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(3)
|
||||
->filters([
|
||||
SelectFilter::make('part')
|
||||
->selectablePlaceholder(false)
|
||||
->default('standard')
|
||||
->label('Gutachten Komponenten')
|
||||
->options([
|
||||
'standard' => 'Gutachten Standard Texte',
|
||||
'nutzwerte' => 'Nutzwerberechnung',
|
||||
'paragraph' => 'Auszug Gutachten gem. §6',
|
||||
]),
|
||||
])
|
||||
// ], layout: FiltersLayout::AboveContent)
|
||||
->defaultSort('sort', direction: 'asc')
|
||||
->reorderable('sort')
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->hidden(fn ($record) => (bool) $record->no_edit),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Methodes\Pages\ListMethodes;
|
||||
use App\Filament\Clusters\Administration\Methodes\Schemas\MethodeForm;
|
||||
use App\Filament\Clusters\Administration\Methodes\Tables\MethodesTable;
|
||||
use App\Models\Methode;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class MethodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Methode::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-calculator';
|
||||
|
||||
protected static ?string $navigationLabel = 'Methode';
|
||||
|
||||
protected static ?string $modelLabel = 'Methode';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Methoden';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MethodeForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MethodesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMethodes::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMethode extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMethode extends EditRecord
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Methodes\MethodeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMethodes extends ListRecords
|
||||
{
|
||||
protected static string $resource = MethodeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->icon('phosphor-file-plus')
|
||||
// ->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MethodeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
RichEditor::make('description')
|
||||
->label('Beschreibung')
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Methodes\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class MethodesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->description);
|
||||
}),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Pages\ListOrientierungs;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Schemas\OrientierungForm;
|
||||
use App\Filament\Clusters\Administration\Orientierungs\Tables\OrientierungsTable;
|
||||
use App\Models\Orientierung;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class OrientierungResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Orientierung::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-compass';
|
||||
|
||||
protected static ?string $navigationLabel = 'Orientierung';
|
||||
|
||||
protected static ?string $modelLabel = 'Orientierung';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Orientierungen';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return OrientierungForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return OrientierungsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListOrientierungs::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('selectable', true)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateOrientierung extends CreateRecord
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditOrientierung extends EditRecord
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Orientierungs\OrientierungResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListOrientierungs extends ListRecords
|
||||
{
|
||||
protected static string $resource = OrientierungResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class OrientierungForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Orientierungs\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class OrientierungsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->color(fn ($record): string => match ($record->selectable) {
|
||||
0 => 'info',
|
||||
default => 'gray',
|
||||
}),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('seitig')
|
||||
->options([
|
||||
'1' => 'E I N S E I T I G',
|
||||
'2' => 'Z W E I S E I T I G',
|
||||
'3' => 'D R E I S E I T I G',
|
||||
'4' => 'V I E R S E I T I G',
|
||||
'5' => 'E X T R A S',
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePermission extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPermission extends EditRecord
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Permissions\PermissionResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPermissions extends ListRecords
|
||||
{
|
||||
protected static string $resource = PermissionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->icon('phosphor-file-plus')
|
||||
// ->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Permissions\Pages\ListPermissions;
|
||||
use App\Filament\Clusters\Administration\Permissions\Schemas\PermissionForm;
|
||||
use App\Filament\Clusters\Administration\Permissions\Tables\PermissionsTable;
|
||||
use App\Models\Permission;
|
||||
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 $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Benutzer';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Berechtigung';
|
||||
|
||||
protected static ?string $modelLabel = 'Berechtigung';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Berechtigungen';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PermissionForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return PermissionsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListPermissions::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class PermissionForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Permissions\Tables;
|
||||
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PermissionsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')->searchable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateTextblock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditTextblock extends EditRecord
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Administration\Textblocks\TextblockResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTextblocks extends ListRecords
|
||||
{
|
||||
protected static string $resource = TextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class TextblockForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Inhaltselement')
|
||||
->icon('phosphor-textbox')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Element Name')
|
||||
->afterLabel([
|
||||
'Wird im Gutachten nicht verwendet, dient nur zur Erkennen des Inhaltselements.',
|
||||
])
|
||||
->required(),
|
||||
RichEditor::make('textblock')
|
||||
->label('Abschnitt A')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
|
||||
])->floatingToolbars([
|
||||
'paragraph' => [
|
||||
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
|
||||
],
|
||||
'heading' => [
|
||||
'h1', 'h2', 'h3',
|
||||
],
|
||||
'table' => [
|
||||
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
|
||||
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
|
||||
'tableMergeCells', 'tableSplitCell',
|
||||
'tableToggleHeaderRow',
|
||||
'tableDelete',
|
||||
],
|
||||
]),
|
||||
RichEditor::make('textblock2')
|
||||
->label('Abschnitt B')
|
||||
->afterLabel([
|
||||
'Textblock uner der Überschrift.',
|
||||
])
|
||||
->belowContent([
|
||||
'Dieses Feld kann auch leer bleiben. Sollten im selben Punkt des Inhaltsvereichnisses auch eine Tabelle verwendet werden, dann wird dieser Text nach dieser angezeigt.',
|
||||
])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
|
||||
])->floatingToolbars([
|
||||
'paragraph' => [
|
||||
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
|
||||
],
|
||||
'heading' => [
|
||||
'h1', 'h2', 'h3',
|
||||
],
|
||||
'table' => [
|
||||
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
|
||||
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
|
||||
'tableMergeCells', 'tableSplitCell',
|
||||
'tableToggleHeaderRow',
|
||||
'tableDelete',
|
||||
],
|
||||
]),
|
||||
]),
|
||||
Tab::make('Benutzer Hilfe')
|
||||
->icon('phosphor-chat-text')
|
||||
->schema([
|
||||
TextInput::make('hilfe_titel')
|
||||
->aboveLabel([
|
||||
'Wird dem Benutzer bei der Bearbeitung dieses Inhaltselements angezeigt.',
|
||||
])
|
||||
->label('Überschrift')
|
||||
->columnSpanFull(),
|
||||
Textarea::make('hilfe_description')
|
||||
->label('Text'),
|
||||
FileUpload::make('hilfe_image')
|
||||
->image()
|
||||
->label('Bild')
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('gutachten_hilfe')
|
||||
->visibility('public')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
]),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks\Tables;
|
||||
|
||||
use App\Models\Textblock;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TextblocksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultPaginationPageOption(5)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->description(function ($record) {
|
||||
return view('pages.textblock')->with('record', $record);
|
||||
})
|
||||
->html(),
|
||||
])
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(3)
|
||||
->filters([
|
||||
SelectFilter::make('id')
|
||||
->label('Textblock')
|
||||
->preload()
|
||||
->default(1)
|
||||
->options(function (): array {
|
||||
return Textblock::pluck('name', 'id')->toArray();
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->persistFiltersInSession()
|
||||
->paginated(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Administration\Textblocks;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Pages\ListTextblocks;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Schemas\TextblockForm;
|
||||
use App\Filament\Clusters\Administration\Textblocks\Tables\TextblocksTable;
|
||||
use App\Models\Textblock;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class TextblockResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Textblock::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-article';
|
||||
|
||||
protected static ?string $navigationLabel = 'Textblöcke';
|
||||
|
||||
protected static ?string $modelLabel = 'Textblock';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Textblöcke';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return TextblockForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return TextblocksTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListTextblocks::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\Pages\ListMailAdressens;
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\Schemas\MailAdressenForm;
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\Tables\MailAdressensTable;
|
||||
use App\Filament\Clusters\Newsletter\NewsletterCluster;
|
||||
use App\Models\MailAdressen;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailAdressenResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MailAdressen::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $cluster = NewsletterCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserCircle;
|
||||
|
||||
protected static ?string $navigationLabel = 'Mail Adressen';
|
||||
|
||||
protected static ?string $modelLabel = 'Mail Adressen';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Mail Adressen';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MailAdressenForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MailAdressensTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMailAdressens::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\MailAdressenResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMailAdressen extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MailAdressenResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\MailAdressenResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMailAdressen extends EditRecord
|
||||
{
|
||||
protected static string $resource = MailAdressenResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailAdressens\MailAdressenResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMailAdressens extends ListRecords
|
||||
{
|
||||
protected static string $resource = MailAdressenResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class MailAdressenForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Newsletter')
|
||||
->columns(2)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
TextInput::make('company')
|
||||
->label('Firma')
|
||||
->required(),
|
||||
TextInput::make('email')
|
||||
->prefixIcon(Heroicon::OutlinedEnvelope)
|
||||
->required(),
|
||||
Select::make('mail_gruppen_id')
|
||||
->required()
|
||||
->label('Mail Gruppe')
|
||||
->relationship(name: 'mail_gruppen', titleAttribute: 'name'),
|
||||
Toggle::make('is_active'),
|
||||
]),
|
||||
Section::make('Persönliche Anrede')
|
||||
->columns(2)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Radio::make('anrede')
|
||||
->required()
|
||||
->options([
|
||||
'Höflich' => 'Höflich',
|
||||
'Freundschaftlich' => 'Freundschaftlich',
|
||||
]),
|
||||
Select::make('gender')
|
||||
->required()
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'0' => 'Herr',
|
||||
'1' => 'Frau',
|
||||
'2' => 'Diverse',
|
||||
]),
|
||||
DatePicker::make('vereidigung')->required()
|
||||
->prefixIcon('heroicon-o-calendar')
|
||||
->native(false),
|
||||
TextInput::make('first_name')
|
||||
->label('Vorname')
|
||||
->required(),
|
||||
TextInput::make('last_name')
|
||||
->label('Nachname')
|
||||
->required(),
|
||||
]),
|
||||
Section::make('Adresse')
|
||||
->columns(3)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
TextInput::make('address')
|
||||
->label('Straße'),
|
||||
TextInput::make('zip')
|
||||
->label('Zip'),
|
||||
TextInput::make('city')
|
||||
->label('Ort'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
// `address` varchar(255) DEFAULT NULL,
|
||||
// `zip` varchar(255) DEFAULT NULL,
|
||||
// `city` varchar(255) DEFAULT NULL,
|
||||
// `vereidigung` t
|
||||
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailAdressens\Tables;
|
||||
|
||||
use App\Models\MailAdressen;
|
||||
use App\Models\MailGruppen;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MailAdressensTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('vereidigung', direction: 'desc')
|
||||
->columns([
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktive')
|
||||
->alignCenter(),
|
||||
// TextColumn::make('anrede')
|
||||
// ->badge()
|
||||
// ->color(fn (string $state): string => match ($state) {
|
||||
// 'Höflich' => 'primary',
|
||||
// 'Freundschaftlich' => 'success',
|
||||
// default => 'gray',
|
||||
// }),
|
||||
// TextColumn::make('company')->label('Firma')
|
||||
// ->description(fn ($record): string => $record->first_name.' '.$record->last_name),
|
||||
TextColumn::make('gender')
|
||||
->label('Geschlecht')
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'0' => 'Herr',
|
||||
'1' => 'Frau',
|
||||
'2' => 'Diverse',
|
||||
}),
|
||||
TextColumn::make('first_name')->label('Vorname')->searchable(),
|
||||
TextColumn::make('last_name')->label('Nachname')->searchable(),
|
||||
TextColumn::make('email')->searchable(),
|
||||
TextColumn::make('vereidigung')->date()->sortable(),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('mail_gruppen_id')
|
||||
->columnSpanFull()
|
||||
->columns(5)
|
||||
->schema([
|
||||
Select::make('mail_gruppen_id')
|
||||
->hiddenLabel()
|
||||
->preload()
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (): array {
|
||||
return MailGruppen::pluck('name', 'id')->toArray();
|
||||
}),
|
||||
Toggle::make('is_active')->label('Aktive'),
|
||||
Select::make('gender')
|
||||
->selectablePlaceholder(false)
|
||||
->hiddenLabel()
|
||||
->preload()
|
||||
->default(0)
|
||||
->options([
|
||||
'0' => 'Alle',
|
||||
'women' => 'Frauen',
|
||||
'men' => 'Männer',
|
||||
]),
|
||||
DatePicker::make('vereidigung_von')->native(false)->hiddenLabel()->placeholder('Vereidigung von'),
|
||||
DatePicker::make('vereidigung_bis')->native(false)->hiddenLabel()->placeholder('Vereidigung bis'),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['mail_gruppen_id'],
|
||||
fn (Builder $query, $mail_gruppen_id): Builder => $query->where('mail_gruppen_id', $mail_gruppen_id),
|
||||
)->when(
|
||||
$data['is_active'],
|
||||
fn (Builder $query, $is_active): Builder => $query->where('is_active', $is_active),
|
||||
)->when(
|
||||
$data['gender'],
|
||||
function (Builder $query, $gender) {
|
||||
switch ($gender) {
|
||||
case 'women':
|
||||
return $query->where('gender', 1);
|
||||
case 'men':
|
||||
return $query->where('gender', 0);
|
||||
}
|
||||
}
|
||||
)->when(
|
||||
$data['vereidigung_von'],
|
||||
fn (Builder $query, $date): Builder => $query->whereDate('vereidigung', '>=', $date),
|
||||
)
|
||||
->when(
|
||||
$data['vereidigung_bis'],
|
||||
fn (Builder $query, $date): Builder => $query->whereDate('vereidigung', '<=', $date),
|
||||
);
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->persistFiltersInSession()
|
||||
->filtersResetActionPosition(null)
|
||||
->hiddenFilterIndicators()
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
Action::make('nach2022')
|
||||
->color('gray')
|
||||
->label('Nach 2022')
|
||||
->tooltip('Aktiviert alle Teilnehmer NACH dem 1. Jan. 2022')
|
||||
->action(function (): void {
|
||||
MailAdressen::where('vereidigung', '>', Carbon::create(2022, 1, 1, 0, 0, 0))
|
||||
->update(
|
||||
['is_active' => 1]
|
||||
);
|
||||
MailAdressen::where('vereidigung', '<', Carbon::create(2022, 1, 1, 0, 0, 0))
|
||||
->update(
|
||||
['is_active' => 0]
|
||||
);
|
||||
}),
|
||||
Action::make('vor2022')
|
||||
->color('gray')
|
||||
->label('Vor 2022')
|
||||
->tooltip('Aktiviert alle Teilnehmer VOR dem 1. Jan. 2022')
|
||||
->action(function (): void {
|
||||
MailAdressen::where('vereidigung', '>', Carbon::create(2022, 1, 1, 0, 0, 0))
|
||||
->update(
|
||||
['is_active' => 0]
|
||||
);
|
||||
MailAdressen::where('vereidigung', '<', Carbon::create(2022, 1, 1, 0, 0, 0))
|
||||
->update(
|
||||
['is_active' => 1]
|
||||
);
|
||||
}),
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('active')
|
||||
->label('Auswahl Aktivieren')
|
||||
->tooltip('Auswahl aktivieren')
|
||||
->icon('heroicon-o-play')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
/** @var object $record */
|
||||
MailAdressen::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_active' => 0]
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('deaktive')
|
||||
->color('primary')
|
||||
->label('Auswahl Deaktivieren')
|
||||
->tooltip('Auswahl deaktivieren')
|
||||
->icon('heroicon-o-stop')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
/** @var object $record */
|
||||
MailAdressen::where('id', '=', $record->id)
|
||||
->update(
|
||||
['is_active' => 1]
|
||||
);
|
||||
}
|
||||
}),
|
||||
DeleteBulkAction::make()->label('Auswahl Löschen'),
|
||||
])->label('Status'),
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('anrede_hoflich')
|
||||
->label('Auswahl Höflichkeitsform')
|
||||
->tooltip('Für ausgewählte Adressen Höflichkeitsform')
|
||||
->icon('heroicon-o-user-circle')
|
||||
->color('primary')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
/** @var object $record */
|
||||
MailAdressen::where('id', '=', $record->id)
|
||||
->update(
|
||||
['anrede' => 'Höflich']
|
||||
);
|
||||
}
|
||||
}),
|
||||
BulkAction::make('anrede_vertraulich')
|
||||
->label('Auswahl Freundschaftlich')
|
||||
->tooltip('Für ausgewählte Adressen freundschaftliche Anrede verwenden')
|
||||
->color('success')
|
||||
->icon('heroicon-o-user')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
/** @var object $record */
|
||||
MailAdressen::where('id', '=', $record->id)
|
||||
->update(
|
||||
['anrede' => 'Freundschaftlich']
|
||||
);
|
||||
}
|
||||
}),
|
||||
])->label('Anrede'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\Pages\ListMailGruppens;
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\Schemas\MailGruppenForm;
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\Tables\MailGruppensTable;
|
||||
use App\Filament\Clusters\Newsletter\NewsletterCluster;
|
||||
use App\Models\MailGruppen;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailGruppenResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MailGruppen::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $cluster = NewsletterCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserGroup;
|
||||
|
||||
protected static ?string $navigationLabel = 'Mail Gruppen';
|
||||
|
||||
protected static ?string $modelLabel = 'Mail Gruppe';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Mail Gruppen';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MailGruppenForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MailGruppensTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMailGruppens::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\MailGruppenResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMailGruppen extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MailGruppenResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\MailGruppenResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMailGruppen extends EditRecord
|
||||
{
|
||||
protected static string $resource = MailGruppenResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailGruppens\MailGruppenResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMailGruppens extends ListRecords
|
||||
{
|
||||
protected static string $resource = MailGruppenResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MailGruppenForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name'),
|
||||
TextInput::make('absender_name')->label('Absender Name'),
|
||||
TextInput::make('absender_mail')->label('Absender E-Mail'),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailGruppens\Tables;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailGruppensTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label('Betreff'),
|
||||
TextColumn::make('absender_name')->label('Absender Name'),
|
||||
TextColumn::make('absender_mail')
|
||||
->icon(Heroicon::Envelope)
|
||||
->iconColor('primary')
|
||||
->label('Absender E-Mail'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton()
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Adressen Gruppe')
|
||||
->modalDescription('Alle Mail Adressen die sich in dieser Gruppe befinden werden auch gelöscht. Dies kann nicht mehr rückgängig gemacht werden.')
|
||||
->modalSubmitActionLabel('Löschen'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\Pages\ListMailVersands;
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\Schemas\MailVersandForm;
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\Tables\MailVersandsTable;
|
||||
use App\Filament\Clusters\Newsletter\NewsletterCluster;
|
||||
use App\Models\MailVersand;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailVersandResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MailVersand::class;
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected static ?string $cluster = NewsletterCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPaperAirplane;
|
||||
|
||||
protected static ?string $navigationLabel = 'Mail Versand';
|
||||
|
||||
protected static ?string $modelLabel = 'Mail Versand';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Mail Versand';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MailVersandForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MailVersandsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMailVersands::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\MailVersandResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMailVersand extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MailVersandResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\MailVersandResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMailVersand extends EditRecord
|
||||
{
|
||||
protected static string $resource = MailVersandResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVersands\MailVersandResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMailVersands extends ListRecords
|
||||
{
|
||||
protected static string $resource = MailVersandResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MailVersandForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label('Benennung')->required(),
|
||||
DateTimePicker::make('sende_zeitpunkt')->native(false)->required(),
|
||||
Select::make('mail_gruppen_id')
|
||||
->label('Versand an Empfänger Grupper')
|
||||
->required()
|
||||
->relationship(name: 'mail_gruppen', titleAttribute: 'name'),
|
||||
Select::make('mail_vorlage_id')
|
||||
->required()
|
||||
->label('Vorlage für den Versand')
|
||||
->relationship(name: 'mail_vorlage', titleAttribute: 'titel'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVersands\Tables;
|
||||
|
||||
use App\Actions\SendMail\SendNewsletter;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailVersandsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Benennung'),
|
||||
SelectColumn::make('mail_gruppen_id')
|
||||
->optionsRelationship(name: 'mail_gruppen', titleAttribute: 'name')
|
||||
->label('Versand an Gruppe'),
|
||||
SelectColumn::make('mail_vorlage_id')
|
||||
->optionsRelationship(name: 'mail_vorlage', titleAttribute: 'titel')
|
||||
->label('Vorlage'),
|
||||
// TextColumn::make('sende_zeitpunkt')
|
||||
// ->alignCenter()
|
||||
// ->since()
|
||||
// ->badge()
|
||||
// ->dateTimeTooltip()
|
||||
// ->label('Sende Zeitpunkt'),
|
||||
// TextColumn::make('versand_am')
|
||||
// ->alignCenter()
|
||||
// ->since()
|
||||
// ->badge()
|
||||
// ->dateTimeTooltip(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()
|
||||
->tooltip('Newsletter Einstellungen'),
|
||||
Action::make('sendmail')
|
||||
->tooltip('Sende Jetzt')
|
||||
->modalHeading('Newsletter Versand')
|
||||
->icon('heroicon-o-paper-airplane')
|
||||
->modalDescription('E-Mails werden gelisted und zum gewählten Datum versandt.')
|
||||
->requiresConfirmation()
|
||||
->modalSubmitActionLabel('Senden')
|
||||
->iconButton()
|
||||
->modalIcon('heroicon-o-paper-airplane')
|
||||
->action(fn ($record) => SendNewsletter::mailit($record)),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\Pages\ListMailVorlages;
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\Schemas\MailVorlageForm;
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\Tables\MailVorlagesTable;
|
||||
use App\Filament\Clusters\Newsletter\NewsletterCluster;
|
||||
use App\Models\MailVorlage;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MailVorlageResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MailVorlage::class;
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static ?string $cluster = NewsletterCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentText;
|
||||
|
||||
protected static ?string $navigationLabel = 'Mail Vorlagen';
|
||||
|
||||
protected static ?string $modelLabel = 'Mail Vorlagen';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Mail Vorlagen';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return MailVorlageForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return MailVorlagesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMailVorlages::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\MailVorlageResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMailVorlage extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MailVorlageResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\MailVorlageResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMailVorlage extends EditRecord
|
||||
{
|
||||
protected static string $resource = MailVorlageResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages\Pages;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\MailVorlages\MailVorlageResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListMailVorlages extends ListRecords
|
||||
{
|
||||
protected static string $resource = MailVorlageResource::class;
|
||||
|
||||
// protected function getTableRecordsPerPageSelectOptions(): array
|
||||
// {
|
||||
// return [1];
|
||||
// }
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class MailVorlageForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('titel')
|
||||
->suffix('Nur zur Kennung')
|
||||
->required(),
|
||||
TextInput::make('subjekt')
|
||||
->label('Betreff')
|
||||
->required(),
|
||||
RichEditor::make('inhalt')
|
||||
->required()
|
||||
->aboveContent(new HtmlString('<div class="text-xs text-blue-600">Im Text können <b>Vornamen</b>, <b>Nachnamen</b> und <b>Herr/Frau</b> des Empfänger/der Empfängerin mit den Platzhaltern ###vorname###, ###nachname### und ###geschlecht### ersetzen werden. <br><br></div>'))
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'code', 'small', 'highlight'],
|
||||
['undo', 'redo'],
|
||||
]),
|
||||
RichEditor::make('unterschrift')
|
||||
->toolbarButtons([
|
||||
['bold', 'italic'],
|
||||
['undo', 'redo'],
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Newsletter\MailVorlages\Tables;
|
||||
|
||||
use App\Models\MailVorlage;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Support\Enums\TextSize;
|
||||
use Filament\Tables\Columns\Layout\Split;
|
||||
use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class MailVorlagesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Split::make([
|
||||
Stack::make([
|
||||
TextColumn::make('subjekt')
|
||||
->size(TextSize::Medium),
|
||||
TextColumn::make('inhalt')
|
||||
->label('E-Mail Vorlage')
|
||||
->extraAttributes(['class' => 'tiptap'])
|
||||
->markdown()
|
||||
->wrap(),
|
||||
TextColumn::make('unterschrift')
|
||||
->markdown(),
|
||||
])->space(10),
|
||||
]),
|
||||
])
|
||||
->paginated(false)
|
||||
->filters([
|
||||
Filter::make('vorlagen_id')
|
||||
->schema([
|
||||
Select::make('vorlagen_id')
|
||||
->searchable()
|
||||
->hiddenLabel()
|
||||
->preload()
|
||||
->default(1)
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (): array {
|
||||
return MailVorlage::pluck('titel', 'id')->toArray();
|
||||
}),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['vorlagen_id'],
|
||||
fn (Builder $query, $vorlagen_id): Builder => $query->where('id', $vorlagen_id),
|
||||
);
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->persistFiltersInSession()
|
||||
->filtersResetActionPosition(null)
|
||||
->hiddenFilterIndicators()
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Projekte;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
|
||||
class ProjekteCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-drafting-compass';
|
||||
|
||||
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Start;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\Pages\ListAuftraggebers;
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\Schemas\AuftraggeberForm;
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\Tables\AuftraggebersTable;
|
||||
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
|
||||
use App\Models\Auftraggeber;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class AuftraggeberResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Auftraggeber::class;
|
||||
|
||||
protected static ?string $cluster = VerwaltungCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-square-user';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Auftraggeber';
|
||||
|
||||
protected static ?string $modelLabel = 'Auftraggeber';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Auftraggeber';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return AuftraggeberForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return AuftraggebersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListAuftraggebers::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\AuftraggeberResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAuftraggeber extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AuftraggeberResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\AuftraggeberResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAuftraggeber extends EditRecord
|
||||
{
|
||||
protected static string $resource = AuftraggeberResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Auftraggebers\AuftraggeberResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListAuftraggebers extends ListRecords
|
||||
{
|
||||
protected static string $resource = AuftraggeberResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
|
||||
|
||||
class AuftraggeberForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Kontaktperson')
|
||||
->icon('lucide-contact')
|
||||
->inlineLabel()
|
||||
->schema([
|
||||
TextInput::make('company')
|
||||
->label('Firma')
|
||||
->belowContent([
|
||||
'Kann als Platzhalter "###AUFTRAGGEBER###" im Gutachten verwendet werden.',
|
||||
])
|
||||
->required(),
|
||||
TextInput::make('title')
|
||||
->label('Titel'),
|
||||
Select::make('gender')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
]),
|
||||
TextInput::make('name')
|
||||
->label('Name'),
|
||||
TextInput::make('email')
|
||||
->label('E-Mail')
|
||||
->prefixIcon(Heroicon::Envelope),
|
||||
PhoneInput::make('phone')
|
||||
->label('Telefon')
|
||||
->defaultCountry('AT'),
|
||||
]),
|
||||
Tab::make('Name am Deckblatt')
|
||||
->icon('lucide-contact')
|
||||
->schema([
|
||||
Checkbox::make('text_anzeigen')
|
||||
->label('Diesen Text am Deckblatt des Gutachtens verwenden'),
|
||||
RichEditor::make('referenz_formatting')
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto; white-wrap: pre-wrap;'])
|
||||
->json()
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'clearFormatting'],
|
||||
])
|
||||
->label('Firmenname mit Adresse')
|
||||
->required(),
|
||||
]),
|
||||
Tab::make('Logo')
|
||||
->icon('phosphor-image')
|
||||
->schema([
|
||||
Checkbox::make('logo_anzeigen')
|
||||
->label('Das Logo im Gutachten verwenden'),
|
||||
FileUpload::make('logo')
|
||||
->image()
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('auftraggeber-logo')
|
||||
->visibility('public')
|
||||
->label('Logo')
|
||||
->columnSpanFull(),
|
||||
])->columns(2),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Auftraggebers\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class AuftraggebersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('logo')->disk('public'),
|
||||
TextColumn::make('company')->label('Firma')->searchable()->wrap(),
|
||||
TextColumn::make('email')->copyable()->label('E-Mail')->searchable()->wrap(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\Pages\ListGutachters;
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\Schemas\GutachterForm;
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\Tables\GutachtersTable;
|
||||
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
|
||||
use App\Models\Gutachter;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class GutachterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Gutachter::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $cluster = VerwaltungCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-stamp';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'company';
|
||||
|
||||
protected static ?string $navigationLabel = 'Gutachter';
|
||||
|
||||
protected static ?string $modelLabel = 'Gutachter';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Gutachter';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return GutachterForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return GutachtersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListGutachters::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\GutachterResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGutachter extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GutachterResource::class;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\GutachterResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditGutachter extends EditRecord
|
||||
{
|
||||
protected static string $resource = GutachterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Gutachters\GutachterResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListGutachters extends ListRecords
|
||||
{
|
||||
protected static string $resource = GutachterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters\Schemas;
|
||||
|
||||
use App\Actions\Helper\ShowHelp;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
|
||||
|
||||
class GutachterForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Gutachter')
|
||||
->icon('lucide-stamp')
|
||||
->inlineLabel()
|
||||
->schema([
|
||||
TextInput::make('company')
|
||||
->belowContent([
|
||||
'Kann als Platzhalter "###GUTACHTER###" im Gutachten verwendet werden.',
|
||||
])
|
||||
->label('Firma')
|
||||
->required(),
|
||||
TextInput::make('title')
|
||||
->label('Title')
|
||||
->required(),
|
||||
Select::make('gender')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required(),
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->required(),
|
||||
TextInput::make('email')
|
||||
->label('E-Mail')
|
||||
->required()
|
||||
->prefixIcon(Heroicon::Envelope),
|
||||
PhoneInput::make('phone')
|
||||
->label('Telefon')
|
||||
->defaultCountry('AT'),
|
||||
]),
|
||||
Tab::make('Logo')
|
||||
->icon('phosphor-image')
|
||||
->schema([
|
||||
Checkbox::make('logo_anzeigen')
|
||||
->label('Das Logo im Gutachten verwenden')
|
||||
->columnSpanFull()
|
||||
->live(),
|
||||
FileUpload::make('logo')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('gutachter-logo')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->visibility('public')
|
||||
->label('Logo')
|
||||
->afterLabel([ShowHelp::show('logo_am_deckblatt')])
|
||||
->columnSpanFull(),
|
||||
Radio::make('logo_align')
|
||||
->Label('Position')
|
||||
->default('right')
|
||||
->options([
|
||||
'left' => 'Links',
|
||||
'center' => 'Zentriert',
|
||||
'right' => 'Rechts',
|
||||
]),
|
||||
TextInput::make('logo_height')
|
||||
->hidden(fn (Get $get): bool => ! $get('logo_anzeigen'))
|
||||
->belowLabel('190mm ist die halbe Breite der Seite')
|
||||
->numeric()
|
||||
->default(70)
|
||||
->minValue(20)
|
||||
->maxValue(100)
|
||||
->label('Logo Breite')
|
||||
->required()
|
||||
->suffix('mm'),
|
||||
])->columns(2),
|
||||
Tab::make('Anzeige am Deckblatt')
|
||||
->icon('lucide-contact')
|
||||
->schema([
|
||||
Checkbox::make('text_anzeigen')
|
||||
->label('Diesen Text anzeigen')
|
||||
->columnSpanFull(),
|
||||
RichEditor::make('referenz_formatting')
|
||||
->json()
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'clearFormatting'],
|
||||
['h3', 'alignStart', 'alignCenter', 'alignEnd', 'textColor'],
|
||||
])
|
||||
->textColors([
|
||||
'#fb2c36' => 'Rot',
|
||||
'#ff6900' => 'Orange',
|
||||
'#fe9a00' => 'Bernstein',
|
||||
'#f0b100' => 'Gelb',
|
||||
'#7ccf00' => 'Limette',
|
||||
'#00c950' => 'Grün',
|
||||
'#00bc7d' => 'Smaragd',
|
||||
'#00bba7' => 'Blaugrün',
|
||||
'#00b8db' => 'Cyan',
|
||||
'#00a6f4' => 'Himmelblau',
|
||||
'#2b7fff' => 'Blau',
|
||||
'#615fff' => 'Indigo',
|
||||
'#8e51ff' => 'Violett',
|
||||
'#ad46ff' => 'Lila',
|
||||
'#e12afb' => 'Fuchisa',
|
||||
'#f6339a' => 'Rosa',
|
||||
'#ff2056' => 'Rose',
|
||||
'#a6a09b' => 'Hellgrau',
|
||||
'#314158' => 'Dunkelgrau',
|
||||
])
|
||||
->label('Gutachter am Deckblatt')
|
||||
->afterLabel([ShowHelp::show('gutachter_am_deckblatt')])
|
||||
->required(),
|
||||
]),
|
||||
|
||||
Tab::make('digitale_signatur')
|
||||
->label('Digitale Signatur')
|
||||
->icon('phosphor-stamp')
|
||||
->schema([
|
||||
FileUpload::make('digitale_signatur_stempel')
|
||||
->label('Bild vom Stempel')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('gutachter-stempel')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->visibility('public'),
|
||||
])->columns(2),
|
||||
Tab::make('Farben')
|
||||
->icon('phosphor-palette')
|
||||
->schema([
|
||||
ColorPicker::make('deckblatt_bg')->label('Deckblatt')
|
||||
->belowContent('Farbe des Hintergrundes'),
|
||||
ColorPicker::make('schmuckfarbe_header')->label('Überschriften')
|
||||
->belowContent('Farbe des Hintergrundes'),
|
||||
ColorPicker::make('farbe_borders')->label('Rahmen')
|
||||
->belowContent('Farbe von Rahmen und Begrenzungen'),
|
||||
])->columns(2),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Gutachters\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class GutachtersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('logo')->disk('public'),
|
||||
TextColumn::make('company')->label('Firmenmame')->searchable(),
|
||||
// TextColumn::make('gender')->label('Geschlecht'),
|
||||
// TextColumn::make('title')->label('Title'),
|
||||
// TextColumn::make('name')->searchable(),
|
||||
ImageColumn::make('digitale_signatur_stempel')
|
||||
->alignCenter()
|
||||
->label('Digitale Signatur')
|
||||
->disk('public'),
|
||||
TextColumn::make('email')->copyable()->label('E-Mail')->searchable(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Clusters\Verwaltung\Helps\Pages\ListHelps;
|
||||
use App\Filament\Clusters\Verwaltung\Helps\Schemas\HelpForm;
|
||||
use App\Filament\Clusters\Verwaltung\Helps\Tables\HelpsTable;
|
||||
use App\Models\Help;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class HelpResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Help::class;
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Hilfen';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-question';
|
||||
|
||||
protected static ?string $navigationLabel = 'Hilfe';
|
||||
|
||||
protected static ?string $modelLabel = 'Hilfe';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Hilfen';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return HelpForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return HelpsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListHelps::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Helps\HelpResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateHelp extends CreateRecord
|
||||
{
|
||||
protected static string $resource = HelpResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Helps\HelpResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditHelp extends EditRecord
|
||||
{
|
||||
protected static string $resource = HelpResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Helps\HelpResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListHelps extends ListRecords
|
||||
{
|
||||
protected static string $resource = HelpResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class HelpForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('kennung'),
|
||||
TextInput::make('titel'),
|
||||
Textarea::make('description'),
|
||||
FileUpload::make('image')
|
||||
->image()
|
||||
->label('Bild')
|
||||
->preserveFilenames()
|
||||
->disk('public')
|
||||
->maxSize(3072) // 3MB limit
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->directory('gutachten_hilfe')
|
||||
->visibility('public')
|
||||
->columnSpanFull(),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Helps\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class HelpsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('kennung')->badge()->searchable(),
|
||||
TextColumn::make('titel'),
|
||||
ImageColumn::make('image')->disk('public'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\Pages\ListKontoTextblocks;
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\Schemas\KontoTextblockForm;
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\Tables\KontoTextblocksTable;
|
||||
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
|
||||
use App\Models\KontoTextblock;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class KontoTextblockResource extends Resource
|
||||
{
|
||||
protected static ?string $model = KontoTextblock::class;
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-article';
|
||||
|
||||
protected static ?string $cluster = VerwaltungCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Eigene Textblöcke';
|
||||
|
||||
protected static ?string $modelLabel = 'Textblock';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Textblöcke';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return KontoTextblockForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return KontoTextblocksTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListKontoTextblocks::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\KontoTextblockResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateKontoTextblock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = KontoTextblockResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\KontoTextblockResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditKontoTextblock extends EditRecord
|
||||
{
|
||||
protected static string $resource = KontoTextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\KontoTextblocks\KontoTextblockResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListKontoTextblocks extends ListRecords
|
||||
{
|
||||
protected static string $resource = KontoTextblockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class KontoTextblockForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
// Textarea::make('beschreibung'),
|
||||
RichEditor::make('textblock')
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\KontoTextblocks\Tables;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class KontoTextblocksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultPaginationPageOption(5)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->textblock);
|
||||
})
|
||||
->html(),
|
||||
TextColumn::make('created_at')
|
||||
->label('Erstellt')
|
||||
->dateTime('M j, Y'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\Pages\ListKontos;
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\Schemas\KontoForm;
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\Tables\KontosTable;
|
||||
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
|
||||
use App\Models\Konto;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class KontoResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Konto::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-landmark';
|
||||
|
||||
protected static ?string $cluster = VerwaltungCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Konto';
|
||||
|
||||
protected static ?string $modelLabel = 'Konto';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Konto';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return KontoForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return KontosTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListKontos::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('id', auth()->user()->konto_id);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->where('id', auth()->user()->konto_id)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\KontoResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateKonto extends CreateRecord
|
||||
{
|
||||
protected static string $resource = KontoResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\KontoResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditKonto extends EditRecord
|
||||
{
|
||||
protected static string $resource = KontoResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Kontos\KontoResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListKontos extends ListRecords
|
||||
{
|
||||
protected static string $resource = KontoResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('agb')
|
||||
->label('AGB\'s')
|
||||
->icon('phosphor-paragraph')
|
||||
->modalContent(view('pages.agb'))
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(fn (Action $action) => $action->label('Schließen')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos\Schemas;
|
||||
|
||||
use App\Models\Konto;
|
||||
use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
|
||||
|
||||
class KontoForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Rechnungsdaten')
|
||||
->icon('lucide-file-pen-line')
|
||||
->inlineLabel()
|
||||
->schema([
|
||||
TextInput::make('company')
|
||||
->label('Firma/Inhaber')
|
||||
->required(),
|
||||
TextInput::make('uid_number')
|
||||
->label('UID Nummer')
|
||||
->rules([new VatNumber])
|
||||
->required(),
|
||||
RichEditor::make('address')->toolbarButtons([
|
||||
['bold', 'italic', 'underline', 'subscript', 'superscript'],
|
||||
])
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->label('Adresse')
|
||||
->required(),
|
||||
])->columnSpanFull(),
|
||||
Tab::make('Kontaktperson')
|
||||
->icon('lucide-contact')
|
||||
->inlineLabel()
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label('Title')
|
||||
->required(),
|
||||
Select::make('gender')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required(),
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->required(),
|
||||
TextInput::make('email')
|
||||
->label('E-Mail')
|
||||
->unique(table: Konto::class)
|
||||
->required()
|
||||
->prefixIcon(Heroicon::Envelope),
|
||||
PhoneInput::make('phone')
|
||||
->label('Telefon')
|
||||
->defaultCountry('AT'),
|
||||
])->columnSpanFull(),
|
||||
// Tab::make('Guthaben')
|
||||
// ->icon('lucide-euro')
|
||||
// ->inlineLabel()
|
||||
// ->schema([
|
||||
// TextInput::make('guthaben')
|
||||
// ->numeric()
|
||||
// ->minValue(1)
|
||||
// ->maxValue(100)
|
||||
// ->label('Guthaben laden')
|
||||
// ->prefixIcon('lucide-coins'),
|
||||
// ])->columnSpanFull(),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Kontos\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\TextSize;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class KontosTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('company')->label('Firma')
|
||||
->size(TextSize::Large)
|
||||
->weight(FontWeight::Bold)
|
||||
->description(fn ($record): HtmlString => new HtmlString($record->address)),
|
||||
TextColumn::make('guthaben')
|
||||
->size(TextSize::Large)
|
||||
->weight(FontWeight::Bold)
|
||||
->color('primary')
|
||||
->description('Gutachten')
|
||||
->alignCenter(),
|
||||
TextColumn::make('abgeschlossen')
|
||||
->size(TextSize::Large)
|
||||
->weight(FontWeight::Bold)
|
||||
->color('success')
|
||||
->description('Gutachten')
|
||||
->alignCenter(),
|
||||
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
// Action::make('Guthaben laden')
|
||||
// ->iconButton()
|
||||
// ->color('gray')
|
||||
// ->icon('heroicon-o-credit-card')
|
||||
// ->schema([
|
||||
// TextInput::make('subject')->required(),
|
||||
// RichEditor::make('body')->required(),
|
||||
// ])
|
||||
// ->action(function (array $data) {}),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Users\UserResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUser extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Users\UserResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUser extends EditRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Pages;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Users\UserResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Schemas\Components\Section;
|
||||
|
||||
class ListUsers extends ListRecords
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('inviteUser')
|
||||
->label('Einladen')
|
||||
->icon('phosphor-envelope')
|
||||
->form([
|
||||
Section::make('Jemanden einladen')
|
||||
->icon('lucide-user')
|
||||
->description('Nur mit dieser Einladung können sich weitere Benutzer bei diesem Konto registrieren.')
|
||||
->schema([
|
||||
TextInput::make('email')
|
||||
->label('E-Mail')
|
||||
->prefixIcon('phosphor-envelope')
|
||||
->email()
|
||||
->required()
|
||||
->belowContent('Die Einladung ist 12 Stunden gültig.'),
|
||||
]),
|
||||
])
|
||||
->action(function ($data) {
|
||||
$invitation = Invitation::create([
|
||||
'knoto_id' => auth()->user()->konto_id,
|
||||
'email' => $data['email'],
|
||||
]);
|
||||
|
||||
// @todo Add email sending here
|
||||
|
||||
Notification::make('invitedSuccess')
|
||||
->body('Der Benutzer wurde erfolgreich eingelanden!')
|
||||
->success()->send();
|
||||
}),
|
||||
CreateAction::make()
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false)
|
||||
->mutateDataUsing(function (array $data): array {
|
||||
$data['konto_id'] = auth()->user()->konto_id;
|
||||
|
||||
return $data;
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Schemas;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
class UserForm
|
||||
{
|
||||
public User $user;
|
||||
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Benutzerkonto')
|
||||
->icon('lucide-user')
|
||||
->schema([
|
||||
Select::make('gender')
|
||||
->prefixIcon('phosphor-gender-neuter')
|
||||
->label('Geschlecht')
|
||||
->options([
|
||||
'Herr' => 'Herr',
|
||||
'Frau' => 'Frau',
|
||||
'Non-binary' => 'Non-binary',
|
||||
])
|
||||
->required(),
|
||||
TextInput::make('name')
|
||||
->prefixIcon('phosphor-user')
|
||||
->required(),
|
||||
TextInput::make('email')->email()
|
||||
->required()
|
||||
->prefixIcon('phosphor-envelope')
|
||||
->label('E-Mail'),
|
||||
TextInput::make('password')
|
||||
->label('Passwort')
|
||||
->password()
|
||||
->revealable()
|
||||
->prefixIcon('phosphor-lock')
|
||||
->dehydrated(fn ($state): bool => filled($state))
|
||||
->dehydrateStateUsing(fn ($state): string => Hash::make($state))
|
||||
->same('password_confirmation')
|
||||
->rule(Password::min(8)
|
||||
->mixedCase()
|
||||
->numbers()
|
||||
->symbols()
|
||||
->uncompromised())
|
||||
->label('Password'),
|
||||
TextInput::make('password_confirmation')
|
||||
->label('Passwort Bestätigen')
|
||||
->prefixIcon('phosphor-lock')
|
||||
->password()
|
||||
->dehydrated(false)
|
||||
->same('password')
|
||||
->revealable(),
|
||||
Checkbox::make('agb_akzeptiert')
|
||||
->default(false)
|
||||
->label('Allgemeinen Geschäftsbedinnungen akzeptieren')
|
||||
->accepted()
|
||||
->validationMessages([
|
||||
'accepted' => 'Das Akzeptieren der Allgemeinen Geschäftsbedingungen ist erforderlich.',
|
||||
]),
|
||||
Select::make('roles')
|
||||
->label('Rollen')
|
||||
->prefixIcon('phosphor-gear')
|
||||
->aboveContent('Nur für SuperAdmin sichtbare')
|
||||
->visible(fn () => auth()->user()->hasRole('super_admin'))
|
||||
->relationship('roles', 'name')
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
]),
|
||||
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UsersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('gender')->label('Geschlecht'),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('konto.company')->badge()->searchable(),
|
||||
TextColumn::make('email')->copyable()->label('E-Mail'),
|
||||
IconColumn::make('agb_akzeptiert')
|
||||
->searchable()
|
||||
->label('AGB')
|
||||
->boolean()
|
||||
->trueIcon(Heroicon::OutlinedCheckBadge)
|
||||
->falseIcon(Heroicon::OutlinedXMark),
|
||||
])
|
||||
->filters([
|
||||
TrashedFilter::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Verwaltung\Users;
|
||||
|
||||
use App\Filament\Clusters\Verwaltung\Users\Pages\ListUsers;
|
||||
use App\Filament\Clusters\Verwaltung\Users\Schemas\UserForm;
|
||||
use App\Filament\Clusters\Verwaltung\Users\Tables\UsersTable;
|
||||
use App\Filament\Clusters\Verwaltung\VerwaltungCluster;
|
||||
use App\Models\User;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
protected static ?string $model = User::class;
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected static ?string $cluster = VerwaltungCluster::class;
|
||||
|
||||
// protected static bool $shouldSkipAuthorization = true;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-user-pen';
|
||||
|
||||
protected static ?string $navigationLabel = 'Benutzer';
|
||||
|
||||
protected static ?string $modelLabel = 'Benutzer';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Benutzer';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UserForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return UsersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListUsers::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getRecordRouteBindingEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
if (auth()->user()->super_admin) {
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id);
|
||||
} else {
|
||||
return parent::getEloquentQuery()->where('super_admin', false)->where('konto_id', auth()->user()->konto_id);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
if (auth()->user()->super_admin) {
|
||||
return parent::getEloquentQuery()->where('konto_id', auth()->user()->konto_id)->count();
|
||||
} else {
|
||||
return parent::getEloquentQuery()->where('super_admin', false)->where('konto_id', auth()->user()->konto_id)->count();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user