<?php

use yii\bootstrap\Alert;

if (Yii::$app->session->getFlash('message') != null) {
    echo Alert::widget([
        'options' => [
            'class' => 'alert-info',
        ],
        'body' => Yii::$app->session->getFlash('message'),
    ]);
}

use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
use yii\widgets\Menu;
use yii\bootstrap\Tabs;
use yii\bootstrap\Button;

$this->title = 'Backup';
$this->params['breadcrumbs'] = [

    $this->title,
];
?>
<div class="site-plugins">
    <div class="row">
        <div class="col-lg-3">
            <?php
            echo Menu::widget($menu);
            ?> 
        </div>
        <div class="col-md-9">
            <h1 style="margin-top: 0px"><?= Html::encode($this->title) ?></h1>

            <?php
            //var_dump($provider);
            $tabs[] = ['label' => 'Backup', 'content' => GridView::widget([
                    'dataProvider' => $provider,
                    'id' => 'backup',
                    'columns' => [
                        ['attribute' => 'ip',
                            'format' => 'text',
                            'label' => 'IP Address'],
                        'name:text:Name',
                        'size:text:Size',
                        [
                            'class' => 'yii\grid\ActionColumn', 'template' => '{download} {delete} {restore}',
                            'buttons' => [
                                'download' => function ($url, $key) {
                                    return Html::a('<span class="glyphicon glyphicon-download"></span>', $url, [
                                                'title' => 'Download',
                                                    ]
                                    );
                                },
                                        'restore' => function ($url, $key) {
                                    return Html::a('<span class="glyphicon glyphicon-upload"></span>', $url, [
                                                'title' => 'Restore',
                                                'data-confirm' => Yii::t('yii', 'Are you sure you want to restore this file?'),
                                                    ]
                                    );
                                },
                                    ],
                                    //'class' => 'yii\grid\CheckboxColumn',
                                    'controller' => 'mikrotik/backup/backup',
                                    'header' => Html::button('Backup now', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/backup/backup/backupnow') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    echo Tabs::widget([
                        'items' => $tabs]);
                    ?>



        </div>
    </div>
</div>



