<?php

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

$this->title = 'BFD';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    $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' => 'Interfaces', 'content' => GridView::widget([
                    'dataProvider' => $provider['interfaces'],
                    'id' => 'interfaces',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info',];
                        }
                    },
                            'columns' => [
                                'interface:text:Interface',
                                'interval:text:Interval',
                                'min_rx:text:Min Rx',
                                'multiplier:text:Multiplier',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '{update} {delete}',
                                    'controller' => 'mikrotik/routing/bfd/bfd',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/routing/bfd/bfd/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    $tabs[] = ['label' => 'Neighbors', 'content' => GridView::widget([
                            'dataProvider' => $provider['neighbors'],
                            'id' => 'interfaces',
                            'columns' => [
                                'interface:text:Interface',
                                'address:text:Address',
                                'protocols:text:Protocols',
                                'state:text:State',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '',
                                    'controller' => 'mikrotik/routing/bfd/bfd',
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];

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



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



