<?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;
use yii\bootstrap\Tabs;

$this->title = 'IPsec Policy';
$this->params['breadcrumbs'] = [
    'Mikrotik',
    'IP',
    'IPsec',
    $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 ?>


            <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
            <?=
            Tabs::widget([
                'items' => [
                    [
                        'label' => 'General',
                        'content' => $this->render('/mikrotik/ip/ipsec/policies/general', ['model' => $model, 'menu' => $menu, 'form' => $form]),
                        'active' => true
                    ],
                    [
                        'label' => 'Action',
                        'content' => $this->render('/mikrotik/ip/ipsec/policies/action', ['items' => $items, 'model' => $model, 'menu' => $menu, 'form' => $form]),
                    ],
            ]]);
            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']);
            }

            ActiveForm::end();
            ?>



        </div>
    </div>
</div>

