Criar Hotel: a escolha do dossier mostra a actividade de cada um

Vindo da página de um sector, os dossiers do mesmo sector aparecem primeiro,
cada um com a sua actividade, e escolher um dossier de outra actividade
avisa que o novo sector fica só como proposta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
Claude
2026-12-04 21:11:45 +02:00
committed by nala
parent a3f2d2d7ca
commit b7ec4578dd
4 changed files with 76 additions and 4 deletions
+13 -2
View File
@@ -352,8 +352,19 @@ final class InvestorPath
$contexts = DB::table('desk_cases as c')->join('investor_journeys as j', 'j.id', '=', 'c.journey_id')->whereNotNull('j.path_definition_id')
->whereNull('j.deleted_at')->whereNull('c.closed_at')->where(fn ($q) => $q->where(fn ($p) => $p->where('c.user_id', $actor->id)->whereNull('c.organization_id'))->orWhereIn('c.organization_id', $organizations))
->orderByDesc('c.updated_at')->get(['c.id', 'c.title', 'c.version', 'c.updated_at'])
->map(fn ($row) => ['id' => $row->id, 'title' => $row->title, 'version' => $row->version, 'updated_at' => $row->updated_at])->all();
->orderByDesc('c.updated_at')->get(['c.id', 'c.title', 'c.version', 'c.updated_at', 'c.payload'])
->map(function ($row) {
// The dossier's primary activity, so a new reference never lands in the wrong initiative unseen.
try {
$fields = $this->desk->decode($row->payload)['investor_path']['context']['fields'] ?? [];
} catch (\Throwable) {
$fields = [];
}
return ['id' => $row->id, 'title' => $row->title, 'version' => $row->version, 'updated_at' => $row->updated_at,
'sector_id' => isset($fields['sector_id']) && $fields['sector_id'] !== '' ? (string) $fields['sector_id'] : null,
'sector' => isset($fields['sector']) && $fields['sector'] !== '' ? (string) $fields['sector'] : null];
})->all();
return array_values($contexts);
}