<?php
use yii\helpers\Url;
use home\widgets\Alert;
use yii\helpers\ArrayHelper;
use yii\web\View;

/* @var $this \yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \home\modules\task\models\Task */

$this->title = '添加组件';

$js = <<<JS
    //选择组件时填充名称和描述
    $("#userportlet-portlet").on('change', function () {
        var titleInput = $("input[name='UserPortlet[title]']");
        titleInput.val($(this).find(":selected").html());
        $("#portlet-desc").html($(this).find(":selected").data('desc'));
    });
    $("#userportlet-portlet").trigger('change');
JS;
$this->registerJs($js, View::POS_READY);
?>

<div class="modal-window">

<?= \home\widgets\Alert::widget(); ?>

<?= $this->render('_form', ['model' => $model, 'action' => $action]);  ?>

</div>
