<?php

use home\assets\MainAsset;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\StringHelper;
use home\modules\customer\models\Customer;
use home\modules\customer\models\District;
use home\assets\ModalAsset;
use home\modules\contract\models\Contract;
use common\assets\ZTreeAsset;

/* @var $this yii\web\View */
$this->title = '客户列表';

$assetUrl = $this->getAssetManager()->getBundle(ModalAsset::className())->baseUrl;
$this->registerJsFile($assetUrl . '/js/cate.tree.js', ['depends' => [MainAsset::className(), ZTreeAsset::className()]]);
?>

<!--container-->
<div class="container manage-project fix">
<?= $this->render('@home/views/site/_left-menu') ?>

    <!--manage-left -->

    <div class="manage-right">
       <div class="tab-column tab-manage">
            <div class="tab-right">
                <?php if(Customer::readAccess('customer/customer/create')) : ?>
                        <button type="button" title="添加客户" data-title='添加客户' data-url='<?= Url::to([$this->context->id . '/create']) ?>'  data-width="800" data-height="550" class="btn btn-default btn-task open-dialog">
                            <i class="icon-plus"></i>
                        </button>

                <?php endif; ?>
            </div>
            <p class="caption">客户列表</p>
        </div>

     <div class="manage-right-cont fix">
        <div class="mainleft-tree">
            <div class="labellink fix"> <a href="<?= Url::to([$this->context->id . '/index']) ?>" class="labelfocus" title="查看全部">全部</a>
            </div>
            <div class="lefttree" >
                <ul id="tree"  class="ztree"  ></ul>
            </div>
        </div>
        <!--manage-left -->

        <div class="manage-right-iframe">
        <iframe  frameBorder=0  name="main_content" id="main_content" scrolling=yes width="100%" height="790px" src="<?= Url::to(['index-iframe']) ?>"></iframe>
       </div>
    <!--manage-right-->
    </div>
  </div>
</div>
<script>
    var CSRF = "<?= Yii::$app->request->getCsrfToken() ?>";
    var getTreeDataUrl = "<?= Url::to([$this->context->id . '/get-treedata', '_csrf' => Yii::$app->request->getCsrfToken()]) ?>";
    var iframeDataUrl = "<?= Url::to([$this->context->id . '/index-iframe', '_csrf' => Yii::$app->request->getCsrfToken()]) ?>";
</script>
<!--container-->

