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
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user