<?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 = 'TE Interface';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'Traffic Eng',
    $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, 'interface')->dropDownList($interfaces); ?>

            <?= $form->field($model, 'bandwidth'); ?>
            <?= $form->field($model, 'k_factor')->label('K Factor'); ?>
            <?= $form->field($model, 'resource_class')->label('Resource Class'); ?>
            <?= $form->field($model, 'refresh_time')->label('Refresh Time'); ?>
            <?= $form->field($model, 'use_udp')->checkBox(); ?>
            <?= $form->field($model, 'blockade_k_factor')->label('Blockade K Factor'); ?>
            <?= $form->field($model, 'te_metric')->label('TE Metric'); ?>
            <?= $form->field($model, 'igp_flood_period')->label('IGP Flood Period'); ?>
            <?= $form->field($model, 'up_flood_thresholds')->label('Up Flood Thresholds'); ?>
            <?= $form->field($model, 'down_flood_thresholds')->label('Down Flood Thresholds'); ?>

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