<?php $__env->startSection("title", env("APP_NAME") . " :: " . __("MobiAngra")); ?>

<?php $__env->startSection('content'); ?>
<div class="card shadow-sm">
    <?php
        $headLine = "<i class='fa-solid fa-bus'></i> " . __('MobiAngra');
        $tabAtual = $tabAtual ?? request('tab', 'mapa');
    ?>

    <?php echo $__env->make('components.buttons._headLineButtonsBackAdd', [
        'headLine'        => $headLine,
        'routeBack'       => 'admin.dashboard',
        'routeBackParams' => [],
        'nameBack'        => __('Voltar'),
        'permission'      => 'GERENCIADOR_DE_MOBIANGRA',
    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="card-body">
        <?php echo $__env->make('errors.messageFlash', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        
        <ul class="nav nav-tabs mb-4" id="mobiangra-tabs" role="tablist">
            <li class="nav-item" role="presentation">
                <button class="nav-link <?php echo e($tabAtual === 'mapa' ? 'active' : ''); ?>"
                        id="tab-mapa-btn" data-bs-toggle="tab" data-bs-target="#tab-mapa"
                        type="button" role="tab"
                        aria-controls="tab-mapa" aria-selected="<?php echo e($tabAtual === 'mapa' ? 'true' : 'false'); ?>">
                    <i class="fa-solid fa-map me-1"></i><?php echo e(__('Mapa')); ?>

                </button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link <?php echo e($tabAtual === 'horarios' ? 'active' : ''); ?>"
                        id="tab-horarios-btn" data-bs-toggle="tab" data-bs-target="#tab-horarios"
                        type="button" role="tab"
                        aria-controls="tab-horarios" aria-selected="<?php echo e($tabAtual === 'horarios' ? 'true' : 'false'); ?>">
                    <i class="fa-solid fa-clock me-1"></i><?php echo e(__('Horários')); ?>

                </button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link <?php echo e($tabAtual === 'manifestacoes' ? 'active' : ''); ?>"
                        id="tab-manifestacoes-btn" data-bs-toggle="tab" data-bs-target="#tab-manifestacoes"
                        type="button" role="tab"
                        aria-controls="tab-manifestacoes" aria-selected="<?php echo e($tabAtual === 'manifestacoes' ? 'true' : 'false'); ?>">
                    <i class="fa-solid fa-comments me-1"></i><?php echo e(__('Manifestações')); ?>

                </button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link <?php echo e($tabAtual === 'alertas' ? 'active' : ''); ?>"
                        id="tab-alertas-btn" data-bs-toggle="tab" data-bs-target="#tab-alertas"
                        type="button" role="tab"
                        aria-controls="tab-alertas" aria-selected="<?php echo e($tabAtual === 'alertas' ? 'true' : 'false'); ?>">
                    <i class="fa-solid fa-bell me-1"></i><?php echo e(__('Alertas')); ?>

                </button>
            </li>
        </ul>

        <div class="tab-content" id="mobiangra-tabs-content">

            
            <div class="tab-pane fade <?php echo e($tabAtual === 'mapa' ? 'show active' : ''); ?>"
                 id="tab-mapa" role="tabpanel" aria-labelledby="tab-mapa-btn">

                
                <div class="row mb-4">
                    <div class="col-md-6 mb-3 mb-md-0">
                        <div class="border rounded p-3 h-100">
                            <h5 class="mb-3">
                                <i class="fa-solid fa-signal"></i>
                                <?php echo e(__('Status do Feed em Tempo Real')); ?>

                            </h5>

                            <?php if($feedStatus): ?>
                                <p class="mb-1">
                                    <strong><?php echo e(__('Última atualização')); ?>:</strong>
                                    <?php if($feedStatus['success']): ?>
                                        <span class="badge bg-success">
                                            <?php echo e(\Carbon\Carbon::parse($feedStatus['last_update'])->diffForHumans()); ?>

                                        </span>
                                    <?php else: ?>
                                        <span class="badge bg-danger"><?php echo e(__('Falha')); ?></span>
                                    <?php endif; ?>
                                </p>
                                <p class="mb-1">
                                    <strong><?php echo e(__('Veículos no último fetch')); ?>:</strong>
                                    <span class="badge bg-primary"><?php echo e($feedStatus['vehicle_count'] ?? 0); ?></span>
                                </p>
                                <p class="mb-0">
                                    <strong><?php echo e(__('Horário')); ?>:</strong>
                                    <code><?php echo e($feedStatus['last_update'] ?? '-'); ?></code>
                                </p>
                            <?php else: ?>
                                <div class="alert alert-warning mb-0">
                                    <i class="fa-solid fa-triangle-exclamation"></i>
                                    <?php echo e(__('O feed ainda não foi executado. Use o botão abaixo ou aguarde o cron (a cada 10s) para a primeira atualização.')); ?>

                                </div>
                            <?php endif; ?>

                            <hr>

                            <p class="mb-1">
                                <strong><?php echo e(__('Arquivo Protobuf (.pb)')); ?>:</strong>
                                <?php if($pbExists): ?>
                                    <span class="badge bg-success"><?php echo e(__('Disponível')); ?></span>
                                <?php else: ?>
                                    <span class="badge bg-secondary"><?php echo e(__('Não gerado')); ?></span>
                                <?php endif; ?>
                            </p>
                            <p class="mb-0">
                                <strong><?php echo e(__('Arquivo JSON (live_data)')); ?>:</strong>
                                <?php if($jsonExists): ?>
                                    <span class="badge bg-success"><?php echo e(__('Disponível')); ?></span>
                                <?php else: ?>
                                    <span class="badge bg-secondary"><?php echo e(__('Não gerado')); ?></span>
                                <?php endif; ?>
                            </p>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="border rounded p-3 h-100">
                            <h5 class="mb-3">
                                <i class="fa-solid fa-link"></i>
                                <?php echo e(__('Acesso Rápido')); ?>

                            </h5>

                            <div class="mb-2">
                                <a href="<?php echo e(route('mobiangra.index')); ?>" target="_blank" class="btn btn-sm btn-outline-secondary me-1">
                                    <i class="fa-solid fa-house"></i>
                                    <?php echo e(__('Portal público')); ?>

                                </a>
                                <a href="<?php echo e(route('mobiangra.mapa')); ?>" target="_blank" class="btn btn-sm btn-outline-primary">
                                    <i class="fa-solid fa-map"></i>
                                    <?php echo e(__('Mapa público')); ?>

                                </a>
                            </div>

                            <div class="mb-2">
                                <small class="text-muted"><?php echo e(__('Endpoint JSON (mapa)')); ?>:</small><br>
                                <code><?php echo e(url('/mobiangra/live_data')); ?></code>
                            </div>

                            <div class="alert alert-info py-2 px-3 small mb-2" role="note">
                                <strong><?php echo e(__('Google Transit / validadores')); ?>:</strong>
                                <?php echo e(__('Use somente as URLs canônicas abaixo. Não use')); ?>

                                <code>/mobiangra/gtfs.zip</code> <?php echo e(__('nem')); ?> <code>/mobiangra/feed.pb</code>.
                            </div>

                            <div class="mb-2">
                                <small class="text-muted"><?php echo e(__('Feed GTFS-RT (tempo real)')); ?>:</small><br>
                                <code><?php echo e(route('mobiangra.gtfs.feed_pb')); ?></code>
                            </div>

                            <div class="mb-2">
                                <small class="text-muted"><?php echo e(__('GTFS estático (.zip)')); ?>:</small><br>
                                <?php if($gtfsStaticAvailable): ?>
                                    <a href="<?php echo e(route('mobiangra.gtfs.gtfs_zip')); ?>" class="text-break" target="_blank">
                                        <code><?php echo e(route('mobiangra.gtfs.gtfs_zip')); ?></code>
                                    </a>
                                <?php else: ?>
                                    <code><?php echo e(route('mobiangra.gtfs.gtfs_zip')); ?></code>
                                    <span class="badge bg-warning text-dark ms-1"><?php echo e(__('Aguardando upload GTFS')); ?></span>
                                <?php endif; ?>
                            </div>

                            <hr>

                            <?php if(auth()->user()->getPermissaoDetalhes('GERENCIADOR_DE_MOBIANGRA')['editar'] ?? false): ?>
                                <form action="<?php echo e(route('admin.mobiangra.forceUpdate')); ?>" method="post" class="d-inline">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="tab" value="mapa">
                                    <button type="submit" class="btn btn-sm btn-warning">
                                        <i class="fa-solid fa-rotate"></i>
                                        <?php echo e(__('Forçar atualização agora')); ?>

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

                
                <div class="border rounded p-3 mb-4">
                    <h5 class="mb-3">
                        <i class="fa-solid fa-database"></i>
                        <?php echo e(__('Arquivos GTFS Estáticos')); ?>

                    </h5>
                    <div class="row mb-3">
                        <?php $__currentLoopData = $gtfsFiles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $filename => $exists): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-6 col-md-3 mb-2">
                                <span class="badge <?php echo e($exists ? 'bg-success' : 'bg-danger'); ?> me-1">
                                    <i class="fa-solid <?php echo e($exists ? 'fa-check' : 'fa-xmark'); ?>"></i>
                                </span>
                                <code><?php echo e($filename); ?></code>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>

                    <?php if(auth()->user()->getPermissaoDetalhes('GERENCIADOR_DE_MOBIANGRA')['adicionar'] ?? false): ?>
                        <hr>
                        <form action="<?php echo e(route('admin.mobiangra.uploadGtfs')); ?>" method="post" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="tab" value="mapa">
                            <p class="fw-bold mb-2"><?php echo e(__('Atualizar GTFS')); ?></p>
                            <div class="mb-3">
                                <label for="gtfs_zip" class="form-label fw-bold mb-1">
                                    <?php echo e(__('Pacote GTFS (.zip)')); ?>

                                </label>
                                <input type="file" name="gtfs_zip" id="gtfs_zip"
                                    class="form-control form-control-sm <?php $__errorArgs = ['gtfs_zip'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                    accept=".zip,application/zip">
                                <?php $__errorArgs = ['gtfs_zip'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                            <button type="submit" class="btn btn-primary btn-sm mb-3">
                                <i class="fa-solid fa-file-zipper"></i>
                                <?php echo e(__('Importar pacote .zip')); ?>

                            </button>

                            <details class="mt-3">
                                <summary class="btn btn-sm btn-outline-secondary mb-2 d-inline-flex align-items-center gap-1">
                                    <i class="fa-solid fa-file-lines"></i>
                                    <?php echo e(__('Envio alternativo: arquivos .txt individuais')); ?>

                                </summary>
                                <div class="mt-2">
                                    <div class="row">
                                        <?php
                                            $gtfsInputs = [
                                                'calendar' => 'calendar.txt', 'calendar_dates' => 'calendar_dates.txt',
                                                'routes' => 'routes.txt', 'trips' => 'trips.txt',
                                                'stops' => 'stops.txt', 'shapes' => 'shapes.txt',
                                                'stop_times' => 'stop_times.txt', 'agency' => 'agency.txt',
                                                'feed_info' => 'feed_info.txt',
                                            ];
                                        ?>
                                        <?php $__currentLoopData = $gtfsInputs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $field => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="col-md-4 mb-2">
                                                <label for="gtfs_<?php echo e($field); ?>" class="form-label small fw-bold mb-1"><?php echo e($label); ?></label>
                                                <input type="file" name="gtfs_<?php echo e($field); ?>" id="gtfs_<?php echo e($field); ?>"
                                                       class="form-control form-control-sm" accept=".txt,.csv">
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                    <button type="submit" class="btn btn-outline-primary btn-sm mt-2">
                                        <i class="fa-solid fa-upload"></i>
                                        <?php echo e(__('Enviar arquivos .txt selecionados')); ?>

                                    </button>
                                </div>
                            </details>
                        </form>
                    <?php endif; ?>
                </div>

                
                <div class="border rounded p-3 mb-4">
                    <h5 class="mb-3">
                        <i class="fa-solid fa-sliders"></i>
                        <?php echo e(__('Configuração da frota (linhas e veículos)')); ?>

                    </h5>
                    <p class="mb-3">
                        <strong><?php echo e(__('Arquivo')); ?>:</strong>
                        <code><?php echo e(config('mobiangra.storage_dir')); ?>/<?php echo e(config('mobiangra.fleet_filename', 'fleet.json')); ?></code>
                        <?php if($fleetExists): ?>
                            <span class="badge bg-success ms-1"><?php echo e(__('Disponível')); ?></span>
                        <?php else: ?>
                            <span class="badge bg-warning text-dark ms-1"><?php echo e(__('Será criado no primeiro acesso')); ?></span>
                        <?php endif; ?>
                    </p>
                    <div class="d-flex flex-wrap gap-2 mb-3">
                        <a href="<?php echo e(route('admin.mobiangra.downloadFleet')); ?>" class="btn btn-sm btn-outline-secondary">
                            <i class="fa-solid fa-download"></i> <?php echo e(__('Baixar fleet.json')); ?>

                        </a>
                    </div>

                    <?php if(auth()->user()->getPermissaoDetalhes('GERENCIADOR_DE_MOBIANGRA')['editar'] ?? false): ?>
                        <form action="<?php echo e(route('admin.mobiangra.uploadFleet')); ?>" method="post" enctype="multipart/form-data" class="mb-3">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="tab" value="mapa">
                            <label for="fleet_config" class="form-label fw-bold mb-1"><?php echo e(__('Enviar fleet.json atualizado')); ?></label>
                            <input type="file" name="fleet_config" id="fleet_config"
                                   class="form-control form-control-sm" accept=".json,application/json" required>
                            <button type="submit" class="btn btn-sm btn-primary mt-2">
                                <i class="fa-solid fa-upload"></i> <?php echo e(__('Salvar configuração da frota')); ?>

                            </button>
                        </form>
                        <form action="<?php echo e(route('admin.mobiangra.resetFleet')); ?>" method="post"
                            onsubmit="return confirm(<?php echo json_encode(__('Regenerar o fleet.json a partir do modelo padrão? Alterações manuais serão substituídas.'), 15, 512) ?>)">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="tab" value="mapa">
                            <button type="submit" class="btn btn-sm btn-outline-warning">
                                <i class="fa-solid fa-rotate-left"></i>
                                <?php echo e(__('Regenerar a partir do modelo padrão')); ?>

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

                
                <div class="border rounded p-3">
                    <h5 class="mb-3">
                        <i class="fa-solid fa-gear"></i>
                        <?php echo e(__('Informações Técnicas')); ?>

                    </h5>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <p class="mb-1">
                                <strong><?php echo e(__('API de telemetria em uso')); ?>:</strong><br>
                                <code class="small"><?php echo e(config('mobiangra.api_url')); ?></code>
                            </p>
                            <p class="mb-1">
                                <strong><?php echo e(__('Intervalo de atualização atual')); ?>:</strong>
                                <span class="badge bg-secondary"><?php echo e($fetchInterval); ?>s</span>
                            </p>
                        </div>
                        <div class="col-md-6">
                            <p class="mb-0">
                                <strong><?php echo e(__('Modo de atualização')); ?>:</strong>
                                <span class="badge bg-info text-dark">
                                    <i class="fa-solid fa-bolt"></i>
                                    <?php echo e(__('Lazy (automático via mapa)')); ?>

                                </span>
                            </p>
                        </div>
                    </div>
                    <?php if(auth()->user()->getPermissaoDetalhes('GERENCIADOR_DE_MOBIANGRA')['editar'] ?? false): ?>
                        <hr>
                        <form action="<?php echo e(route('admin.mobiangra.saveSettings')); ?>" method="post" class="row g-2 align-items-end">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="tab" value="mapa">
                            <div class="col-auto">
                                <label for="fetch_interval" class="form-label fw-bold mb-1">
                                    <?php echo e(__('Intervalo de atualização (segundos)')); ?>

                                </label>
                                <div class="input-group input-group-sm" style="width:220px;">
                                    <input type="number" id="fetch_interval" name="fetch_interval"
                                           class="form-control <?php $__errorArgs = ['fetch_interval'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                           value="<?php echo e(old('fetch_interval', $fetchInterval)); ?>"
                                           min="5" max="300" step="1" required>
                                    <span class="input-group-text">s</span>
                                    <?php $__errorArgs = ['fetch_interval'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="invalid-feedback"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-auto">
                                <button type="submit" class="btn btn-sm btn-primary">
                                    <i class="fa-solid fa-floppy-disk"></i> <?php echo e(__('Salvar')); ?>

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

            
            <div class="tab-pane fade <?php echo e($tabAtual === 'horarios' ? 'show active' : ''); ?>"
                 id="tab-horarios" role="tabpanel" aria-labelledby="tab-horarios-btn">

                
                <div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
                    <h5 class="mb-0">
                        <i class="fa-solid fa-clock me-1"></i><?php echo e(__('Linhas de Horários')); ?>

                        <span id="mobiangra-horarios-total-badge" class="badge bg-secondary ms-1"><?php echo e($linhasHorarios->count()); ?></span>
                    </h5>
                    <div class="d-flex gap-2 flex-wrap">
                        <a href="<?php echo e(route('mobiangra.horarios')); ?>" target="_blank" class="btn btn-sm btn-outline-primary">
                            <i class="fa-solid fa-eye me-1"></i><?php echo e(__('Ver no site')); ?>

                        </a>
                        <?php if(auth()->user()->getPermissaoDetalhes('GERENCIADOR_DE_MOBIANGRA')['adicionar'] ?? false): ?>
                            <a href="<?php echo e(route('admin.mobiangra.horarios.linhas.create')); ?>" class="btn btn-sm btn-success">
                                <i class="fa-solid fa-plus me-1"></i><?php echo e(__('Nova linha')); ?>

                            </a>
                            
                            <button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#modal-importar-xlsx">
                                <i class="fa-solid fa-file-excel me-1"></i><?php echo e(__('Importar XLSX')); ?>

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

                <div id="mobiangra-horarios-busca-config" class="d-none"
                     data-url="<?php echo e(route('admin.mobiangra.horarios.linhas.buscar')); ?>"
                     data-total-inicial="<?php echo e($totalLinhasHorariosCadastro ?? 0); ?>"
                     data-msg-buscando="<?php echo e(__('Buscando…')); ?>"
                     data-msg-erro="<?php echo e(__('Não foi possível buscar. Tente novamente.')); ?>"
                     data-msg-sem-resultado="<?php echo e(__('Nenhuma linha encontrada para esta busca.')); ?>"
                     data-msg-resultados="<?php echo e(__(':total linha(s) encontrada(s)')); ?>"
                     data-msg-todas="<?php echo e(__('Exibindo todas as linhas')); ?>">
                </div>

                <div class="mb-3">
                    <label for="mobiangra-horarios-busca" class="form-label visually-hidden"><?php echo e(__('Buscar linha')); ?></label>
                    <div class="input-group">
                        <span class="input-group-text" aria-hidden="true">
                            <i class="fa-solid fa-magnifying-glass"></i>
                        </span>
                        <input type="search"
                               id="mobiangra-horarios-busca"
                               class="form-control"
                               value="<?php echo e(request('q')); ?>"
                               placeholder="<?php echo e(__('Buscar por código ou nome da linha…')); ?>"
                               autocomplete="off"
                               aria-controls="mobiangra-horarios-linhas-tbody"
                               aria-describedby="mobiangra-horarios-busca-status">
                        <button type="button"
                                id="mobiangra-horarios-busca-limpar"
                                class="btn btn-outline-secondary <?php if(! request('q')): ?> d-none <?php endif; ?>"
                                title="<?php echo e(__('Limpar busca')); ?>"
                                aria-label="<?php echo e(__('Limpar busca')); ?>">
                            <i class="fa-solid fa-xmark" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div id="mobiangra-horarios-busca-status" class="form-text" aria-live="polite"></div>
                </div>

                <div id="mobiangra-horarios-linhas-tabela-wrap" class="table-responsive <?php if($linhasHorarios->isEmpty()): ?> d-none <?php endif; ?>">
                    <table class="table table-hover align-middle mb-0">
                        <thead class="table-light">
                            <tr>
                                <th style="width:70px"><?php echo e(__('Código')); ?></th>
                                <th><?php echo e(__('Nome')); ?></th>
                                <th class="text-center" style="width:80px"><?php echo e(__('Tarifa')); ?></th>
                                <th class="text-center" style="width:90px"><?php echo e(__('Seções')); ?></th>
                                <th class="text-center" style="width:90px"><?php echo e(__('Status')); ?></th>
                                <th class="text-center" style="width:120px"><?php echo e(__('Ações')); ?></th>
                            </tr>
                        </thead>
                        <tbody id="mobiangra-horarios-linhas-tbody">
                            <?php echo $__env->make('admin.mobiangra.horarios._linhas_tbody', ['linhasHorarios' => $linhasHorarios], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </tbody>
                    </table>
                </div>

                <div id="mobiangra-horarios-linhas-vazio"
                     class="alert alert-info <?php if($linhasHorarios->isNotEmpty()): ?> d-none <?php endif; ?>">
                    <i class="fa-solid fa-circle-info me-1"></i>
                    <?php echo e(__('Nenhuma linha cadastrada. Clique em "Nova linha" para começar, ou importe um arquivo XLSX.')); ?>

                </div>

                <div id="mobiangra-horarios-linhas-sem-resultado" class="alert alert-warning d-none" role="status">
                    <i class="fa-solid fa-magnifying-glass me-1"></i>
                    <?php echo e(__('Nenhuma linha encontrada para esta busca.')); ?>

                </div>

                
                <div class="modal fade" id="modal-importar-xlsx" tabindex="-1" aria-labelledby="modal-importar-xlsx-label" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="modal-importar-xlsx-label">
                                    <i class="fa-solid fa-file-excel me-1"></i><?php echo e(__('Importar Grade de Horários (.xlsx)')); ?>

                                </h5>
                                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                            </div>
                            <form action="<?php echo e(route('admin.mobiangra.horarios.importarXlsx')); ?>" method="post" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="tab" value="horarios">
                                <div class="modal-body">
                                    <p class="text-muted small">
                                        <?php echo e(__('Selecione o arquivo XLSX com as grades de horários. O sistema irá importar automaticamente todas as abas (linhas) do arquivo, criando ou atualizando os registros no banco de dados.')); ?>

                                    </p>
                                    <div class="mb-3">
                                        <label for="horarios_xlsx_import" class="form-label fw-semibold"><?php echo e(__('Arquivo .xlsx')); ?></label>
                                        <input type="file" name="horarios_xlsx" id="horarios_xlsx_import"
                                               class="form-control" accept=".xlsx,.xls" required>
                                    </div>
                                    <div class="alert alert-warning small mb-0">
                                        <i class="fa-solid fa-triangle-exclamation me-1"></i>
                                        <?php echo e(__('A importação irá substituir os dados existentes das linhas que coincidirem com o código da aba.')); ?>

                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo e(__('Cancelar')); ?></button>
                                    <button type="submit" class="btn btn-primary">
                                        <i class="fa-solid fa-upload me-1"></i><?php echo e(__('Importar')); ?>

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

            </div>

            <?php echo $__env->make('admin.mobiangra.manifestacoes._tab', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <?php echo $__env->make('admin.mobiangra.alertas._tab', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

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

<?php $__env->startPush('after-scripts'); ?>
<script>
    window.mobiangraAlertasConfig = {
        storeUrl: <?php echo json_encode(route('admin.mobiangra.alertas.store'), 15, 512) ?>,
        updateUrlBase: <?php echo json_encode(url('/admin/mobiangra/alertas'), 15, 512) ?>,
        createLabel: <?php echo json_encode(__('Novo alerta'), 15, 512) ?>,
        editLabel: <?php echo json_encode(__('Editar alerta'), 15, 512) ?>,
        openModalOnError: <?php echo json_encode($tabAtual === 'alertas' && $errors->any(), 15, 512) ?>,
    };
</script>
<script src="<?php echo e(asset('pmar/js/admin/mobiangra/admin_index.js')); ?>"></script>
<script src="<?php echo e(asset('pmar/js/admin/mobiangra/admin_horarios_busca.js')); ?>?v=<?php echo e(time()); ?>"></script>
<script src="<?php echo e(asset('pmar/js/admin/mobiangra/admin_alertas.js')); ?>?v=<?php echo e(time()); ?>"></script>
<?php $__env->stopPush(); ?>

<?php $__env->stopSection(); ?>

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