mail versand wip
This commit is contained in:
1 parent
e1f7729add
commit
ebdf2e396a
32 files changed
+496
-28
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MailVersands;
|
||||
|
||||
use App\Filament\Clusters\Newsletter\NewsletterCluster;
|
||||
use App\Filament\Resources\MailVersands\Pages\ListMailVersands;
|
||||
use App\Filament\Resources\MailVersands\Schemas\MailVersandForm;
|
||||
use App\Filament\Resources\MailVersands\Tables\MailVersandsTable;
|
||||
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\Resources\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Resources\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\Resources\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Resources\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\Resources\MailVersands\Pages;
|
||||
|
||||
use App\Filament\Resources\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,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\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')
|
||||
->required()
|
||||
->relationship(name: 'mail_gruppen', titleAttribute: 'name'),
|
||||
Select::make('mail_vorlage_id')
|
||||
->required()
|
||||
->relationship(name: 'mail_vorlage', titleAttribute: 'titel'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MailVersands\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
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')->dateTime()->label('Sende Zeitpunkt'),
|
||||
TextColumn::make('versand_am')->dateTime(),
|
||||
SelectColumn::make('status')
|
||||
->native(false)
|
||||
->disabled(fn ($record): bool => $record->ist_active ? true : false)
|
||||
->options([
|
||||
'wartend' => '<span class="text-blue-500">Wartend</span>',
|
||||
'versand' => '<span class="text-green-500">Mail Versand</span>',
|
||||
])
|
||||
->allowOptionsHtml(),
|
||||
ToggleColumn::make('ist_active')->onColor('success'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user