<?php include $this->admin_tpl('meta');?>
<title>字段管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 内容管理 <span class="c-gray en">&gt;</span> <?php echo get_model($modelid, 'name');?> <span class="c-gray en">&gt;</span> 字段管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
	<div class="cl tb-top"> <span class="l"><a href="<?php echo U('add', array('modelid'=>$modelid));?>" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加字段</a></span></div>
	<form action="<?php echo U('order');?>" method="post">
	<table class="table table-border table-bg table-hover">
		<thead>
			<tr class="text-c">
				<th>排序</th>
				<th>字段名</th>
				<th>别名</th>
				<th>类型</th>
				<th>必填</th>
				<th>启用</th>		
				<th>管理操作</th>
			</tr>
		</thead>
		<tbody>
			<?php 
			   foreach($data as $val){
			 ?>
			<tr class="text-c">
				<td><?php $dis = $val['modelid'] ? '' : 'disabled'; echo '<input type="text" class="input-text listorder" name="listorder[]" '.$dis.' value="'.$val["listorder"].'">'; if($val['modelid']) echo '<input type="hidden" name="fieldid[]" value="'.$val["fieldid"].'">'?></td>
				<td><?php echo $val['field'];?></td>
				<td><?php echo $val['name'];?></td>
				<td><?php echo $val['fieldtype'];?></td>
				<td><?php echo $val['isrequired'] ? '<span style="color:red">是</span>' : '否';?></td>
				<td>
					<?php if(!$val['disabled']){ ?>
					<span class="yzm-status-enable" data-field="status" data-id="<?php echo $val['fieldid']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe81f;</i>是</span>
					<?php }else{ ?>
					<span class="yzm-status-disable" data-field="status" data-id="<?php echo $val['fieldid']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe601;</i>否</span>
					<?php } ?>
				</td>
				<td class="td-manage"><?php if($val['modelid']){ ?><a title="编辑字段"  class="btn-mini btn-primary ml-5" href="<?php echo U('edit',array('modelid'=>$modelid,'fieldid'=>$val['fieldid']));?>" style="text-decoration:none">编辑</a> <a title="删除"  class="btn-mini btn-danger ml-5" href="javascript:;" onclick="yzm_confirm('<?php echo U('delete',array('modelid'=>$modelid, 'fieldid'=>$val['fieldid']));?>', '确认要删除【<?php echo $val['name'];?>】字段吗？')" style="text-decoration:none">删除</a><?php }else{ echo '<span  class="btn-mini btn-disabled ml-5" >编辑</span> <span  class="btn-mini btn-disabled ml-5">删除</span>';} ?></td>
			</tr>
			<?php 
			   }		 
			?>	
		</tbody>
	</table>
	<?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
	<input type="hidden" value="<?php echo $modelid;?>" name="modelid">
	<div class="cl mt-5"> <span class="l"><input class="orderbutton btn-primary radius" name="dosubmit" value="排序" type="submit"></span></div>
	</form>
</div>
<?php include $this->admin_tpl('footer');?>
</body>
</html>