<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>人员评价表及客户满意表信息管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		img{width: 50px;height: 50px;}
	</style>
	<script type="text/javascript">
        $(function(){
//            $("img").not(".upload_ico").each(function () {
//                var num = 1 ;
//                $(this).click(function () {
//                    var flag = num%2;
//                    if(flag == 1){
//                        $(this).css("width","90%");
//                        $(this).css("height","90%");
//                        num++;
//                    }else if(flag ==0){
//                        $(this).css("width","50px");
//                        $(this).css("height","50px");
//                        num++;
//                    }
//                })
//            });
        });

        var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
	<script type="text/javascript">
        $(function () {
            ;$("#execute_btn").click(function () {
                $("#execute_file").click();
            })
            ;$("#manuscript_btn").click(function () {
                $("#manuscript_file").click();
            })
        })


        function execute_insertTitle(tValue){
            $("#execute_title_div").remove();
            var t1 = tValue.lastIndexOf("\\");
            if(t1 >= 0 && t1 < tValue.length){
                $("#execute_title").text(tValue.substring(t1+1));
                $("#execute_title").after("<div id='execute_title_div' style='float: right'>&nbsp;&nbsp;<span id='execute_delete' onclick='execute_del()'style='color: red ; cursor: pointer;'>x</span></div>");
            }
        }
        function execute_del() {
            $("#execute_file").val("");
            $("#execute_title").text("");
            $("#execute_delete").remove();
            $("#execute_title_div").remove();
        }
        function manuscript_insertTitle(tValue){
            $("#manuscript_title_div").remove();
            var t1 = tValue.lastIndexOf("\\");
            if(t1 >= 0 && t1 < tValue.length){
                $("#manuscript_title").text(tValue.substring(t1+1));
                $("#manuscript_title").after("<div id='manuscript_title_div' style='float: right'>&nbsp;&nbsp;<span id='execute_delete' onclick='manuscript_del()'style='color: red ; cursor: pointer;'>x</span></div>");
            }
        }
        function manuscript_del() {
            $("#manuscript_file").val("");
            $("#manuscript_title").text("");
            $("#manuscript_delete").remove();
            $("#manuscript_title_div").remove();
        }
	</script>
</head>
<body class="hideScroll">
									<%--action="${ctx}/hr/evaluation/save"--%>
