Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m38s
- Buchung erfassen: Buchungsweg Portal (Referenz, Portalpreis, ohne Kontaktdaten), Prozess bestaetigen/Vertrag sofort/nur erfassen - Buchungsakte: Kontaktdaten eintragen (automatisch oder manuell weiter), Gast um Kontaktdaten bitten, Status von Hand aendern, Archivieren - Liste: Filter Kanal, Anreisezeitraum, Kontaktdaten fehlen; Spalten ausblendbar; Archiv - Klaerung: verstaendlichere Texte, eigenstaendige Belegung mit Kanal gilt als geklaert (Gitea #4) - Akte per Button aus Liste und Belegungsplan erreichbar - Menue: Gruppen Verwaltung (Tagesgeschaeft) und Einrichtung (Konfiguration), einfache Ansicht auf 8 Punkte Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
78 lines
2.3 KiB
PHP
78 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use App\Availability\OccupancyOverview;
|
|
use App\Filament\Concerns\FollowsAdminMode;
|
|
use App\Models\Booking;
|
|
use App\Models\Property;
|
|
use App\Support\CurrentProperty;
|
|
use BackedEnum;
|
|
use Carbon\CarbonImmutable;
|
|
use Filament\Pages\Page;
|
|
use Filament\Support\Icons\Heroicon;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Attributes\Url;
|
|
use UnitEnum;
|
|
|
|
class OccupancyCalendar extends Page
|
|
{
|
|
use FollowsAdminMode;
|
|
|
|
protected string $view = 'filament.pages.occupancy-calendar';
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCalendarDays;
|
|
|
|
protected static string|UnitEnum|null $navigationGroup = 'Verwaltung';
|
|
|
|
protected static ?string $title = 'Belegungsplan';
|
|
|
|
protected static ?string $navigationLabel = 'Belegungsplan';
|
|
|
|
protected static ?string $slug = 'belegungsplan';
|
|
|
|
protected static ?int $navigationSort = 0;
|
|
|
|
#[Url(as: 'monat')]
|
|
public string $month = '';
|
|
|
|
#[Url(as: 'wohnung')]
|
|
public ?int $propertyId = null;
|
|
|
|
public static function canAccess(): bool
|
|
{
|
|
return Gate::allows('viewAny', Booking::class);
|
|
}
|
|
|
|
public function getSubheading(): ?string
|
|
{
|
|
return app(CurrentProperty::class)->hasChoice() ? Property::query()->find($this->propertyId)?->name : null;
|
|
}
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->month = $this->month ?: now()->format('Y-m');
|
|
$this->propertyId = app(CurrentProperty::class)->followUrl($this->propertyId);
|
|
}
|
|
|
|
#[Computed]
|
|
public function calendar(): ?array
|
|
{
|
|
Validator::make(['month' => $this->month], ['month' => ['required', 'date_format:Y-m']])->validate();
|
|
if ($this->propertyId === null) {
|
|
return null;
|
|
}
|
|
|
|
return app(OccupancyOverview::class)->calendar(Property::findOrFail($this->propertyId), CarbonImmutable::createFromFormat('!Y-m', $this->month));
|
|
}
|
|
|
|
public function moveMonth(int $direction): void
|
|
{
|
|
Validator::make(['month' => $this->month, 'direction' => $direction], ['month' => ['required', 'date_format:Y-m'], 'direction' => ['in:-1,1']])->validate();
|
|
$this->month = CarbonImmutable::createFromFormat('!Y-m', $this->month)->addMonths($direction)->format('Y-m');
|
|
unset($this->calendar);
|
|
}
|
|
}
|