Stornoregeln mit automatischer Kostenberechnung, Storno-Verwaltung, Vertragsanlagen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s

- Stornoregel (Stufen nach Tagen vor Anreise, Mietpreis oder Gesamtpreis, Ersatzmieter-Gebuehr), je Vertragsvorlage,
  beim Angebot eingefroren, als Platzhalter im Vertrag
- Stornierung (Gast-Link oder Verwaltung) berechnet die Kosten, legt einen Stornofall an; Verwaltung Stornierungen
  mit Vorschlag, Festlegung, Saldo, Abrechnung und Erlass; Gast sieht die Kosten vorab auf der Storno-Seite
- Vertragsanlagen als eigene versionierte Dokumente mit Bedingung (immer, Zusatzleistung, Portal, von Hand),
  je Angebot ausgewaehlt und eingefroren; Zusatzleistungen in der Buchung erfassbar
- FeWo-direkt-Installation legt die Stornoregel aus Paragraf 13 an

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 16:32:48 +01:00
1 parent 5baf39441f
commit 0c4187edaf
37 files changed
+1440 -10

No files matched your search

+24 -2
View File
@@ -5,13 +5,15 @@
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Collection;
/**
* 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', 'body', 'annex_title', 'annex_body', 'notes'])]
#[Fillable(['name', 'version', 'texts', 'body', 'annex_title', 'annex_body', 'cancellation_policy_id', 'annex_ids', 'notes'])]
class ContractTemplate extends Model
{
use BelongsToTenant;
@@ -33,7 +35,7 @@ class ContractTemplate extends Model
*/
protected function casts(): array
{
return ['texts' => 'array', 'version' => 'integer'];
return ['texts' => 'array', 'version' => 'integer', 'annex_ids' => 'array'];
}
/**
@@ -44,6 +46,24 @@ public function hasDocument(): bool
return filled($this->body) && trim(strip_tags((string) $this->body)) !== '';
}
/**
* @return BelongsTo<CancellationPolicy, $this>
*/
public function cancellationPolicy(): BelongsTo
{
return $this->belongsTo(CancellationPolicy::class);
}
/**
* The annexes of this template whose condition fits the booking.
*
* @return Collection<int, ContractAnnex>
*/
public function annexesFor(Booking $booking): Collection
{
return ContractAnnex::query()->whereIn('id', (array) ($this->annex_ids ?? []))->orderBy('name')->get()->filter(fn (ContractAnnex $annex): bool => $annex->appliesTo($booking))->values();
}
public function label(): string
{
return $this->name.' (Version '.$this->version.')';
@@ -83,6 +103,8 @@ public function newVersion(): self
'body' => $this->body,
'annex_title' => $this->annex_title,
'annex_body' => $this->annex_body,
'cancellation_policy_id' => $this->cancellation_policy_id,
'annex_ids' => $this->annex_ids,
'notes' => $this->notes,
]);
}