refactoring into clusters
This commit is contained in:
1 parent
042a5a8b58
commit
48deb69379
97 files changed
+186
-198
No files matched your search
@@ -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'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user