% layout 'AdminLTE', title => "Sme server 2 - yum";

% content_for 'module' => begin

<div class="card-body">

    % if (config->{debug} == 1) {
        <pre>
            <%= dumper $c->current_route %>
            <%= dumper $yum_datas %>
        </pre>
    % }

    <h1><%= $title%></h1>

    % if ( $notif ) {
        <br>
        <div class="text-warn">
            <%= $notif %>
        </div>
        <br>
    % }

    % if ( $c->is_empty('updates') ) {
        <br>
        <div>
            <h2><%=l 'yum_TITLE_UPTODATE' %></h2>
            <br>
            <%=l 'yum_DESC_UPTODATE' %>
        </div>
        <br>
    % }

    % if ( $c->non_empty('updates') ) {
        <br>
        <div>
            <h2><%= l 'yum_TITLE_UPDATES_AVAILABLE' %></h2>
            <%= l 'yum_DESC_UPDATES_AVAILABLE' %>
        </div>
        <br>

        <form action="/smanager/yum" method="POST">
            % my $btnInUp = $c->l('yum_BUTTON_INSTALL_UPDATES');
            <%= hidden_field 'trt' => 'UPDT' %>
            <div class="row g-3 align-items-center">
                <div class="col-md-2">
                    <button type="submit" class="btn btn-primary btn-sm"><%= $btnInUp %></button>
                </div>
            </div>
        </form>
    % }

    % if ( $c->non_empty('available') ) {
        <form action="/smanager/yum" method="POST">
            <br>
            % my $btnInAv = $c->l('yum_BUTTON_INSTALL_AVAILABLE');
            <%= hidden_field 'trt' => 'INST' %>
            <div class="row g-3 align-items-center">
                <div class="col-md-2">
                    <button type="submit" class="btn btn-primary btn-sm"><%= $btnInAv %></button>
                </div>
            </div>
        </form>
    % }

    % if ( $c->non_empty('installed') ) {
        <form action="/smanager/yum" method="POST">
            <br>
            % my $btnInRm = $c->l('yum_BUTTON_REMOVE');
            <%= hidden_field 'trt' => 'REMO' %>
            <div class="row g-3 align-items-center">
                <div class="col-md-2">
                    <button type="submit" class="btn btn-primary btn-sm"><%= $btnInRm %></button>
                </div>
            </div>

    % }

    </form>

    <br>
    <!--<br><hr class=""><br>-->

    <form action="/smanager/yum" method="POST">

        <div class="row g-3 align-items-center">
            <div class="col-md-2 border-bottom">
                <%= l 'yum_LABEL_YUM_STATUS' %>
            </div>
            <div class="col-auto border-bottom">
                <%= $c->get_status('status', 'localise') %>
            </div>
        </div>

        <div class="row g-3 align-items-center">
            <div class="col-md-2 border-bottom">
                <%= l 'yum_LABEL_YUM_PACKAGEFUNCTIONS' %>
            </div>
            <div class="col-auto border-bottom">
                <%= $c->get_status('PackageFunctions', 'localise') %>
            </div>
        </div>

        <div class="row g-3 align-items-center">
            <div class="col-md-2 border-bottom">
                <%= l 'yum_LABEL_YUM_DELTARPMPROCESS' %>
            </div>
            <div class="col-auto border-bottom">
                <%= $c->get_status('DeltaRpmProcess', 'localise') %>
            </div>
        </div>

        <div class="row g-3 align-items-center">
            <div class="col-md-2 border-bottom">
                <%= l 'yum_LABEL_YUM_DOWNLOADONLY' %>
            </div>
            <div class="col-auto border-bottom">
                <%= $c->get_status('DownloadOnly', 'localise') %>
            </div>
        </div>

        <div class="row g-3 align-items-center">
            <div class="col-md-2 border-bottom">
                <%= l 'yum_LABEL_YUM_AUTOINSTALLUPDATES' %>
            </div>
            <div class="col-auto border-bottom">
                <%= $c->get_status('AutoInstallUpdates', 'localise') %>
            </div>
        </div>

        <br>

        % my $btnConfig = $c->l('yum_BUTTON_CONFIGURATION');
        <%=  hidden_field 'trt' => 'CONF' %>

        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <button type="submit" class="btn btn-primary btn-sm"><%= $btnConfig %></button>
            </div>
        </div>

    </form>

</div>

% end