<?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 = 'CAPs Provisioning';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'CAPsMAN',
    $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-ac']);
                ?>
                <?= $form->field($model, 'radio_mac')->label('Radio MAC'); ?>
                <?=
                $form->field($model, 'hw_supported_modes')->dropDownList(['' => '',
                    'an' => 'an',
                    'a' => 'a',
                    'a-turbo' => 'a-turbo',
                    'ac' => 'ac',
                    'b' => 'b',
                    'g' => 'g',
                    'g-turbo' => 'g-turbo',
                    'gn' => 'gn',
                        ], ['multiple' => true]);
                ?>
                <?=
                $form->field($model, 'action')->dropDownList(['none' => 'none',
                    'create-disabled' => 'create-disabled',
                    'create-enabled' => 'create-enabled',
                    'create-dynamic-enabled' => 'create-dynamic-enabled',
                ]);
                ?>
                <?= $form->field($model, 'master_configuration')->dropDownList($items); ?>
                <?php $items[''] = ''; ?>
                <?= $form->field($model, 'slave_configurations')->dropDownList($items, ['multiple' => true]); ?>
                <?= $form->field($model, 'name_prefix')->label('Name Prefix'); ?>
                <?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>
