" . __('Homologação'); @endphp
@include('components.buttons._headLineButtonsBackAdd', [
'headLine' => __($headLine),
'routeBack' => 'admin.licitacoesProcedimentos.index',
'routeBackParams' => request()->only(['ano', 'tipo_processo', 'tipo', 'status', 'nr_processo', 'page']),
'nameBack' => __('Voltar'),
'permission' => 'GERENCIADOR_DE_LICITACOES_E_PROCEDIMENTOS',
])
@php
$favorecidosOld = old('favorecidos');
$boletinsRegistro = collect($registro->boletins ?? []);
$favorecidosRegistro = collect();
if ($boletinsRegistro->isNotEmpty() && is_array($boletinsRegistro->first()) && array_key_exists('ds_favorecido', $boletinsRegistro->first())) {
$favorecidosRegistro = $boletinsRegistro;
} else {
$boletinsLegado = $boletinsRegistro;
if ($boletinsLegado->isEmpty() && (!empty($registro->ds_bo) || !empty($registro->ds_urlbo))) {
$boletinsLegado = collect([['ds_bo' => $registro->ds_bo, 'ds_urlbo' => $registro->ds_urlbo]]);
}
$favorecidosRegistro = collect([[
'ds_favorecido' => $registro->ds_favorecido,
'dt_homologacao' => optional($registro->dt_homologacao)->format('Y-m-d'),
'boletins' => $boletinsLegado->values()->all(),
]]);
}
$favorecidosPreenchidos = collect($favorecidosOld ?? $favorecidosRegistro)->values();
if ($favorecidosPreenchidos->isEmpty()) {
$favorecidosPreenchidos = collect([[
'ds_favorecido' => '',
'dt_homologacao' => '',
'boletins' => [['ds_bo' => '', 'ds_urlbo' => '']],
]]);
}
$nextFavorecidoIndex = $favorecidosPreenchidos->count();
@endphp