<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.w3.org/1999/xhtml"
      layout:decorate="~{layouts/main-layout}">
<head>
    <title>Анализ TLE</title>
    <link rel="stylesheet" href="/css/catalog.css"/>
    <link rel="stylesheet" href="/css/tle-analysis.css"/>
</head>
<body>
<th:block layout:fragment="content">
    <div id="tle-analysis-page" class="catalog-page tle-analysis-page py-3">
        <div class="d-flex justify-content-between align-items-start flex-wrap gap-3 mb-3">
            <div>
                <h2 class="mb-1">Анализ TLE</h2>
                <div class="catalog-helper">Анализ изменения TLE выбранного спутника по разнице рассчитанных радиус-векторов.</div>
            </div>
            <div class="d-flex align-items-end gap-2 flex-wrap">
                <div>
                    <label for="tle-analysis-count" class="form-label mb-1 small text-muted">Количество TLE</label>
                    <input id="tle-analysis-count"
                           type="number"
                           class="form-control form-control-sm"
                           min="1"
                           step="1"
                           value="5">
                </div>
                <button id="tle-analysis-refresh" type="button" class="btn btn-outline-secondary">Обновить</button>
            </div>
        </div>

        <div id="tle-analysis-alert"></div>

        <div class="row g-3 tle-analysis-layout">
            <div class="col-12 col-xl-4">
                <div class="card catalog-card tle-analysis-sidebar h-100">
                    <div class="card-header">
                        <div class="catalog-section-title">Спутники</div>
                        <div class="catalog-helper mt-1">Выберите КА для формирования аналитической таблицы TLE.</div>
                    </div>
                    <div class="card-body p-2 tle-analysis-filter-body">
                        <label for="tle-analysis-satellite-filter" class="form-label mb-1 small text-muted">Фильтр</label>
                        <input id="tle-analysis-satellite-filter"
                               type="search"
                               class="form-control form-control-sm"
                               autocomplete="off"
                               placeholder="ID, NORAD, код, имя, тип">
                    </div>
                    <div class="card-body p-0 tle-analysis-satellites-wrap">
                        <table class="table table-hover mb-0 tle-analysis-satellites-table">
                            <thead class="table-light">
                            <tr>
                                <th>ID</th>
                                <th>Спутник</th>
                                <th>NORAD</th>
                            </tr>
                            </thead>
                            <tbody id="tle-analysis-satellites-body"></tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-12 col-xl-8">
                <div class="card catalog-card tle-analysis-results-card h-100">
                    <div class="card-header d-flex justify-content-between align-items-start gap-3 flex-wrap">
                        <div>
                            <div class="catalog-section-title">Таблица анализа TLE</div>
                            <div id="tle-analysis-selected-satellite" class="catalog-helper mt-1">Выберите спутник слева.</div>
                        </div>
                        <div id="tle-analysis-summary" class="catalog-helper text-end"></div>
                    </div>
                    <div class="card-body p-0 tle-analysis-results-wrap">
                        <div id="tle-analysis-empty" class="catalog-empty">Выберите спутник для загрузки TLE.</div>
                        <div id="tle-analysis-table-wrap" class="table-responsive d-none">
                            <table class="table table-hover table-sm mb-0 tle-analysis-results-table">
                                <thead class="table-light">
                                <tr>
                                    <th>#</th>
                                    <th>Эпоха</th>
                                    <th>Виток</th>
                                    <th>NORAD</th>
                                    <th>Радиус-вектор, м</th>
                                    <th>|r|, м</th>
                                    <th>Разница Времени, ч</th>
                                    <th>Расхождение, м</th>
                                </tr>
                                </thead>
                                <tbody id="tle-analysis-results-body"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/tle_analysis_scripts.js"></script>
</th:block>
</body>
</html>
