<?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;

$this->title = 'Route Filters';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'Routing',
    $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' => 'Route Filters', 'content' => GridView::widget([
                    'dataProvider' => $provider,
                    'id' => 'interfaces',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info',];
                        }
                    },
                            'columns' => [
                                'chain:text:Chain',
                                'prefix:text:Prefix',
                                'prefix_length:text:Prefix Length',
                                'protocol:text:Protocol',
                                'bgp_as_path:text:BGP AS Path',
                                'action:text:Action',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '{update} {delete}',
                                    'controller' => 'mikrotik/routing/filter/filter',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/routing/filter/filter/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];

                    echo Tabs::widget([
                        'items' => $tabs]);
                    ?>



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



