@php
function renderStructure($structure, $level = 0)
{
$paddingLeft = 20 * $level;
$isArtigo = ($structure->structureType->abrev ?? '') === 'Art.';
$isCentered = $structure->structureType && $structure->structureType->center;
$showAbrev = $structure->structureType && $structure->structureType->show_abrev;
echo '
';
if ($isCentered) {
echo '';
if ($showAbrev) {
echo '
';
echo $structure->structureType->abrev . ' ' . $structure->order_label;
echo '';
} else {
echo '
';
echo $structure->order_label;
echo '';
}
if (!empty(trim($structure->content ?? ''))) {
echo '
';
echo $structure->content;
echo '
';
}
echo '
';
} else {
echo '';
if ($showAbrev) {
if ($isArtigo) {
echo '';
echo $structure->structureType->abrev . ' ' . $structure->order_label;
echo '';
} else {
echo '';
echo $structure->structureType->abrev . ' ' . $structure->order_label . ' -';
echo '';
}
} else {
echo '';
echo $structure->order_label . ' -';
echo '';
}
if (!empty(trim($structure->content ?? ''))) {
echo '';
echo $structure->content;
echo '';
}
echo '
';
}
echo '';
// Renderiza children recursivamente ORDENADOS
if ($structure->children->count() > 0) {
$sortedChildren = $structure->children->sortBy('sort_order');
echo '';
foreach ($sortedChildren as $child) {
renderStructure($child, $level + 1);
}
echo '
';
}
}
// Ordena as estruturas principais pelo sort_order
$sortedStructures = $law->structures->sortBy('sort_order');
@endphp
๐ รndice da Lei
@foreach ($sortedStructures as $index => $structure)
@endforeach
@foreach ($sortedStructures as $structure)
@php renderStructure($structure); @endphp
@endforeach
@include('maker.scripts.search')
@include('maker.scripts.tabelas')