<?php

use qcbase\assets\MenuAsset;
use yii\helpers\Url;
use qcbase\models\Menu;
use yii\widgets\ActiveForm;
MenuAsset::register($this);
?>

<div class="nav">
    <ul class="cc">
        <li class="current"><a href="<?= Url::to(['menu/index']) ?>">菜单管理</a></li>
        <li><a href="<?= Url::to(['menu/create']) ?>">添加菜单</a></li>
    </ul>
</div>
    <?= $this->render('/site/_search', ['get' =>'', 'model' => $model,'action'=>'menu/search-menu']); ?>
<div class="table_list">
<?php $mainForm = ActiveForm::begin([ 'id' => 'main-form', 'action' => '']); ?>
    <table width="100%">
        <thead>
            <tr>
                <td width="50"><input type="checkbox" name="select_all" class="box-select-all" />全选</td>
                <td width="50">排序</td>
                <td width="5%">ID</td>
                <td>应用/菜单名称</td>
                <td>模块名称</td>
                <td >控制器名称</td>
                <td>动作名称</td>
                <td>类型</td>
                <td>是否显示</td>
                <td width="20%" align="center">操作</td>
            </tr>
        </thead>
        <?php if (empty($appArr)) : ?>
            <tr><td colspan="9" class="tac red">还没有任何数据...</td></tr>
        <?php else : ?>
    <?php foreach ($appArr as $key => $item): ?>
                <tr>
                    <td colspan="3" ></td>
                    <td id="<?= $item['value'] ?>">
                        <span   <?php
                        if ($item['expandStatus']) {
                            echo "class='J_start_icon start_icon'";
                        } else {
                            echo "class='J_start_icon away_icon expandChild' title='点击展开'";
                        }
                        ?> data-app_name="<?= $item['value'] ?>" data-id="<?= $item['id'] ?>" data-expand-status="<?= $item['expandStatus'] ?>" data-level="1" ></span>
                <?= $item['name'] ?></td>
                    <td colspan="6"></td>
                </tr>
        <?php endforeach; ?>
<?php endif; ?>
    </table>
<?php ActiveForm::end(); ?>
</div>
<div class="pages">
</div>

<div class="btn_wrap">
    <div class="btn_wrap_pd">
        <button class="btn btn_submit mr10 batch-delete" data-url="<?= Url::to(['menu/delete', 'id' => '']) ?>" type="submit" >删除</button>
        <button class="btn  mr10 batch-sort" data-url="<?= Url::to(['menu/sort']) ?>" type="submit">排序</button>
    </div>
</div>
<script>
    var getMenuUrl = "<?= Url::to(['menu/get-menu-list']) ?>"
    var csrfToken = "<?= Yii::$app->request->getCsrfToken() ?>";
</script>
