<?php

use common\assets\ZTreeAsset;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use qcbase\assets\MainAsset;

/* @var $this yii\web\View */
/* @var $model \qcbase\models\LoginForm */
MainAsset::register($this);
ZTreeAsset::register($this);

$this->beginPage();
?>

<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
    <head>
        <meta charset="UTF-8">
        <title>权限管理</title>
        <?php $this->head() ?>
    </head>
    <body>
        <?php $this->beginBody() ?>

        <div class="nav">
            <!--<div class="return"><a href="">返回上一级</a></div>-->
            <ul class="cc">
                <?php foreach ($app_list as $app): ?>
                    <li <?php
                    if ($app['value'] == $app_name) {
                        echo "class='current'";
                    }
                    ?>><a href="<?= Url::to(['role/show-auth-menu', 'role' => $role, 'user_id' => $user_id, 'app_name' => $app['value']]) ?>"><?= $app['name'] ?></a></li>
                    <?php endforeach; ?>
            </ul>
        </div>
        <div>

            <div class="zTreeDemoBackground left">
                <ul id="treeDemo" class="ztree"></ul>
            </div>

        </div>
        <input type="hidden" name="app_name" id="app_name" value="<?= $app_name ?>"/>
        <div id="dataLoad" style="display:none"><!--页面载入显示-->
            <table width=100% height=100% border=0 align=center valign=middle>
                <tr height=50%><td align=center>&nbsp;</td></tr>
                <tr><td align=center>数据正在提交中，请稍后......</td></tr>
                <tr height=50%><td align=center>&nbsp;</td></tr>
            </table>
        </div>
        <?php $this->endBody() ?>
        <SCRIPT type="text/javascript">
            var setting = {
                check: {
                    enable: true,
                    chkStyle: "checkbox",
                    chkboxType: {"Y": "ps", "N": "ps"}
                },
                data: {
                    simpleData: {
                        enable: true,
                        idKey: "id",
                        pIdKey: "parent_id"
                    },
                    key: {
                        title: "auth_url"
                    }

                }
            };
            var zNodes = <?= $authList ?>;
            $(document).ready(function() {
                $.fn.zTree.init($("#treeDemo"), setting, zNodes);
                window.zTree = $.fn.zTree.getZTreeObj("treeDemo");
                zTree.expandAll(true);
            });
        </SCRIPT>
    </body>
</html>
<?php $this->endPage() ?>
