<style>
.table tr {
    height: 35px;
}
thead th {
	text-align: center;
}
#{cFun}List td{text-align: center;}
</style>
<div class="bjui-pageHeader">
	<div class="row cl pt-10 pb-10 pl-10">
		<div class="f-l">
			<form id="pagerForm" name="{cFun}Form" data-toggle="ajaxsearch" data-loadingmask="true" action="{url}" method="post">
				<input type="hidden" name="pageSize" value="<?php echo C('page.pageSize');?>">
				<input type="hidden" name="pageCurrent" value="<?php echo C('page.pageCurrent');?>">
				<input type="hidden" name="orderField" value="<?php echo C('page.orderField');?>">
				<input type="hidden" name="orderDirection" value="<?php echo C('page.orderDirection');?>">
				<span class="" style="float:left;margin:5px 0 0 15px;">快速查询：</span>
                <input type="text" placeholder="请输入手机号关键字" name="key" size="15">
				<button type="submit" class="btn btn-warning radius" data-icon="search">查询</button>
				<a id="{cFun}refresh" class="btn size-MINI btn-primary radius"><i class="fa fa-refresh fa-spin"></i> 刷新</a> &nbsp;
				<a href="{action}apply_del" data-toggle="doajaxchecked" data-idname="ids" data-group="ids" data-confirm-msg="确定要删除选中项吗？" class="btn btn-danger size-MINI radius" data-callback="{cFun}ajaxCallBack"> <i class="fa fa-remove"></i> 批量删除</a>
			</form>
		</div>
	</div>
</div>

<div class="bjui-pageContent" id="{cFun}List">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
			<th style="text-align: center;" width="4%;"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
			<th width="10%" data-order-field="message_id">ID</th>
			<th width="20%">姓名</th>
			<th width="20%">电话</th>
            <th>申请时间</th>
            <th width="20%">操作</th>
            </tr>
		</thead>
		
		<tbody>
			<?php
			if( C('plugin.demo.apply') )
			{
				$i = 1;
				foreach (C('plugin.demo.apply') as $k=>$v)
				{
					$cur = str::CheckElse( $i%2 , 0 , '' , 'even_index_row');
					echo '<tr class="'.$cur.'">
							<td style="text-align: center;"><input type="checkbox" name="ids" data-toggle="icheck" value="'.$v['message_id'].'"></td>
							<td>'.$v['message_id'].'</td>
							<td>'.$v['message_name'].'</td>
							<td>'.$v['message_phone'].'</td>
							<td>'.date('Y-m-d H:i:s',$v['message_time']).'</td>
							<td style="text-align: center;">
				            	<a class="btn btn-secondary radius size-MINI" data-mask="true" href="{action}apply_detail&aid='.$v['message_id'].'"  data-toggle="dialog" data-title="查看申请详情" data-width="470" data-height="270" >查看详情</a> 
				            	<a class="btn btn-danger radius" onclick="{cFun}delAjax('.$v['message_id'].')">删除</a>
                			</td>
						</tr>';
					$i++;
				}
			}
			else
			{
				echo '<script type="text/javascript">$(document).ready(function(){$(this).alertmsg("info", "没有数据了!")});</script>';
			}
			?>
		</tbody>
	</table>
</div>

<div class="bjui-pageFooter">
    <div class="pages">
        <span>每页&nbsp;</span>
        <div class="selectPagesize">
            <select data-toggle="selectpicker" data-toggle-change="changepagesize">
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="60">60</option>
                <option value="120">120</option>
            </select>
        </div>
        <span>&nbsp;条，共 <?php echo C('page.pageCount');?> 条</span>
    </div>
    <div id="asd" class="pagination-box" data-toggle="pagination" data-total="<?php echo C('page.pageCount');?>" data-page-size="<?php echo C('page.pageSize');?>" data-pageCurrent="<?php echo C('page.pageCurrent');?>">
    </div>
</div>

<script type="text/javascript">
//页面唯一op获取函数
function {cFun}GetOp(){
	var op=new Array();
	op['type'] = 'POST';
	op['data'] = $("[name={cFun}Form]").serializeArray();
	return op;
}
//删除数据
function {cFun}delAjax(aid)
{
	var ajaxOptions=new Array();
	var ajaxData=new Object();
	ajaxOptions = {cFun}GetOp();
	
	ajaxData.aid = aid;
	ajaxOptions['data'] = ajaxData;
	ajaxOptions['url'] = "{action}apply_del";
	ajaxOptions['confirmMsg'] = "确定要删除所选的数据吗？";
	ajaxOptions['callback'] = "{cFun}ajaxCallBack";
	$(".btn-danger").bjuiajax('doAjax', ajaxOptions);
}
//页面唯一回调函数
function {cFun}ajaxCallBack(json){
	$(this).bjuiajax("ajaxDone",json);//显示处理结果
	$(this).dialog("closeCurrent");	//关闭当前dialog
	//刷新当前div
	$(this).bjuiajax('refreshLayout', '#cloudAppsPluginManager_{id}ManagerContent');
}

$(document).ready(function(){
	$('#{cFun}refresh').click(function() {
		$(this).bjuiajax('refreshLayout', '#cloudAppsPluginManager_{id}ManagerContent');
	});
});
</script>