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
@@ -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']);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user