<?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\widgets\Menu;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use yii\grid\GridView;

$this->title = 'GRE Tunnel';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'Interfaces',
    $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 $form = ActiveForm::begin(['id' => 'form-proxy']); ?>
                <?= $form->field($model, 'name'); ?>
                <?= $form->field($model, 'type')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'mtu')->label('MTU'); ?>
                <?= $form->field($model, 'actual_mtu')->label('Actual MTU')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'l2mtu')->label('L2 MTU')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'local_address')->label('Local Address'); ?>
                <?= $form->field($model, 'remote_address')->label('Remote Address'); ?>
                <?= $form->field($model, 'ipsec_secret')->label('Ipsec Secret'); ?>
                <?= $form->field($model, 'keepalive')->label('Keepalive'); ?>
                <?= $form->field($model, 'dscp')->label('DSCP'); ?>
                <?= $form->field($model, 'dont_fragment')->dropDownList(['no' => 'no', 'inherited' => 'inherited']); ?>
                <?= $form->field($model, 'clamp_tcp_mss')->checkBox(); ?>
                <?php
                if ($action == 'update') {
                    if ($model->disabled == 'true') {
                        $action_e = 'enable';
                    } else {
                        $action_e = 'disable';
                    }
                    echo Html::submitButton('Update', ['class' => 'btn btn-primary', 'name' => 'create-button']);
                    echo ' ';
                    echo Html::a('<spanclass="btn-label">' . ucfirst($action_e) . '</span>', [$action_e, 'id' => $model->id], ['class' => 'btn btn-primary']);
                } else {
                    echo Html::submitButton('Create', ['class' => 'btn btn-primary', 'name' => 'create-button']);
                }
                ?>
        </div>
<?php ActiveForm::end(); ?> 
    </div>
</div>
</div>