<!DOCTYPE html>
<html lang="ru">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <title>
        Список достпуных в репозитории пакетов
    </title>
    <link rel="stylesheet" href="bootstrap.min.css">
</head>

<body>

    <div class="container p-3">
        <p>Для подключения репозитория в своей системе используейте команду</p>
        <div class="alert alert-warning" role="alert">
            <pre>
echo -e "[<%= repo_name %>]
name=<%= repo_name %>
skip_if_unavailable=True
baseurl=<%= repo_url %>
enabled=1
gpgkey=<%= repo_url %><%= repo_name %>-gpg-key
gpgcheck=1" > /etc/yum.repos.d/<%= repo_name %>.repo
            </pre>
        </div>
    </div>
        <div class="container p-3">
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">Последние обновленные пакеты</h5>
                <h6 class="card-subtitle mb-2 text-body-secondary">src.rpm (для непубличных репозиториев сам пакет с исходными кодами может отсутствовать)</h6>
                <p class="card-text">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th scope="col">Дата обновления</th>
                                <th scope="col">Пакет исходников</th>
                            </tr>
                        </thead>
                        <tbody>
                            <% last_update_src.each do |item| %>
                            <tr>
                                <td><%= item[0] %></td>
                                <td><%= item[1] %></td>
                            </tr>
                            <% end %>
                        </tbody>
                    </table>
                </p>
            </div>
        </div>
    </div>
    <div class="container p-3">
        <div class="card border-warning mb-3">
            <div class="card-header">Список доступных в репозитории пакетов</div>
            <div class="card-body">
                <h5 class="card-title text-danger-emphasis">Всего пакетов <%= pkg_num %></h5>
                <div class="accordion" id="dirInfo">
                    <% repo_data.each_with_index do |item, index| %>
                    <div class="accordion-item">
                        <h2 class="accordion-header">
                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
                                data-bs-target="#id<%= index %>" aria-expanded="false" aria-controls="id<%= index %>">
                                <%= item[1] %>
                            </button>
                        </h2>
                        <div id="id<%= index %>" class="accordion-collapse collapse" data-bs-parent="#dirInfo">
                            <div class="accordion-body">
                                <div class="accordion accordion-flush" id="rpmInfo">
                                    <% item[0].each_with_index do |idata, jndex| %>
                                    <div class="accordion-item">
                                        <h2 class="accordion-header">
                                            <button class="accordion-button collapsed" type="button"
                                                data-bs-toggle="collapse" data-bs-target="#rid<%= jndex %>" aria-expanded="false"
                                                aria-controls="rid<%= jndex %>">
                                                <%= idata[1] %>
                                            </button>
                                        </h2>
                                        <div id="rid<%= jndex %>" class="accordion-collapse collapse" data-bs-parent="#rpmInfo">
                                            <div class="accordion-body">

                                                <div class="accordion accordion-flush" id="pkgInfo">
                                                    <% idata[0].each_with_index do |iidata, ijndex| %>
                                                    <div class="accordion-item">
                                                        <h2 class="accordion-header">
                                                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#pid<%= ijndex %>" aria-expanded="false" aria-controls="pid<%= ijndex %>">
                                                                <%= iidata[:fname] %>  (<%= iidata[:stat]%>)
                                                            </button>
                                                        </h2>
                                                        <div id="pid<%= ijndex %>" class="accordion-collapse collapse" data-bs-parent="#pkgInfo" style="">
                                                            <div class="accordion-body">
                                                                <div class="accordion accordion-flush" id="pkgInfo">
                                                                    <ul class="list-group list-group-flush">
                                                                        <li class="list-group-item list-group-item-warning"> Скачать пакет - <a href="<%= iidata[:aname] %>"><%= iidata[:fname] %></a> </li>
                                                                        <% iidata[:chlog].each do |chlg| %>
                                                                        <li class="list-group-item list-group-item-warning"> <%= chlg.text %> </li>
                                                                        <% end %>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <% end %>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <% end %>
                                </div>
                            </div>
                        </div>
                    </div>
                    <% end %>
                </div>
            </div>
        </div>
    </div>
    <script src="bootstrap.bundle.min.js"></script>
</body>
</html>