<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
 <style>
    	.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		 label.control-label-error {
  				color: Red;
             }
          .lispan {line-height: 34px;}   
          
          .select1{
   		    width:100%;
		    height: 32px;
		    line-height: 32px;
		    border-top: solid 1px #a7b5bc;
		    border-left: solid 1px #a7b5bc;
		    border-right: solid 1px #ced9df;
		    border-bottom: solid 1px #ced9df;
		    opacity:1;
	        margin-bottom: 10px;
    	}
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">图书馆</a></li>
    	<li><a href="#">老师审核</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>老师申请审核</span></div>
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		     <input type="hidden" name="id" th:if="${ws.id}" th:value="${ws.id}"/>
		     <input type="hidden" name="userId" th:if="${ws.userId}" th:value="${ws.userId}"/>
		     <input type="hidden" name="personalInfo" id="personalInfo" th:value="${ws.personalInfo}"/>
		     <input type="hidden" name="successfulCase" id="successfulCase"  th:value="${ws.successfulCase}"/>
		<ul class="forminfo">
			<li class="clearfix">
				<label>老师姓名:<b>*</b></label>
				<input  id="realName" class="dfinput fl" name="realName"  th:value="${ws.realName}"  />
			</li>
			<li class="clearfix">
				<label>老师头像:<b>*</b></label>
				<img  id="headPicUrl" class="dfinput fl" name="headPicUrl"  th:src=" ${ws.headPicUrl} !=null  ? (${ws.headPicUrl} !='' ? ${imgUrl}+''+${ws.headPicUrl}+'!m200x240.png' : '' ) :'' " style="width:200px;height:140px;"/>
			</li>
			<li class="clearfix">
				<label>老师性别:<b>*</b></label>
				<input type="hidden" id="sex"  class="dfinput fl" name="sex"  th:value="${ws.sex}"/>
				<input type="text"  class="dfinput fl"   th:value="${ws.sex ==0 ?'未知':ws.sex==1?'男':'女'}"/>
			</li>
			<li class="clearfix">
				<label>联系方式:<b>*</b></label>
				<input type="text" id="concatPhone" class="dfinput fl" name="concatPhone"  th:value="${ws.concatPhone}"/>
			</li>
			<li class="clearfix">
				<label>科目:<b>*</b></label>
				<input type="text" id="subject" class="dfinput fl" name="subject"  th:value="${ws.subject}"/>
			</li>
			<li class="clearfix">
				<label>申请时间:<b>*</b></label>
				<input id="createTime"  name="createTime"  class="dfinput fl" type="text" th:value="${#calendars.format(ws.createTime,'yyyy-MM-dd HH:mm:ss')}"/>
			</li>
			<li class="clearfix">
				<label>个人标签:<b>*</b></label>
				<input type="text" id=personalLabel class="dfinput fl" name="personalLabel"  th:value="${ws.personalLabel}"/>
			</li>
			<li class="clearfix">
				<label>个人简介:<b>*</b></label>
				<textarea rows="10" cols="80" id="personalInfo1"  class="textinput" th:text="${ws.personalInfo}">[[${ws.personalInfo}]]</textarea>
			</li>
			<li class="clearfix">
				<label>教学特点:<b>*</b></label>
				<input id="teachPoint"  name="teachPoint"  class="dfinput fl" type="text" th:value="${ws.teachPoint}"/>
			</li>
			<li class="clearfix">
				<label>成功案例:<b>*</b></label>
				<textarea rows="10" cols="80" id="successfulCase1"  class="textinput">[[${ws.successfulCase}]]</textarea>
			</li>
			<li class="clearfix" id="clear">
				<label>老师级别</label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
				<label class="fl" style="width: 70px;"><input type="checkbox" name="csbox" value="注册老师">注册老师</label>
				<label class="fl" style="width: 70px;"><input type="checkbox" name="csbox" value="明星老师">明星老师</label>
				<label class="fl" style="width: 70px;"><input type="checkbox" name="csbox" value="学霸老师">学霸老师</label>
				<label class="fl" style="width: 70px;"><input type="checkbox" name="csbox" value="资深老师">资深老师</label>
				<input type="hidden" name="teacherLever" id="teacherLever"/>
				</div>
			</li>
			<li class="clearfix">
				<label>老师类型</label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
					<select name="teacherType" id="teacherType" class="select1"> 
						<option th:selected="${ ws.teacherType eq '全职' }" value="全职" >全职</option>
						<option th:selected="${ ws.teacherType eq '兼职' }" value="兼职" >兼职</option>
					</select>
				</div>
			</li>
			<li class="clearfix">
				<label>教师资格证</label>
				<div class="vocation" style="margin-right: 5px; width: 346px" th:each="item:${titleImgList}">
					<img  th:src=" ${item} !=null  ? (${item} !='' ? ${imgUrl}+''+${item}: '' ) :'' "  style="width:200px;height:140px;" />
				</div>
			</li>
			<li class="clearfix">
				<label>身份证正面</label>
				<img id="oneImg" th:src=" ${oneImg} !=null  ? (${oneImg} !='' ? ${imgUrl}+''+${oneImg}: '' ) :'' "  style="width:200px;height:140px;" />
			</li>
			<li class="clearfix">
				<label>身份证反面</label>
				<img id="towImg" th:src=" ${towImg} !=null  ? (${towImg} !='' ? ${imgUrl}+''+${towImg}: '' ) :'' "  style="width:200px;height:140px;" />
			</li>
			<li>
				<label>&nbsp;</label>
				<input type="hidden" id="auditState" name="auditState">
				<button type="button" class="btn" onclick="roleFrom(2)" th:if="${ws.auditState eq '1'}">审核通过</button>
				<button type="button" class="btn" onclick="roleFrom(3)" th:if="${ws.auditState eq '1'}">审核不通过</button>
				<button type="button" class="btn" onClick="javascript :history.back(-1);" >返回</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">
$(function(){
	var bookTag = '[[${ws.teacherLever}]]';
	if(bookTag!=''){
		var arr=bookTag.split(',');
		for(var j=0;j<arr.length;j++){
		 $.each($("#clear").find('input[type=checkbox]'),function(i, v){
				if(arr[j]==$(v).val()){
					$(v).attr("checked", true);
					return 	false;
				}
			});
		}
	}
});
function roleFrom(auditState){
	$("#auditState").val(auditState);
	//老师类型
	var teacherLever="";
 	$.each($("#clear").find('input[type=checkbox]'),function(i, v){
 		if($(v).is(':checked')){ //选中
 			if(teacherLever == ""){
 				teacherLever = $(v).val();
 			}else{
 				teacherLever = teacherLever +","+$(v).val();
 			}
 		}
	});
 	if(teacherLever == ""){
 		//layer.msg("请勾选老师级别！",{icon:11});
 		alert("请勾选老师级别！");
 		return;
 	}else{
 		$("#teacherLever").val(teacherLever);
 	}
 	var text1 = $("#personalInfo1").val();
	$("#personalInfo").val(text1);
	var text2 = $("#successfulCase1").val();
	$("#successfulCase").val(text2);
	var url="[[${sysUrl}]]/sys/audit/auditSave";
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/audit/TeacherAuditList.html';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}
</script>
</html>