<?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 = 'PPPoE Service';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'PPP',
    $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, 'service_name')->label('Service Name'); ?>
                <?php $interface['<l2tp>'] = '<l2tp>'; ?>
                <?= $form->field($model, 'interface')->dropDownList($interface); ?>
                <?= $form->field($model, 'max_mtu')->label('Max MTU'); ?>
                <?= $form->field($model, 'max_mru')->label('Max MRU'); ?>
                <?= $form->field($model, 'mrru')->label('MRRU'); ?>
                <?= $form->field($model, 'keepalive_timeout')->label('Keepalive Timeout'); ?>
                <?= $form->field($model, 'default_profile')->dropDownList($profile); ?>
                <?= $form->field($model, 'one_session_per_host')->checkBox(); ?>
                <?= $form->field($model, 'max_sessions')->label('Max Sessions'); ?>
                <?= $form->field($model, 'pado_delay')->label('PADO Delay'); ?>
                <?=
                $form->field($model, 'authentication')->dropDownList(['mschap2' => 'mschap2',
                    'mschap1' => 'mschap1',
                    'chap' => 'chap',
                    'pap' => 'pap',
                        ], ['multiple' => 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>