<?php $__env->startSection("title", env("APP_NAME") . " :: " . __('Detalhes do Contrato')); ?>

<?php $__env->startSection('content'); ?>
<link rel="stylesheet" href="<?php echo e(asset('pmar/css/paginas/contratos.css')); ?>">
<section class="py-5 contratos-detalhe-section">
    <div class="container">
        <nav aria-label="breadcrumb" class="mb-4">
            <ol class="breadcrumb small">
                <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.contratos')); ?>"><?php echo e(__('Contratos')); ?></a></li>
                <li class="breadcrumb-item active"><?php echo e(__('Detalhes')); ?></li>
            </ol>
        </nav>

        <div class="card border-0 shadow-lg contratos-detalhe-card">
            <div class="card-body p-4 p-md-5">
                <div class="d-flex flex-column flex-md-row justify-content-between align-items-start mb-4">
                    <div>
                        <h1 class="h3 fw-bold text-dark mb-1"><?php echo e(__('Contrato Nº')); ?> <?php echo e($contrato->con_numero ?: '-'); ?></h1>
                        <span class="badge bg-primary-subtle text-primary px-3 py-2 rounded-pill"><?php echo e($contrato->modalidade_label ?: '-'); ?></span>
                    </div>
                    <div class="mt-3 mt-md-0">
                        <span class="badge bg-success px-3 py-2 rounded-pill"><?php echo e($contrato->status_label ?: '-'); ?></span>
                    </div>
                </div>

                <?php $prorrogacao = $contrato->prorrogacao; ?>

                <div class="row g-4 mb-4">
                    <div class="col-md-4"><strong><?php echo e(__('Publicado em')); ?>:</strong> <?php echo e($contrato->con_datapub ?: '-'); ?></div>
                    <div class="col-md-4"><strong><?php echo e(__('Data de início')); ?>:</strong> <?php echo e($contrato->con_dataini ?: '-'); ?></div>
                    <div class="col-md-4">
                        <strong><?php echo e(__('Data de término')); ?>:</strong>
                        <?php echo e($contrato->con_datafim ?: '-'); ?>

                        <?php if($prorrogacao): ?>
                            <span class="text-muted d-block small mt-1">
                                <?php echo e(__('Prorrogado até')); ?> <strong><?php echo e($prorrogacao->arq_datafim); ?></strong>
                                <?php echo e(__('pelo anexo')); ?> <?php echo e($prorrogacao->arq_titulo ?: $prorrogacao->arq_numero); ?>

                            </span>
                        <?php endif; ?>
                    </div>
                    <div class="col-md-4"><strong><?php echo e(__('Ano')); ?>:</strong> <?php echo e($contrato->con_ano ?: '-'); ?></div>
                    <div class="col-md-4"><strong><?php echo e(__('Processo')); ?>:</strong> <?php echo e($contrato->con_processo ?: '-'); ?></div>
                    <div class="col-md-4"><strong><?php echo e(__('Valor')); ?>:</strong> <?php echo e($contrato->con_valor ?: '-'); ?></div>
                    <div class="col-md-6"><strong><?php echo e(__('Favorecido')); ?>:</strong> <?php echo e($contrato->favorecido?->fav_nome ?: '-'); ?></div>
                    <div class="col-md-6"><strong><?php echo e(__('CPF/CNPJ')); ?>:</strong> <?php echo e($contrato->con_favorecido ?: '-'); ?></div>
                    <div class="col-md-6"><strong><?php echo e(__('Secretaria')); ?>:</strong> <?php echo e($contrato->secretaria?->name ?: '-'); ?></div>
                    <div class="col-md-6"><strong><?php echo e(__('Secretaria Gestora')); ?>:</strong> <?php echo e($contrato->secretariaGestora?->name ?: '-'); ?></div>
                    <div class="col-md-6">
                        <strong><?php echo e(__('Licitação vinculada')); ?>:</strong>
                        <?php if($contrato->licitacao_procedimento_id): ?>
                            <a href="<?php echo e(route('paginas.licitacoes-e-procedimentos.detalhe', $contrato->licitacao_procedimento_id)); ?>">
                                <?php echo e($contrato->licitacao?->nr_licitacao ?? ('#' . $contrato->licitacao_procedimento_id)); ?>

                            </a>
                        <?php else: ?>
                            -
                        <?php endif; ?>
                    </div>
                    <div class="col-md-12"><strong><?php echo e(__('Título')); ?>:</strong> <?php echo e($contrato->con_titulo ?: '-'); ?></div>
                    <div class="col-md-12"><strong><?php echo e(__('Fiscais')); ?>:</strong> <?php echo e($contrato->con_fiscais ?: '-'); ?></div>
                </div>

                <div>
                    <h6 class="fw-bold mb-3"><?php echo e(__('Arquivos')); ?></h6>
                    <?php if($contrato->arquivos->isNotEmpty()): ?>
                        <div class="d-flex flex-wrap gap-3">
                            <?php $__currentLoopData = $contrato->arquivos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $arquivo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <a class="btn btn-outline-primary d-flex align-items-center gap-2 px-3 py-2 rounded-pill shadow-sm"
                                   href="<?php echo e($arquivo->arquivo_url); ?>"
                                   target="_blank"
                                   rel="noopener noreferrer">
                                    <i class="fa-solid fa-file-arrow-down"></i>
                                    <span><?php echo e($arquivo->arq_titulo ?: basename((string) $arquivo->arq_arquivo)); ?></span>
                                </a>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    <?php else: ?>
                        <div class="text-muted"><?php echo e(__('Sem arquivos vinculados.')); ?></div>
                    <?php endif; ?>
                </div>
            </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/contratos-detalhe.blade.php ENDPATH**/ ?>