<?php $__env->startSection("title", env("APP_NAME") . " :: " . __('Detalhes da Licitação')); ?>

<?php $__env->startSection('content'); ?>

<?php
    $statusBadgeClasses = [
        0 => 'bg-secondary',
        1 => 'bg-success',
        2 => 'bg-danger',
        3 => 'bg-warning text-dark',
        4 => 'bg-info text-dark',
        5 => 'bg-warning text-dark',
        6 => 'bg-primary',
        7 => 'bg-danger',
    ];

    $statusIcons = [
        0 => 'fa-circle-question',
        1 => 'fa-circle-play',
        2 => 'fa-circle-xmark',
        3 => 'fa-circle-pause',
        4 => 'fa-clock',
        5 => 'fa-circle-minus',
        6 => 'fa-circle-check',
        7 => 'fa-circle-exclamation',
    ];

    $cdStatus         = (int) ($licitacao->cd_status ?? 0);
    $statusBadgeClass = $statusBadgeClasses[$cdStatus] ?? 'bg-secondary';
    $statusIcon       = $statusIcons[$cdStatus] ?? 'fa-circle-question';

    $infoGrid = [
        __('Modalidade/Procedimento') => $licitacao->modalidade_label ?? $licitacao->procedimento_label,
        __('Instituição')             => $licitacao->nome_setor,
        __('Nº do Processo')          => $licitacao->nr_processo,
        __('Memorando')               => $licitacao->nr_memorando,
        __('Data')                    => optional($licitacao->dt_data)->format('d/m/Y'),
        __('Hora')                    => $licitacao->dt_hora,
        __('Favorecido')              => $licitacao->ds_favorecido,
    ];
?>

<link rel="stylesheet" href="<?php echo e(asset('pmar/css/paginas/licitacoes-publicas.css')); ?>">

<section class="lp-detalhe-section">
    <div class="container">

        <nav aria-label="<?php echo e(__('Navegação estrutural')); ?>" 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.licitacoes-e-procedimentos')); ?>">
                        <?php echo e(__('Licitações e Procedimentos')); ?>

                    </a>
                </li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('Detalhes')); ?></li>
            </ol>
        </nav>

        <div class="card border-0 shadow-lg rounded-4">
            <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 gap-3">
                    <div>
                        <h1 class="h3 fw-bold text-dark mb-2">
                            <?php echo e($licitacao->modalidade_label ?? $licitacao->procedimento_label); ?>

                            <?php echo e($licitacao->nr_licitacao ?: ''); ?>

                        </h1>
                        <span class="badge bg-primary-subtle text-primary px-3 py-2 rounded-pill">
                            <?php echo e(ucfirst($licitacao->tipo_processo ?? '-')); ?>

                        </span>
                    </div>

                    <div class="mt-2 mt-md-0">
                        <span class="badge <?php echo e($statusBadgeClass); ?> px-3 py-2 rounded-pill d-inline-flex align-items-center gap-1">
                            <i class="fa-solid <?php echo e($statusIcon); ?>" aria-hidden="true"></i>
                            <?php echo e($licitacao->cd_status_label ?? '-'); ?>

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

                <div class="row g-4 mb-4">
                    <?php $__currentLoopData = $infoGrid; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $label => $valor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-4">
                            <div class="p-3 bg-light rounded-3 h-100">
                                <small class="text-muted d-block mb-1"><?php echo e($label); ?></small>
                                <div class="fw-semibold"><?php echo e($valor ?: '-'); ?></div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>

                <div class="mb-4">
                    <div class="p-4 bg-light rounded-3">
                        <small class="text-muted d-block mb-2"><?php echo e(__('Objeto')); ?></small>
                        <p class="mb-0"><?php echo e($licitacao->ds_objeto ?: '-'); ?></p>
                    </div>
                </div>

                <div>
                    <h6 class="fw-bold mb-3"><?php echo e(__('Arquivos')); ?></h6>

                    <?php if($licitacao->uploads->isNotEmpty()): ?>
                        <div class="d-flex flex-wrap gap-3">
                            <?php $__currentLoopData = $licitacao->uploads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $upload): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $uploadHref = route(
                                        'paginas.licitacoes-e-procedimentos.uploads.download',
                                        ['licitacao' => $licitacao->id, 'upload' => $upload->id]
                                    );
                                ?>
                                <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($uploadHref); ?>"
                                   target="_blank"
                                   rel="noopener noreferrer">
                                    <i class="fa-solid fa-file-arrow-down" aria-hidden="true"></i>
                                    <span><?php echo e($upload->ds_legenda ?? $upload->ds_arquivo ?? __('Baixar arquivo')); ?></span>
                                </a>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    <?php else: ?>
                        <p class="text-muted mb-0"><?php echo e(__('Sem arquivos vinculados.')); ?></p>
                    <?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/licitacoes-e-procedimentos-detalhe.blade.php ENDPATH**/ ?>