<?php

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

$this->title = 'VPLS';
$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' => 'VPLS', 'content' => GridView::widget([
                    'dataProvider' => $provider['vpls'],
                    'id' => 'interfaces',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info',];
                        }
                    },
                            'columns' => [
                                'name:text:Name',
                                'type:text:Type',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '{update} {delete}',
                                    'controller' => 'mikrotik/mpls/vpls/vpls',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/mpls/vpls/vpls/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    $tabs[] = ['label' => 'BGP VPLS', 'content' => GridView::widget([
                            'dataProvider' => $provider['bgp'],
                            'id' => 'interfaces',
                            'rowOptions' => function($provider) {
                                if ($provider->disabled == 'true') {
                                    return ['class' => 'info',];
                                }
                            },
                                    'columns' => [
                                        'route_distinguisher:text:Route Distinguisher',
                                        'import_route_targets:text:Import Route Targets',
                                        'export_route_targets:text:Export Route TArgets',
                                        'site_id:text:Site ID',
                                        'bridge:text:Bridge',
                                        'bridge_cost:text:Bridge Cost',
                                        'bridge_horizon:text:Bridge Horizon',
                                        [
                                            'class' => 'yii\grid\ActionColumn',
                                            'template' => '{update} {delete}',
                                            'controller' => 'mikrotik/mpls/vpls/bgp',
                                            'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                                'js:document.location.href="' . Url::toRoute('mikrotik/mpls/vpls/bgp/create') . '"']),
                                        ],
                                    ],
                                    'showFooter' => false,
                                ])
                            ];
                            $tabs[] = ['label' => 'Cisco BGP VPLS', 'content' => GridView::widget([
                                    'dataProvider' => $provider['cisco'],
                                    'id' => 'interfaces',
                                    'rowOptions' => function($provider) {
                                        if ($provider->disabled == 'true') {
                                            return ['class' => 'info',];
                                        }
                                    },
                                            'columns' => [
                                                'route_distinguisher:text:Route Distinguisher',
                                                'import_route_targets:text:Import Route Targets',
                                                'export_route_targets:text:Export Route TArgets',
                                                'vpls_id:text:VPLS ID',
                                                'bridge:text:Bridge',
                                                'bridge_cost:text:Bridge Cost',
                                                'bridge_horizon:text:Bridge Horizon',
                                                [
                                                    'class' => 'yii\grid\ActionColumn',
                                                    'template' => '{update} {delete}',
                                                    'controller' => 'mikrotik/mpls/vpls/cisco',
                                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                                        'js:document.location.href="' . Url::toRoute('mikrotik/mpls/vpls/cisco/create') . '"']),
                                                ],
                                            ],
                                            'showFooter' => false,
                                        ])
                                    ];
                                    echo Tabs::widget([
                                        'items' => $tabs]);
                                    ?>



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



