Gästeverzeichnis und Customer Voice
- Gäste: Markierungen, Aufenthalte & Umsatz, Stammgast-/Einwilligungsfilter, CSV-Export, Anonymisierung (manuell + automatisch nach Aufbewahrungsfrist) - Werbe-Einwilligung per Double-Opt-in aus dem Anfrageformular, signierte Bestätigungs-/Abmeldelinks - Bewertungen: automatische Einladung nach Abreise, Bewertungsformular mit Kategorien und internem Feedback, Freigabe und öffentliche Antwort im Admin - Konzept: Rollen, Inhalte, Customer Voice, Architektur Portal-Sync/Buchungshoheit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bb7eb62782
commit
2892e6aeab
44 files changed
+1505
-23
No files matched your search
@@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Guests\Pages\CreateGuest;
|
||||
use App\Filament\Resources\Guests\Pages\EditGuest;
|
||||
use App\Filament\Resources\Guests\Pages\ListGuests;
|
||||
use App\Filament\Resources\Guests\RelationManagers\BookingsRelationManager;
|
||||
use App\Filament\Resources\Guests\Schemas\GuestForm;
|
||||
use App\Filament\Resources\Guests\Tables\GuestsTable;
|
||||
use App\Models\Guest;
|
||||
@@ -44,7 +45,7 @@ public static function table(Table $table): Table
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
BookingsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\Guests\Pages;
|
||||
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Models\Guest;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
/**
|
||||
* @property Guest $record
|
||||
*/
|
||||
class EditGuest extends EditRecord
|
||||
{
|
||||
protected static string $resource = GuestResource::class;
|
||||
@@ -13,7 +20,19 @@ class EditGuest extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
Action::make('anonymize')
|
||||
->label('Anonymisieren')
|
||||
->icon(Heroicon::OutlinedEyeSlash)
|
||||
->color('danger')
|
||||
->visible(fn (): bool => $this->record->anonymized_at === null && (bool) auth()->user()?->hasRole(UserRole::Admin))
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Name, Kontaktdaten, Notizen und Nachrichten werden unwiderruflich entfernt (z. B. auf Löschwunsch nach DSGVO). Buchungen und Beträge bleiben für die Buchhaltung erhalten.')
|
||||
->action(function (): void {
|
||||
$this->record->anonymize();
|
||||
$this->refreshFormData(['first_name', 'last_name', 'email', 'phone', 'street', 'postal_code', 'city', 'notes', 'tags']);
|
||||
|
||||
Notification::make()->title('Gast anonymisiert')->success()->send();
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,13 @@
|
||||
namespace App\Filament\Resources\Guests\Pages;
|
||||
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
use App\Models\Guest;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class ListGuests extends ListRecords
|
||||
{
|
||||
@@ -13,7 +18,52 @@ class ListGuests extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('export')
|
||||
->label('Export (Excel/CSV)')
|
||||
->icon(Heroicon::OutlinedArrowDownTray)
|
||||
->color('gray')
|
||||
->schema([
|
||||
Toggle::make('consent_only')->label('Nur Gäste mit Einwilligung für Angebote'),
|
||||
])
|
||||
->action(fn (array $data): StreamedResponse => $this->export($data['consent_only'])),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Semicolon-separated UTF-8 with BOM so that Excel opens umlauts correctly.
|
||||
*/
|
||||
private function export(bool $consentOnly): StreamedResponse
|
||||
{
|
||||
$guests = Guest::query()
|
||||
->whereNull('anonymized_at')
|
||||
->when($consentOnly, fn ($query) => $query->withMarketingConsent())
|
||||
->withCount('bookings')
|
||||
->orderBy('last_name')
|
||||
->get();
|
||||
|
||||
return response()->streamDownload(function () use ($guests): void {
|
||||
$out = fopen('php://output', 'w');
|
||||
fwrite($out, "\xEF\xBB\xBF");
|
||||
fputcsv($out, ['Vorname', 'Nachname', 'E-Mail', 'Telefon', 'Straße', 'PLZ', 'Ort', 'Land', 'Markierungen', 'Buchungen', 'Einwilligung Angebote'], ';');
|
||||
|
||||
foreach ($guests as $guest) {
|
||||
fputcsv($out, [
|
||||
$guest->first_name,
|
||||
$guest->last_name,
|
||||
$guest->email,
|
||||
$guest->phone,
|
||||
$guest->street,
|
||||
$guest->postal_code,
|
||||
$guest->city,
|
||||
$guest->country,
|
||||
implode(', ', $guest->tags ?? []),
|
||||
$guest->bookings_count,
|
||||
$guest->marketing_consent_at?->format('d.m.Y'),
|
||||
], ';');
|
||||
}
|
||||
|
||||
fclose($out);
|
||||
}, 'gaeste-'.now()->format('Y-m-d').'.csv', ['Content-Type' => 'text/csv; charset=UTF-8']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Guests\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Models\Booking;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookingsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'bookings';
|
||||
|
||||
protected static ?string $title = 'Aufenthalte & Anfragen';
|
||||
|
||||
public function isReadOnly(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('reference')
|
||||
->columns([
|
||||
TextColumn::make('reference')->label('Nr.'),
|
||||
TextColumn::make('arrival')->label('Anreise')->date('d.m.Y'),
|
||||
TextColumn::make('departure')->label('Abreise')->date('d.m.Y'),
|
||||
TextColumn::make('guests')->label('Pers.'),
|
||||
TextColumn::make('status')->label('Status')->badge(),
|
||||
TextColumn::make('total')->label('Gesamt')->money('EUR', divideBy: 100, locale: 'de'),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make()->url(fn (Booking $record): string => BookingResource::getUrl('view', ['record' => $record])),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Guests\Schemas;
|
||||
|
||||
use App\Models\Guest;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class GuestForm
|
||||
@@ -12,21 +16,40 @@ class GuestForm
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(2)
|
||||
->columns(3)
|
||||
->components([
|
||||
TextInput::make('first_name')->label('Vorname')->required()->maxLength(255),
|
||||
TextInput::make('last_name')->label('Nachname')->required()->maxLength(255),
|
||||
TextInput::make('email')->label('E-Mail')->email()->required()->maxLength(255),
|
||||
TextInput::make('phone')->label('Telefon')->tel()->maxLength(50),
|
||||
TextInput::make('street')->label('Straße')->maxLength(255),
|
||||
TextInput::make('postal_code')->label('PLZ')->maxLength(20),
|
||||
TextInput::make('city')->label('Ort')->maxLength(255),
|
||||
Select::make('country')
|
||||
->label('Land')
|
||||
->options(['DE' => 'Deutschland', 'AT' => 'Österreich', 'CH' => 'Schweiz', 'NL' => 'Niederlande', 'DK' => 'Dänemark', 'PL' => 'Polen'])
|
||||
->default('DE')
|
||||
->required(),
|
||||
Textarea::make('notes')->label('Notizen')->columnSpanFull(),
|
||||
Section::make('Kontakt')
|
||||
->columnSpan(2)
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('first_name')->label('Vorname')->required()->maxLength(255),
|
||||
TextInput::make('last_name')->label('Nachname')->required()->maxLength(255),
|
||||
TextInput::make('email')->label('E-Mail')->email()->required()->maxLength(255),
|
||||
TextInput::make('phone')->label('Telefon')->tel()->maxLength(50),
|
||||
TextInput::make('street')->label('Straße')->maxLength(255),
|
||||
TextInput::make('postal_code')->label('PLZ')->maxLength(20),
|
||||
TextInput::make('city')->label('Ort')->maxLength(255),
|
||||
Select::make('country')
|
||||
->label('Land')
|
||||
->options(['DE' => 'Deutschland', 'AT' => 'Österreich', 'CH' => 'Schweiz', 'NL' => 'Niederlande', 'DK' => 'Dänemark', 'PL' => 'Polen'])
|
||||
->default('DE')
|
||||
->required(),
|
||||
]),
|
||||
Section::make('Verwaltung')
|
||||
->columnSpan(1)
|
||||
->schema([
|
||||
TagsInput::make('tags')
|
||||
->label('Markierungen')
|
||||
->suggestions(['Stammgast', 'Familie', 'Empfehlung', 'Nicht wieder vermieten']),
|
||||
TextEntry::make('marketing_consent_at')
|
||||
->label('Einwilligung Angebote per E-Mail')
|
||||
->state(fn (?Guest $record): string => $record?->marketing_consent_at ? 'bestätigt am '.$record->marketing_consent_at->format('d.m.Y') : 'keine'),
|
||||
TextEntry::make('anonymized_at')
|
||||
->label('Anonymisiert')
|
||||
->dateTime('d.m.Y')
|
||||
->visible(fn (?Guest $record): bool => $record?->anonymized_at !== null),
|
||||
Textarea::make('notes')->label('Notizen')->rows(5),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,54 @@
|
||||
|
||||
namespace App\Filament\Resources\Guests\Tables;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Models\Guest;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class GuestsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
$countedBookings = ['bookings' => fn (Builder $query): Builder => $query->whereIn('status', BookingStatus::occupying())];
|
||||
|
||||
return $table
|
||||
->defaultSort('last_name')
|
||||
->columns([
|
||||
TextColumn::make('last_name')
|
||||
->label('Name')
|
||||
->formatStateUsing(fn (Guest $record): string => "{$record->last_name}, {$record->first_name}")
|
||||
->searchable(['first_name', 'last_name'])
|
||||
->description(fn (Guest $record): string => $record->email)
|
||||
->searchable(['first_name', 'last_name', 'email'])
|
||||
->sortable(),
|
||||
TextColumn::make('email')->label('E-Mail')->searchable(),
|
||||
TextColumn::make('phone')->label('Telefon')->placeholder('–'),
|
||||
TextColumn::make('city')->label('Ort')->placeholder('–'),
|
||||
TextColumn::make('bookings_count')->label('Buchungen')->counts('bookings')->sortable(),
|
||||
TextColumn::make('created_at')->label('Seit')->date('m/Y')->sortable(),
|
||||
TextColumn::make('city')->label('Ort')->placeholder('–')->toggleable(),
|
||||
TextColumn::make('tags')->label('Markierungen')->badge(),
|
||||
TextColumn::make('bookings_count')->label('Aufenthalte')->counts($countedBookings)->sortable(),
|
||||
TextColumn::make('bookings_sum_total')->label('Umsatz')->sum($countedBookings, 'total')->money('EUR', divideBy: 100, locale: 'de')->sortable(),
|
||||
IconColumn::make('marketing_consent_at')->label('Angebote')->boolean()->getStateUsing(fn (Guest $record): bool => $record->marketing_consent_at !== null),
|
||||
])
|
||||
->filters([
|
||||
Filter::make('returning')
|
||||
->label('Stammgäste (ab 2 Aufenthalten)')
|
||||
->query(fn (Builder $query): Builder => $query->has('bookings', '>=', 2)),
|
||||
TernaryFilter::make('marketing_consent_at')
|
||||
->label('Einwilligung Angebote')
|
||||
->nullable(),
|
||||
SelectFilter::make('tag')
|
||||
->label('Markierung')
|
||||
->options(fn (): array => Guest::query()->whereNotNull('tags')->pluck('tags')->flatten()->unique()->sort()->mapWithKeys(fn (string $tag): array => [$tag => $tag])->all())
|
||||
->query(fn (Builder $query, array $data): Builder => $query->when($data['value'], fn (Builder $query, string $tag): Builder => $query->whereJsonContains('tags', $tag))),
|
||||
TernaryFilter::make('anonymized_at')
|
||||
->label('Anonymisierte anzeigen')
|
||||
->nullable()
|
||||
->default(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews\Pages;
|
||||
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateReview extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ReviewResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews\Pages;
|
||||
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditReview extends EditRecord
|
||||
{
|
||||
protected static string $resource = ReviewResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews\Pages;
|
||||
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListReviews extends ListRecords
|
||||
{
|
||||
protected static string $resource = ReviewResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews;
|
||||
|
||||
use App\Enums\ReviewStatus;
|
||||
use App\Filament\Resources\Reviews\Pages\CreateReview;
|
||||
use App\Filament\Resources\Reviews\Pages\EditReview;
|
||||
use App\Filament\Resources\Reviews\Pages\ListReviews;
|
||||
use App\Filament\Resources\Reviews\Schemas\ReviewForm;
|
||||
use App\Filament\Resources\Reviews\Tables\ReviewsTable;
|
||||
use App\Models\Review;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ReviewResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Review::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $modelLabel = 'Bewertung';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Bewertungen';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
$pending = Review::query()->where('status', ReviewStatus::Pending)->count();
|
||||
|
||||
return $pending > 0 ? (string) $pending : null;
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): string
|
||||
{
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ReviewForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ReviewsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListReviews::route('/'),
|
||||
'create' => CreateReview::route('/create'),
|
||||
'edit' => EditReview::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews\Schemas;
|
||||
|
||||
use App\Enums\ReviewStatus;
|
||||
use App\Models\Property;
|
||||
use App\Models\Review;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ReviewForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
$stars = [1 => '★', 2 => '★★', 3 => '★★★', 4 => '★★★★', 5 => '★★★★★'];
|
||||
|
||||
return $schema
|
||||
->columns(3)
|
||||
->components([
|
||||
Section::make('Bewertung')
|
||||
->columnSpan(2)
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('display_name')->label('Angezeigter Name')->required()->maxLength(80),
|
||||
DatePicker::make('stayed_on')->label('Aufenthalt'),
|
||||
Select::make('rating')->label('Gesamt')->options($stars)->required(),
|
||||
...collect(Review::CATEGORIES)->map(fn (string $label, string $field) => Select::make($field)->label($label)->options($stars))->values()->all(),
|
||||
TextInput::make('title')->label('Überschrift')->maxLength(120)->columnSpanFull(),
|
||||
Textarea::make('body')->label('Text')->rows(5)->columnSpanFull(),
|
||||
Textarea::make('private_feedback')
|
||||
->label('Nur für die Gastgeber')
|
||||
->rows(3)
|
||||
->disabled(fn (?Review $record): bool => $record?->source === 'website')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
Section::make('Freigabe')
|
||||
->columnSpan(1)
|
||||
->schema([
|
||||
Select::make('status')->label('Status')->options(ReviewStatus::class)->default(ReviewStatus::Approved)->required(),
|
||||
Toggle::make('publish_consent')
|
||||
->label('Gast hat Veröffentlichung erlaubt')
|
||||
->disabled(fn (?Review $record): bool => $record?->source === 'website'),
|
||||
TextInput::make('source')
|
||||
->label('Quelle')
|
||||
->helperText('„website“ = über den Bewertungslink. Bei übernommenen Bewertungen das Portal eintragen.')
|
||||
->default('manuell')
|
||||
->disabled(fn (?Review $record): bool => $record?->source === 'website')
|
||||
->required(),
|
||||
Select::make('property_id')
|
||||
->label('Wohnung')
|
||||
->options(fn (): array => Property::query()->pluck('name', 'id')->all())
|
||||
->default(fn (): ?int => Property::query()->value('id'))
|
||||
->required(),
|
||||
]),
|
||||
Section::make('Öffentliche Antwort der Gastgeber')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Textarea::make('response')->hiddenLabel()->rows(3)->placeholder('Optional – erscheint unter der Bewertung.'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Reviews\Tables;
|
||||
|
||||
use App\Enums\ReviewStatus;
|
||||
use App\Models\Review;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ReviewsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('created_at', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('rating')
|
||||
->label('Sterne')
|
||||
->formatStateUsing(fn (int $state): string => str_repeat('★', $state).str_repeat('☆', 5 - $state))
|
||||
->color('warning')
|
||||
->sortable(),
|
||||
TextColumn::make('display_name')
|
||||
->label('Gast')
|
||||
->description(fn (Review $record): ?string => $record->title)
|
||||
->searchable(['display_name', 'title', 'body']),
|
||||
TextColumn::make('status')->label('Status')->badge(),
|
||||
IconColumn::make('publish_consent')->label('Darf veröffentlicht werden')->boolean(),
|
||||
TextColumn::make('source')->label('Quelle'),
|
||||
TextColumn::make('stayed_on')->label('Aufenthalt')->date('m/Y')->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('status')->label('Status')->options(ReviewStatus::class),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('approve')
|
||||
->label('Freigeben')
|
||||
->icon(Heroicon::OutlinedCheck)
|
||||
->color('success')
|
||||
->visible(fn (Review $record): bool => $record->status !== ReviewStatus::Approved)
|
||||
->action(fn (Review $record) => $record->update(['status' => ReviewStatus::Approved])),
|
||||
Action::make('reject')
|
||||
->label('Ablehnen')
|
||||
->icon(Heroicon::OutlinedXMark)
|
||||
->color('gray')
|
||||
->visible(fn (Review $record): bool => $record->status === ReviewStatus::Pending)
|
||||
->action(fn (Review $record) => $record->update(['status' => ReviewStatus::Rejected])),
|
||||
EditAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user