<!DOCTYPE html>
<html>
	<?php echo $this->fetch('head.html'); ?>
	<style>
		.aBox{
			background-color: #F4ABA7;
		}
		.aBox:nth-child(odd){
			background-color: #4FBCAD;
		}
		.aBox-hide tr{
			display: none;
		}
		.aBox-hide tr:first-child{
			display: table-row;
		}
		.aBox td{
			border-collapse: collapse;
			border-spacing: 0;
			border: 0;
		}
	</style>
	<body>
		<?php echo $this->fetch('fenlei_category/nav.html'); ?>
		<div class="main-body">
		<form method="post" action="/moduleadmin.php?m=fenlei_category&a=save">
			<input type="hidden" name="catid" style="display:none;" value="<?php echo $this->_var['data']['catid']; ?>">
			<table class="table-add">
				<tr>
					<td>分类名称：</td>
					<td><input type="text" name="title" id="title" value="<?php echo $this->_var['data']['title']; ?>"></td>
				</tr>
				<tr>
					<td>图片：</td>
					<td>
						<div class="js-upload-item">
							<input type="file" id="upa" class="js-upload-file" style="display: none;" />
							<div class="upimg-btn js-upload-btn">+</div>
							<input type="hidden" name="imgurl" class="js-imgurl" value="<?php echo $this->_var['data']['imgurl']; ?>" />
							<div class="js-imgbox">
								<?php if ($this->_var['data']['imgurl']): ?>
								<img src="<?php echo images_site($this->_var['data']['imgurl']); ?>.100x100.jpg">
								<?php endif; ?>
							</div>
						</div>
				
					</td>
				</tr>
				<tr>
					<td>发布费用：</td>
					<td><input type="text" name="money" class="w60" id="money" value="<?php echo $this->_var['data']['money']; ?>"> 元</td>
				</tr>
				<tr>
					<td>置顶费用：</td>
					<td><input type="text" name="dingmoney" class="w60" id="dingmoney" value="<?php echo $this->_var['data']['dingmoney']; ?>"> 元</td>
				</tr>
				<tr>
					<td>更新费用：</td>
					<td><input class="w150" type="text" name="update_money"  value="<?php echo $this->_var['data']['update_money']; ?>">
						元
					</td>
				</tr>
				<tr>
					<td>上级分类：</td>
					<td> 
						<select  name="pid">
							<option  value="0">请选择</option>
							<?php $_from = $this->_var['catlist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
							<option value="<?php echo $this->_var['c']['catid']; ?>" <?php if ($this->_var['c']['catid'] == $this->_var['data']['pid']): ?>selected<?php endif; ?>><?php echo $this->_var['c']['title']; ?></option>
							<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>排序：</td>
					<td><input type="text" name="orderindex" id="orderindex" value="<?php echo $this->_var['data']['orderindex']; ?>"></td>
				</tr>
				<tr>
					<td>状态</td>
					<td>
						<input type="radio" <?php if ($this->_var['data']['status'] != 1): ?> checked="" <?php endif; ?> name="status" value="2" /> 下线
						<input type="radio" <?php if ($this->_var['data']['status'] == 1): ?> checked="" <?php endif; ?> name="status" value="1" /> 上线
					</td>
				</tr>
				
				<tr>
					<td>开启评论</td>
					<td>
						<input type="radio" <?php if ($this->_var['data']['comment_open'] != 1): ?> checked="" <?php endif; ?> name="comment_open" value="0" /> 关闭
						<input type="radio" <?php if ($this->_var['data']['comment_open'] == 1): ?> checked="" <?php endif; ?> name="comment_open" value="1" /> 开启
					</td>
				</tr>
				<tr>
					<td>上线天数</td>
					<td>
						<input class="w100" type="text" name="on_day" value="<?php if (! $this->_var['data']): ?>30<?php else: ?><?php echo $this->_var['data']['on_day']; ?><?php endif; ?>" />
						天
					</td>
				</tr>
				<tbody class="aBox <?php if ($this->_var['data']['money_open'] != 1): ?>aBox-hide<?php endif; ?>">
				<tr>
					<td>开启价格字段</td>
					<td>
						<input class="js-open-btn" type="radio" <?php if ($this->_var['data']['money_open'] != 1): ?> checked="" <?php endif; ?> name="money_open" value="0" /> 关闭
						<input class="js-open-btn" type="radio" <?php if ($this->_var['data']['money_open'] == 1): ?> checked="" <?php endif; ?> name="money_open" value="1" /> 开启
					</td>
				</tr>
				<tr>
					<td>价格标签</td>
					<td>
						<input type="text" name="moneyLabel" value="<?php if ($this->_var['data']['moneyLabel']): ?><?php echo $this->_var['data']['moneyLabel']; ?><?php else: ?>价格<?php endif; ?>" />
					</td>
				</tr>
				<tr>
					<td>价格筛选</td>
					<td>
						<textarea class="h100" name="pricedata"><?php echo $this->_var['data']['pricedata']; ?></textarea>
						<div>一行一个：500以下</div>
					</td>
				</tr>
				</tbody>
				<tbody class="aBox <?php if ($this->_var['data']['type_open'] != 1): ?>aBox-hide<?php endif; ?>">
				<tr>
					<td>开启类型字段</td>
					<td>
						<input class="js-open-btn" type="radio" <?php if ($this->_var['data']['type_open'] != 1): ?> checked="" <?php endif; ?> name="type_open" value="0" /> 关闭
						<input class="js-open-btn" type="radio" <?php if ($this->_var['data']['type_open'] == 1): ?> checked="" <?php endif; ?> name="type_open" value="1" /> 开启
					</td>
				</tr>
				<tr>
					<td>类型字段</td>
					<td>
						<input type="text" name="typeLabel" value="<?php if ($this->_var['data']['typeLabel']): ?><?php echo $this->_var['data']['typeLabel']; ?><?php else: ?>类型<?php endif; ?>" />
					</td>
				</tr>
				<tr>
					<td>类型筛选</td>
					<td>
						<textarea class="h100"  name="typedata"><?php echo $this->_var['data']['typedata']; ?></textarea>
						<div>一行一个：1=>三室一厅</div>
					</td>
				</tr>
				</tbody>
				<tr>
					<td>开启区域字段</td>
					<td>
						<input type="radio" <?php if ($this->_var['data']['area_open'] != 1): ?> checked="" <?php endif; ?> name="area_open" value="0" /> 关闭
						<input type="radio" <?php if ($this->_var['data']['area_open'] == 1): ?> checked="" <?php endif; ?> name="area_open" value="1" /> 开启
					</td>
				</tr>
				<tr>
					<td>表单扩展</td>
					<td>
						<select name="ex_table_id">
							<option value="0">请选择</option>
							<?php $_from = $this->_var['tableList']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
							<option <?php if ($this->_var['c']['tableid'] == $this->_var['data']['ex_table_id']): ?>selected<?php endif; ?> value="<?php echo $this->_var['c']['tableid']; ?>"><?php echo $this->_var['c']['title']; ?></option>
							<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>栏目模板</td>
					<td>
						<input type="text" name="listtpl" value="<?php echo $this->_var['data']['listtpl']; ?>" />
					</td>
				</tr>
				<tr>
					<td>详情模板</td>
					<td>
						<input type="text" name="showtpl" value="<?php echo $this->_var['data']['showtpl']; ?>" />
					</td>
				</tr>
			</table>
			<div class="btn-row-submit js-submit">保存</div>
		</form>
		</div>
		<?php echo $this->fetch('footer.html'); ?>
		<script src="/static/admin/js/upload.js"></script>
		<script>
			$(document).on("change",".js-open-btn",function(){
				var v=$(this).val();
				var p=$(this).parents(".aBox");
				if(v==0){
					p.addClass("aBox-hide");
				}else{
					p.removeClass("aBox-hide");
				}
			})
		</script>
	</body>
</html>