<form:form id="inputForm" modelAttribute="userInfo" method="post" enctype="multipart/form-data" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="userOffice.userId"/>
		<form:hidden path="userOffice.companyId"/>
		<form:hidden path="userOffice.id"/>
		<form:hidden path="userId"/>
		<form:hidden path="companyId"/>
		<sys:message content="${message}"/>
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">姓名：</label></td>
				   <td class="width-35">
						   ${userInfo.name}
				   </td>
				   <td class="width-15 active"><label class="pull-right">性别：</label></td>
				   <td class="width-35">
						   ${fns:getDictLabel(userInfo.gender,'sex' ,'' )}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">昵称：</label></td>
				   <td class="width-35">
						   ${userInfo.nickName}
				   </td>
				   <td class="width-15 active"><label class="pull-right">工号：</label></td>
				   <td class="width-35">
						   ${userInfo.jobNumber}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">联系电话：</label></td>
				   <td class="width-35">
						   ${userInfo.mobilePhone}
				   </td>
				   <td class="width-15 active"><label class="pull-right">电子邮件：</label></td>
				   <td class="width-35">
						   ${userInfo.email}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">个人简介：</label></td>
				   <td class="width-35" colspan="3">
						   ${userInfo.personalProfile}
				   </td>
			   </tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">备注信息：</label></td>
				   <td class="width-35" colspan="3">
						   ${userInfo.remarks}
				   </td>
			   </tr>
		   		<tr>
					<td class="width-15 active"><label class="pull-right">人员评价信息：</label></td>
					<td class="width-35" colspan="3">
						<div>
							<div style="float:left; height: 100%; width: 100%; ">
								<div style="display: inline-block">
									<input id="execute_file" type="file" name="execute_file" multiple="multiple" style="display: none;" onChange="if(this.value)execute_insertTitle(this.value);"/>
									<a id="execute_btn" class="btn btn-info btn-xs" ><i class="fa fa-plus"></i> 添加附件</a>
									<span id="execute_title"></span>
								</div>
								<table id="listExecuteFile"  style="text-align: center;width: 100%;margin-top:10px;"  class="table table-striped table-bordered table-condensed" >
									<tr>
										<%--<td>序号</td>--%><td>文件名</td><td>上传人</td><td>上传时间</td><td>操作</td>
									</tr>
									<tr>
										<c:if test="${not empty userInfo.user.workattachment.id}">
											<%--<td>1</td>--%>
												<%--<span title="${userInfo.user.workattachment.attachmentName}">${fns:abbr(userInfo.user.workattachment.attachmentName, 30)}</span>--%>
											<c:choose>
												<c:when test="${fn:containsIgnoreCase(userInfo.user.workattachment.attachmentName,'jpg')
															   or fn:containsIgnoreCase(userInfo.user.workattachment.attachmentName,'png')
															   or fn:containsIgnoreCase(userInfo.user.workattachment.attachmentName,'gif')
															   or fn:containsIgnoreCase(userInfo.user.workattachment.attachmentName,'jpeg')}">
													<td><img src="${userInfo.user.workattachment.url}" onclick="openDialogView(' ','${ctx}/sys/picturepreview/picturePreview?url=${userInfo.user.workattachment.url}','860px','600px')" width="50" height="50" alt="${userInfo.user.workattachment.attachmentName}"/></td>
												</c:when>
												<c:otherwise>
													<c:choose>
														<c:when test="${fn:containsIgnoreCase(userInfo.user.workattachment.attachmentName,'pdf')}">
															<td><a href="javascript:void(0)" onclick="preview('预览','${userInfo.user.workattachment.url}','80%','80%','1')">
																<span title="${userInfo.user.workattachment.attachmentName}">${fns:abbr(userInfo.user.workattachment.attachmentName, 30)}</span></a></td>
														</c:when>
														<c:otherwise>
															<td><a href="javascript:void(0)" onclick="preview('预览','${userInfo.user.workattachment.url}','80%','80%')">
																<span title="${userInfo.user.workattachment.attachmentName}">${fns:abbr(userInfo.user.workattachment.attachmentName, 30)}</span></a></td>
														</c:otherwise>
													</c:choose>
												</c:otherwise>
											</c:choose>
											<td>${userInfo.user.workattachment.attachmentUser}</td>
											<td><fmt:formatDate value="${userInfo.user.workattachment.createDate}" pattern="yyyy-MM-dd"/></td>
											<td>
												<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${userInfo.user.workattachment.url}');" class="btn btn-success btn-xs">下载</a>
												<%--<a href="${ctx}/workfullmanage/workFullManage/downLoadAttach?file=${userInfo.user.workattachment.url}" class="btn btn-success btn-xs">下载</a>--%>
											</td>
										</c:if>
									</tr>
								</table>
							</div>
						</div>
					</td>
				</tr>
			   <tr>
				   <td class="width-15 active"><label class="pull-right">客户满意信息：</label></td>
				   <td class="width-35" colspan="3">
					   <div>
						   <div style="float:left; height: 100%; width: 100%; ">
							   <div style="display: inline-block">
								   <input id="manuscript_file" type="file" name="manuscript_file" multiple="multiple" style="display: none;" onChange="if(this.value)manuscript_insertTitle(this.value);"/>
								   <a id="manuscript_btn" class="btn btn-info btn-xs" ><i class="fa fa-plus"></i> 添加附件</a>
								   <span id="manuscript_title"></span>
							   </div>
							   <table id="listManuscriptFile"  style="text-align: center;width: 100%;margin-top:10px;"  class="table table-striped table-bordered table-condensed" >
								   <tr>
									  <%-- <td>序号</td>--%><td>文件名</td><td>上传人</td><td>上传时间</td><td>操作</td>
								   </tr>
								   <tr>
									   <c:if test="${not empty userInfo.user.satisfaction.id}">
										  <%-- <td>${index.index + 1}</td>--%>

											   <%--<span title="${userInfo.user.satisfaction.attachmentName}">${fns:abbr(userInfo.user.satisfaction.attachmentName, 30)}</span>--%>
										   <c:choose>
											   <c:when test="${fn:containsIgnoreCase(userInfo.user.satisfaction.attachmentName,'jpg')
															   or fn:containsIgnoreCase(userInfo.user.satisfaction.attachmentName,'png')
															   or fn:containsIgnoreCase(userInfo.user.satisfaction.attachmentName,'gif')
															   or fn:containsIgnoreCase(userInfo.user.satisfaction.attachmentName,'jpeg')}">
												   <td><img src="${userInfo.user.satisfaction.url}" onclick="openDialogView(' ','${ctx}/sys/picturepreview/picturePreview?url=${userInfo.user.satisfaction.url}','860px','600px')" width="50" height="50" alt="${userInfo.user.satisfaction.attachmentName}"/></td>
											   </c:when>
											   <c:otherwise>
												   <c:choose>
													   <c:when test="${fn:containsIgnoreCase(userInfo.user.satisfaction.attachmentName,'pdf')}">
														   <td><a href="javascript:void(0)" onclick="preview('预览','${userInfo.user.satisfaction.url}','80%','80%','1')">
															   <span title="${userInfo.user.satisfaction.attachmentName}">${fns:abbr(userInfo.user.satisfaction.attachmentName, 30)}</span></a></td>
													   </c:when>
													   <c:otherwise>
														   <td><a href="javascript:void(0)" onclick="preview('预览','${userInfo.user.satisfaction.url}','80%','80%')">
															   <span title="${userInfo.user.satisfaction.attachmentName}">${fns:abbr(userInfo.user.satisfaction.attachmentName, 30)}</span></a></td>
													   </c:otherwise>
												   </c:choose>
											   </c:otherwise>
										   </c:choose>

										   <td>${userInfo.user.satisfaction.attachmentUser}</td>
										   <td><fmt:formatDate value="${userInfo.user.satisfaction.createDate}" pattern="yyyy-MM-dd"/></td>
										   <td>
											  <%-- <a href="${ctx}/workfullmanage/workFullManage/downLoadAttach?file=${userInfo.user.satisfaction.url}" class="btn btn-success btn-xs">下载</a>--%>
											   <a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${userInfo.user.satisfaction.url}');" class="btn btn-success btn-xs">下载</a>

										   </td>
									   </c:if>
								   </tr>
							   </table>
						   </div>
					   </div>
				   </td>
			   </tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>