<?php $__env->startSection("title", env("APP_NAME") . " - " . __("Escolas Municipais — Climatização")); ?>

<?php $__env->startSection('content'); ?>
    <div id="mapa-container"
         data-endpoint="<?php echo e(route('servicos.escolasClimatizadas.dados')); ?>"
         data-label-details="<?php echo e(__('Detalhes')); ?>"
         data-label-locate="<?php echo e(__('Minha localização')); ?>"
         data-label-zoom-in="<?php echo e(__('Aproximar')); ?>"
         data-label-zoom-out="<?php echo e(__('Afastar')); ?>"
         data-label-reset="<?php echo e(__('Recentrar mapa')); ?>"
         data-label-total="<?php echo e(__('Total no mapa:')); ?>"
         data-status-climatizada="<?php echo e(__('Climatizada')); ?>"
         data-status-andamento="<?php echo e(__('Em andamento')); ?>"
         data-status-nao="<?php echo e(__('Pendente')); ?>"
         aria-label="<?php echo e(__('Mapa interativo das escolas municipais por status de climatização')); ?>">

        <div id="map" class="escolas-climatizadas-map" role="application"></div>

        <div id="status-chip" aria-live="polite">
            <i class="fa-solid fa-school" aria-hidden="true"></i>
            <span class="me-1"><?php echo e(__("Total no mapa:")); ?></span>
            <strong id="escolasClimatizadasCount">0</strong>
        </div>

        <nav id="barra-acoes" aria-label="<?php echo e(__('Ações do mapa')); ?>">
            <button class="acao-btn" id="btn-localizar" type="button"
                    title="<?php echo e(__('Minha localização')); ?>" aria-label="<?php echo e(__('Minha localização')); ?>">
                <i class="fa-solid fa-location-crosshairs" aria-hidden="true"></i>
            </button>

            <button class="acao-btn" id="btn-zoom-in" type="button"
                    title="<?php echo e(__('Aproximar')); ?>" aria-label="<?php echo e(__('Aproximar')); ?>">
                <i class="fa-solid fa-plus" aria-hidden="true"></i>
            </button>

            <button class="acao-btn acao-btn--destaque" id="btn-lista" type="button"
                    title="<?php echo e(__('Lista de escolas')); ?>" aria-label="<?php echo e(__('Lista de escolas')); ?>">
                <i class="fa-solid fa-list-ul" aria-hidden="true"></i>
            </button>

            <button class="acao-btn" id="btn-zoom-out" type="button"
                    title="<?php echo e(__('Afastar')); ?>" aria-label="<?php echo e(__('Afastar')); ?>">
                <i class="fa-solid fa-minus" aria-hidden="true"></i>
            </button>

            <button class="acao-btn" id="btn-reset" type="button"
                    title="<?php echo e(__('Recentrar mapa')); ?>" aria-label="<?php echo e(__('Recentrar mapa')); ?>">
                <i class="fa-solid fa-map" aria-hidden="true"></i>
            </button>
        </nav>
    </div>

    
    <div id="escolas-lista-painel" hidden role="dialog"
         aria-label="<?php echo e(__('Lista de escolas')); ?>" aria-modal="true">
        <div id="escolas-lista-header">
            <span class="escolas-lista-titulo">
                <i class="fa-solid fa-school" aria-hidden="true"></i>
                <?php echo e(__('Escolas Municipais')); ?>

            </span>
            <button type="button" id="btn-fechar-lista" aria-label="<?php echo e(__('Fechar lista')); ?>">
                <i class="fa-solid fa-xmark" aria-hidden="true"></i>
            </button>
        </div>
        <div id="escolas-lista-busca-wrap">
            <input type="search" id="escolas-lista-busca"
                   placeholder="<?php echo e(__('Buscar pelo nome ou bairro...')); ?>"
                   autocomplete="off"
                   aria-label="<?php echo e(__('Buscar escola')); ?>">
        </div>
        <ul id="escolas-lista-items" role="list" aria-label="<?php echo e(__('Resultados da busca')); ?>"></ul>
    </div>
    <div id="escolas-lista-backdrop" hidden aria-hidden="true"></div>

    
    <?php $__currentLoopData = $escolas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $escola): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php
            $bairroLabel = optional($escola->endereco)->bairro ?? __('Não informado');
            $logradouro = optional($escola->endereco)->logradouro ?? __('Não informado');
            $numero = optional($escola->endereco)->numero ?? __('S/N');
            $cep = optional($escola->endereco)->cep ?? null;
            $latitude = optional($escola->endereco)->latitude;
            $longitude = optional($escola->endereco)->longitude;
        ?>

        <?php
            $clima = $escola->climatizacao ?? 'PENDENTE';
            $climaBadge = match($clima) {
                'CLIMATIZADA'  => ['label' => __('Climatizada'),               'class' => 'badge-climatizada',  'icon' => 'fa-snowflake', 'text' => 'text-success'],
                'EM_ANDAMENTO' => ['label' => __('Climatização em andamento'), 'class' => 'badge-em-andamento', 'icon' => 'fa-spinner',  'text' => 'text-info'],
                default        => ['label' => __('Não climatizada'),           'class' => 'badge-pendente',     'icon' => 'fa-clock',    'text' => 'text-secondary'],
            };
        ?>

        <div class="modal fade"
             id="modalEscolaMunicipal<?php echo e($escola->id); ?>"
             tabindex="-1"
             aria-labelledby="modalLabel<?php echo e($escola->id); ?>"
             aria-hidden="true">
            <div class="modal-dialog modal-xl modal-fullscreen-md-down">
                <div class="modal-content shadow-lg border-0 overflow-hidden">

                    <div class="position-relative">
                        <img src="<?php echo e($escola->foto_url); ?>"
                             class="modal-escola-foto"
                             alt="<?php echo e($escola->nome); ?>"
                             onerror="this.onerror=null;this.src='<?php echo e(asset('pmar/assets/img/icons/escola.png')); ?>'">

                        <div class="position-absolute top-0 start-0 w-100 h-100 modal-escola-header-overlay"></div>

                        <button type="button"
                                class="btn-close btn-close-white position-absolute top-0 end-0 m-3"
                                data-bs-dismiss="modal"
                                aria-label="<?php echo e(__('Fechar')); ?>"></button>

                        <div class="position-absolute bottom-0 start-0 p-4 text-white">
                            <div class="d-flex flex-wrap gap-2 mb-2">
                                <span class="badge bg-primary"><?php echo e($escola->tipoUnidadeEscolar); ?></span>
                                <?php if($escola->possuiRecursosMultifuncionais): ?>
                                    <span class="badge badge-recursos">
                                        <i class="fas fa-universal-access me-1"></i><?php echo e(__("Recursos Especiais")); ?>

                                    </span>
                                <?php endif; ?>
                                <span class="badge <?php echo e($climaBadge['class']); ?>">
                                    <i class="fas <?php echo e($climaBadge['icon']); ?> me-1"></i><?php echo e($climaBadge['label']); ?>

                                </span>
                            </div>
                            <h2 class="fw-bold text-shadow mb-1" id="modalLabel<?php echo e($escola->id); ?>">
                                <?php echo e($escola->nome); ?>

                            </h2>
                            <p class="mb-0 text-white text-shadow">
                                <i class="fas fa-map-marker-alt me-1"></i>
                                <?php echo e($bairroLabel); ?> — Angra dos Reis/RJ
                            </p>
                        </div>
                    </div>

                    <div class="modal-body p-0">
                        <div class="row g-0">
                            <div class="col-md-5 p-4 border-end">
                                <h6 class="text-muted text-uppercase fw-semibold mb-3 small">
                                    <i class="fas fa-info-circle me-1"></i><?php echo e(__("Informações de Contato")); ?>

                                </h6>

                                <ul class="list-unstyled mb-0">
                                    <li class="d-flex align-items-start gap-3 mb-3">
                                        <span class="text-danger mt-1 flex-shrink-0">
                                            <i class="fas fa-map-marker-alt fa-fw"></i>
                                        </span>
                                        <div>
                                            <div class="fw-semibold small text-muted"><?php echo e(__("Endereço")); ?></div>
                                            <div><?php echo e($logradouro); ?>, <?php echo e($numero); ?></div>
                                            <div class="text-muted small">
                                                <?php echo e($bairroLabel); ?> — CEP: <?php echo e($cep ?? __('Não informado')); ?>

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

                                    <li class="d-flex align-items-start gap-3 mb-3">
                                        <span class="text-primary mt-1 flex-shrink-0">
                                            <i class="fas fa-envelope fa-fw"></i>
                                        </span>
                                        <div>
                                            <div class="fw-semibold small text-muted"><?php echo e(__("E-mail")); ?></div>
                                            <?php if($escola->email): ?>
                                                <a href="mailto:<?php echo e($escola->email); ?>" class="text-decoration-none"><?php echo e($escola->email); ?></a>
                                            <?php else: ?>
                                                <span class="text-muted fst-italic small"><?php echo e(__("Não informado")); ?></span>
                                            <?php endif; ?>
                                        </div>
                                    </li>

                                    <li class="d-flex align-items-start gap-3">
                                        <span class="text-success mt-1 flex-shrink-0">
                                            <i class="fas fa-phone-alt fa-fw"></i>
                                        </span>
                                        <div>
                                            <div class="fw-semibold small text-muted"><?php echo e(__("Telefone")); ?></div>
                                            <?php if($escola->telefone): ?>
                                                <a href="tel:+55<?php echo e($escola->telefone); ?>" class="text-decoration-none">
                                                    <?php echo e(preg_replace('/(\d{2})(\d{4,5})(\d{4})/', '($1) $2-$3', $escola->telefone)); ?>

                                                </a>
                                            <?php else: ?>
                                                <span class="text-muted fst-italic small"><?php echo e(__("Não informado")); ?></span>
                                            <?php endif; ?>
                                        </div>
                                    </li>
                                </ul>

                                <hr class="my-3">
                                <h6 class="text-muted text-uppercase fw-semibold mb-2 small">
                                    <i class="fas fa-snowflake me-1"></i><?php echo e(__("Climatização")); ?>

                                </h6>
                                <div class="d-flex align-items-center gap-2 mb-2">
                                    <span class="badge <?php echo e($climaBadge['class']); ?> px-3 py-2">
                                        <i class="fas <?php echo e($climaBadge['icon']); ?> me-1"></i>
                                        <?php echo e($climaBadge['label']); ?>

                                    </span>
                                </div>
                                <?php if($escola->observacoes_climatizacao): ?>
                                    <p class="text-muted small mb-0"><?php echo e($escola->observacoes_climatizacao); ?></p>
                                <?php endif; ?>

                                <?php if($escola->informacoes): ?>
                                    <hr class="my-3">
                                    <h6 class="text-muted text-uppercase fw-semibold mb-2 small">
                                        <i class="fas fa-file-alt me-1"></i><?php echo e(__("Informações Adicionais")); ?>

                                    </h6>
                                    <div class="small"><?php echo $escola->informacoes; ?></div>
                                <?php endif; ?>
                            </div>

                            <div class="col-md-7 modal-escola-mapa d-flex flex-column">
                                <?php if($latitude && $longitude): ?>
                                    <iframe
                                        class="modal-escola-iframe"
                                        frameborder="0"
                                        scrolling="no"
                                        marginheight="0"
                                        marginwidth="0"
                                        src="https://maps.google.com/maps?q=<?php echo e($latitude); ?>,<?php echo e($longitude); ?>&z=17&output=embed"
                                        title="<?php echo e(__('Localização de')); ?> <?php echo e($escola->nome); ?>"
                                        allowfullscreen>
                                    </iframe>
                                <?php else: ?>
                                    <div class="flex-grow-1 d-flex flex-column justify-content-center align-items-center bg-light text-center p-4">
                                        <i class="fas fa-map-marker-alt fa-3x mb-3 text-secondary"></i>
                                        <p class="text-muted mb-0"><?php echo e(__("Localização não disponível")); ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>

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

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