Zahlungsaufgaben, Freigabe-/Storno-Link, Vertragsvorlagen, Anreise-Mail
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s
- Zahlungen werden nicht mehr automatisch angemahnt: faellige Anzahlung/Restzahlung werden Aufgaben (Zahlungen & Wuensche, Tages-/Wochenuebersicht); Mail nur per Klick; je Portal und Buchungstyp abschaltbar - Freigabe-Link in der Eingangsbestaetigung, Storno-Link in der Buchungsbestaetigung; je Wohnung Wunsch / sofort / sofort bis Frist; Stornowuensche und Kosten bleiben Aufgabe des Gastgebers - Vertragsvorlagen mit Versionen (je Angebot, Portal oder Wohnung waehlbar), benutzte Versionen gesperrt; Angebot und finaler Vertrag als unveraenderliche PDF mit SHA-256, Vertrag wird nie neu geschrieben - Anreise-Mail je Wohnung einstellbar (Standard 3 Tage), neue Textfelder Schluessel/Parken/Ankunftstag Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eafab8a2cb
commit
a73b164ea1
51 files changed
+1807
-52
No files matched your search
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\CancellationMode;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\BookingCancelled;
|
||||
use App\Mail\CancellationRequested;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The guest uses the cancellation link of the booking confirmation. Depending on the property's setting the
|
||||
* booking is cancelled at once (dates released) or only a request task is created for the landlord – costs
|
||||
* are never settled automatically. Repeating the click changes nothing.
|
||||
*/
|
||||
class CancelBookingByGuest
|
||||
{
|
||||
/**
|
||||
* What a click on the link does for this booking today.
|
||||
*/
|
||||
public function modeFor(Booking $booking): CancellationMode
|
||||
{
|
||||
$property = $booking->property;
|
||||
$freeUntil = $booking->arrival->subDays($property->free_cancellation_days);
|
||||
|
||||
return match ($property->cancellation_mode) {
|
||||
CancellationMode::Instant => CancellationMode::Instant,
|
||||
CancellationMode::InstantWhenFree => today()->lessThanOrEqualTo($freeUntil) ? CancellationMode::Instant : CancellationMode::Request,
|
||||
default => CancellationMode::Request,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CancellationMode|null what happened (Instant = cancelled, Request = request recorded); null when it had happened before
|
||||
*
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(Booking $booking, ?string $message = null): ?CancellationMode
|
||||
{
|
||||
$outcome = DB::transaction(function () use ($booking, $message): ?CancellationMode {
|
||||
$booking->lockForTransition();
|
||||
|
||||
$alreadyAsked = BookingTask::query()->where('booking_id', $booking->id)->where('kind', BookingTaskKind::CancellationRequest)->exists();
|
||||
if ($booking->status === BookingStatus::Cancelled || $alreadyAsked) {
|
||||
return null;
|
||||
}
|
||||
if (! in_array($booking->status, BookingStatus::occupying(), true) || $booking->arrival->isPast()) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'storniert');
|
||||
}
|
||||
|
||||
$mode = $this->modeFor($booking);
|
||||
if ($mode === CancellationMode::Instant) {
|
||||
$booking->update(['status' => BookingStatus::Cancelled, 'cancelled_at' => now()]);
|
||||
}
|
||||
BookingTask::query()->create([
|
||||
'booking_id' => $booking->id,
|
||||
'kind' => BookingTaskKind::CancellationRequest,
|
||||
'status' => BookingTaskStatus::Open,
|
||||
'note' => trim(($mode === CancellationMode::Instant ? 'Vom Gast storniert – bitte Stornokosten und Rückzahlung prüfen. ' : '').($message ?? '')) ?: null,
|
||||
]);
|
||||
|
||||
return $mode;
|
||||
});
|
||||
|
||||
if ($outcome !== null) {
|
||||
$this->notify($booking, $outcome);
|
||||
}
|
||||
|
||||
return $outcome;
|
||||
}
|
||||
|
||||
private function notify(Booking $booking, CancellationMode $mode): void
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$cancelled = $mode === CancellationMode::Instant;
|
||||
|
||||
$sends = [
|
||||
fn () => Mail::to(Settings::notificationRecipients())->send(new CancellationRequested($booking, $cancelled)),
|
||||
fn () => $booking->guest?->email ? Mail::to($booking->guest->email, $booking->guest->full_name)->send(new BookingCancelled($booking, $cancelled)) : null,
|
||||
];
|
||||
foreach ($sends as $send) {
|
||||
try {
|
||||
$send();
|
||||
} catch (Throwable $exception) {
|
||||
Log::warning('Stornomitteilung nicht zugestellt', ['booking' => $booking->id, 'exception' => $exception::class]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\OfferAnswered;
|
||||
use App\Models\Booking;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The guest releases a held request or offer through the link in the mail – the dates are free again at once.
|
||||
* Repeating it is harmless. The link only reaches requests that are still held; a binding booking is never touched.
|
||||
*/
|
||||
class ReleaseReservation
|
||||
{
|
||||
/**
|
||||
* @return bool true when this call released the dates, false when they had been released before
|
||||
*
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(Booking $booking): bool
|
||||
{
|
||||
$released = DB::transaction(function () use ($booking): bool {
|
||||
$booking->lockForTransition();
|
||||
|
||||
if ($booking->status === BookingStatus::Declined && $booking->declined_by === 'guest') {
|
||||
return false;
|
||||
}
|
||||
if (! in_array($booking->status, BookingStatus::holding(), true)) {
|
||||
throw ReservationException::invalidTransition($booking->status->getLabel(), 'freigegeben');
|
||||
}
|
||||
|
||||
$booking->update(['status' => BookingStatus::Declined, 'declined_by' => 'guest', 'hold_expires_at' => null]);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if ($released) {
|
||||
try {
|
||||
Mail::to(Settings::notificationRecipients())->send(new OfferAnswered($booking, accepted: false));
|
||||
} catch (Throwable $exception) {
|
||||
Log::warning('Meldung über Freigabe nicht zugestellt', ['booking' => $booking->id, 'exception' => $exception::class]);
|
||||
}
|
||||
}
|
||||
|
||||
return $released;
|
||||
}
|
||||
}
|
||||
@@ -3,22 +3,27 @@
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Mail\ArrivalInformation;
|
||||
use App\Mail\PaymentReminder;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
/**
|
||||
* Daily booking workflow: payment requests and reminders, arrival information, completion after departure.
|
||||
* Every message is sent at most once per booking.
|
||||
* Daily booking workflow. Payments are never chased automatically: due payments become tasks for the landlord
|
||||
* (BookingTask, once per booking and kind) who checks the payment and sends the reminder on a click
|
||||
* ({@see SendPaymentReminder}). Only the arrival information goes out by itself, once per booking, the configured
|
||||
* number of days before arrival. Completion after departure.
|
||||
*/
|
||||
class SendBookingReminders
|
||||
{
|
||||
private const BALANCE_REQUEST_DAYS_BEFORE = 7;
|
||||
|
||||
private const ARRIVAL_INFO_DAYS_BEFORE = 7;
|
||||
/** Upper bound of the per-property setting; the property decides the actual day. */
|
||||
private const ARRIVAL_INFO_MAX_DAYS_BEFORE = 14;
|
||||
|
||||
/**
|
||||
* @return array{deposit_overdue: int, balance_request: int, balance_overdue: int, arrival_info: int, completed: int}
|
||||
@@ -33,7 +38,7 @@ public function handle(): array
|
||||
->whereNull('deposit_reminded_at')
|
||||
->whereDate('deposit_due_on', '<', $today))
|
||||
->filter(fn (Booking $booking): bool => $booking->openDeposit() > 0);
|
||||
$this->remind($depositOverdue, PaymentReminder::DEPOSIT_OVERDUE, 'deposit_reminded_at');
|
||||
$depositTasks = $this->createTasks($depositOverdue, BookingTaskKind::DepositReminder, fn (Booking $booking) => $booking->deposit_due_on);
|
||||
|
||||
$balanceRequest = $this->bookings(fn (Builder $query) => $query
|
||||
->whereIn('status', $unpaid)
|
||||
@@ -41,20 +46,21 @@ public function handle(): array
|
||||
->whereDate('balance_due_on', '>=', $today)
|
||||
->whereDate('balance_due_on', '<=', $today->copy()->addDays(self::BALANCE_REQUEST_DAYS_BEFORE)))
|
||||
->filter(fn (Booking $booking): bool => ! $booking->requiresFullPayment() && $booking->openAmount() > 0 && $booking->status === BookingStatus::DepositPaid);
|
||||
$this->remind($balanceRequest, PaymentReminder::BALANCE_REQUEST, 'balance_requested_at');
|
||||
$requestTasks = $this->createTasks($balanceRequest, BookingTaskKind::BalanceRequest, fn (Booking $booking) => $booking->balance_due_on);
|
||||
|
||||
$balanceOverdue = $this->bookings(fn (Builder $query) => $query
|
||||
->whereIn('status', $unpaid)
|
||||
->whereNull('balance_reminded_at')
|
||||
->whereDate('balance_due_on', '<', $today))
|
||||
->filter(fn (Booking $booking): bool => $booking->openAmount() > 0 && ($booking->status === BookingStatus::DepositPaid || $booking->requiresFullPayment()));
|
||||
$this->remind($balanceOverdue, PaymentReminder::BALANCE_OVERDUE, 'balance_reminded_at');
|
||||
$overdueTasks = $this->createTasks($balanceOverdue, BookingTaskKind::BalanceReminder, fn (Booking $booking) => $booking->balance_due_on);
|
||||
|
||||
$arrivals = $this->bookings(fn (Builder $query) => $query
|
||||
->whereIn('status', BookingStatus::occupying())
|
||||
->whereNull('arrival_info_sent_at')
|
||||
->whereDate('arrival', '>=', $today)
|
||||
->whereDate('arrival', '<=', $today->copy()->addDays(self::ARRIVAL_INFO_DAYS_BEFORE)));
|
||||
->whereDate('arrival', '<=', $today->copy()->addDays(self::ARRIVAL_INFO_MAX_DAYS_BEFORE)))
|
||||
->filter(fn (Booking $booking): bool => $booking->arrival->lessThanOrEqualTo($today->copy()->addDays($booking->property->arrival_info_days_before)));
|
||||
foreach ($arrivals as $booking) {
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new ArrivalInformation($booking));
|
||||
$booking->update(['arrival_info_sent_at' => now()]);
|
||||
@@ -67,9 +73,9 @@ public function handle(): array
|
||||
$completed->each->update(['status' => BookingStatus::Completed]);
|
||||
|
||||
return [
|
||||
'deposit_overdue' => $depositOverdue->count(),
|
||||
'balance_request' => $balanceRequest->count(),
|
||||
'balance_overdue' => $balanceOverdue->count(),
|
||||
'deposit_overdue' => $depositTasks,
|
||||
'balance_request' => $requestTasks,
|
||||
'balance_overdue' => $overdueTasks,
|
||||
'arrival_info' => $arrivals->count(),
|
||||
'completed' => $completed->count(),
|
||||
];
|
||||
@@ -81,7 +87,7 @@ public function handle(): array
|
||||
*/
|
||||
private function bookings(callable $constraints): Collection
|
||||
{
|
||||
return $constraints(Booking::query()->with(['guest', 'property', 'payments']))
|
||||
return $constraints(Booking::query()->with(['guest', 'property', 'payments', 'importChannel', 'originChannel']))
|
||||
->whereHas('guest', fn (Builder $query) => $query->whereNull('anonymized_at')->whereNotNull('email')->where('email', '!=', ''))
|
||||
->get()
|
||||
->toBase();
|
||||
@@ -89,12 +95,20 @@ private function bookings(callable $constraints): Collection
|
||||
|
||||
/**
|
||||
* @param Collection<int, Booking> $bookings
|
||||
* @param callable(Booking): mixed $dueOn
|
||||
* @return int the number of tasks created now
|
||||
*/
|
||||
private function remind(Collection $bookings, string $kind, string $sentAtColumn): void
|
||||
private function createTasks(Collection $bookings, BookingTaskKind $kind, callable $dueOn): int
|
||||
{
|
||||
foreach ($bookings as $booking) {
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new PaymentReminder($booking, $kind));
|
||||
$booking->update([$sentAtColumn => now()]);
|
||||
$created = 0;
|
||||
foreach ($bookings->filter(fn (Booking $booking): bool => $booking->wantsPaymentTasks()) as $booking) {
|
||||
$task = BookingTask::query()->firstOrCreate(
|
||||
['booking_id' => $booking->id, 'kind' => $kind],
|
||||
['status' => BookingTaskStatus::Open, 'due_on' => $dueOn($booking)],
|
||||
);
|
||||
$created += $task->wasRecentlyCreated ? 1 : 0;
|
||||
}
|
||||
|
||||
return $created;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Mail\OfferMade;
|
||||
use App\Models\Booking;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\PriceQuote;
|
||||
use App\Pricing\QuoteException;
|
||||
@@ -42,7 +43,7 @@ public function __construct(
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array{arrival?: string, departure?: string, guests?: int, promo_code?: ?string, price_adjustment?: ?int, price_adjustment_label?: ?string, valid_until?: ?string, offer_message?: ?string, guest?: array<string, ?string>} $changes
|
||||
* @param array{arrival?: string, departure?: string, guests?: int, promo_code?: ?string, price_adjustment?: ?int, price_adjustment_label?: ?string, valid_until?: ?string, offer_message?: ?string, contract_template_id?: int|string|null, guest?: array<string, ?string>} $changes
|
||||
*
|
||||
* @throws QuoteException
|
||||
* @throws ReservationException
|
||||
@@ -97,7 +98,7 @@ public function handle(Booking $booking, array $changes = [], bool $sendMail = t
|
||||
'offer_version' => $booking->offer_version + 1,
|
||||
'offer_sent_at' => now(),
|
||||
'offer_message' => $changes['offer_message'] ?? null,
|
||||
'offer_terms' => OfferTerms::capture(),
|
||||
'offer_terms' => OfferTerms::capture($this->templateFor($booking, $changes)),
|
||||
]);
|
||||
$booking->refresh();
|
||||
$booking->update(['offer_hash' => OfferTerms::hash($booking)]);
|
||||
@@ -113,6 +114,20 @@ public function handle(Booking $booking, array $changes = [], bool $sendMail = t
|
||||
return $booking;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contract template of this offer: chosen explicitly, else the portal's default, else the property's.
|
||||
*
|
||||
* @param array<string, mixed> $changes
|
||||
*/
|
||||
private function templateFor(Booking $booking, array $changes): ?ContractTemplate
|
||||
{
|
||||
$id = filled($changes['contract_template_id'] ?? null)
|
||||
? (int) $changes['contract_template_id']
|
||||
: ($booking->importChannel ?? $booking->originChannel)?->contract_template_id ?? $booking->property->contract_template_id;
|
||||
|
||||
return $id ? ContractTemplate::query()->find($id) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the offer mail. The offer is already saved (and its validity runs), so a failing mail server is
|
||||
* recorded in the admin inbox and reported to the caller instead of being lost.
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Mail\PaymentReminder;
|
||||
use App\Models\BookingTask;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
/**
|
||||
* Sends the payment mail belonging to a task – only when the landlord decides to, after checking the payment.
|
||||
* The task is completed and the dispatch is recorded on the booking; a failing mail server leaves the task open.
|
||||
*/
|
||||
class SendPaymentReminder
|
||||
{
|
||||
/**
|
||||
* @throws ReservationException
|
||||
*/
|
||||
public function handle(BookingTask $task, string $by): void
|
||||
{
|
||||
$reminder = $task->kind->reminder();
|
||||
$booking = $task->booking->loadMissing(['guest', 'property', 'payments']);
|
||||
|
||||
if ($reminder === null) {
|
||||
throw new ReservationException('Zu dieser Aufgabe gibt es keine Zahlungs-E-Mail.');
|
||||
}
|
||||
if (blank($booking->guest?->email)) {
|
||||
throw new ReservationException('Der Gast hat keine E-Mail-Adresse.');
|
||||
}
|
||||
if ($booking->openAmount() <= 0) {
|
||||
throw new ReservationException('Die Buchung ist bereits vollständig bezahlt.');
|
||||
}
|
||||
|
||||
[$kind, $column] = $reminder;
|
||||
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new PaymentReminder($booking, $kind));
|
||||
$booking->update([$column => now()]);
|
||||
$task->complete($by);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Documents;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Support\Content;
|
||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
use Illuminate\Support\HtmlString;
|
||||
@@ -28,13 +29,16 @@ class OfferTerms
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array{captured_at: string, texts: array<string, ?string>, deposit_due_days: int, owner: array<string, mixed>, bank: array<string, mixed>}
|
||||
* @return array{captured_at: string, template: ?array{id: int, name: string, version: int}, texts: array<string, ?string>, deposit_due_days: int, owner: array<string, mixed>, bank: array<string, mixed>}
|
||||
*/
|
||||
public static function capture(): array
|
||||
public static function capture(?ContractTemplate $template = null): array
|
||||
{
|
||||
$overrides = $template?->overrides() ?? [];
|
||||
|
||||
return [
|
||||
'captured_at' => now()->toIso8601String(),
|
||||
'texts' => collect(self::TEXT_KEYS)->mapWithKeys(fn (string $key): array => [$key => Content::get($key)])->all(),
|
||||
'template' => $template ? ['id' => $template->id, 'name' => $template->name, 'version' => $template->version] : null,
|
||||
'texts' => collect(self::TEXT_KEYS)->mapWithKeys(fn (string $key): array => [$key => $overrides[$key] ?? Content::get($key)])->all(),
|
||||
'deposit_due_days' => (int) config('fewo.deposit_due_days'),
|
||||
'owner' => (array) config('fewo.owner'),
|
||||
'bank' => (array) config('fewo.bank'),
|
||||
|
||||
@@ -28,12 +28,18 @@ public function generate(Booking $booking, bool $draft = false): string
|
||||
// fetching anything over the network. Each website has its own (A14).
|
||||
$logo = $booking->website()?->brandPath(Site::BRAND_DOCUMENT_LOGO);
|
||||
|
||||
Storage::disk(self::DISK)->put($path, Pdf::loadView('pdf.contract', [
|
||||
// The final contract is a document of record: once stored it is never rewritten (confirmation resends reuse it).
|
||||
if (! $draft && $booking->contract_path !== null && Storage::disk(self::DISK)->exists($booking->contract_path)) {
|
||||
return $booking->contract_path;
|
||||
}
|
||||
|
||||
$pdf = Pdf::loadView('pdf.contract', [
|
||||
'booking' => $booking,
|
||||
'draft' => $draft,
|
||||
'logo' => $logo,
|
||||
])->setPaper('a4')->output());
|
||||
$booking->update([$draft ? 'offer_path' : 'contract_path' => $path]);
|
||||
])->setPaper('a4')->output();
|
||||
Storage::disk(self::DISK)->put($path, $pdf);
|
||||
$booking->update([$draft ? 'offer_path' : 'contract_path' => $path, $draft ? 'offer_pdf_sha256' : 'contract_pdf_sha256' => hash('sha256', $pdf)]);
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Filament\Pages\PricesAndOffers;
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\BookingTasks\BookingTaskResource;
|
||||
use App\Filament\Resources\Channels\ChannelResource;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Filament\Resources\Guests\GuestResource;
|
||||
@@ -37,6 +38,7 @@ enum AdminMode: string implements HasDescription, HasLabel
|
||||
PricesAndOffers::class,
|
||||
GuestResource::class,
|
||||
ChannelTaskResource::class,
|
||||
BookingTaskResource::class,
|
||||
ChannelResource::class,
|
||||
ReviewResource::class,
|
||||
PhotoResource::class,
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Mail\PaymentReminder;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* What the landlord has to do about a booking. Payment tasks are created by the daily run; nothing is
|
||||
* sent to the guest until the landlord has checked the payment and chooses to send the mail.
|
||||
*/
|
||||
enum BookingTaskKind: string implements HasLabel
|
||||
{
|
||||
case DepositReminder = 'deposit_reminder';
|
||||
case BalanceRequest = 'balance_request';
|
||||
case BalanceReminder = 'balance_reminder';
|
||||
case CancellationRequest = 'cancellation_request';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::DepositReminder => 'Anzahlung überfällig – anmahnen',
|
||||
self::BalanceRequest => 'Restzahlung bald fällig – anfordern',
|
||||
self::BalanceReminder => 'Restzahlung überfällig – anmahnen',
|
||||
self::CancellationRequest => 'Stornierungswunsch des Gastes',
|
||||
};
|
||||
}
|
||||
|
||||
public function isPayment(): bool
|
||||
{
|
||||
return $this !== self::CancellationRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* The mail kind (App\Mail\PaymentReminder) and the booking column that records its dispatch.
|
||||
*
|
||||
* @return array{0: string, 1: string}|null
|
||||
*/
|
||||
public function reminder(): ?array
|
||||
{
|
||||
return match ($this) {
|
||||
self::DepositReminder => [PaymentReminder::DEPOSIT_OVERDUE, 'deposit_reminded_at'],
|
||||
self::BalanceRequest => [PaymentReminder::BALANCE_REQUEST, 'balance_requested_at'],
|
||||
self::BalanceReminder => [PaymentReminder::BALANCE_OVERDUE, 'balance_reminded_at'],
|
||||
self::CancellationRequest => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum BookingTaskStatus: string implements HasColor, HasLabel
|
||||
{
|
||||
case Open = 'open';
|
||||
case Done = 'done';
|
||||
case Dismissed = 'dismissed';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Open => 'Offen',
|
||||
self::Done => 'Erledigt',
|
||||
self::Dismissed => 'Verworfen',
|
||||
};
|
||||
}
|
||||
|
||||
public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Open => 'warning',
|
||||
self::Done => 'success',
|
||||
self::Dismissed => 'gray',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* What the cancellation link in the booking confirmation does.
|
||||
*/
|
||||
enum CancellationMode: string implements HasLabel
|
||||
{
|
||||
/** The guest sends a request; the landlord decides and settles costs. */
|
||||
case Request = 'request';
|
||||
|
||||
/** The booking is cancelled at once and the dates are released. */
|
||||
case Instant = 'instant';
|
||||
|
||||
/** Cancelled at once while the stay is still far enough away (free cancellation), otherwise a request. */
|
||||
case InstantWhenFree = 'instant_when_free';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Request => 'Nur Stornierungswunsch – ich entscheide',
|
||||
self::Instant => 'Sofort stornieren (Ein-Klick)',
|
||||
self::InstantWhenFree => 'Sofort stornieren bis zur Frist der kostenfreien Stornierung, danach Wunsch',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public function getLabel(): string
|
||||
self::Requests => 'Offene Anfragen und Angebote',
|
||||
self::News => 'Neu seit der letzten Übersicht',
|
||||
self::Stays => 'An- und Abreisen',
|
||||
self::Payments => 'Überfällige Zahlungen',
|
||||
self::Payments => 'Zahlungsaufgaben und Gästewünsche',
|
||||
self::Portals => 'Portale: Aufgaben und Klärungsfälle',
|
||||
self::Reviews => 'Bewertungen zur Freigabe',
|
||||
};
|
||||
@@ -38,7 +38,7 @@ public function getDescription(): string
|
||||
self::Requests => 'Anfragen und Angebote, die auf Sie oder den Gast warten, mit Frist',
|
||||
self::News => 'Neue Anfragen, Buchungen, Stornierungen und Portalbuchungen',
|
||||
self::Stays => 'Heute und morgen, in der Wochenübersicht die nächsten 7 Tage',
|
||||
self::Payments => 'Anzahlungen und Restzahlungen nach Fälligkeit',
|
||||
self::Payments => 'Offene Aufgaben: fällige Zahlungen (nur wo Sie selbst mahnen) und Stornierungswünsche',
|
||||
self::Portals => 'Offene Portal-Aufgaben, zu prüfende Portal-Mails und Kalendereinträge, Abgleichsfehler',
|
||||
self::Reviews => 'Neue Bewertungen, die noch nicht freigegeben sind',
|
||||
};
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BookingTasks;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\BookingTasks\Pages\ListBookingTasks;
|
||||
use App\Filament\Resources\BookingTasks\Tables\BookingTasksTable;
|
||||
use App\Models\BookingTask;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class BookingTaskResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = BookingTask::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $modelLabel = 'Buchungsaufgabe';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Zahlungen & Wünsche';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BookingTasksTable::configure($table);
|
||||
}
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
$open = BookingTask::query()->open()->count();
|
||||
|
||||
return $open > 0 ? (string) $open : null;
|
||||
}
|
||||
|
||||
public static function getNavigationBadgeColor(): string
|
||||
{
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBookingTasks::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BookingTasks\Pages;
|
||||
|
||||
use App\Filament\Concerns\ListsCurrentProperty;
|
||||
use App\Filament\Resources\BookingTasks\BookingTaskResource;
|
||||
use App\Models\Property;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListBookingTasks extends ListRecords
|
||||
{
|
||||
use ListsCurrentProperty;
|
||||
|
||||
protected static string $resource = BookingTaskResource::class;
|
||||
|
||||
protected function scopeToProperty(Builder $query, Property $property): Builder
|
||||
{
|
||||
return $query->whereHas('booking', fn (Builder $booking) => $booking->where('property_id', $property->id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BookingTasks\Tables;
|
||||
|
||||
use App\Actions\SendPaymentReminder;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Models\BookingTask;
|
||||
use App\Support\Money;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Throwable;
|
||||
|
||||
class BookingTasksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('created_at', 'desc')
|
||||
->description('Fällige Zahlungen und Wünsche von Gästen. Es wird nichts automatisch an Gäste gesendet: Bitte erst den Zahlungseingang prüfen, dann die Erinnerung per Klick senden oder die Aufgabe abhaken.')
|
||||
->columns([
|
||||
TextColumn::make('booking.reference')->label('Buchung')->weight('medium')->description(fn (BookingTask $record): string => $record->booking->guest?->full_name ?? ''),
|
||||
TextColumn::make('kind')->label('Aufgabe')->badge(),
|
||||
TextColumn::make('due_on')->label('Fällig seit')->date('d.m.Y')->placeholder('–'),
|
||||
TextColumn::make('open')->label('Offen')->state(fn (BookingTask $record): string => Money::format($record->booking->openAmount())),
|
||||
TextColumn::make('status')->label('Status')->badge()
|
||||
->description(fn (BookingTask $record): ?string => $record->completed_by ? "{$record->completed_by}, {$record->completed_at?->format('d.m. H:i')}" : null),
|
||||
TextColumn::make('note')->label('Hinweis')->wrap()->placeholder('–'),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('status')->label('Status')->options(BookingTaskStatus::class)->default(BookingTaskStatus::Open->value),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('booking')
|
||||
->label('Buchung')
|
||||
->icon(Heroicon::OutlinedArrowTopRightOnSquare)
|
||||
->color('gray')
|
||||
->url(fn (BookingTask $record): string => BookingResource::getUrl('view', ['record' => $record->booking])),
|
||||
Action::make('send')
|
||||
->label('Mail an Gast senden')
|
||||
->icon(Heroicon::OutlinedEnvelope)
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Haben Sie den Zahlungseingang geprüft? Der Gast erhält die Zahlungs-E-Mail sofort.')
|
||||
->visible(fn (BookingTask $record): bool => $record->status === BookingTaskStatus::Open && $record->kind->reminder() !== null)
|
||||
->action(function (BookingTask $record, SendPaymentReminder $send): void {
|
||||
try {
|
||||
$send->handle($record, auth()->user()->name);
|
||||
} catch (ReservationException $exception) {
|
||||
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
|
||||
|
||||
return;
|
||||
} catch (Throwable) {
|
||||
Notification::make()->title('E-Mail konnte nicht gesendet werden')->body('Die Aufgabe bleibt offen.')->danger()->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Notification::make()->title('E-Mail gesendet')->success()->send();
|
||||
}),
|
||||
Action::make('done')
|
||||
->label('Erledigt')
|
||||
->icon(Heroicon::OutlinedCheck)
|
||||
->color('success')
|
||||
->visible(fn (BookingTask $record): bool => $record->status === BookingTaskStatus::Open)
|
||||
->action(fn (BookingTask $record) => $record->complete(auth()->user()->name)),
|
||||
Action::make('dismiss')
|
||||
->label('Verwerfen')
|
||||
->icon(Heroicon::OutlinedXMark)
|
||||
->color('gray')
|
||||
->requiresConfirmation()
|
||||
->visible(fn (BookingTask $record): bool => $record->status === BookingTaskStatus::Open)
|
||||
->action(fn (BookingTask $record) => $record->update(['status' => BookingTaskStatus::Dismissed])),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
use App\Filament\Actions\AssignGuestAction;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Models\Booking;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\StayRequest;
|
||||
@@ -20,6 +21,7 @@
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
@@ -85,6 +87,13 @@ protected function getHeaderActions(): array
|
||||
TextInput::make('price_adjustment_label')->label('Bezeichnung')->placeholder('Nachlass / Zuschlag')->maxLength(80),
|
||||
Text::make(fn (Get $get): string => $this->offerPricePreview($get))->columnSpanFull(),
|
||||
]),
|
||||
Section::make('Vertragsvorlage')->schema([
|
||||
Select::make('contract_template_id')
|
||||
->label('Vorlage für dieses Angebot')
|
||||
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
|
||||
->placeholder('Standard (Portal / Wohnung / Webseite)')
|
||||
->helperText('Die Texte werden beim Versand fest im Angebot abgelegt.'),
|
||||
]),
|
||||
Section::make('Gültigkeit & Nachricht')->columns(2)->schema([
|
||||
DateTimePicker::make('valid_until')
|
||||
->label('Angebot gültig bis')
|
||||
@@ -187,16 +196,6 @@ protected function getHeaderActions(): array
|
||||
->visible(fn (): bool => $this->record->contract_path !== null)
|
||||
->action(fn (RentalContract $contract) => response()->download($contract->absolutePath($this->record) ?? abort(404), "Mietvertrag-{$this->record->reference}.pdf")),
|
||||
ActionGroup::make([
|
||||
Action::make('regenerateContract')
|
||||
->label('Mietvertrag neu erzeugen')
|
||||
->icon(Heroicon::OutlinedArrowPath)
|
||||
->visible(fn (): bool => in_array($this->record->status, [...BookingStatus::occupying()], true))
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Der Vertrag wird mit den Bedingungen des angenommenen Angebots neu erstellt. Der Gast erhält ihn nicht automatisch.')
|
||||
->action(function (RentalContract $contract): void {
|
||||
$contract->generate($this->record);
|
||||
Notification::make()->title('Mietvertrag neu erzeugt')->success()->send();
|
||||
}),
|
||||
Action::make('notes')
|
||||
->label('Interne Notiz bearbeiten')
|
||||
->icon(Heroicon::OutlinedPencilSquare)
|
||||
|
||||
@@ -74,7 +74,7 @@ public static function configure(Schema $schema): Schema
|
||||
->visible(fn (Booking $record): bool => $record->isDirect()),
|
||||
TextEntry::make('offer')
|
||||
->label('Angebot')
|
||||
->state(fn (Booking $record): string => 'Version '.$record->offer_version.', gesendet '.$record->offer_sent_at?->format('d.m.Y, H:i').' · Prüfsumme '.substr((string) $record->offer_hash, 0, 12))
|
||||
->state(fn (Booking $record): string => 'Version '.$record->offer_version.', gesendet '.$record->offer_sent_at?->format('d.m.Y, H:i').' · Prüfsumme '.substr((string) $record->offer_hash, 0, 12).(isset($record->offer_terms['template']) ? ' · Vorlage '.$record->offer_terms['template']['name'].' v'.$record->offer_terms['template']['version'] : ''))
|
||||
->visible(fn (Booking $record): bool => $record->offer_version > 0),
|
||||
TextEntry::make('accepted_at')->label('Angenommen am')->dateTime('d.m.Y, H:i:s')->visible(fn (Booking $record): bool => $record->accepted_at !== null),
|
||||
TextEntry::make('confirmation')
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
use App\Enums\ChannelExportMode;
|
||||
use App\Enums\ChannelStatus;
|
||||
use App\Models\Channel;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Models\Property;
|
||||
use App\Support\CurrentProperty;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
@@ -49,7 +50,20 @@ public static function configure(Schema $schema, bool $selectProperty = false):
|
||||
->maxLength(100),
|
||||
Select::make('status')->label('Kanalstatus')->options(ChannelStatus::class)->default(ChannelStatus::Setup)->required(),
|
||||
Select::make('booking_model')->label('Buchungsmodell')->options(ChannelBookingModel::class)->default(ChannelBookingModel::Mixed)->required()
|
||||
->helperText('Fachliche Einordnung; löst keine automatischen Buchungsentscheidungen aus.'),
|
||||
->helperText('„Portalbuchung“ und „Gemischt“ gelten als Sofortbuchung: automatische Angebote für diese Wohnung warten, bis das Portal unseren Kalender abgerufen hat. „Vermittlung / Anfrage“: keine Sofortbuchung.'),
|
||||
Select::make('contract_template_id')
|
||||
->label('Vertragsvorlage für dieses Portal')
|
||||
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
|
||||
->placeholder('Standard der Wohnung')
|
||||
->helperText('Für Angebote zu Buchungen, die über dieses Portal kommen und dessen Vorgaben (z. B. Stornofristen) entsprechen müssen.'),
|
||||
Toggle::make('payment_tasks_inquiry')
|
||||
->label('Zahlungsaufgaben bei Anfragen über dieses Portal')
|
||||
->helperText('Fällige Anzahlungen/Restzahlungen erscheinen als Aufgabe (Mails an Gäste gehen nie automatisch).')
|
||||
->default(true),
|
||||
Toggle::make('payment_tasks_reservation')
|
||||
->label('Zahlungsaufgaben bei Reservierungen über dieses Portal')
|
||||
->helperText('Aus, wenn das Portal das Geld einzieht und mahnt (z. B. FeWo-direkt Online-Buchung).')
|
||||
->default(false),
|
||||
Select::make('connector')
|
||||
->label('Kalenderanbindung')
|
||||
->helperText('Diese Verbindung gleicht Belegungszeiträume über iCal ab. Weitere Portalfunktionen benötigen eine eigene Anbindung.')
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates;
|
||||
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\CreateContractTemplate;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\EditContractTemplate;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\ListContractTemplates;
|
||||
use App\Filament\Resources\ContractTemplates\Schemas\ContractTemplateForm;
|
||||
use App\Filament\Resources\ContractTemplates\Tables\ContractTemplatesTable;
|
||||
use App\Models\ContractTemplate;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use UnitEnum;
|
||||
|
||||
class ContractTemplateResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = ContractTemplate::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentDuplicate;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Vermietung';
|
||||
|
||||
protected static ?string $modelLabel = 'Vertragsvorlage';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Vertragsvorlagen';
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ContractTemplateForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ContractTemplatesTable::configure($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* A version used in an offer is a document of record and is never edited; a new version is made instead.
|
||||
*/
|
||||
public static function canEdit(Model $record): bool
|
||||
{
|
||||
return ! $record->isUsed();
|
||||
}
|
||||
|
||||
public static function canDelete(Model $record): bool
|
||||
{
|
||||
return ! $record->isUsed();
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListContractTemplates::route('/'),
|
||||
'create' => CreateContractTemplate::route('/create'),
|
||||
'edit' => EditContractTemplate::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateContractTemplate extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
/**
|
||||
* A new template starts with version 1; further versions are made from an existing one.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['version'] = 1;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditContractTemplate extends EditRecord
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [DeleteAction::make()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Pages;
|
||||
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListContractTemplates extends ListRecords
|
||||
{
|
||||
protected static string $resource = ContractTemplateResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [CreateAction::make()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ContractTemplateForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
$editor = fn (string $field, string $label): RichEditor => RichEditor::make("texts.{$field}")
|
||||
->label($label)
|
||||
->toolbarButtons([['bold', 'italic', 'link'], ['bulletList', 'orderedList']])
|
||||
->columnSpanFull();
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label('Name der Vorlage')->required()->maxLength(120)
|
||||
->helperText('z. B. „Direktbuchung“ oder „Portal XY“. Versionen derselben Vorlage haben denselben Namen.'),
|
||||
TextInput::make('version')->label('Version')->integer()->default(1)->disabled()->dehydrated(false)
|
||||
->helperText('Neue Versionen entstehen über „Neue Version“ in der Liste. Eine Vorlage, die in einem Angebot verwendet wurde, kann nicht mehr geändert werden.'),
|
||||
Section::make('Texte dieser Vorlage')
|
||||
->description('Nur ausgefüllte Felder ersetzen die Texte der Webseite (Texte › Aufenthalt / Vertrag); leere Felder übernehmen den Webseitentext. Beim Versand des Angebots wird eine Kopie fest abgelegt.')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
$editor('terms', 'Mietbedingungen'),
|
||||
$editor('cancellation', 'Rücktritt / Stornierung'),
|
||||
$editor('house_rules', 'Hausordnung'),
|
||||
Textarea::make('texts.intro')->label('Vertragseinleitung')->rows(3)->columnSpanFull(),
|
||||
Textarea::make('texts.closing')->label('Vertragsschluss')->rows(3)->columnSpanFull(),
|
||||
Textarea::make('texts.contract_note')->label('Hinweis im Angebots-PDF')->rows(3)->columnSpanFull(),
|
||||
]),
|
||||
Textarea::make('notes')->label('Interne Notiz')->rows(2)->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContractTemplates\Tables;
|
||||
|
||||
use App\Models\ContractTemplate;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ContractTemplatesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('name')
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Vorlage')->searchable()->weight('medium'),
|
||||
TextColumn::make('version')->label('Version')->badge(),
|
||||
IconColumn::make('used')->label('In Angeboten verwendet')->boolean()->state(fn (ContractTemplate $record): bool => $record->isUsed()),
|
||||
TextColumn::make('updated_at')->label('Geändert')->dateTime('d.m.Y, H:i'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
Action::make('newVersion')
|
||||
->label('Neue Version')
|
||||
->icon(Heroicon::OutlinedDocumentDuplicate)
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Es wird eine Kopie mit der nächsten Versionsnummer angelegt, die Sie dann bearbeiten können. Die bisherige Version bleibt unverändert.')
|
||||
->action(function (ContractTemplate $record): void {
|
||||
$copy = $record->newVersion();
|
||||
Notification::make()->title('Version '.$copy->version.' angelegt')->success()->send();
|
||||
}),
|
||||
DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Filament\Resources\Properties\Schemas;
|
||||
|
||||
use App\Enums\CancellationMode;
|
||||
use App\Enums\OfferMode;
|
||||
use App\Filament\Forms\Components\EuroInput;
|
||||
use App\ImageWorlds\ImageWorldRegistry;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Models\Site;
|
||||
use Closure;
|
||||
use Filament\Forms\Components\Select;
|
||||
@@ -116,6 +118,34 @@ public static function configure(Schema $schema): Schema
|
||||
->minValue(1)
|
||||
->suffix('Stunden')
|
||||
->default(48),
|
||||
Select::make('cancellation_mode')
|
||||
->label('Stornierungslink in der Buchungsbestätigung')
|
||||
->options(CancellationMode::class)
|
||||
->default(CancellationMode::Request)
|
||||
->required()
|
||||
->live()
|
||||
->helperText('Bei Sofort-Stornierung wird der Zeitraum frei; Kosten und Rückzahlung bleiben immer Ihre Aufgabe.'),
|
||||
TextInput::make('free_cancellation_days')
|
||||
->label('Kostenfrei stornierbar bis')
|
||||
->integer()
|
||||
->minValue(0)
|
||||
->suffix('Tage vor Anreise')
|
||||
->default(14)
|
||||
->visible(fn (Get $get): bool => $get('cancellation_mode') === CancellationMode::InstantWhenFree->value || $get('cancellation_mode') === CancellationMode::InstantWhenFree),
|
||||
Select::make('contract_template_id')
|
||||
->label('Standard-Vertragsvorlage')
|
||||
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
|
||||
->placeholder('Texte der Webseite')
|
||||
->helperText('Wird bei neuen Angeboten verwendet, sofern das Portal keine eigene Vorlage hat.'),
|
||||
TextInput::make('arrival_info_days_before')
|
||||
->label('Anreise-E-Mail senden')
|
||||
->helperText('Automatische Mail mit den letzten Hinweisen (Texte unter Texte › Aufenthalt).')
|
||||
->required()
|
||||
->integer()
|
||||
->minValue(1)
|
||||
->maxValue(14)
|
||||
->suffix('Tage vor Anreise')
|
||||
->default(3),
|
||||
Toggle::make('pre_reservation_enabled')
|
||||
->label('Anfrage blockiert den Kalender (Vorreservierung)')
|
||||
->helperText('Aus: eine bloße Anfrage sperrt keinen Zeitraum. Dann ist kein automatisches Angebot möglich.')
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\CancelBookingByGuest;
|
||||
use App\Actions\ReleaseReservation;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\CancellationMode;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* Pages behind the signed links in the guest's mails: release a held request, cancel a booking. Opening a page
|
||||
* changes nothing; only the button on it does (POST, signed, rate limited).
|
||||
*/
|
||||
class SelfServiceController extends Controller
|
||||
{
|
||||
public function showRelease(Booking $booking): View
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
|
||||
return view('self-service.release', [
|
||||
'booking' => $booking,
|
||||
'canRelease' => in_array($booking->status, BookingStatus::holding(), true) && $booking->isHoldActive(),
|
||||
'released' => $booking->status === BookingStatus::Declined && $booking->declined_by === 'guest',
|
||||
'action' => $this->signed('reservations.release.confirm', $booking, now()->addHour()),
|
||||
'title' => 'Zeitraum freigeben',
|
||||
]);
|
||||
}
|
||||
|
||||
public function release(Booking $booking, ReleaseReservation $release): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$release->handle($booking);
|
||||
} catch (ReservationException $exception) {
|
||||
return redirect()->to($this->signed('reservations.release', $booking, now()->addDays(2)))->with('self-service.error', $exception->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->to($this->signed('reservations.release', $booking, now()->addDays(30)))->with('self-service.success', 'Vielen Dank – der Zeitraum ist wieder freigegeben.');
|
||||
}
|
||||
|
||||
public function showCancel(Booking $booking, CancelBookingByGuest $cancel): View
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$open = in_array($booking->status, BookingStatus::occupying(), true) && ! $booking->arrival->isPast();
|
||||
|
||||
return view('self-service.cancel', [
|
||||
'booking' => $booking,
|
||||
'canCancel' => $open && ! $booking->cancellationRequested(),
|
||||
'alreadyAsked' => $booking->status === BookingStatus::Cancelled || $booking->cancellationRequested(),
|
||||
'instant' => $cancel->modeFor($booking) === CancellationMode::Instant,
|
||||
'action' => $this->signed('bookings.cancel.confirm', $booking, now()->addHour()),
|
||||
'title' => 'Buchung stornieren',
|
||||
]);
|
||||
}
|
||||
|
||||
public function cancel(Request $request, Booking $booking, CancelBookingByGuest $cancel): RedirectResponse
|
||||
{
|
||||
$data = $request->validate(['message' => ['nullable', 'string', 'max:1000']]);
|
||||
$back = fn (int $days): string => $this->signed('bookings.cancel', $booking, now()->addDays($days));
|
||||
|
||||
try {
|
||||
$outcome = $cancel->handle($booking, $data['message'] ?? null);
|
||||
} catch (ReservationException $exception) {
|
||||
return redirect()->to($back(2))->with('self-service.error', $exception->getMessage());
|
||||
}
|
||||
|
||||
$success = match ($outcome) {
|
||||
CancellationMode::Instant => 'Ihre Buchung ist storniert. Eine Bestätigung haben wir Ihnen per E-Mail gesendet.',
|
||||
CancellationMode::Request => 'Wir haben Ihren Stornierungswunsch erhalten. Ihre Buchung bleibt bestehen, bis wir uns bei Ihnen gemeldet haben.',
|
||||
default => 'Ihr Stornierungswunsch liegt uns bereits vor.',
|
||||
};
|
||||
|
||||
return redirect()->to($back(30))->with('self-service.success', $success);
|
||||
}
|
||||
|
||||
private function signed(string $name, Booking $booking, DateTimeInterface $expiration): string
|
||||
{
|
||||
$parameters = ['booking' => $booking];
|
||||
|
||||
return $booking->website()?->temporarySignedRoute($name, $expiration, $parameters)
|
||||
?? URL::temporarySignedRoute($name, $expiration, $parameters);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* To the guest after using the cancellation link: either the booking is cancelled or the request was received.
|
||||
*/
|
||||
class BookingCancelled extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public function __construct(public Booking $booking, public bool $cancelled) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: ($this->cancelled ? 'Stornierung ' : 'Ihr Stornierungswunsch ').$this->booking->reference,
|
||||
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(markdown: 'mail.booking-cancelled');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* To the landlord: a guest cancelled a booking or asks to.
|
||||
*/
|
||||
class CancellationRequested extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public function __construct(public Booking $booking, public bool $cancelled) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(subject: ($this->cancelled ? 'Storniert: ' : 'Stornierungswunsch: ').$this->booking->reference.' – '.$this->booking->guest->full_name);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(markdown: 'mail.cancellation-requested');
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
use App\Documents\OfferTerms;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\ReferralSource;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use App\Models\Concerns\HasChannelProvenance;
|
||||
@@ -57,6 +59,8 @@
|
||||
'offer_path',
|
||||
'offer_terms',
|
||||
'offer_hash',
|
||||
'offer_pdf_sha256',
|
||||
'contract_pdf_sha256',
|
||||
'message',
|
||||
'internal_notes',
|
||||
'confirmed_at',
|
||||
@@ -266,6 +270,31 @@ public function requiresFullPayment(): bool
|
||||
return $this->deposit_due_on !== null && $this->balance_due_on->lessThanOrEqualTo($this->deposit_due_on);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the landlord chases payments of this booking. Own bookings: always. Portal bookings: as configured
|
||||
* per channel and kind – a reservation whose payment the portal collects (e.g. instant booking) needs no
|
||||
* tasks, a mere inquiry passed on by the portal does.
|
||||
*/
|
||||
public function wantsPaymentTasks(): bool
|
||||
{
|
||||
$channel = $this->importChannel ?? $this->originChannel;
|
||||
if ($channel === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $channel->booking_model === ChannelBookingModel::PortalBooking
|
||||
? $channel->payment_tasks_reservation
|
||||
: $channel->payment_tasks_inquiry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the guest already asked to cancel (or cancelled) through the cancellation link.
|
||||
*/
|
||||
public function cancellationRequested(): bool
|
||||
{
|
||||
return BookingTask::query()->where('booking_id', $this->id)->where('kind', BookingTaskKind::CancellationRequest)->exists();
|
||||
}
|
||||
|
||||
public function nights(): int
|
||||
{
|
||||
return (int) $this->arrival->diffInDays($this->departure);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Something the landlord has to do about a booking. One task per booking and kind; a finished or
|
||||
* dismissed task is never created again.
|
||||
*/
|
||||
#[Fillable(['booking_id', 'kind', 'status', 'due_on', 'note', 'completed_by', 'completed_at'])]
|
||||
class BookingTask extends Model
|
||||
{
|
||||
use BelongsToTenant;
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'kind' => BookingTaskKind::class,
|
||||
'status' => BookingTaskStatus::class,
|
||||
'due_on' => 'immutable_date',
|
||||
'completed_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Booking, $this>
|
||||
*/
|
||||
public function booking(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<BookingTask> $query
|
||||
* @return Builder<BookingTask>
|
||||
*/
|
||||
#[Scope]
|
||||
protected function open(Builder $query): Builder
|
||||
{
|
||||
return $query->where('status', BookingTaskStatus::Open);
|
||||
}
|
||||
|
||||
public function complete(string $by): void
|
||||
{
|
||||
$this->update(['status' => BookingTaskStatus::Done, 'completed_by' => $by, 'completed_at' => now()]);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
* A sales channel (portal) of a property. Our system leads: occupations are imported from the
|
||||
* channel and every channel gets its own export feed without its own occupations.
|
||||
*/
|
||||
#[Fillable(['property_id', 'name', 'connector', 'settings', 'is_active', 'requires_manual_blocking', 'manage_url', 'status', 'booking_model', 'import_enabled', 'export_enabled', 'export_mode', 'external_poll_minutes', 'echo_behavior', 'echo_notes', 'operating_notes', 'portal_verified_at'])]
|
||||
#[Fillable(['property_id', 'name', 'connector', 'settings', 'is_active', 'requires_manual_blocking', 'manage_url', 'status', 'booking_model', 'import_enabled', 'export_enabled', 'export_mode', 'external_poll_minutes', 'echo_behavior', 'echo_notes', 'operating_notes', 'portal_verified_at', 'payment_tasks_inquiry', 'payment_tasks_reservation', 'contract_template_id'])]
|
||||
#[Hidden(['export_token', 'previous_export_token', 'export_snapshot', 'settings', 'ical_analysis'])]
|
||||
class Channel extends Model
|
||||
{
|
||||
@@ -72,6 +72,8 @@ protected function casts(): array
|
||||
'booking_model' => ChannelBookingModel::class,
|
||||
'echo_behavior' => ChannelEchoBehavior::class,
|
||||
'portal_verified_at' => 'immutable_datetime',
|
||||
'payment_tasks_inquiry' => 'boolean',
|
||||
'payment_tasks_reservation' => 'boolean',
|
||||
'export_mode' => ChannelExportMode::class,
|
||||
'import_enabled' => 'boolean',
|
||||
'export_enabled' => 'boolean',
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* A version of contract texts for offers (e.g. conditions demanded by a portal). The texts replace the website
|
||||
* texts of the same meaning when an offer is made; the offer then freezes a copy. A version that has been used in
|
||||
* an offer is never edited – a new version is created instead.
|
||||
*/
|
||||
#[Fillable(['name', 'version', 'texts', 'notes'])]
|
||||
class ContractTemplate extends Model
|
||||
{
|
||||
use BelongsToTenant;
|
||||
|
||||
/** Form/storage key => website text key it replaces in an offer. */
|
||||
public const TEXTS = [
|
||||
'intro' => 'contract.intro',
|
||||
'terms' => 'contract.terms',
|
||||
'closing' => 'contract.closing',
|
||||
'cancellation' => 'stay.cancellation',
|
||||
'house_rules' => 'stay.house_rules',
|
||||
'contract_note' => 'offer.contract_note',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['texts' => 'array', 'version' => 'integer'];
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return $this->name.' (Version '.$this->version.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Texts by website text key; blank ones fall back to the website texts.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function overrides(): array
|
||||
{
|
||||
$overrides = [];
|
||||
foreach (self::TEXTS as $field => $key) {
|
||||
$value = $this->texts[$field] ?? null;
|
||||
if (filled($value) && trim(strip_tags((string) $value)) !== '') {
|
||||
$overrides[$key] = (string) $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $overrides;
|
||||
}
|
||||
|
||||
public function isUsed(): bool
|
||||
{
|
||||
return Booking::query()->where('offer_terms->template->id', $this->id)->exists();
|
||||
}
|
||||
|
||||
public function newVersion(): self
|
||||
{
|
||||
$latest = static::query()->where('name', $this->name)->max('version');
|
||||
|
||||
return static::query()->create([
|
||||
'name' => $this->name,
|
||||
'version' => $latest + 1,
|
||||
'texts' => $this->texts,
|
||||
'notes' => $this->notes,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\CancellationMode;
|
||||
use App\Enums\OfferMode;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Carbon\CarbonImmutable;
|
||||
@@ -32,6 +33,10 @@
|
||||
'hold_hours',
|
||||
'offer_mode',
|
||||
'pre_reservation_enabled',
|
||||
'arrival_info_days_before',
|
||||
'cancellation_mode',
|
||||
'free_cancellation_days',
|
||||
'contract_template_id',
|
||||
'check_in_time',
|
||||
'check_out_time',
|
||||
'changeover_weekday',
|
||||
@@ -61,6 +66,9 @@ class Property extends Model
|
||||
'min_stay_absolute' => 2,
|
||||
'offer_mode' => 'manual',
|
||||
'pre_reservation_enabled' => true,
|
||||
'arrival_info_days_before' => 3,
|
||||
'cancellation_mode' => 'request',
|
||||
'free_cancellation_days' => 14,
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -69,6 +77,9 @@ protected function casts(): array
|
||||
'is_active' => 'boolean',
|
||||
'offer_mode' => OfferMode::class,
|
||||
'pre_reservation_enabled' => 'boolean',
|
||||
'arrival_info_days_before' => 'integer',
|
||||
'cancellation_mode' => CancellationMode::class,
|
||||
'free_cancellation_days' => 'integer',
|
||||
'min_stay_fill_gaps' => 'boolean',
|
||||
'min_stay_until_changeover' => 'boolean',
|
||||
'changeover_weekday' => 'integer',
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
use App\Enums\ReviewStatus;
|
||||
use App\Filament\Pages\OccupancyCalendar;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\BookingTasks\BookingTaskResource;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Filament\Resources\InboxMessages\InboxMessageResource;
|
||||
use App\Filament\Resources\PortalOccupations\PortalOccupationResource;
|
||||
use App\Filament\Resources\Reviews\ReviewResource;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Channel;
|
||||
use App\Models\ChannelTask;
|
||||
use App\Models\InboxMessage;
|
||||
@@ -50,7 +52,7 @@ public function build(array $sections, bool $weekly, CarbonImmutable $since): ar
|
||||
DigestSection::Requests => ['Offene Anfragen und Angebote', $this->requests(), BookingResource::getUrl('index'), 'Buchungen öffnen'],
|
||||
DigestSection::News => ['Neu seit '.$since->format('d.m. H:i').' Uhr', $this->news($since), BookingResource::getUrl('index'), 'Buchungen öffnen'],
|
||||
DigestSection::Stays => [$weekly ? 'An- und Abreisen der nächsten 7 Tage' : 'An- und Abreisen heute und morgen', $this->stays($weekly ? 7 : 2), OccupancyCalendar::getUrl(), 'Belegungsplan öffnen'],
|
||||
DigestSection::Payments => ['Überfällige Zahlungen', $this->payments(), BookingResource::getUrl('index'), 'Buchungen öffnen'],
|
||||
DigestSection::Payments => ['Zahlungsaufgaben und Gästewünsche', $this->payments(), BookingTaskResource::getUrl('index'), 'Aufgaben öffnen'],
|
||||
DigestSection::Portals => ['Portale: Aufgaben und Klärungsfälle', $this->portals(), ChannelTaskResource::getUrl('index'), 'Portal-Aufgaben öffnen'],
|
||||
DigestSection::Reviews => ['Bewertungen zur Freigabe', $this->reviews(), ReviewResource::getUrl('index'), 'Bewertungen öffnen'],
|
||||
};
|
||||
@@ -149,13 +151,8 @@ private function stayEvents(array &$events, CarbonImmutable $from, CarbonImmutab
|
||||
*/
|
||||
private function payments(): Collection
|
||||
{
|
||||
return Booking::query()->whereIn('status', [BookingStatus::Confirmed, BookingStatus::DepositPaid])->with(['guest', 'property', 'payments'])->orderBy('arrival')->get()
|
||||
->map(fn (Booking $booking): ?string => match (true) {
|
||||
$booking->status === BookingStatus::Confirmed && $booking->deposit_due_on?->isPast() && $booking->openDeposit() > 0 => $this->booking($booking).' – Anzahlung '.Money::format($booking->openDeposit()).' seit '.$booking->deposit_due_on->format('d.m.').' fällig',
|
||||
$booking->balance_due_on?->isPast() && $booking->openAmount() > 0 => $this->booking($booking).' – offen '.Money::format($booking->openAmount()).' seit '.$booking->balance_due_on->format('d.m.').' fällig',
|
||||
default => null,
|
||||
})
|
||||
->filter()
|
||||
return BookingTask::query()->open()->with('booking.guest', 'booking.property')->oldest()->get()
|
||||
->map(fn (BookingTask $task): string => $this->booking($task->booking).' – '.$task->kind->getLabel().($task->due_on ? ' (seit '.$task->due_on->format('d.m.').')' : ''))
|
||||
->values();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* Signed links the guest finds in mails to release a held request or to cancel a booking (no account needed).
|
||||
* They only open a page; nothing changes before the guest confirms there.
|
||||
*/
|
||||
class SelfServiceLinks
|
||||
{
|
||||
/** Releases a request or offer the guest does not want; valid as long as the dates are held. */
|
||||
public static function release(Booking $booking): string
|
||||
{
|
||||
return self::signed('reservations.release', $booking, $booking->hold_expires_at ?? now()->addDays(14));
|
||||
}
|
||||
|
||||
/** Cancels (or asks to cancel) a binding booking; valid until the day of arrival. */
|
||||
public static function cancel(Booking $booking): string
|
||||
{
|
||||
return self::signed('bookings.cancel', $booking, CarbonImmutable::parse($booking->arrival)->endOfDay());
|
||||
}
|
||||
|
||||
private static function signed(string $route, Booking $booking, \DateTimeInterface $until): string
|
||||
{
|
||||
$parameters = ['booking' => $booking];
|
||||
|
||||
return $booking->website()?->temporarySignedRoute($route, $until, $parameters)
|
||||
?? URL::temporarySignedRoute($route, $until, $parameters);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@
|
||||
'fields' => [
|
||||
'stay.house_rules' => ['label' => 'Hausregeln', 'type' => 'richtext', 'default' => null],
|
||||
'stay.arrival_info' => ['label' => 'Anreiseinformationen (für Gäste-E-Mail vor Anreise)', 'type' => 'richtext', 'default' => null],
|
||||
'stay.key_handover' => ['label' => 'Schlüsselübergabe (Anreise-E-Mail)', 'type' => 'richtext', 'default' => null],
|
||||
'stay.parking' => ['label' => 'Parken (Anreise-E-Mail)', 'type' => 'richtext', 'default' => null],
|
||||
'stay.arrival_day' => ['label' => 'Der entspannte Ankunftstag (Anreise-E-Mail)', 'type' => 'richtext', 'default' => null],
|
||||
'stay.cancellation' => ['label' => 'Stornobedingungen', 'type' => 'richtext', 'default' => null],
|
||||
],
|
||||
],
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Tasks for the landlord about a booking (payment reminders, cancellation requests), the payment policy per
|
||||
* portal and the time of the arrival information per property. Additive; the defaults keep fully own
|
||||
* bookings under payment control and leave portal reservations (portal collects the money) without tasks.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('booking_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('booking_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('kind', 30);
|
||||
$table->string('status', 12)->default('open');
|
||||
$table->date('due_on')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->string('completed_by')->nullable();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['booking_id', 'kind']);
|
||||
$table->index(['tenant_id', 'status']);
|
||||
});
|
||||
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->boolean('payment_tasks_inquiry')->default(true)->after('operating_notes');
|
||||
$table->boolean('payment_tasks_reservation')->default(false)->after('payment_tasks_inquiry');
|
||||
});
|
||||
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('arrival_info_days_before')->default(3)->after('offer_mode');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->dropColumn('arrival_info_days_before');
|
||||
});
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->dropColumn(['payment_tasks_inquiry', 'payment_tasks_reservation']);
|
||||
});
|
||||
Schema::dropIfExists('booking_tasks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* What happens when a guest uses the cancellation link: only a request for the landlord (default), an
|
||||
* immediate cancellation, or an immediate cancellation up to N days before arrival.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->string('cancellation_mode', 20)->default('request')->after('arrival_info_days_before');
|
||||
$table->unsignedSmallInteger('free_cancellation_days')->default(14)->after('cancellation_mode');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->dropColumn(['cancellation_mode', 'free_cancellation_days']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Contract templates with versions (texts that replace the website texts in an offer), a default per property
|
||||
* and per portal, and SHA-256 fingerprints of the stored offer/contract PDFs. Additive.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contract_templates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->unsignedInteger('version')->default(1);
|
||||
$table->json('texts')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['tenant_id', 'name', 'version']);
|
||||
});
|
||||
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->foreignId('contract_template_id')->nullable()->after('free_cancellation_days')->constrained('contract_templates')->nullOnDelete();
|
||||
});
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->foreignId('contract_template_id')->nullable()->after('payment_tasks_reservation')->constrained('contract_templates')->nullOnDelete();
|
||||
});
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->string('offer_pdf_sha256', 64)->nullable()->after('offer_hash');
|
||||
$table->string('contract_pdf_sha256', 64)->nullable()->after('offer_pdf_sha256');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->dropColumn(['offer_pdf_sha256', 'contract_pdf_sha256']);
|
||||
});
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('contract_template_id');
|
||||
});
|
||||
Schema::table('properties', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('contract_template_id');
|
||||
});
|
||||
Schema::dropIfExists('contract_templates');
|
||||
}
|
||||
};
|
||||
@@ -11,10 +11,28 @@
|
||||
|
||||
@if (\App\Support\Content::get('stay.arrival_info'))
|
||||
{{ \App\Support\Content::html('stay.arrival_info') }}
|
||||
@else
|
||||
@endif
|
||||
|
||||
@if (\App\Support\Content::get('stay.key_handover'))
|
||||
## Schlüsselübergabe
|
||||
|
||||
{{ \App\Support\Content::html('stay.key_handover') }}
|
||||
@elseif (! \App\Support\Content::get('stay.arrival_info'))
|
||||
Zur Schlüsselübergabe melden wir uns noch persönlich bei Ihnen.
|
||||
@endif
|
||||
|
||||
@if (\App\Support\Content::get('stay.parking'))
|
||||
## Parken
|
||||
|
||||
{{ \App\Support\Content::html('stay.parking') }}
|
||||
@endif
|
||||
|
||||
@if (\App\Support\Content::get('stay.arrival_day'))
|
||||
## Ihr entspannter Ankunftstag
|
||||
|
||||
{{ \App\Support\Content::html('stay.arrival_day') }}
|
||||
@endif
|
||||
|
||||
@if (\App\Support\Content::get('stay.house_rules'))
|
||||
## Hausregeln
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<x-mail::message :site="$booking->website()" :message="$message ?? null">
|
||||
@if ($cancelled)
|
||||
# Ihre Buchung {{ $booking->reference }} ist storniert
|
||||
|
||||
Guten Tag {{ $booking->guest->full_name }},
|
||||
|
||||
wir haben Ihre Buchung der **{{ $booking->property->name }}** vom {{ $booking->arrival->format('d.m.Y') }} bis {{ $booking->departure->format('d.m.Y') }} wie gewünscht storniert. Der Zeitraum ist wieder frei.
|
||||
|
||||
Ob und in welcher Höhe Stornokosten nach den vereinbarten Stornobedingungen anfallen, teilen wir Ihnen separat mit.
|
||||
@else
|
||||
# Ihr Stornierungswunsch {{ $booking->reference }}
|
||||
|
||||
Guten Tag {{ $booking->guest->full_name }},
|
||||
|
||||
wir haben Ihren Wunsch erhalten, die Buchung der **{{ $booking->property->name }}** vom {{ $booking->arrival->format('d.m.Y') }} bis {{ $booking->departure->format('d.m.Y') }} zu stornieren. **Die Buchung bleibt zunächst bestehen**, bis wir uns bei Ihnen gemeldet haben. Wir prüfen Ihre Anfrage anhand der vereinbarten Stornobedingungen und melden uns zeitnah.
|
||||
@endif
|
||||
|
||||
Bei Fragen erreichen Sie uns unter {{ config('fewo.owner.phone') }}.
|
||||
|
||||
Herzliche Grüße<br>
|
||||
{{ config('fewo.owner.name') }}
|
||||
</x-mail::message>
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
Ihren **Mietvertrag** finden Sie als PDF im Anhang.
|
||||
|
||||
Eine Woche vor Ihrer Anreise erhalten Sie von uns alle Informationen zu Schlüsselübergabe, Parken und WLAN.
|
||||
Falls Sie Ihre Buchung stornieren müssen: [Buchung stornieren oder Stornierung anfragen]({{ \App\Support\SelfServiceLinks::cancel($booking) }}). Dort sehen Sie auch die vereinbarten Stornobedingungen.
|
||||
|
||||
Kurz vor Ihrer Anreise erhalten Sie von uns alle Informationen zu Schlüsselübergabe, Parken und WLAN.
|
||||
|
||||
Herzliche Grüße<br>
|
||||
{{ config('fewo.owner.name') }}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<x-mail::message :site="$booking->website()" :message="$message ?? null">
|
||||
# {{ $cancelled ? 'Buchung vom Gast storniert' : 'Stornierungswunsch eines Gastes' }}
|
||||
|
||||
**{{ $booking->guest->full_name }}** · Buchung **{{ $booking->reference }}** · {{ $booking->property->name }}<br>
|
||||
**Zeitraum:** {{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}<br>
|
||||
**Gesamtpreis:** {{ \App\Support\Money::format($booking->total) }}, bezahlt {{ \App\Support\Money::format($booking->paidAmount()) }}
|
||||
|
||||
@if ($cancelled)
|
||||
Die Buchung wurde sofort storniert und der Zeitraum ist frei. **Stornokosten und eine mögliche Rückzahlung bitte von Hand prüfen** (Aufgabe unter „Zahlungen & Wünsche“).
|
||||
@else
|
||||
Die Buchung besteht weiter. Bitte entscheiden Sie (Aufgabe unter „Zahlungen & Wünsche“) und melden Sie sich beim Gast.
|
||||
@endif
|
||||
|
||||
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
|
||||
Buchung öffnen
|
||||
</x-mail::button>
|
||||
</x-mail::message>
|
||||
@@ -21,6 +21,10 @@
|
||||
{{ $booking->message }}
|
||||
@endif
|
||||
|
||||
@if ($booking->isHoldActive())
|
||||
**Sie brauchen den Zeitraum nicht mehr?** [Zeitraum freigeben]({{ \App\Support\SelfServiceLinks::release($booking) }}) – dann können ihn andere Gäste buchen.
|
||||
@endif
|
||||
|
||||
Bei Fragen antworten Sie einfach auf diese E-Mail oder rufen Sie uns an: {{ config('fewo.owner.phone') }}
|
||||
|
||||
Herzliche Grüße<br>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
@extends('theme::layouts.app', ['title' => 'Buchung stornieren'])
|
||||
|
||||
@push('head')
|
||||
<meta name="robots" content="noindex">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="mx-auto max-w-2xl px-4 py-14 sm:px-8">
|
||||
<p class="eyebrow">Buchung {{ $booking->reference }}</p>
|
||||
<h1 class="heading-display">{{ $booking->property->name }}</h1>
|
||||
|
||||
@if (session('self-service.success'))
|
||||
<div class="mt-8 rounded border border-accent bg-surface p-5" role="status">{{ session('self-service.success') }}</div>
|
||||
@endif
|
||||
@if (session('self-service.error'))
|
||||
<div class="mt-8 rounded border border-line bg-surface p-5" role="alert">{{ session('self-service.error') }}</div>
|
||||
@endif
|
||||
|
||||
<section class="mt-8 rounded bg-surface p-7">
|
||||
<p>{{ $booking->arrival->translatedFormat('l, d.m.Y') }} bis {{ $booking->departure->translatedFormat('l, d.m.Y') }}, {{ $booking->guests }} Personen · Gesamtpreis {{ \App\Support\Money::format($booking->total) }}</p>
|
||||
|
||||
@if ($alreadyAsked && ! session('self-service.success'))
|
||||
<p class="mt-4">
|
||||
@if ($booking->status === \App\Enums\BookingStatus::Cancelled) Diese Buchung ist storniert.
|
||||
@else Ihr Stornierungswunsch liegt uns vor; wir melden uns bei Ihnen. @endif
|
||||
</p>
|
||||
@elseif ($canCancel)
|
||||
@if ($booking->offerText('stay.cancellation'))
|
||||
<h2 class="mt-6 font-display text-xl">Stornobedingungen Ihrer Buchung</h2>
|
||||
<div class="prose-theme mt-2">{{ $booking->offerHtml('stay.cancellation') }}</div>
|
||||
@endif
|
||||
|
||||
<form method="post" action="{{ $action }}" class="mt-6">
|
||||
@csrf
|
||||
@if ($instant)
|
||||
<p>Mit Klick auf den Button wird Ihre Buchung <strong>sofort storniert</strong> und der Zeitraum freigegeben. Ob Stornokosten nach den oben genannten Bedingungen anfallen, teilen wir Ihnen danach mit.</p>
|
||||
@else
|
||||
<p>Mit Klick auf den Button senden Sie uns Ihren <strong>Stornierungswunsch</strong>. Ihre Buchung bleibt bestehen, bis wir uns bei Ihnen gemeldet haben; wir prüfen sie anhand der oben genannten Bedingungen.</p>
|
||||
@endif
|
||||
<label class="mt-4 block" for="message">Nachricht an uns (optional)</label>
|
||||
<textarea id="message" name="message" rows="3" maxlength="1000" class="mt-1 w-full rounded border border-line"></textarea>
|
||||
<button type="submit" class="btn-accent mt-4">{{ $instant ? 'Buchung jetzt stornieren' : 'Stornierung anfragen' }}</button>
|
||||
</form>
|
||||
@else
|
||||
<p class="mt-4">Diese Buchung kann über diesen Link nicht mehr storniert werden. Bitte kontaktieren Sie uns.</p>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<p class="mt-8 text-sm text-muted">Fragen? {{ config('fewo.owner.name') }} · {{ config('fewo.owner.phone') }} · <a class="underline" href="mailto:{{ config('fewo.owner.email') }}">{{ config('fewo.owner.email') }}</a></p>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,37 @@
|
||||
@extends('theme::layouts.app', ['title' => 'Zeitraum freigeben'])
|
||||
|
||||
@push('head')
|
||||
<meta name="robots" content="noindex">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="mx-auto max-w-2xl px-4 py-14 sm:px-8">
|
||||
<p class="eyebrow">Anfrage {{ $booking->reference }}</p>
|
||||
<h1 class="heading-display">{{ $booking->property->name }}</h1>
|
||||
|
||||
@if (session('self-service.success'))
|
||||
<div class="mt-8 rounded border border-accent bg-surface p-5" role="status">{{ session('self-service.success') }}</div>
|
||||
@endif
|
||||
@if (session('self-service.error'))
|
||||
<div class="mt-8 rounded border border-line bg-surface p-5" role="alert">{{ session('self-service.error') }}</div>
|
||||
@endif
|
||||
|
||||
<section class="mt-8 rounded bg-surface p-7">
|
||||
<p>{{ $booking->arrival->translatedFormat('l, d.m.Y') }} bis {{ $booking->departure->translatedFormat('l, d.m.Y') }}, {{ $booking->guests }} Personen</p>
|
||||
|
||||
@if ($released && ! session('self-service.success'))
|
||||
<p class="mt-4">Dieser Zeitraum wurde freigegeben.</p>
|
||||
@elseif ($canRelease)
|
||||
<p class="mt-4">Wenn Sie den vorgemerkten Zeitraum nicht benötigen, geben Sie ihn hier frei – dann können ihn andere Gäste buchen. Es entstehen keine Kosten.</p>
|
||||
<form method="post" action="{{ $action }}" class="mt-6">
|
||||
@csrf
|
||||
<button type="submit" class="btn-accent">Zeitraum freigeben</button>
|
||||
</form>
|
||||
@elseif (! $released)
|
||||
<p class="mt-4">Für diese Anfrage gibt es nichts mehr freizugeben (der Zeitraum ist nicht mehr vorgemerkt oder die Buchung ist bereits verbindlich).</p>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<p class="mt-8 text-sm text-muted">Fragen? {{ config('fewo.owner.name') }} · {{ config('fewo.owner.phone') }} · <a class="underline" href="mailto:{{ config('fewo.owner.email') }}">{{ config('fewo.owner.email') }}</a></p>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -4,6 +4,7 @@
|
||||
use App\Http\Controllers\MarketingConsentController;
|
||||
use App\Http\Controllers\OfferController;
|
||||
use App\Http\Controllers\PageController;
|
||||
use App\Http\Controllers\SelfServiceController;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -16,6 +17,11 @@
|
||||
Route::get('/angebot/{booking}', [OfferController::class, 'show'])->name('offers.show')->middleware('throttle:30,1');
|
||||
Route::post('/angebot/{booking}/annehmen', [OfferController::class, 'accept'])->name('offers.accept')->middleware('throttle:10,1');
|
||||
Route::post('/angebot/{booking}/ablehnen', [OfferController::class, 'reject'])->name('offers.reject')->middleware('throttle:10,1');
|
||||
// Self service from the guest's mails: release a held request, cancel a booking (paths under /angebot/ keep the requested host)
|
||||
Route::get('/angebot/{booking}/freigeben', [SelfServiceController::class, 'showRelease'])->name('reservations.release')->middleware('throttle:30,1');
|
||||
Route::post('/angebot/{booking}/freigeben/bestaetigen', [SelfServiceController::class, 'release'])->name('reservations.release.confirm')->middleware('throttle:10,1');
|
||||
Route::get('/angebot/{booking}/storno', [SelfServiceController::class, 'showCancel'])->name('bookings.cancel')->middleware('throttle:30,1');
|
||||
Route::post('/angebot/{booking}/storno/bestaetigen', [SelfServiceController::class, 'cancel'])->name('bookings.cancel.confirm')->middleware('throttle:10,1');
|
||||
});
|
||||
|
||||
Route::get('/kalender/{token}.ics', [ChannelController::class, 'feed'])->name('channels.feed')->middleware('throttle:60,1');
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Actions\AcceptOffer;
|
||||
use App\Actions\ConfirmBooking;
|
||||
use App\Actions\SendOffer;
|
||||
use App\Documents\RentalContract;
|
||||
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
||||
use App\Filament\Resources\ContractTemplates\Pages\ListContractTemplates;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Contract templates with versions and the documents of record (stored PDFs with fingerprint).
|
||||
*/
|
||||
class ContractTemplateTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Mail::fake();
|
||||
Storage::fake('local');
|
||||
$this->withoutVite();
|
||||
}
|
||||
|
||||
public function test_offer_uses_the_chosen_template_and_freezes_it_with_name_and_version(): void
|
||||
{
|
||||
$template = $this->template('Portal XY', ['terms' => '<p>Bedingungen Portal XY</p>', 'cancellation' => '<p>Storno bis 30 Tage</p>']);
|
||||
|
||||
$offer = $this->offer(['contract_template_id' => $template->id]);
|
||||
|
||||
$this->assertSame('Bedingungen Portal XY', trim(strip_tags($offer->offerText('contract.terms'))));
|
||||
$this->assertSame(['id' => $template->id, 'name' => 'Portal XY', 'version' => 1], $offer->offer_terms['template']);
|
||||
$this->assertNotNull($offer->offer_pdf_sha256);
|
||||
// blank template fields fall back to the website text
|
||||
$this->assertNotEmpty($offer->offerText('contract.closing'));
|
||||
}
|
||||
|
||||
public function test_default_order_is_explicit_choice_then_portal_then_property(): void
|
||||
{
|
||||
$propertyDefault = $this->template('Direkt', ['terms' => '<p>DIREKT</p>']);
|
||||
$portalDefault = $this->template('Portal', ['terms' => '<p>PORTAL</p>']);
|
||||
$this->property->update(['contract_template_id' => $propertyDefault->id]);
|
||||
$channel = Channel::factory()->for($this->property)->create(['contract_template_id' => $portalDefault->id]);
|
||||
|
||||
$direct = $this->offer();
|
||||
$viaPortal = $this->offer([], ['import_channel_id' => $channel->id, 'arrival' => '2026-12-01', 'departure' => '2026-12-04']);
|
||||
|
||||
$this->assertSame('DIREKT', trim(strip_tags($direct->offerText('contract.terms'))));
|
||||
$this->assertSame('PORTAL', trim(strip_tags($viaPortal->offerText('contract.terms'))));
|
||||
}
|
||||
|
||||
public function test_editing_a_template_later_does_not_change_a_sent_offer_or_the_contract(): void
|
||||
{
|
||||
$template = $this->template('Direkt', ['terms' => '<p>VERSION EINS</p>']);
|
||||
$offer = $this->offer(['contract_template_id' => $template->id]);
|
||||
|
||||
$template->update(['texts' => ['terms' => '<p>GEÄNDERT</p>']]);
|
||||
app(AcceptOffer::class)->handle($offer->fresh(), 1);
|
||||
|
||||
$this->assertSame('VERSION EINS', trim(strip_tags($offer->fresh()->offerText('contract.terms'))));
|
||||
}
|
||||
|
||||
public function test_used_versions_are_locked_and_a_new_version_can_be_made(): void
|
||||
{
|
||||
$template = $this->template('Direkt', ['terms' => '<p>A</p>']);
|
||||
$this->assertTrue(ContractTemplateResource::canEdit($template));
|
||||
|
||||
$this->offer(['contract_template_id' => $template->id]);
|
||||
$this->assertFalse(ContractTemplateResource::canEdit($template->fresh()));
|
||||
$this->assertFalse(ContractTemplateResource::canDelete($template->fresh()));
|
||||
|
||||
$this->actingAs(User::factory()->create());
|
||||
Livewire::test(ListContractTemplates::class)->callAction(TestAction::make('newVersion')->table($template), []);
|
||||
|
||||
$this->assertSame([1, 2], ContractTemplate::query()->where('name', 'Direkt')->orderBy('version')->pluck('version')->all());
|
||||
$this->assertTrue(ContractTemplateResource::canEdit(ContractTemplate::query()->where('version', 2)->sole()));
|
||||
}
|
||||
|
||||
public function test_final_contract_is_a_document_of_record_that_is_never_rewritten(): void
|
||||
{
|
||||
$offer = $this->offer();
|
||||
app(AcceptOffer::class)->handle($offer->fresh(), 1);
|
||||
$booking = $offer->fresh();
|
||||
$content = Storage::disk('local')->get($booking->contract_path);
|
||||
|
||||
$this->assertSame(hash('sha256', $content), $booking->contract_pdf_sha256);
|
||||
|
||||
$this->travel(3)->days();
|
||||
app(ConfirmBooking::class)->resend($booking);
|
||||
app(RentalContract::class)->generate($booking->fresh());
|
||||
|
||||
$this->assertSame($content, Storage::disk('local')->get($booking->contract_path));
|
||||
$this->assertSame($booking->contract_pdf_sha256, $booking->fresh()->contract_pdf_sha256);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $texts
|
||||
*/
|
||||
private function template(string $name, array $texts): ContractTemplate
|
||||
{
|
||||
return ContractTemplate::query()->create(['name' => $name, 'version' => 1, 'texts' => $texts]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $changes
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
private function offer(array $changes = [], array $attributes = []): Booking
|
||||
{
|
||||
$booking = Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create([
|
||||
'arrival' => '2026-11-07', 'departure' => '2026-11-10', 'guests' => 2, ...$attributes,
|
||||
]);
|
||||
|
||||
return app(SendOffer::class)->handle($booking, $changes);
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,13 @@
|
||||
|
||||
use App\Actions\SendDigests;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\DigestSection;
|
||||
use App\Filament\Pages\Operations;
|
||||
use App\Mail\Digest;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Guest;
|
||||
use App\Models\InboxMessage;
|
||||
use App\Models\Property;
|
||||
@@ -87,7 +90,8 @@ public function test_summary_lists_requests_stays_payments_and_inbox_and_only_th
|
||||
{
|
||||
$this->openRequest();
|
||||
$this->booking(['arrival' => '2026-11-03', 'departure' => '2026-11-07'], 'Erika Mustermann');
|
||||
$this->booking(['arrival' => '2026-12-01', 'departure' => '2026-12-05', 'balance_due_on' => '2026-10-20', 'created_at' => now()->subWeek()], 'Hans Säumig');
|
||||
$late = $this->booking(['arrival' => '2026-12-01', 'departure' => '2026-12-05', 'balance_due_on' => '2026-10-20', 'created_at' => now()->subWeek()], 'Hans Säumig');
|
||||
BookingTask::query()->create(['booking_id' => $late->id, 'kind' => BookingTaskKind::BalanceReminder, 'status' => BookingTaskStatus::Open, 'due_on' => '2026-10-20']);
|
||||
InboxMessage::factory()->create(['subject' => 'Mögliche Doppelbuchung über FeWo-direkt', 'body' => '<b>Ostsee</b>']);
|
||||
|
||||
app(SendDigests::class)->send($this->tenant, weekly: false);
|
||||
@@ -98,7 +102,7 @@ public function test_summary_lists_requests_stays_payments_and_inbox_and_only_th
|
||||
|
||||
return in_array('Offene Anfragen und Angebote', $titles, true)
|
||||
&& in_array('An- und Abreisen heute und morgen', $titles, true)
|
||||
&& in_array('Überfällige Zahlungen', $titles, true)
|
||||
&& in_array('Zahlungsaufgaben und Gästewünsche', $titles, true)
|
||||
&& str_contains($html, 'Morgen: Anreise')
|
||||
&& str_contains($html, 'Erika Mustermann')
|
||||
&& str_contains($html, 'Hans Säumig')
|
||||
|
||||
@@ -6,13 +6,17 @@
|
||||
use App\Actions\CreateReservation;
|
||||
use App\Actions\RecordPayment;
|
||||
use App\Actions\SendBookingReminders;
|
||||
use App\Actions\SendPaymentReminder;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Filament\Resources\Bookings\Pages\ViewBooking;
|
||||
use App\Filament\Resources\Bookings\RelationManagers\PaymentsRelationManager;
|
||||
use App\Mail\ArrivalInformation;
|
||||
use App\Mail\BookingConfirmed;
|
||||
use App\Mail\PaymentReminder;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use App\Pricing\StayRequest;
|
||||
@@ -85,7 +89,15 @@ public function test_reminders_are_sent_once_at_the_right_time(): void
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-30 09:00'));
|
||||
$this->assertSame(1, $reminders->handle()['deposit_overdue']);
|
||||
$this->assertSame(0, $reminders->handle()['deposit_overdue']);
|
||||
Mail::assertNotSent(PaymentReminder::class);
|
||||
$task = BookingTask::query()->where('kind', BookingTaskKind::DepositReminder)->sole();
|
||||
$this->assertSame(BookingTaskStatus::Open, $task->status);
|
||||
|
||||
app(SendPaymentReminder::class)->handle($task, 'Test');
|
||||
Mail::assertSent(PaymentReminder::class, 1);
|
||||
Mail::assertSent(PaymentReminder::class, fn (PaymentReminder $mail): bool => $mail->kind === PaymentReminder::DEPOSIT_OVERDUE && $mail->hasBcc(config('fewo.notification_email')));
|
||||
$this->assertSame(BookingTaskStatus::Done, $task->fresh()->status);
|
||||
$this->assertNotNull($booking->fresh()->deposit_reminded_at);
|
||||
|
||||
(new RecordPayment)->handle($booking, $booking->deposit, today());
|
||||
|
||||
@@ -97,7 +109,9 @@ public function test_reminders_are_sent_once_at_the_right_time(): void
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-04 09:00'));
|
||||
$this->assertSame(1, $reminders->handle()['balance_overdue']);
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-24 09:00'));
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-27 09:00'));
|
||||
$this->assertSame(0, $reminders->handle()['arrival_info'], 'default: 3 days before arrival');
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-28 09:00'));
|
||||
$this->assertSame(1, $reminders->handle()['arrival_info']);
|
||||
Mail::assertSent(ArrivalInformation::class);
|
||||
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Actions\AcceptOffer;
|
||||
use App\Actions\SendBookingReminders;
|
||||
use App\Actions\SendOffer;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\CancellationMode;
|
||||
use App\Mail\BookingCancelled;
|
||||
use App\Mail\BookingConfirmed;
|
||||
use App\Mail\CancellationRequested;
|
||||
use App\Mail\PaymentReminder;
|
||||
use App\Mail\ReservationReceived;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Support\SelfServiceLinks;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Testing\TestResponse;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Release link (held requests), cancellation link (bookings) and the payment task policy per channel.
|
||||
*/
|
||||
class SelfServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Mail::fake();
|
||||
Storage::fake('local');
|
||||
$this->withoutVite();
|
||||
}
|
||||
|
||||
public function test_release_link_opens_a_page_and_only_the_button_releases_the_dates(): void
|
||||
{
|
||||
$booking = Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create(['arrival' => '2026-11-07', 'departure' => '2026-11-10']);
|
||||
$link = SelfServiceLinks::release($booking);
|
||||
|
||||
$this->get($link)->assertOk()->assertSee('Zeitraum freigeben');
|
||||
$this->assertSame(BookingStatus::Reserved, $booking->fresh()->status);
|
||||
|
||||
$action = $this->formAction($link, 'freigeben/bestaetigen');
|
||||
$this->submit($action)->assertOk()->assertSee('wieder freigegeben');
|
||||
$this->submit($action)->assertOk();
|
||||
|
||||
$this->assertSame(BookingStatus::Declined, $booking->fresh()->status);
|
||||
$this->assertSame(0, Booking::query()->occupying()->count());
|
||||
}
|
||||
|
||||
public function test_release_never_touches_a_binding_booking_and_needs_a_valid_signature(): void
|
||||
{
|
||||
$booking = Booking::factory()->for($this->property)->create(['status' => BookingStatus::Confirmed, 'arrival' => '2026-11-07', 'departure' => '2026-11-10']);
|
||||
|
||||
$this->get(SelfServiceLinks::release($booking).'x')->assertForbidden();
|
||||
$this->post(SelfServiceLinks::release($booking))->assertStatus(405);
|
||||
$this->assertSame(BookingStatus::Confirmed, $booking->fresh()->status);
|
||||
}
|
||||
|
||||
public function test_reservation_mail_contains_the_release_link_only_while_the_dates_are_held(): void
|
||||
{
|
||||
$booking = Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create();
|
||||
$this->assertStringContainsString('/freigeben', (new ReservationReceived($booking))->render());
|
||||
|
||||
$booking->update(['hold_expires_at' => null]);
|
||||
$this->assertStringNotContainsString('/freigeben', (new ReservationReceived($booking->fresh()))->render());
|
||||
}
|
||||
|
||||
public function test_confirmation_contains_the_cancellation_link(): void
|
||||
{
|
||||
$offer = app(SendOffer::class)->handle(Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create(['arrival' => '2026-11-07', 'departure' => '2026-11-10', 'guests' => 2]));
|
||||
app(AcceptOffer::class)->handle($offer->fresh(), 1);
|
||||
|
||||
Mail::assertSent(BookingConfirmed::class, fn (BookingConfirmed $mail): bool => str_contains($mail->render(), '/storno'));
|
||||
}
|
||||
|
||||
public function test_request_mode_only_creates_a_task_and_keeps_the_booking(): void
|
||||
{
|
||||
$booking = $this->confirmed();
|
||||
|
||||
$link = SelfServiceLinks::cancel($booking);
|
||||
$this->get($link)->assertOk()->assertSee('Stornierung anfragen');
|
||||
$action = $this->formAction($link, 'storno/bestaetigen');
|
||||
$this->submit($action, ['message' => 'Krank'])->assertOk()->assertSee('Stornierungswunsch erhalten');
|
||||
$this->submit($action)->assertOk()->assertSee('liegt uns bereits vor');
|
||||
|
||||
$this->assertSame(BookingStatus::Confirmed, $booking->fresh()->status);
|
||||
$task = BookingTask::query()->where('kind', BookingTaskKind::CancellationRequest)->sole();
|
||||
$this->assertSame('Krank', $task->note);
|
||||
Mail::assertSent(CancellationRequested::class, 1);
|
||||
Mail::assertSent(BookingCancelled::class, fn (BookingCancelled $mail): bool => ! $mail->cancelled);
|
||||
}
|
||||
|
||||
public function test_instant_mode_cancels_at_once_and_still_leaves_a_task_for_the_costs(): void
|
||||
{
|
||||
$this->property->update(['cancellation_mode' => CancellationMode::Instant]);
|
||||
$booking = $this->confirmed();
|
||||
|
||||
$link = SelfServiceLinks::cancel($booking);
|
||||
$this->submit($this->formAction($link, 'storno/bestaetigen'))->assertOk()->assertSee('storniert');
|
||||
|
||||
$this->assertSame(BookingStatus::Cancelled, $booking->fresh()->status);
|
||||
$this->assertSame(0, Booking::query()->occupying()->count());
|
||||
$this->assertStringContainsString('Stornokosten', BookingTask::query()->sole()->note);
|
||||
Mail::assertSent(BookingCancelled::class, fn (BookingCancelled $mail): bool => $mail->cancelled);
|
||||
}
|
||||
|
||||
public function test_free_cancellation_window_switches_between_instant_and_request(): void
|
||||
{
|
||||
$this->property->update(['cancellation_mode' => CancellationMode::InstantWhenFree, 'free_cancellation_days' => 14]);
|
||||
$far = $this->confirmed('2026-12-20', '2026-12-24');
|
||||
$near = $this->confirmed('2026-11-01', '2026-11-04');
|
||||
|
||||
$this->post($this->formAction(SelfServiceLinks::cancel($far), 'storno/bestaetigen'));
|
||||
$this->post($this->formAction(SelfServiceLinks::cancel($near), 'storno/bestaetigen'));
|
||||
|
||||
$this->assertSame(BookingStatus::Cancelled, $far->fresh()->status);
|
||||
$this->assertSame(BookingStatus::Confirmed, $near->fresh()->status);
|
||||
}
|
||||
|
||||
public function test_payment_tasks_follow_the_channel_policy(): void
|
||||
{
|
||||
$own = $this->confirmed();
|
||||
$reservationPortal = Channel::factory()->for($this->property)->create(['booking_model' => 'portal_booking', 'payment_tasks_reservation' => false]);
|
||||
$inquiryPortal = Channel::factory()->for($this->property)->create(['booking_model' => 'inquiry', 'payment_tasks_inquiry' => true]);
|
||||
$portalReservation = $this->confirmed('2026-12-10', '2026-12-14', ['import_channel_id' => $reservationPortal->id, 'source' => 'portal']);
|
||||
$portalInquiry = $this->confirmed('2026-12-16', '2026-12-18', ['import_channel_id' => $inquiryPortal->id, 'source' => 'portal']);
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-30 09:00'));
|
||||
(new SendBookingReminders)->handle();
|
||||
|
||||
$withTasks = BookingTask::query()->pluck('booking_id')->unique()->all();
|
||||
$this->assertContains($own->id, $withTasks);
|
||||
$this->assertContains($portalInquiry->id, $withTasks);
|
||||
$this->assertNotContains($portalReservation->id, $withTasks);
|
||||
Mail::assertNotSent(PaymentReminder::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
private function confirmed(string $arrival = '2026-12-01', string $departure = '2026-12-05', array $attributes = []): Booking
|
||||
{
|
||||
return Booking::factory()->for($this->property)->create([
|
||||
'status' => BookingStatus::Confirmed,
|
||||
'arrival' => $arrival,
|
||||
'departure' => $departure,
|
||||
'deposit_due_on' => '2026-10-25',
|
||||
'balance_due_on' => '2026-11-20',
|
||||
'total' => 100000,
|
||||
'deposit' => 30000,
|
||||
...$attributes,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts the form and opens the page it redirects to (the redirect carries the result message in the session).
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
private function submit(string $action, array $data = []): TestResponse
|
||||
{
|
||||
return $this->get($this->post($action, $data)->headers->get('Location'));
|
||||
}
|
||||
|
||||
private function formAction(string $pageUrl, string $action): string
|
||||
{
|
||||
preg_match('~action="([^"]*/'.preg_quote($action, '~').'[^"]*)"~', $this->get($pageUrl)->getContent(), $match);
|
||||
$this->assertNotEmpty($match, "form for {$action} not found");
|
||||
|
||||
return html_entity_decode($match[1]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user