<?php

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

$this->title = 'DHCP Client';
$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
            $tabs[] = ['label' => 'DHCP Client', 'content' => GridView::widget([
                    'dataProvider' => $provider['DHCP Client'],
                    'id' => 'DHCP Client',
                    'rowOptions' => function($provider) {
                        if ($provider->disabled == 'true') {
                            return ['class' => 'info'];
                        }
                    },
                            'columns' => [
                                ['attribute' => 'interface',
                                    'format' => 'text',
                                    'label' => 'Interface'],
                                'use_peer_dns:text:Use Peer DNS',
                                'add_default_route:text:Add Default Route',
                                'address:text:Address',
                                'expires_after:text:Expires After',
                                'status:text:Status',
                                [
                                    'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete} {view}',
                                    //'class' => 'yii\grid\CheckboxColumn',
                                    'controller' => 'mikrotik/ip/dhcpclient/dhcpclient',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/ip/dhcpclient/dhcpclient/create') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    $tabs[] = ['label' => 'DHCP Client Options', 'content' => GridView::widget([
                            'dataProvider' => $provider['DHCP Client Options'],
                            'id' => 'DHCP CLient Options',
                            'columns' => [
                                ['attribute' => 'name',
                                    'format' => 'text',
                                    'label' => 'Name'],
                                'code:text:Code',
                                'value:text:Value',
                                [
                                    'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}',
                                    'controller' => 'mikrotik/ip/dhcpclient/dhcpclientoptions',
                                    'header' => Html::button('Add', ['class' => 'btn btn-primary', 'name' => 'add-button', 'onclick' =>
                                        'js:document.location.href="' . Url::toRoute('mikrotik/ip/dhcpclient/dhcpclientoptions/createoption') . '"']),
                                ],
                            ],
                            'showFooter' => false,
                        ])
                    ];
                    echo Tabs::widget([
                        'items' => $tabs]);
                    ?>



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



