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

% content_for 'module' => begin

<div class="card-body">

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

    % if ( stash 'warning' ) {
        <br>
        <div>
        %= $c->render_to_string(inline => stash 'warning') 
        </div>
    %}
    % if ( stash 'error' ) {
        <br>
        <div>
        %= $c->render_to_string(inline => stash 'error') 
        </div>
    %}

    <h1><%= $title%></h1>
    <!--br>Still incomplete click here for previous version
    <a href="/server-manager/cgi-bin/backup" target='_blank'><b>(Previous Backup version)</b></a>
    <br-->

    <%= $c->render_to_string(inline => (l 'bac_BACKUP_DESC_DAR', $bac_datas->{module}, 
        $bac_datas->{dumpsize}, $bac_datas->{tarsize})) %>

    <form action="/smanager/backup" method="POST">
        %#= form_for '/backup' => (method => 'POST') => begin
    
    <h2><%= l 'bac_BACKUP_CONFIG_STATUS' %></h2>

    <div>
    <%= l 'bac_TAPE_BACKUPS' %>,
    <%= $c->l(uc($bac_datas->{'backupStatus'})).'.' %>

    % if ( $bac_datas->{'backupStatus'} eq 'enabled' ) {
        %= $c->l('bac_BACKUPS_RUN_AT')
        %=  $bac_datas->{'backupTime'}
        %= $c->l('bac_REMINDER_MESSAGE_AT')
        %= $bac_datas->{'reminderTime'}
    % }
    </div>
    
    <div>

    <%=l 'bac_WORKSTN_BACKUPS' %>,
    <%= $c->l(uc($bac_datas->{'backupwkStatus'})) . '.' %>
    % if ( $bac_datas->{'backupwkStatus'} eq 'enabled' ) {
        <%= $c->l('bac_WKBACKUPS_RUN_AT') %>
        <%= $bac_datas->{'backupwkTime'} %>
    % }
    </div>

    <div>
    <%= l 'bac_SELECT_AN_ACTION' %>
    % param 'Function' => $bac_datas->{function} unless param 'Function';
    <%= select_field 'Function' => $c->get_function_options() %>
    </div>

    <br>

        <%  my $btn = $c->l('PERFORM'); %>
         <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <button type="submit" class="btn btn-primary"><%= $btn %></button>
            </div>
        </div>
    % end

</div>

% end