Zentralen Belegungsplan und plattformuebergreifende Buchungs- und Gaesteverwaltung integrieren
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m41s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m41s
This commit is contained in:
1 parent
c74199e978
commit
f369018a68
41 files changed
+1343
-157
No files matched your search
@@ -33,7 +33,7 @@ class GuestResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'last_name';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Guests\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Models\Booking;
|
||||
use Filament\Actions\ViewAction;
|
||||
use App\Filament\Resources\Bookings\Tables\BookingsTable;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookingsRelationManager extends RelationManager
|
||||
@@ -22,18 +19,6 @@ public function isReadOnly(): bool
|
||||
|
||||
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])),
|
||||
]);
|
||||
return BookingsTable::configure($table, $this->getOwnerRecord()->id);
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,8 @@ public static function configure(Schema $schema): Schema
|
||||
->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('last_name')->label('Nachname')->maxLength(255)->dehydrateStateUsing(fn (?string $state): string => $state ?? ''),
|
||||
TextInput::make('email')->label('E-Mail')->email()->maxLength(255)->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? $state : null)->helperText('Bei Portalgästen gegebenenfalls noch unbekannt. Keine Ersatzadresse eintragen.'),
|
||||
TextInput::make('phone')->label('Telefon')->tel()->maxLength(50),
|
||||
TextInput::make('street')->label('Straße')->maxLength(255),
|
||||
TextInput::make('postal_code')->label('PLZ')->maxLength(20),
|
||||
|
||||
@@ -20,25 +20,26 @@ public static function configure(Table $table): Table
|
||||
$countedBookings = ['bookings' => fn (Builder $query): Builder => $query->whereIn('status', BookingStatus::occupying())];
|
||||
|
||||
return $table
|
||||
->modifyQueryUsing(fn (Builder $query): Builder => $query->withCount('portalStays'))
|
||||
->defaultSort('last_name')
|
||||
->columns([
|
||||
TextColumn::make('last_name')
|
||||
->label('Name')
|
||||
->formatStateUsing(fn (Guest $record): string => "{$record->last_name}, {$record->first_name}")
|
||||
->description(fn (Guest $record): string => $record->email)
|
||||
->formatStateUsing(fn (Guest $record): string => $record->full_name)
|
||||
->description(fn (Guest $record): string => $record->email ?? 'E-Mail unbekannt')
|
||||
->searchable(['first_name', 'last_name', 'email'])
|
||||
->sortable(),
|
||||
TextColumn::make('phone')->label('Telefon')->placeholder('–'),
|
||||
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(),
|
||||
TextColumn::make('bookings_count')->label('Aufenthalte')->counts($countedBookings)->formatStateUsing(fn (Guest $record, int $state): int => $state + $record->portal_stays_count)->description('Eigene und zugeordnete Portalaufenthalte'),
|
||||
TextColumn::make('bookings_sum_total')->label('Umsatz eigener Buchungen')->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)),
|
||||
->query(fn (Builder $query): Builder => $query->where(fn (Builder $query) => $query->whereHas('bookings', fn (Builder $query) => $query->whereIn('status', BookingStatus::occupying()), '>=', 2)->orWhereHas('portalStays', null, '>=', 2)->orWhere(fn (Builder $query) => $query->whereHas('bookings', fn (Builder $query) => $query->whereIn('status', BookingStatus::occupying()))->whereHas('portalStays')))),
|
||||
TernaryFilter::make('marketing_consent_at')
|
||||
->label('Einwilligung Angebote')
|
||||
->nullable(),
|
||||
|
||||
Reference in new issue
Block a user