<?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;

$this->title = 'RIP Interface';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'Routing',
    $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']); ?>
                <?php $int['all'] = 'all' ?>
                <?= $form->field($model, 'interface')->dropDownList($int); ?>
                <?=
                $form->field($model, 'receive')->dropDownList(['v2' => 'v2',
                    'v1' => 'v1',
                    'v1-2' => 'v1-2',]);
                ?>
                <?=
                $form->field($model, 'send')->dropDownList(['v2' => 'v2',
                    'v1' => 'v1',
                    'v1-2' => 'v1-2',]);
                ?>
                <?=
                $form->field($model, 'authentication')->dropDownList(['none' => 'none',
                    'simple' => 'simple',
                    'md5' => 'md5',
                ]);
                $prefix[''] = '';
                $keys[''] = '';
                ?>
                <?= $form->field($model, 'authentication_key')->label('Authentication Key'); ?>
                <?= $form->field($model, 'key_chain')->dropDownList($keys); ?>
                <?= $form->field($model, 'passive')->checkBox(); ?>
                <?= $form->field($model, 'in_prefix_list')->dropDownList($prefix); ?>
                <?= $form->field($model, 'out_prefix_list')->dropDownList($prefix); ?>
                <?= $form->field($model, 'updates_tx')->label('Updates Tx')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'updates_rx')->label('Updates Rx')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'bad_packets')->label('Bad Packets')->textinput(['readonly' => true]); ?>
                <?= $form->field($model, 'bad_routes')->label('Bad Routes')->textinput(['readonly' => true]); ?>

            <?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>
