<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use qcbase\models\Menu;
use yii\db\Query as query;
use yii\helpers\Url;

/* @var $this yii\web\View */

$form = ActiveForm::begin([
        'id' => 'main-form',
        'action' => ($model->isNewRecord) ? ['menu/create'] : ['menu/update'],
        'fieldConfig' => [
            'options' => ['tag' => 'tr'],
            'template' => "<th width='120'>{label}</th><td>{input}{hint}{error}</td>",
        ]
    ]);
?>

<div class="h_a">基本属性</div>
<div class="table_full">
    <table width="100%">
        <?= $form->field($model, 'app_name')->dropDownList(Menu::getAppName(), ['id' => 'chooseApp']) ?>
        <tr class="field-menu-parent_id">
            <th width="120">
                <label class="control-label" for="menu-parent_id">父级菜单</label>
            </th>
            <td>
                <select name="Menu[parent_id]" id="Menu_parent_id">
                    <option value="0" >----作为一级菜单----</option>
                </select>
                <div class="help-block"></div>
            </td>
        </tr>
        <?= $form->field($model, 'name')->textInput(['class' => 'input length_5', 'placeholder' => '']); ?>
        <?= $form->field($model, 'module')->textInput(['class' => 'input length_5', 'placeholder' => '']); ?>
        <?= $form->field($model, 'controller')->textInput(['class' => 'input length_5', 'placeholder' => '']); ?>
        <?= $form->field($model, 'action')->textInput(['class' => 'input length_5', 'placeholder' => '']); ?>
        <?= $form->field($model, 'param')->textInput(['class' => 'input length_5', 'placeholder' => '附加参数，格式：group=1&class=2']); ?>
        <?= $form->field($model, 'sort')->textInput(['class' => 'input length_5', 'placeholder' => '']); ?>
        <?= $form->field($model, 'is_auth')->dropDownList(Menu::getIsAuthList(), ['class' => 'switch_list']); ?>
        <?= $form->field($model, 'status')->radioList(Menu::getStatusList(), ['class' => 'switch_list']); ?>
        <?= $form->field($model, 'show_scope')->radioList(Menu::getShowScopeList(), ['class' => 'switch_list']); ?>
        <?= $form->field($model, 'remark')->textArea(['style' => 'width:290px']); ?>
        <?= ($model->isNewRecord) ?$form->field($model, 'child_actions')->checkboxList(Menu::getActionList(), ['class' => 'switch_list']):'' ?>
    </table>
</div>

<?= ($model->isNewRecord) ? '' : Html::hiddenInput('id', $model->menu_id); ?>

<div class="btn_wrap">
    <div class="btn_wrap_pd">
        <?= Html::submitButton('提交', ['class' => 'btn btn_submit mr10']); ?>
    </div>
</div>
<?php ActiveForm::end(); ?>
