<%inherit file="base.html"/>

<%def name="head()">
    <script>
        function deleteCmanager(cmanager_id){
            if (window.confirm("确定要删除吗？")){
                window.location.href = "/cmanager/delete?manager_id="+cmanager_id;
            }
        }
    </script>
</%def>
<%def name="body()">
<div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> 客户经理列表</div>
    <div class="panel-body">
        <div class="pull-right bottom10">
             % if permit.match('/cmanager/add'):
            <a href="/cmanager/add" class="btn btn-sm btn-default">
                <span class="glyphicon glyphicon-plus"></span> 增加客户经理
            </a>
            % endif
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>工号</th>
                <th>姓名</th>
                <th>手机</th>
                <th>关联操作员</th>
            </tr>
            </thead>
            <tbody>
            % for cmanager in page_data.result:
            <tr>
                <td>${cmanager.manager_code}</td>
                <td>
                <a href="/cmanager/detail?manager_id=${cmanager.id}">${cmanager.manager_name}</a>
                </td>
                <td>${cmanager.manager_mobile}</td>
                <td>${cmanager.operator_name}</td>
                <th>
                % if permit.match('/cmanager/update'):
                <a type="button" class=" opt-btn btn-default" href="/cmanager/update?manager_id=${cmanager.id}">修改</a>
                % endif
                % if permit.match('/cmanager/delete'):
                <a type="button" class=" opt-btn btn-default" href="javascript:deleteCmanager('${cmanager.id}')">删除</a>
                </th>
                % endif
            </tr>
            % endfor
            </tbody>
        </table>

        ${page_data.render()}
    </div>
</div>
</%def>