<?php
/**
 * Created by PhpStorm.
 * User: chenkuan
 * Date: 2017/12/19
 * Time: 上午10:27
 */
use yii\helpers\Url;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>BIT System 后台管理平台</title>
    <?php include(Yii::getAlias("@cp_module_views")."/common/css_js_main.php") ?>
</head>
<body id="main">
<div class="main-nav"> <span class="fn-left">角色列表 总记录数: <?= $data['totalCount'] ?> (共<?= $data['pageCount'] ?>页)</span> <span class="fn-right"><a href="javascript:javascript:history.go(-1);"><i class="icon-chevron-left"></i>返回</a></span>
    <div class="fn-clear"></div>
</div>
<form id="list-form" action="<?= Url::to(['/cp/role/list']); ?>" method="get">
    <div class="main-content">
        <div class="main-action-bar">
            <a class="btn fn-left" href="<?= Url::to(['/cp/role/add']); ?>"><i class="icon-plus"></i>添加</a>
            <div class="fn-left">
                &nbsp;&nbsp;搜索：
                <select name="searchBy" class="span1">
                    <option value="name"<?php if($vars['searchBy'] == "name") { ?> selected<?php } ?>>名称</option>
                </select>
                &nbsp;
            </div>
            <input type="text" name="keyword" value="<?= isset($vars['keyword']) ? $vars['keyword'] : '' ?>" class="input-medium search-query fn-left">
            <button id="search-button" type="submit" class="btn fn-left">Search</button>
            &nbsp;&nbsp;每页显示：
            <select name="pageSize" id="page-size" class="span1">
                <option value="10"<?php if($vars['pageSize'] == 10) { ?> selected<?php } ?>>
                10
                </option>
                <option value="20"<?php if($vars['pageSize'] == 20) { ?> selected<?php } ?>>
                20
                </option>
                <option value="50"<?php if($vars['pageSize'] == 50) { ?> selected<?php } ?>>
                50
                </option>
                <option value="100"<?php if($vars['pageSize'] == 100) { ?> selected<?php } ?>>
                100
                </option>
            </select>
        </div>
        <div class="form-or-table">
            <table id="list-table" class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th class="table-checkbox"><input type="checkbox" class="all-check"></th>
                    <th><a href="#" class="sort" name="name">角色名称</a></th>
                    <th><a href="#" class="sort" name="isSystem">系统内置</a></th>
                    <th><a href="#" class="sort" name="description">描述</a></th>
                    <th><a href="#" class="sort" name="createDate">创建日期</a></th>
                    <th class="table-action">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($data['dataList'] as $role) { ?>
                    <tr>
                        <td><input name="ids" type="checkbox" value="<?= $role['id'] ?>"></td>
                        <td><?= $role['name'] ?></td>
                        <td><?= $role['is_system'] ? '是' : '否' ?></td>
                        <td><?= $role['description'] ?></td>
                        <td><?= $role['create_date'] ?></td>
                        <td><a href="<?= Url::to(['/cp/role/edit?id='.$role['id']]) ?>"><i class="icon-edit"></i> 编辑</a>
                        </td>
                    </tr>
                <?php } ?>
                </tbody>
            </table>
            <?php if ($data['pageCount'] > 0) { ?>
                <div class="main-footer-action-bar"> <a id="delete-button" class="btn fn-left" url="<?= Url::to(['/cp/role/delete']) ?>" disabled=""><i class="icon-trash"></i> 删除</a>
                    <?= $this->render('/common/pager', ['pageCount' => $data['pageCount']]) ?>
                </div>
            <?php } ?>
        </div>
    </div>
    <input type="hidden" name="pageNumber" id="page-number" value="<?= $vars['pageNumber'] ?>" />
    <input type="hidden" name="orderBy" id="order-by" value="<?= $vars['orderBy'] ?>" />
    <input type="hidden" name="order" id="order" value="<?= $vars['order'] ?>" />
</form>
<div id="delete-modal" class="modal hide fade" style="display: none; ">
    <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
        <p><strong>您确定要删除吗?</strong></p>
    </div>
    <div class="modal-body">
        <p>删除之后将不可恢复,请确定!</p>
    </div>
    <div class="modal-footer"> <a href="#" id="delete-modal-sure-btn" class="btn btn-primary">确定</a> <a href="#" class="btn" data-dismiss="modal">返回</a> </div>
</div>
</body>
</html>
