This commit is contained in:
2026-11-02 20:31:15 +02:00
parent 8ddfa93f45
commit 1da273f1f3
131 changed files with 14802 additions and 526 deletions
+11 -12
View File
@@ -26,24 +26,23 @@ footer { margin-top:28px; border-top:1px solid #cbd8d3; padding-top:12px; }
<h2>Dados submetidos</h2><table><caption>Informação declarada pelo requerente</caption><tbody>
@php
$opportunityScope = json_decode($snapshot['payload']['context_opportunity_snapshot'] ?? '{}', true);
$applicableFields = $applicableFields ?? app(\App\Services\VirtualDesk::class)->applicableFields($snapshot['payload'] ?? [], $definition);
$answers = array_diff_key($snapshot['payload'] ?? [], array_flip(['context_opportunity_snapshot', 'context_opportunity', 'context_reuse']));
$inactiveAnswers = array_intersect_key($answers, array_diff_key($definition['fields'], $applicableFields));
@endphp
@if(data_get($opportunityScope, 'choice.opportunity.key'))
<tr><th>Oportunidade associada</th><td>{{ data_get($opportunityScope, 'choice.opportunity.title') }} · {{ data_get($opportunityScope, 'choice.opportunity.key') }}</td></tr>
<tr><th>Contexto territorial guardado</th><td>{{ data_get($opportunityScope, 'choice.territory.title') ?: 'Por definir' }} · {{ data_get($opportunityScope, 'choice.corridor_name') ?: 'Corredor por definir' }} · {{ data_get($opportunityScope, 'choice.park.title') ?: 'Sem zona/parque seleccionado' }} · Revisão {{ $opportunityScope['revision'] }}</td></tr>
@endif
@foreach(($snapshot['payload'] ?? []) as $key => $value)
@continue(in_array($key, ['context_opportunity_snapshot', 'context_opportunity', 'context_reuse'], true))
@php
$field = $definition['fields'][$key] ?? [];
$empty = $value === null || $value === '' || $value === [];
$display = $empty ? 'Não informado' : (is_bool($value) ? ($value ? 'Sim' : 'Não') : (is_scalar($value) ? ($field['options'][(string) $value] ?? (string) $value) : json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)));
if (!$empty && in_array($key, ['investment_amount', 'own_finance', 'other_finance'], true) && is_numeric($value)) {
$display = number_format((float)$value, 2, ',', ' ').' '.(($snapshot['payload']['currency'] ?? '') ?: '(moeda não informada)');
}
@endphp
<tr><th scope="row">{{ $field['label'] ?? \Illuminate\Support\Str::headline($key) }}</th><td>{{ $display }}</td></tr>
@endforeach
@include('desk.receipt-answers', ['answers' => array_diff_key($answers, $inactiveAnswers)])
</tbody></table>
@if($inactiveAnswers)
<h2>Respostas conservadas de perguntas não aplicáveis</h2>
<p>Estas respostas foram conservadas na submissão, mas as condições do formulário não as tornam aplicáveis. Não entram nas verificações de preparação deste pedido.</p>
<table><caption>Histórico conservado na submissão</caption><tbody>
@include('desk.receipt-answers', ['answers' => $inactiveAnswers])
</tbody></table>
@endif
<h2>Suportes documentais</h2>
@forelse(($snapshot['documents'] ?? []) as $document)
<p>{{ data_get($document, 'source_reference') ?: 'Referência não informada' }} · Versão {{ data_get($document, 'version_no') ?? 'Não informada' }}</p>