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

% content_for 'module' => begin

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

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

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

    <br>

    <h2><%= l 'bac_ENABLE_DISABLE_TAPE' %></h2>

    <br>

    <div>
        <%= $c->render_to_string(inline => (l 'bac_TAPE_CONFIG_DESC')) %>
    </div>

    <br>

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

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <%= l 'bac_ENABLE_TAPE_BACKUP' %>
            </div>
            <div class="col-auto">
            % if ( $bac_datas->{status} eq 'checked' ) {
                <input type='checkbox' name='Tapebackup' aria-describedby="enabled" checked >
            % } else {
                <input type='checkbox' name='Tapebackup' aria-describedby="disabled">
            % }
            </div>
        </div>

        <br>

        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <label for="inputBackupHour" class="col-form-label"><%= l 'bac_TAPE_BACKUP_TIME' %></label>
                <label for="inputBackupMin" class="col-form-label"></label>
            </div>
            <div class="col-auto">
                % param 'BackupHour' => $bac_datas->{backupHour} unless param 'BackupHour';
                <input type="text" name="BackupHour" id="inputBackupHour" class="form-control" maxlength="2" size="4" aria-describedby="Backup Hour" value="<%= $bac_datas->{backupHour} %>">
            </div>
            <div class="col-auto">
                % param 'BackupMin' => $bac_datas->{backupMin} unless param 'BackupMin';
                <input type="text" name="BackupMin" id="inputBackupMin" class="form-control" maxlength="2" size="4" aria-describedby="Backup Minute" value="<%= $bac_datas->{backupMin} %>">
            </div>
            <div class="col-auto">
                % param 'BackupAMPM' => $bac_datas->{backupAMPM} unless param 'BackupAMPM';
                <%= select_field 'BackupAMPM' => ['AM', 'PM'], class => "form-select" %>
            </div>
        </div>

        <br>


        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <label for="inputReminderMin" class="col-form-label"><%= l 'bac_LOAD_TAPE_REMINDER_TIME' %></label>
                <label for="inputReminderMin" class="col-form-label"></label>
            </div>
            <div class="col-auto">
                % param 'ReminderHour' => $bac_datas->{reminderHour} unless param 'ReminderHour';
                <input type="text" name="ReminderHour" id="inputReminderHour" class="form-control" maxlength="2" size="4" aria-describedby="Reminder Hour" value="<%= $bac_datas->{reminderHour} %>">
            </div>
            <div class="col-auto">
                % param 'ReminderMin' => $bac_datas->{reminderMin} unless param 'ReminderMin';
                <input type="text" name="ReminderMin" id="inputReminderMin" class="form-control" maxlength="2" size="4" aria-describedby="Reminder Minute" value="<%= $bac_datas->{reminderMin} %>">
            </div>
            <div class="col-auto">
                % param 'ReminderAMPM' => $bac_datas->{reminderAMPM} unless param 'ReminderAMPM';
                <%= select_field 'ReminderAMPM' => ['AM', 'PM'], class => "form-select" %>
            </div>
        </div>

        <br>

        <%=  hidden_field 'Function' => $bac_datas->{'function'} %>

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

    </form>

</div>
% end