Ein Eingang fuer alle Kanaele (Paket 4, Prozessarchitektur v0.10)
Portalbuchungen und -anfragen aus Kalender und Mail werden ueber PortalIntake zum Vorgang (nur bei sicherer Erkennung), Dubletten ueber Buchungsnummer, gleiches Portal mit gleichen Naechten und Spiegelung; Unsicheres wird geklaert. Portalstorno und -aenderung als Aufgabe am Vorgang ohne stille Stornierung. Schalter je Kanal (Aus als Standard, Beobachten, Anlegen, Anlegen + weiter), Eingangsprotokoll, Bestandsuebernahme mit Vorschau/Bericht/Ruecknahme, Sperrnachweis in drei Stufen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf11c8a474
commit
ac9d20b812
29 files changed
+1952
-16
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\ChannelTaskAction;
|
||||
use App\Enums\ChannelTaskProof;
|
||||
use App\Enums\ChannelTaskStatus;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Database\Factories\ChannelTaskFactory;
|
||||
@@ -18,7 +19,7 @@
|
||||
* A change that has to be made by hand (or by an external automation) on a portal that
|
||||
* cannot be kept in sync fast enough by calendar feeds, e.g. because of instant booking.
|
||||
*/
|
||||
#[Fillable(['channel_id', 'action', 'starts_on', 'ends_on', 'reason', 'status', 'completed_by', 'completed_at', 'reminded_at', 'automation_sent_at', 'automation_error'])]
|
||||
#[Fillable(['channel_id', 'action', 'starts_on', 'ends_on', 'reason', 'status', 'completed_by', 'completed_at', 'reminded_at', 'automation_sent_at', 'automation_error', 'proof', 'proof_note', 'proof_at', 'proof_by'])]
|
||||
class ChannelTask extends Model
|
||||
{
|
||||
/** @use HasFactory<ChannelTaskFactory> */
|
||||
@@ -39,6 +40,8 @@ protected function casts(): array
|
||||
'completed_at' => 'immutable_datetime',
|
||||
'reminded_at' => 'immutable_datetime',
|
||||
'automation_sent_at' => 'immutable_datetime',
|
||||
'proof' => ChannelTaskProof::class,
|
||||
'proof_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -60,7 +63,10 @@ protected function open(Builder $query): Builder
|
||||
return $query->where('status', ChannelTaskStatus::Open);
|
||||
}
|
||||
|
||||
public function complete(string $completedBy): void
|
||||
/**
|
||||
* Completes the task with the proof the person can give (at least: the change was made or started).
|
||||
*/
|
||||
public function complete(string $completedBy, ChannelTaskProof $proof = ChannelTaskProof::Initiated, ?string $note = null): void
|
||||
{
|
||||
if ($this->status !== ChannelTaskStatus::Open) {
|
||||
return;
|
||||
@@ -74,9 +80,38 @@ public function complete(string $completedBy): void
|
||||
'status' => ChannelTaskStatus::Done,
|
||||
'completed_by' => $completedBy,
|
||||
'completed_at' => now(),
|
||||
'proof' => $proof,
|
||||
'proof_note' => filled($note) ? trim($note) : null,
|
||||
'proof_at' => now(),
|
||||
'proof_by' => $completedBy,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raises the proof of a completed task (e.g. the block was later seen in the portal); never lowers it.
|
||||
*/
|
||||
public function prove(ChannelTaskProof $proof, string $by, ?string $note = null): void
|
||||
{
|
||||
$order = array_flip(array_map(fn (ChannelTaskProof $case): string => $case->value, ChannelTaskProof::cases()));
|
||||
if ($this->status !== ChannelTaskStatus::Done || ($this->proof !== null && $order[$proof->value] <= $order[$this->proof->value])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->update(['proof' => $proof, 'proof_note' => filled($note) ? trim($note) : $this->proof_note, 'proof_at' => now(), 'proof_by' => $by]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The state of the task in plain words, including how far it is proven.
|
||||
*/
|
||||
public function proofLabel(): string
|
||||
{
|
||||
return match ($this->status) {
|
||||
ChannelTaskStatus::Open => 'noch offen',
|
||||
ChannelTaskStatus::Dismissed => 'verworfen',
|
||||
ChannelTaskStatus::Done => ($this->proof ?? ChannelTaskProof::Initiated)->getLabel().($this->proof_note ? ' ('.$this->proof_note.')' : ''),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Human readable period, e.g. "14.06.2027 – 21.06.2027".
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user