Files
fewo-stommer/app/Process/Modules/Intake/ChannelBlocks.php
T
LarsandClaude Opus 5.5 7e22e12cac U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester
CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11:
11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002).
Volle Suite vor U-B: 785/785.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 14:49:44 +01:00

61 lines
2.3 KiB
PHP
Raw 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\Process\Modules\Intake;
use App\Enums\ActivityState;
use App\Enums\ChannelTaskStatus;
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
use App\Models\ChannelTask;
use App\Process\Activity;
use App\Process\CaseContext;
use App\Process\Modules\Module;
use App\Process\Modules\ModuleDefinition;
use App\Process\Modules\StepState;
/**
* Blocking and releasing the dates in portals that need it by hand (requires_manual_blocking): the tasks come from the
* observers (CreateChannelTasks) and are proven per portal (ChannelTaskProof). Mandatory, never switched off.
*/
final class ChannelBlocks extends Module
{
public static function key(): string
{
return 'channels.block';
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Andere Kanäle sperren',
purpose: 'Sperrt den Zeitraum in Portalen, die nicht automatisch abgleichen, und gibt ihn bei Ende wieder frei – mit Nachweis je Portal.',
phase: 'P02',
effects: ['channel_task', 'landlord_mail', 'network'],
waits: ['landlord', 'portal'],
triggers: ['booking.occupies', 'booking.released'],
performers: ['landlord', 'system'],
);
}
public function activities(CaseContext $case): array
{
$booking = $case->booking;
return ChannelTask::query()
->with('channel')
->whereHas('channel', fn ($query) => $query->where('property_id', $booking->property_id))
->whereDate('starts_on', $booking->arrival)
->whereDate('ends_on', $booking->departure)
->where('status', '!=', ChannelTaskStatus::Dismissed)
->orderBy('id')
->get()
->map(fn (ChannelTask $task): Activity => new Activity('channel_block', ($task->action->value === 'block' ? 'In ' : 'Freigeben in ').$task->channel?->name.($task->action->value === 'block' ? ' sperren' : ''), $task->status === ChannelTaskStatus::Open ? ActivityState::Open : ActivityState::Done, $task->period().' · '.$task->proofLabel(), url: ChannelTaskResource::getUrl()))
->all();
}
/** Listed on its own in the work list; it never holds another step back. */
public function state(CaseContext $case): ?StepState
{
return null;
}
}