{include file='public/meta'}
<body>
<article class="page-container">
	<form class="form form-horizontal" id="frm1">

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>父节点</label>
		<div class="formControls col-xs-8 col-sm-9">
			<span class="select-box" style="width:300px">
				<?php if($row){?>
				<select name='pid' class='select'>
					<option value='0'>作为根</option>
					<?php foreach ($menus as $key => $value) {?>
						<option value='<?php echo $value['id'];?>' <?php if($row['pid']==$value['id']) echo "selected";?> ><?php echo $value['prefix'].$value['title'];?></option>
					<?php }?>
				</select>
				<?php }else{ //添加?>
				<select name='pid' class='select'>
					<option value='0'>作为根</option>
					<?php foreach ($menus as $key => $value) {?>
						<option value='<?php echo $value['id'];?>' <?php if(input('pid')==$value['id']) echo "selected";?> ><?php echo $value['prefix'].$value['title'];?></option>
					<?php }?>
				</select>
				<?php }?>
			</span>
			
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>名称</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text"  placeholder="" id="title" name="title" value="<?php echo $row['title'];?>" >
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">模块</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text"  placeholder="" id="module" name="module" value="<?php echo $row['module'];?>" >
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">URL</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text"  placeholder="" id="url" name="url" value="<?php echo $row['url'];?>" >
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">图标</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text"  placeholder="" id="icon" name="icon" value="<?php echo $row['icon'];?>" >
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-2">类型</label>
		<div class="formControls col-xs-8 col-sm-9">
			<div class="radio-box">
			<input name="type" type="radio" id="type-1"  value="nav" <?php if( $row['type']=='nav') echo 'checked' ;?>>
			<label for="type-1">展示</label>
			</div>
			<div class="radio-box">
			<input name="type" type="radio" id="type-2"  value="auth" <?php if(empty($row) || $row['type']=='auth') echo 'checked' ;?>  >
			<label for="type-2">不展示</label>
			</div>
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">排序</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" onkeyup='checkInputInt(this)'  placeholder="" id="sort_order" name="sort_order" value="<?php echo $row['sort_order'];?>" >
		</div>
	</div>

	<input name="id" type="hidden" value="<?php echo intval($row['id']);?>" />

	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
		</div>
	</div>



	</form>
</article>

{include file='public/pfooter'}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#frm1").validate({
		rules:{
			name:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: "{$action}" ,
				success: function(data){
					layer.msg(data.msg);
					if(0==data.error){
						setTimeout(function(){
							var index = parent.layer.getFrameIndex(window.name);
							parent.location.reload();
							parent.layer.close(index);
						},1000)
					}
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('服务器错误',{icon:1,time:1000});
				}
			});
		}
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>