<?php

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

$this->title = 'DHCP Relay';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'IP',
    $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
            //echo $model->name;
            $tabs[] = ['label' => 'DHCP Relay', 'content' => GridView::widget([
                    'dataProvider' => $provider,
                    'id' => 'DHCP Relay',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info'];
                        }
                    },
                            'columns' => [
                                ['attribute' => 'name',
                                    'format' => 'text',
                                    'label' => 'Name'],
//                        ['attribute' => 'ranges',
//                            'format' => 'text',
//                            'label' => 'Addresses'],
                                'interface:text:Interface',
                                'dhcp_server:text:DHCP Server',
                                'local_address:text:Local Address',
                                [
                                    'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}',
                                    //'class' => 'yii\grid\CheckboxColumn',
                                    'controller' => 'mikrotik/ip/dhcprelay/dhcprelay',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/ip/dhcprelay/dhcprelay/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];

                    echo Tabs::widget([
                        'items' => $tabs]);
                    echo Html::a('<span class="btn-label">Reset Counters</span>', ['resetcounters', 'id' => $model->id], ['class' => 'btn btn-primary']);
                    ?>

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



