<extend name="Public/base" />

<block name="body">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> Home <span class="c-gray en">&gt;</span> {$meta_title} <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="refresh" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="pd-20">

	<div class="text-c">
		<form action="{:U()}" method="post">
		keyword：
		<input type="text" class="input-text" style="width:250px" placeholder="Input keyword" id="keywords" name="keywords" value="{$keywords}">
		<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> Search</button>
		</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="{:U('edit')}" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> Add new records</a>
			<a href="{:U('setStatus?Model=Machine&status=0')}" class="btn btn-danger radius ajax-doSelect" target-form="ids"><i class="Hui-iconfont">&#xe631;</i> Disable</a>
			<a href="{:U('setStatus?Model=Machine&status=1')}" class="btn btn-success radius ajax-doSelect" target-form="ids"><i class="Hui-iconfont">&#xe6e1;</i> Enable</a>
		</span>
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" name="" value=""></th>
					<th width="30">ID</th>
					<th width="250">title</th>
					<th width="250">No.</th>
					<th width="120">address</th>
					<th width="120">belong to</th>
					<th width="100">state</th>
					<th width="100">network</th>
					<th width="120">operation</th>
					<th width="120">business</th>
				</tr>
			</thead>
			<tbody>
				<volist name="_list" id="vo">
				<tr class="text-c">
					<td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}"></td>
					<td>{$vo.id}</td>
					<td>{$vo.title}</td>
					<td>{$vo.serial_no}</td>
					<td>{$vo.address}</td>
					<td class="td-status">
						<?php
							if($vo['mid']==0 && $vo['agent_id']==0 && $vo['fac_id']==0)
								echo '<span class="label label-warning radius"></span>';
							else{
								if($vo['agent_id'])
									echo 'agent：'.get_agent($vo['agent_id'],'title').'<br>';
								if($vo['mid'])
									echo 'merchant：'.get_merchant($vo['mid'],'title').'<br>';
								if($vo['fac_id'])
									echo 'factory：'.get_factory($vo['fac_id'],'title').'<br>';
							}
						?>
					</td>
					<td class="td-status">
						<switch name="vo.status">
						    <case value="1"><span class="label label-success radius">enabled</span></case>
						    <case value="-1"><span class="label label-danger radius">disabled</span></case>
						    <default /><span class="label label-defaunt radius">disabled</span>
						</switch>
					</td>
					<td class="td-status">
						<?php $mac_status = getMachineStatus($vo['serial_no']); ?>
						<switch name="mac_status">
						    <case value="1"><span class="label label-success radius">online</span></case>
						    <default /><span class="label label-danger radius">offline</span>
						</switch>
					</td>
					<td class="f-14 product-brand-manage">
						<eq name="vo.status" value="1">
							<a href="{:U('setStatus?Model=Machine&status=0&ids='.$vo['id'])}" style="text-decoration:none" class="ml-5 ajax-get" title="disabled"><i class="Hui-iconfont">&#xe631;</i></a>
						<else/>
							<a href="{:U('setStatus?Model=Machine&status=1&ids='.$vo['id'])}" style="text-decoration:none" class="ml-5 ajax-get" title="enabled"><i class="Hui-iconfont">&#xe615;</i></a>
						</eq>
						<a href="{:U('edit',array('id'=>$vo['id']))}"  class="ml-5" style="text-decoration:none" title="edit"><i class="Hui-iconfont">&#xe6df;</i></a>
					</td>
					<td class="f-14 product-brand-manage">
						<a href="{:U('box',array('mac_id'=>$vo['id']))}"  class="ml-5" style="text-decoration:none" title="box"><i class="Hui-iconfont">&#xe6c0;</i></a>
						<a href="{:U('ad',array('mac_id'=>$vo['id']))}"  class="ml-5" style="text-decoration:none" title="ad"><i class="Hui-iconfont">&#xe635;</i></a>
					</td>

				</tr>
				</volist>
			</tbody>
		</table>
	</div>
	<div class="page">
        {$_page}
    </div>
</div>

</block>

<block name="script">
	<script type="text/javascript">
	</script>
</block>
