<?php $__env->startSection("title", env("APP_NAME") . " :: " . __('Legislação Municipal')); ?>
<?php $__env->startSection('content'); ?>
<link rel="stylesheet" href="<?php echo e(asset('pmar/css/paginas/licitacoes-publicas.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('pmar/css/paginas/legislacao-publica.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 active" aria-current="page"><?php echo e(__('Legislação Municipal')); ?></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(__('Legislação Municipal')); ?></h1>
                <p class="lp-hero-sub text-primary"><?php echo e(__('Consulte leis, decretos e normas publicadas pelo município')); ?></p>
            </div>
        </div>
    </div>
    <div class="lp-hero-bar"></div>
</div>

<section class="lp-main lp-wrap">
    <div class="container">
        <div class="lp-filter-card">
            <div class="lp-filter-header">
                <div class="lp-filter-header-left">
                    <div class="lp-filter-icon">
                        <i class="fa-solid fa-sliders"></i>
                    </div>
                    <span class="lp-filter-title"><?php echo e(__('Filtros')); ?></span>
                    <span class="lp-filter-sub"><?php echo e(__('Refine sua pesquisa')); ?></span>
                </div>
                <a class="btn-lp-clear text-decoration-none" href="<?php echo e(route('paginas.legislacao')); ?>">
                    <i class="fa-solid fa-xmark"></i><?php echo e(__('Limpar filtros')); ?>

                </a>
            </div>

            <div class="lp-filter-body">
                <form method="get">

                    
                    <div class="row g-3 mb-3">
                        <div class="col-12">
                            <label for="texto" class="lp-field-label">
                                <?php echo e(__('Texto ou palavra-chave')); ?>

                            </label>

                            <div class="lp-field-wrap lp-has-icon">
                                <span class="lp-field-icon">
                                    <i class="fa-solid fa-magnifying-glass"></i>
                                </span>

                                <input id="texto"
                                    name="texto"
                                    type="search"
                                    class="form-control"
                                    value="<?php echo e(request('texto')); ?>"
                                    placeholder="<?php echo e(__('Ex: saúde, educação, transporte...')); ?>">
                            </div>
                        </div>
                    </div>

                    
                    <div class="row g-3 align-items-end">

                        
                        <div class="col-12 col-md-6 col-lg-3">
                            <label for="tipo" class="lp-field-label">
                                <?php echo e(__('Tipo')); ?>

                            </label>

                            <div class="lp-field-wrap">
                                <select class="form-select" id="tipo" name="tipo">
                                    <option value=""><?php echo e(__('Todos')); ?></option>

                                    <?php $__currentLoopData = $tipos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tipo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($tipo->id_tipo_legislacao); ?>"
                                            <?php if((string) request('tipo') === (string) $tipo->id_tipo_legislacao): echo 'selected'; endif; ?>>
                                            <?php echo e($tipo->ds_tipo_legislacao); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>

                                <span class="lp-select-arrow">
                                    <i class="fa-solid fa-chevron-down"></i>
                                </span>
                            </div>
                        </div>

                        
                        <div class="col-12 col-md-6 col-lg-2">
                            <label for="numero" class="lp-field-label">
                                <?php echo e(__('Número')); ?>

                            </label>

                            <div class="lp-field-wrap lp-has-icon">
                                <span class="lp-field-icon">
                                    <i class="fa-solid fa-hashtag"></i>
                                </span>

                                <input id="numero"
                                    name="numero"
                                    type="search"
                                    class="form-control"
                                    value="<?php echo e(request('numero')); ?>"
                                    placeholder="<?php echo e(__('1234')); ?>">
                            </div>
                        </div>

                        
                        <div class="col-12 col-md-6 col-lg-2">
                            <label for="ano" class="lp-field-label">
                                <?php echo e(__('Ano')); ?>

                            </label>

                            <div class="lp-field-wrap">
                                <select class="form-select" id="ano" name="ano">
                                    <option value=""><?php echo e(__('Todos')); ?></option>

                                    <?php $__currentLoopData = $anos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ano): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($ano); ?>"
                                            <?php if((string) request('ano') === (string) $ano): echo 'selected'; endif; ?>>
                                            <?php echo e($ano); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>

                                <span class="lp-select-arrow">
                                    <i class="fa-solid fa-chevron-down"></i>
                                </span>
                            </div>
                        </div>

                        
                        <div class="col-12 col-md-6 col-lg-3">
                            <label for="categoria" class="lp-field-label">
                                <?php echo e(__('Categoria')); ?>

                            </label>

                            <div class="lp-field-wrap">
                                <select class="form-select" id="categoria" name="categoria">
                                    <option value=""><?php echo e(__('Todas')); ?></option>

                                    <?php $__currentLoopData = $categorias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($categoria->id_categoria); ?>"
                                            <?php if((string) request('categoria') === (string) $categoria->id_categoria): echo 'selected'; endif; ?>>
                                            <?php echo e($categoria->nm_categoria); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>

                                <span class="lp-select-arrow">
                                    <i class="fa-solid fa-chevron-down"></i>
                                </span>
                            </div>
                        </div>

                        
                        <div class="col-12 col-lg-2">
                            <button class="btn-lp-apply w-100" type="submit">
                                <i class="fa-solid fa-filter"></i>
                                <?php echo e(__('Filtrar')); ?>

                            </button>
                        </div>

                    </div>

                    <div class="lp-filter-options">
                        <label class="lp-filter-option" for="mostrar-portarias">
                            <input type="checkbox"
                                class="lp-filter-option-input"
                                name="mostrar_portarias"
                                value="1"
                                id="mostrar-portarias"
                                <?php if($mostrarPortarias ?? false): echo 'checked'; endif; ?>>
                            <span class="lp-filter-option-box" aria-hidden="true">
                                <i class="fa-solid fa-check"></i>
                            </span>
                            <span class="lp-filter-option-content">
                                <span class="lp-filter-option-title">
                                    <i class="fa-solid fa-file-signature" aria-hidden="true"></i>
                                    <?php echo e(__('Incluir portarias')); ?>

                                </span>
                                <span class="lp-filter-option-desc">
                                    <?php echo e(__('Exibe portarias municipais publicadas junto com as demais normas.')); ?>

                                </span>
                            </span>
                        </label>
                    </div>

                </form>
            </div>
        </div>

        <div class="lp-result-bar-wrap">
            <p class="lp-result-bar mb-0">
                <?php echo e(__(':total documento(s) encontrado(s)', ['total' => $legislacoes->total()])); ?>

            </p>
            <a href="#" class="lp-download-link" id="btn-download-csv" aria-label="<?php echo e(__('Download em CSV')); ?>">
                <i class="fa-solid fa-download"></i><?php echo e(__('Download em CSV')); ?>

            </a>
        </div>

        <div class="row g-3">
            <?php $__empty_1 = true; $__currentLoopData = $legislacoes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="col-12">
                <?php if(($documento['kind'] ?? 'legislacao') === 'portaria'): ?>
                    <?php $portaria = $documento['data']; ?>
                    <article class="card border-0 shadow-sm legislacao-card h-100">
                        <div class="card-body p-4">
                            <div class="d-flex flex-column flex-lg-row justify-content-between align-items-start gap-3">
                                <div class="flex-grow-1">
                                    <div class="d-flex flex-wrap gap-2 mb-3">
                                        <span class="badge rounded-pill bg-primary-subtle text-primary fw-semibold px-3 py-2">
                                            <i class="fa-solid fa-file-signature me-1"></i>
                                            <?php echo e(__('Portaria')); ?>

                                        </span>

                                        <?php if($portaria->dt_publicacao): ?>
                                            <span class="badge rounded-pill bg-light text-dark border px-3 py-2">
                                                <i class="fa-regular fa-calendar me-1"></i>
                                                <?php echo e($portaria->dt_publicacao->format('d/m/Y')); ?>

                                            </span>
                                        <?php endif; ?>
                                    </div>

                                    <h2 class="h4 mb-3 fw-bold">
                                        <?php if($portaria->boletim?->public_bo_pdf_url): ?>
                                            <a href="<?php echo e($portaria->boletim->public_bo_pdf_url); ?>"
                                                target="_blank"
                                                rel="noopener noreferrer"
                                                class="text-primary text-decoration-none legislacao-link">
                                                <?php echo e(__('Portaria Nº :numero', ['numero' => $portaria->nr_portaria])); ?>

                                            </a>
                                        <?php else: ?>
                                            <span class="text-primary">
                                                <?php echo e(__('Portaria Nº :numero', ['numero' => $portaria->nr_portaria])); ?>

                                            </span>
                                        <?php endif; ?>
                                    </h2>

                                    <p class="text-muted mb-4 legislacao-ementa">
                                        <?php echo e($portaria->ds_ementa ?: __('Sem ementa cadastrada.')); ?>

                                    </p>
                                </div>

                                <div class="d-flex flex-lg-column gap-2 w-auto">
                                    <?php if($portaria->boletim?->public_bo_pdf_url): ?>
                                        <a href="<?php echo e($portaria->boletim->public_bo_pdf_url); ?>"
                                            target="_blank"
                                            rel="noopener noreferrer"
                                            class="btn btn-outline-danger btn-sm px-3"
                                            aria-label="<?php echo e(__('Abrir PDF da portaria nº :numero em nova aba', [
                                                'numero' => $portaria->nr_portaria
                                            ])); ?>">
                                            <i class="fa-solid fa-file-pdf me-1"></i>
                                            <?php echo e(__('Baixar')); ?>

                                        </a>
                                    <?php endif; ?>
                                </div>
                            </div>

                            <div class="border-top my-3"></div>

                            <div class="d-flex flex-wrap gap-4 small text-muted mb-0">
                                <?php if($portaria->dt_ato): ?>
                                    <div class="d-flex align-items-center gap-2">
                                        <div class="legislacao-info-icon">
                                            <i class="fa-solid fa-calendar-check"></i>
                                        </div>
                                        <div>
                                            <div class="fw-semibold text-dark">
                                                <?php echo e(__('Data do ato')); ?>

                                            </div>
                                            <div>
                                                <?php echo e($portaria->dt_ato->format('d/m/Y')); ?>

                                            </div>
                                        </div>
                                    </div>
                                <?php endif; ?>

                                <div class="d-flex align-items-center gap-2">
                                    <div class="legislacao-info-icon">
                                        <i class="fa-solid fa-calendar-days"></i>
                                    </div>
                                    <div>
                                        <div class="fw-semibold text-dark">
                                            <?php echo e(__('Publicação')); ?>

                                        </div>
                                        <div>
                                            <?php echo e($portaria->dt_publicacao
                                                ? $portaria->dt_publicacao->format('d/m/Y')
                                                : __('Não informada')); ?>

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                <?php else: ?>
                    <?php $legislacao = $documento['data']; ?>
                <article class="card border-0 shadow-sm legislacao-card h-100">
    <div class="card-body p-4">

        
        <div class="d-flex flex-column flex-lg-row justify-content-between align-items-start gap-3">

            <div class="flex-grow-1">

                
                <div class="d-flex flex-wrap gap-2 mb-3">

                    <span class="badge rounded-pill bg-primary-subtle text-primary fw-semibold px-3 py-2">
                        <i class="fa-solid fa-scale-balanced me-1"></i>
                        <?php echo e($legislacao->tipo->ds_tipo_legislacao ?? __('Sem tipo')); ?>

                    </span>

                    <?php if($legislacao->dt_publicacao): ?>
                        <span class="badge rounded-pill bg-light text-dark border px-3 py-2">
                            <i class="fa-regular fa-calendar me-1"></i>
                            <?php echo e(\Carbon\Carbon::parse($legislacao->dt_publicacao)->format('d/m/Y')); ?>

                        </span>
                    <?php endif; ?>

                </div>

                
                <h2 class="h4 mb-3 fw-bold">
                    <a href="<?php echo e($legislacao->public_pdf_url); ?>"
                        class="text-primary text-decoration-none legislacao-link">

                        <?php echo e(__('Legislação Nº :numero', [
                            'numero' => $legislacao->nr_legislacao
                        ])); ?>


                    </a>
                </h2>

                
                <p class="text-muted mb-4 legislacao-ementa">
                    <?php echo e($legislacao->ds_ementa ?: __('Sem ementa cadastrada.')); ?>

                </p>

            </div>

            
            <div class="d-flex flex-lg-column gap-2 w-auto">

                <!-- <a href="<?php echo e(route('paginas.legislacao.detalhe', $legislacao)); ?>"
                    class="btn btn-primary btn-sm px-3">

                    <i class="fa-solid fa-eye me-1"></i>
                    <?php echo e(__('Detalhes')); ?>

                </a> -->

                <?php if($legislacao->public_pdf_url): ?>
                    <a href="<?php echo e($legislacao->public_pdf_url); ?>"
                        target="_blank"
                        rel="noopener noreferrer"
                        class="btn btn-outline-danger btn-sm px-3"
                        aria-label="<?php echo e(__('Abrir PDF da legislação nº :numero em nova aba', [
                            'numero' => $legislacao->nr_legislacao
                        ])); ?>">

                        <i class="fa-solid fa-file-pdf me-1"></i>
                        <?php echo e(__('Baixar')); ?>

                    </a>
                <?php endif; ?>

            </div>
        </div>

        
        <div class="border-top my-3"></div>

        
        <div class="d-flex flex-wrap gap-4 small text-muted mb-3">

            <div class="d-flex align-items-center gap-2">
                <div class="legislacao-info-icon">
                    <i class="fa-solid fa-user"></i>
                </div>

                <div>
                    <div class="fw-semibold text-dark">
                        <?php echo e(__('Autor')); ?>

                    </div>

                    <div>
                        <?php echo e($legislacao->autor->nm_autor ?? __('Não informado')); ?>

                    </div>
                </div>
            </div>

            <div class="d-flex align-items-center gap-2">
                <div class="legislacao-info-icon">
                    <i class="fa-solid fa-calendar-days"></i>
                </div>

                <div>
                    <div class="fw-semibold text-dark">
                        <?php echo e(__('Publicação')); ?>

                    </div>

                    <div>
                        <?php echo e($legislacao->dt_publicacao
                            ? \Carbon\Carbon::parse($legislacao->dt_publicacao)->format('d/m/Y')
                            : __('Não informada')); ?>

                    </div>
                </div>
            </div>

        </div>

        
        <?php if($legislacao->categorias->isNotEmpty()): ?>
            <div class="d-flex flex-wrap gap-2">

                <?php $__currentLoopData = $legislacao->categorias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <span class="badge rounded-pill text-bg-light border px-3 py-2">
                        <i class="fa-solid fa-tag me-1"></i>
                        <?php echo e($categoria->nm_categoria); ?>

                    </span>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            </div>
        <?php endif; ?>

    </div>
</article>
                <?php endif; ?>

                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="col-12">
                    <div class="lp-empty" role="status">
                        <i class="fa-regular fa-folder-open"></i>
                        <p><?php echo e(__('Nenhuma legislação encontrada para os filtros informados.')); ?></p>
                    </div>
                </div>
            <?php endif; ?>
        </div>

        <div class="lp-pagination d-flex justify-content-center mt-4">
            <?php echo e($legislacoes->links()); ?>

        </div>
    </div>
</section>

<div id="legislacao-publica-config"
    class="d-none"
    data-documentos="<?php echo e($legislacaoExportJson); ?>">
</div>

<script src="<?php echo e(asset('pmar/js/paginas/legislacao-publica.js')); ?>?v=<?php echo e(@filemtime(public_path('pmar/js/paginas/legislacao-publica.js')) ?: time()); ?>"></script>
<?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-publica.blade.php ENDPATH**/ ?>