@php
function renderStructure($item)
{
$isArtigo = ($item['structureType']->abrev ?? '') === 'Art.';
if (!empty($item['children'])) {
foreach ($item['allVersions'] as $version) {
$isRevogada = false;
$isAdicionada = false;
$isAtual = $version['isCurrent'];
$alterations = $version['alteration'] ?? [];
if (!is_array($alterations) || isset($alterations['type'])) {
$alterations = [$version['alteration']];
}
foreach ($alterations as $alt) {
if (!empty($alt['type'])) {
if ($alt['type'] === 'revogado') {
$isRevogada = true;
}
if ($alt['type'] === 'adicionado') {
$isAdicionada = true;
}
}
}
echo '
';
$style = $item['isCentered']
? 'text-align:center; display:block; width:100%;'
: 'text-align:left; display:flex; align-items:flex-start;';
echo '';
if ($item['showAbrev'] && $item['structureType']) {
if ($isArtigo && !$item['isCentered']) {
echo '' .
e($item['structureType']->abrev) .
' ' .
e($item['orderText']) .
'';
} else {
echo '' .
e($item['structureType']->abrev) .
' ' .
e($item['orderText']) .
($item['isCentered'] ? '' : ' - ') .
'';
}
} else {
echo '' .
e($item['orderText']) .
($item['isCentered'] ? '' : ' - ') .
'';
}
if (!empty(trim($version['structure']->content ?? ''))) {
if (!$isAtual) {
echo '
' .
$version['structure']->content .
'
';
} else {
echo '' .
$version['structure']->content .
'';
}
}
echo '
';
foreach ($alterations as $alteration) {
if (!empty($alteration['text'])) {
$type = $alteration['type'] ?? '';
$class =
$type === 'revogado'
? 'text-danger fw-bold'
: ($type === 'adicionado'
? 'text-success fw-bold'
: 'text-primary');
$text = e($alteration['text']);
echo '';
if (!empty($alteration['link'])) {
echo '
' .
$text .
'';
} else {
echo '
' . $text . '';
}
echo '
';
}
}
echo '';
if ($isAtual && !$isRevogada) {
echo '';
foreach ($item['children'] as $child) {
renderStructure($child);
}
echo '
';
}
}
} else {
foreach ($item['allVersions'] as $version) {
$isRevogada = false;
$isAdicionada = false;
$isAtual = $version['isCurrent'];
$alterations = $version['alteration'] ?? [];
if (!is_array($alterations) || isset($alterations['type'])) {
$alterations = [$version['alteration']];
}
foreach ($alterations as $alt) {
if (!empty($alt['type'])) {
if ($alt['type'] === 'revogado') {
$isRevogada = true;
}
if ($alt['type'] === 'adicionado') {
$isAdicionada = true;
}
}
}
echo '';
$style = $item['isCentered']
? 'text-align:center; display:block; width:100%;'
: 'text-align:left; display:flex; align-items:flex-start;';
echo '';
if ($item['showAbrev'] && $item['structureType']) {
if ($isArtigo && !$item['isCentered']) {
echo '' .
e($item['structureType']->abrev) .
' ' .
e($item['orderText']) .
'';
} else {
echo '' .
e($item['structureType']->abrev) .
' ' .
e($item['orderText']) .
($item['isCentered'] ? '' : ' - ') .
'';
}
} else {
echo '' .
e($item['orderText']) .
($item['isCentered'] ? '' : ' - ') .
'';
}
if (!empty(trim($version['structure']->content ?? ''))) {
if (!$isAtual) {
echo '
' .
$version['structure']->content .
'
';
} else {
echo '' .
$version['structure']->content .
'';
}
}
echo '
';
foreach ($alterations as $alteration) {
if (!empty($alteration['text'])) {
$type = $alteration['type'] ?? '';
$class =
$type === 'revogado'
? 'text-danger fw-bold'
: ($type === 'adicionado'
? 'text-success fw-bold'
: 'text-primary');
$text = e($alteration['text']);
echo '';
if (!empty($alteration['link'])) {
echo '
' .
$text .
'';
} else {
echo '
' . $text . '';
}
echo '
';
}
}
echo '';
}
}
}
@endphp
๐ รndice da Lei
@foreach ($processedStructures as $index => $item)
@endforeach
@foreach ($processedStructures as $item)
@php renderStructure($item); @endphp
@endforeach
@include('maker.scripts.search')
@include('maker.scripts.tabelas')