Booking path 1 (offer + guest acceptance), 2FA for all, privacy hardening, brand graphics in theme
- Offer workflow: "Angebot senden" in the admin (dates, guests, promo code, manual price adjustment, validity from the property's hold time, message, guest data for the contract) with live price; contract draft PDF; signed, versioned offer page for the guest to accept (acceptance record without IP) or decline; expiry job, landlord notifications, editable offer texts, wording on the website. - 2FA is mandatory for every admin account. - Privacy: complete anonymisation (notes, attribution, review names, offer messages), shorter periods for unbinding requests, portal mail excerpts and attribution (configurable proposals), iCal summary not stored, known e-mail no longer overwrites guest data, security headers, bearer tokens for automations, metadata stripped from photo originals, review link throttled. - Daily database backup (backup:database) and scripts/backup-pull.sh for the NAS. - Theme: brand mark in header/footer, favicon/touch icon, wave divider, icons, illustration as image placeholder; navy follows the text colour for dark appearances. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82698f8eda
commit
4f69b426a4
77 files changed
+1658
-108
No files matched your search
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\AcceptOffer;
|
||||
use App\Actions\RejectOffer;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* The guest's offer page (no account): reached by the signed link in the offer e-mail. Shows the complete
|
||||
* offer and lets the guest accept or decline it; the form actions are signed the same way.
|
||||
*/
|
||||
class OfferController extends Controller
|
||||
{
|
||||
public function show(Request $request, Booking $booking, AcceptOffer $accept): View
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$version = (int) $request->query('v');
|
||||
|
||||
$problem = null;
|
||||
if ($booking->status === BookingStatus::OfferSent) {
|
||||
try {
|
||||
$accept->ensureAcceptable($booking, $version);
|
||||
} catch (ReservationException $exception) {
|
||||
$problem = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$expires = $booking->hold_expires_at?->isFuture() ? $booking->hold_expires_at : now()->addHour();
|
||||
|
||||
return view('offer', [
|
||||
'booking' => $booking,
|
||||
'problem' => $problem,
|
||||
'canAnswer' => $booking->status === BookingStatus::OfferSent && $problem === null,
|
||||
'acceptUrl' => URL::temporarySignedRoute('offers.accept', $expires, ['booking' => $booking, 'v' => $version]),
|
||||
'rejectUrl' => URL::temporarySignedRoute('offers.reject', $expires, ['booking' => $booking, 'v' => $version]),
|
||||
'title' => 'Ihr Angebot',
|
||||
]);
|
||||
}
|
||||
|
||||
public function accept(Request $request, Booking $booking, AcceptOffer $accept): RedirectResponse
|
||||
{
|
||||
$request->validate(['terms' => ['accepted']], ['terms.accepted' => 'Bitte bestätigen Sie, dass Sie die Bedingungen gelesen haben.']);
|
||||
|
||||
return $this->answer($request, $booking, fn (int $version) => $accept->handle($booking, $version), 'Vielen Dank! Ihre Buchung ist verbindlich. Die Bestätigung mit dem Mietvertrag haben wir Ihnen per E-Mail gesendet.');
|
||||
}
|
||||
|
||||
public function reject(Request $request, Booking $booking, RejectOffer $reject): RedirectResponse
|
||||
{
|
||||
return $this->answer($request, $booking, fn (int $version) => $reject->handle($booking, $version), 'Schade – wir haben Ihre Absage erhalten und den Zeitraum wieder freigegeben. Vielleicht ein anderes Mal!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the answer and returns to a freshly signed offer page with the result.
|
||||
*/
|
||||
private function answer(Request $request, Booking $booking, callable $action, string $success): RedirectResponse
|
||||
{
|
||||
$version = (int) $request->query('v');
|
||||
$back = URL::temporarySignedRoute('offers.show', now()->addDays(30), ['booking' => $booking, 'v' => $version]);
|
||||
|
||||
try {
|
||||
$action($version);
|
||||
} catch (ReservationException $exception) {
|
||||
return redirect()->to($back)->with('offer.error', $exception->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->to($back)->with('offer.success', $success);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user