<?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 = 'Queue List';
$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
            $tabs[] = ['label' => 'Simple Queues', 'content' => GridView::widget([
                    'dataProvider' => $provider['simple'],
                    'id' => 'interfaces',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info',];
                        }
                    },
                            'columns' => [
                                'name:text:Name',
                                'target:text:Target',
                                'max_limit:text:Upload Max Limit / Download Max Limit',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '{update} {delete}',
                                    'controller' => 'mikrotik/queues/simple',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/queues/simple/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    $tabs[] = ['label' => 'Interface Queues', 'content' => GridView::widget([
                            'dataProvider' => $provider['interface'],
                            'id' => 'interfaces',
                            'columns' => [
                                'interface:text:Interface',
                                'queue:text:Queue Type',
                                'active_queue:text:Active Queue Type',
                                [
                                    'class' => 'yii\grid\ActionColumn',
                                    'template' => '',
                                    'controller' => 'mikrotik/queues/queues',
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    $tabs[] = ['label' => 'Queue Tree', 'content' => GridView::widget([
                            'dataProvider' => $provider['tree'],
                            'id' => 'interfaces',
                            'rowOptions' => function($provider) {
                                if ($provider->disabled == 'true') {
                                    return ['class' => 'info',];
                                }
                            },
                                    'columns' => [
                                        'name:text:Name',
                                        'parent:text:Parent',
                                        'packet_mark:text:Packet Mark',
                                        'limit_at:text:Limit At',
                                        'max_limit:text:Max Limit',
                                        [
                                            'class' => 'yii\grid\ActionColumn',
                                            'template' => '{update} {delete}',
                                            'controller' => 'mikrotik/queues/tree',
                                            'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                                'js:document.location.href="' . Url::toRoute('mikrotik/queues/tree/create') . '"']),
                                        ],
                                    ],
                                    'showFooter' => false,
                                ])
                            ];
                            $tabs[] = ['label' => 'Queue Types', 'content' => GridView::widget([
                                    'dataProvider' => $provider['type'],
                                    'id' => 'interfaces',
                                    'rowOptions' => function($provider) {
                                        if ($provider->default == 'true') {
                                            return ['class' => 'info',];
                                        }
                                    },
                                            'columns' => [
                                                'name:text:Name',
                                                'kind:text:Kind',
                                                [
                                                    'class' => 'yii\grid\ActionColumn',
                                                    'template' => '{update} {delete}',
                                                    'controller' => 'mikrotik/queues/types',
                                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                                        'js:document.location.href="' . Url::toRoute('mikrotik/queues/types/create') . '"']),
                                                ],
                                            ],
                                            'showFooter' => false,
                                        ])
                                    ];

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



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



