<?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 = 'OSPF Area';
$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']); ?>
                <?=
                $form->field($model, 'name')->label('Name');
                $areas['default'] = '';
                ?>
                <?= $form->field($model, 'instance')->dropDownList($areas); ?>
                <?= $form->field($model, 'area_id')->label('Area ID'); ?>
                <?=
                $form->field($model, 'type')->dropDownList(['default' => 'default',
                    'nssa' => 'nssa',
                    'stub' => 'stub',
                ]);
                ?>
                <?=
                $form->field($model, 'translator_role')->dropDownList(['' => '', 'translate-candidate' => 'translate-candidate',
                    'translate-always' => 'translate-always',
                    'translate-never' => 'translate-never',
                ]);
                ?>
                <?= $form->field($model, 'inject_summary_lsas')->checkBox(); ?>
                <?= $form->field($model, 'default_cost')->label('Default Cost'); ?>
                <?= $form->field($model, 'interfaces')->label('Interfaces')->textInput(['readonly' => true]); ?>
                <?= $form->field($model, 'active_interfaces')->label('Active Interfaces')->textInput(['readonly' => true]); ?>
                <?= $form->field($model, 'neighbors')->label('Neighbors')->textInput(['readonly' => true]); ?>
                <?= $form->field($model, 'adjacent_neighbors')->label('Adjacent Neighbors')->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>
