Files
fewo-stommer/app/Http/Controllers/ChangeController.php
LarsandClaude Opus 5.5 3bcfc09417
Deploy FeWo mit PipelineManager / deploy (push) Successful in 4m44s
Pakete 8, 5 und 6: Beträge und Zahlungen, Ändern und Stornieren, A6 im Vorgang
- Paket 8: Zahlungsarten (Gast an uns, laut Portal, Auszahlung, Erstattung),
  Portalbeträge als Angaben mit Quelle, Übersicht nach Zuständigkeit (R09).
- Paket 5: Ändern mit Folgenvorschau, vereinbart oder dem Gast vorgeschlagen
  (signierter Link), ein Stornoweg mit Grund und Erstattung, Portalstorno erst
  nach Bestätigung.
- Paket 6: eigene Nutzung, Besuch und Sperre als Vorgang mit Kurabgabe und
  Aufenthaltsbestätigung; Bestandsübernahme der Sperren mit identischem Export.
- Wirksame Einstellungen (Expertenansicht), Abnahmekatalog T01–T14, Ergebnis-,
  Abnahme- und Konfigurationsdokument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:16:47 +01:00

51 lines
1.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Controllers;
use App\Actions\ChangeBooking;
use App\Enums\ChangeStatus;
use App\Exceptions\ReservationException;
use App\Mail\ChangeAnswered;
use App\Models\BookingChange;
use App\Support\Settings;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
/**
* The guest's page for a proposed change of a booking (signed link): see it, accept it or decline it. Only the acceptance
* here makes the change binding; it is recorded with time and (hashed) address.
*/
class ChangeController extends Controller
{
public function show(BookingChange $change): View
{
return view('change', ['change' => $change, 'booking' => $change->booking]);
}
public function accept(Request $request, BookingChange $change, ChangeBooking $changes): RedirectResponse
{
$request->validate(['agree' => ['accepted']], ['agree.accepted' => 'Bitte bestätigen Sie, dass Sie mit der Änderung einverstanden sind.']);
try {
$changes->accept($change, $request->ip());
} catch (ReservationException $exception) {
return back()->with('change.error', $exception->getMessage());
}
rescue(fn () => Mail::to(Settings::notificationRecipients())->send(new ChangeAnswered($change->fresh(), accepted: true)));
return back()->with('change.success', 'Vielen Dank – die Änderung ist jetzt verbindlich.');
}
public function decline(BookingChange $change, ChangeBooking $changes): RedirectResponse
{
if ($change->status === ChangeStatus::Proposed) {
$changes->decline($change, request()->ip());
rescue(fn () => Mail::to(Settings::notificationRecipients())->send(new ChangeAnswered($change->fresh(), accepted: false)));
}
return back()->with('change.success', 'Sie haben die Änderung abgelehnt. Ihre Buchung bleibt unverändert.');
}
}