<?php $__env->startSection("title", env("APP_NAME") . " :: " . __('Licitações - Atas')); ?>

<?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")); ?>">Portal</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('Licitações - Atas')); ?></li>
            </ol>
        </nav>

        <div class="lp-hero-body">
            <div class="lp-hero-icon">
                <i class="fa-solid fa-file-signature text-primary"></i>
            </div>
            <div>
                <h1 class="lp-hero-title text-primary"><?php echo e(__('Licitações - Atas de Registros de Preços')); ?></h1>
                <p class="lp-hero-sub text-primary"><?php echo e(__('Consulte atas vinculadas aos processos licitatórios')); ?></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 href="<?php echo e(route('paginas.licitacoes-atas')); ?>" class="btn-lp-clear">
                    <i class="fa-solid fa-xmark"></i><?php echo e(__('Limpar filtros')); ?>

                </a>
            </div>

            <div class="lp-filter-body">
                <form method="get" action="<?php echo e(route('paginas.licitacoes-atas')); ?>">
                    <div class="lp-filter-grid">
                        <div>
                            <label class="lp-field-label"><?php echo e(__('Instituição')); ?></label>
                            <div class="lp-field-wrap">
                                <select name="instituicao" class="form-select">
                                    <option value=""><?php echo e(__('Todas')); ?></option>
                                    <?php $__currentLoopData = $secretarias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $secretaria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($secretaria->id); ?>" <?php if(request('instituicao') == $secretaria->id): echo 'selected'; endif; ?>>
                                            <?php echo e($secretaria->name); ?>

                                        </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>
                            <label class="lp-field-label"><?php echo e(__('Objeto')); ?></label>
                            <div class="lp-field-wrap lp-has-icon">
                                <span class="lp-field-icon"><i class="fa-solid fa-magnifying-glass"></i></span>
                                <input type="text" name="objeto" class="form-control" placeholder="<?php echo e(__('Ex: material, serviço...')); ?>" value="<?php echo e(request('objeto')); ?>">
                            </div>
                        </div>

                        <div>
                            <label class="lp-field-label"><?php echo e(__('Nº da Ata')); ?></label>
                            <input type="text" name="numero_ata" class="form-control" value="<?php echo e(request('numero_ata')); ?>">
                        </div>

                        <div>
                            <label class="lp-field-label"><?php echo e(__('Ano')); ?></label>
                            <div class="lp-field-wrap">
                                <select name="ano_ata" class="form-select">
                                    <option value=""><?php echo e(__('Todos')); ?></option>
                                    <?php $__currentLoopData = $anosAta; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ano): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($ano); ?>" <?php if(request('ano_ata') == $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>
                            <label class="lp-field-label"><?php echo e(__('Vigência')); ?></label>
                            <div class="lp-field-wrap">
                                <select name="vigencia_ata" class="form-select">
                                    <option value=""><?php echo e(__('Todas')); ?></option>
                                    <?php $__currentLoopData = $vigencias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vigencia): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($vigencia); ?>" <?php if(request('vigencia_ata') == $vigencia): echo 'selected'; endif; ?>>
                                            <?php echo e($vigencia); ?>

                                        </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>

                    <div class="lp-filter-grid-bottom">
                        <div aria-hidden="true"></div>
                        <div class="d-flex align-items-end justify-content-end">
                            <button type="submit" class="btn-lp-apply">
                                <i class="fa-solid fa-filter"></i>
                                <?php echo e(__('Aplicar filtros')); ?>

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

        <div class="lp-result-bar-wrap">
            <p class="lp-result-bar mb-0">
                <strong><?php echo e($atas->total()); ?></strong> <?php echo e(__('resultado(s) encontrado(s)')); ?>

            </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>

        <?php $__empty_1 = true; $__currentLoopData = $atas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <article class="lp-result-item">
                <div class="lp-result-item-header">
                    <h2 class="lp-result-title">
                        <?php echo e(__('Ata Nº')); ?> <?php echo e($ata->nr_ata ?: '-'); ?> - <?php echo e($ata->ds_objeto ?: __('Sem objeto informado')); ?>

                    </h2>
                </div>

                <div class="lp-result-meta">
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-building-columns"></i>
                        <strong><?php echo e(__('Secretaria:')); ?></strong> <?php echo e($ata->ds_sigla ?: '-'); ?>

                    </div>
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-folder-tree"></i>
                        <strong><?php echo e(__('Processo:')); ?></strong> <?php echo e($ata->nr_processo ?: '-'); ?>

                    </div>
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-calendar-day"></i>
                        <strong><?php echo e(__('Data da ata:')); ?></strong>
                        <?php echo e($ata->dt_data_ata ? date('d/m/Y', strtotime($ata->dt_data_ata)) : '-'); ?>

                    </div>
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-hourglass-half"></i>
                        <strong><?php echo e(__('Vigência:')); ?></strong>
                        <?php echo e($ata->dt_vigencia_ata ? date('d/m/Y', strtotime($ata->dt_vigencia_ata)) : '-'); ?>

                    </div>
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-newspaper"></i>
                        <strong><?php echo e(__('Publicação BO:')); ?></strong>
                        <?php echo e($ata->nr_bo ?: '-'); ?>

                        <?php if($ata->dt_bo): ?>
                            (<?php echo e(date('d/m/Y', strtotime($ata->dt_bo))); ?>)
                        <?php endif; ?>
                    </div>
                    <div class="lp-meta-item">
                        <i class="fa-solid fa-scale-balanced"></i>
                        <strong><?php echo e(__('Licitação:')); ?></strong>
                        <?php if($ata->licitacao_procedimento_id): ?>
                            <a href="<?php echo e(route('paginas.licitacoes-e-procedimentos.detalhe', $ata->licitacao_procedimento_id)); ?>">
                                <?php echo e($ata->licitacao->nr_licitacao ?? ('#' . $ata->licitacao_procedimento_id)); ?>

                            </a>
                        <?php else: ?>
                            -
                        <?php endif; ?>
                    </div>
                </div>

                <div class="lp-file-links">
                    <?php if($ata->public_bo_link_url): ?>
                        <a href="<?php echo e($ata->public_bo_link_url); ?>"
                           target="_blank"
                           class="lp-file-link">
                            <i class="fa-solid fa-download"></i>
                            <?php echo e(__('Baixar BO')); ?>

                        </a>
                    <?php endif; ?>
                    <?php if($ata->nm_arquivo_ata): ?>
                        <a href="<?php echo e($ata->public_arquivo_ata_url); ?>"
                           target="_blank"
                           rel="noopener noreferrer"
                           class="lp-file-link">
                            <i class="fa-solid fa-file-arrow-down"></i>
                            <?php echo e(__('Baixar Ata')); ?>

                        </a>
                    <?php endif; ?>
                    <?php if(!$ata->public_bo_link_url && !$ata->nm_arquivo_ata): ?>
                        <span class="lp-meta-item"><?php echo e(__('Sem arquivos vinculados.')); ?></span>
                    <?php endif; ?>
                </div>
            </article>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="lp-empty">
                <i class="fa-regular fa-folder-open"></i>
                <p><?php echo e(__('Nenhum registro encontrado.')); ?></p>
            </div>
        <?php endif; ?>

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

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

<div id="licitacoes-atas-config"
    class="d-none"
    data-atas="<?php echo e($atasExportJson); ?>">
</div>

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