<?php $__env->startSection('title', env('APP_NAME') . ' :: ' . __('Legislação') . ' — ' . $legislacao->nr_legislacao); ?>
<?php $__env->startSection('content'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('pmar/css/paginas/licitacoes-publicas.css')); ?>">

    <div class="lp-hero lp-wrap">
        <div class="lp-hero-inner">
            <div class="container">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(route('paginas.home')); ?>"><?php echo e(__('Portal')); ?></a></li>
                        <li class="breadcrumb-item"><a href="<?php echo e(route('paginas.legislacao')); ?>"><?php echo e(__('Legislação municipal')); ?></a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo e($legislacao->nr_legislacao); ?></li>
                    </ol>
                </nav>
                <div class="lp-hero-body">
                    <div class="lp-hero-icon">
                        <i class="fa-solid fa-scale-balanced text-primary"></i>
                    </div>
                    <div>
                        <h1 class="lp-hero-title text-primary">
                            <?php echo e($legislacao->tipo->ds_tipo_legislacao ?? __('Legislação')); ?> <?php echo e(__('nº :n', ['n' => $legislacao->nr_legislacao])); ?>

                        </h1>
                        <p class="lp-hero-sub text-primary mb-0"><?php echo e($legislacao->ds_ementa ?: __('Sem ementa cadastrada.')); ?></p>
                    </div>
                </div>
            </div>
            <div class="lp-hero-bar"></div>
        </div>
    </div>

    <section class="lp-main lp-wrap">
        <div class="container">
            <div class="row g-4">
                <div class="col-lg-4">
                    <div class="card border-0 shadow-sm">
                        <div class="card-body small">
                            <p class="mb-2"><strong><?php echo e(__('Publicação:')); ?></strong>
                                <?php echo e($legislacao->dt_publicacao ? $legislacao->dt_publicacao->format('d/m/Y') : __('Não informada')); ?></p>
                            <p class="mb-2"><strong><?php echo e(__('Assinatura:')); ?></strong>
                                <?php echo e($legislacao->dt_assinatura ? $legislacao->dt_assinatura->format('d/m/Y') : __('Não informada')); ?></p>
                            <p class="mb-2"><strong><?php echo e(__('Autor:')); ?></strong> <?php echo e($legislacao->autor?->autor_com_cargo ?? __('Não informado')); ?></p>
                            <p class="mb-2"><strong><?php echo e(__('Sanção:')); ?></strong> <?php echo e($legislacao->autorSancao?->autor_com_cargo ?? __('Não informado')); ?></p>
                            <?php if($legislacao->boletim): ?>
                                <p class="mb-2">
                                    <strong><?php echo e(__('Boletim:')); ?></strong>
                                    <?php echo $__env->make('components.legislacao._boletimNumeroLink', ['boletim' => $legislacao->boletim], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                </p>
                            <?php endif; ?>
                            <?php if($legislacao->public_pdf_url): ?>
                                <div>
                                    <a href="<?php echo e($legislacao->public_pdf_url); ?>" target="_blank" rel="noopener noreferrer"
                                        class="btn btn-sm btn-outline-primary">
                                        <i class="fa-solid fa-file-pdf me-1"></i><?php echo e(__('PDF da legislação')); ?>

                                    </a>
                                </div>
                            <?php endif; ?>
                            <?php if($legislacao->categorias->isNotEmpty()): ?>
                                <div class="mt-3">
                                    <strong class="d-block mb-1"><?php echo e(__('Categorias')); ?></strong>
                                    <?php $__currentLoopData = $legislacao->categorias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis me-1"><?php echo e($categoria->nm_categoria); ?></span>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="col-lg-8">
                    <?php if($legislacao->retificacoes->isNotEmpty()): ?>
                        <div class="card border-0 shadow-sm mb-3">
                            <div class="card-header bg-light"><strong><?php echo e(__('Correções publicadas')); ?></strong></div>
                            <ul class="list-group list-group-flush">
                                <?php $__currentLoopData = $legislacao->retificacoes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ret): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li class="list-group-item small">
                                        <strong><?php echo e((int) $ret->cd_tipo === 1 ? __('Errata') : __('Republicação')); ?></strong>
                                        —
                                        <?php echo $__env->make('components.legislacao._boletimNumeroLink', ['boletim' => $ret->boletim], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                        <?php if($ret->ds_descricao): ?>
                                            <div class="text-muted mt-1"><?php echo e($ret->ds_descricao); ?></div>
                                        <?php endif; ?>
                                    </li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    <?php endif; ?>

                    <?php if($legislacao->acoes->isNotEmpty()): ?>
                        <div class="card border-0 shadow-sm mb-3">
                            <div class="card-header bg-light"><strong><?php echo e(__('Relacionamentos')); ?></strong></div>
                            <ul class="list-group list-group-flush small">
                                <?php $__currentLoopData = $legislacao->acoes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $acao): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php
                                        $alvo = $acao->legislacaoSofreAcao;
                                        $tipo = $alvo?->tipo?->ds_tipo_legislacao ?? '';
                                        $nr = $alvo?->nr_legislacao ?? '';
                                        $rotulo = match ((int) $acao->cd_acao) {
                                            1 => __('Altera'),
                                            2 => __('Revoga'),
                                            3 => __('Anula'),
                                            4 => __('Promulga'),
                                            default => '',
                                        };
                                    ?>
                                    <li class="list-group-item"><?php echo e($rotulo); ?>: <?php echo e($tipo); ?> <?php echo e(__('nº :n', ['n' => $nr])); ?></li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    <?php endif; ?>

                    <?php if($legislacao->ds_legislacao_compilada): ?>
                        <div class="card border-0 shadow-sm mb-3">
                            <div class="card-header bg-light"><strong><?php echo e(__('Texto compilado')); ?></strong></div>
                            <div class="card-body">
                                <div class="legislacao-html"><?php echo \App\Helpers\HtmlSanitizer::sanitize($legislacao->ds_legislacao_compilada); ?></div>
                            </div>
                        </div>
                    <?php elseif($legislacao->ds_legislacao_sem_html): ?>
                        <div class="card border-0 shadow-sm mb-3">
                            <div class="card-header bg-light"><strong><?php echo e(__('Texto')); ?></strong></div>
                            <div class="card-body">
                                <p class="mb-0"><?php echo e($legislacao->ds_legislacao_sem_html); ?></p>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if($legislacao->ds_legislacao_original && $legislacao->ds_legislacao_original !== $legislacao->ds_legislacao_compilada): ?>
                        <div class="card border-0 shadow-sm">
                            <div class="card-header bg-light"><strong><?php echo e(__('Texto original')); ?></strong></div>
                            <div class="card-body">
                                <div class="legislacao-html"><?php echo \App\Helpers\HtmlSanitizer::sanitize($legislacao->ds_legislacao_original); ?></div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.pmar.theme', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/portal/resources/views/paginas/legislacao-detalhe.blade.php ENDPATH**/ ?>