<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<meta name="author" content="" />
	<meta name="viewport" content="width=device-width,height=device-height, user-scalable=no,initial-scale=1, minimum-scale=1, maximum-scale=1,target-densitydpi=device-dpi ">
	<meta name="robots" content="" />
	<title>预约记录</title>
	<script type="text/javascript" src="${ctx }/scripts/jquery/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${ctx }/scripts/visitor/controlOptionMenu.js?v=4.0"></script>
	<link rel="stylesheet" href="${ctx }/styles/visitor/visitorlist.css?v=20220218" type="text/css">
	<link rel="stylesheet" type="text/css" href="${ctx }/styles/visitor/loadview.css" />
</head>
<input type="hidden" id="ctx" value="${ctx }" />
<input type="hidden" id="imageServer" value="${imageServer }" />
<input type="hidden" id="passType" value="${passType}" />
<script type="text/javascript">
	$(document).ready(function () {
		$("#divContent").hide();
		$(window).resize(infinite);
		sessionStorage.setItem('passType', $("#passType").val())
		let strOpenId = getUrlParam('openId');
		let strOrgId = getUrlParam('orgId');
		let strUserId = getUrlParam('userId');
		let strDevelopId = getUrlParam('developId');
		let strState = getUrlParam('state');
		let strUserToken = getUrlParam('userToken');
		let isForm = sessionStorage.getItem('isFrom') || 0
		let isList = sessionStorage.getItem('isList') || 0

		if (strOpenId) {
			sessionStorage.setItem('openId',strOpenId)
		}
		if (strOrgId) {
			sessionStorage.setItem('orgId', strOrgId)
		}
		if (strUserId) {
			sessionStorage.setItem('userId', strUserId)
		}
		if (strDevelopId) {
			sessionStorage.setItem('developId', strDevelopId)
		}
		if (strState) {
			sessionStorage.setItem('state', strState)
		}
		if (strUserToken) {
			sessionStorage.setItem('userToken', strUserToken)
		}
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg);  //匹配目标参数
			if (r != null) return unescape(r[2]); return null; //返回参数值
		}
		function infinite() {
			var htmlWidth = $('html').width();
			if (htmlWidth >= 640) {
				$("html").css({
					"font-size": "24px"
				});
			} else {
				$("html").css({
					"font-size": 24 / 640 * htmlWidth + "px"
				});
			}
		}
		infinite();
		$("#addvistor").click(function () {
//			var status = $("#status").val();
//			if (status != 1) {
//				if (confirm('您的信息还没有通过认证，是否要去完善资料！')) {
//					$("#renzhenform").submit()
//				}
//			} else {
//				$("#addVisitorform").submit();
//			}
            $("#addVisitorform").submit();
		});

		if (isForm == 1&&isList == 0) {
			$("#addVisitorform").submit();
		} else {
			$("#divContent").show();
		}
	});

	function getVisitorInfoList(val) {
		$("#visitorOrderId").val(val);
		$("#tt").show();
		$("#getVisitorInfoform").submit();

	}
</script>

<body>
	<div id="divContent">
		<input type="hidden" id="ctx" value="${ctx }" />
		<input type="hidden" id="status" value="${status }" />
		<form:form action="${ctx}/wechat/appUser/choiceOrgAddress" method="get" id="renzhenform">
			<input type="hidden" name="userId" value="${userId }" />
			<input type="hidden" name="openId" value="${openId }" />
			<input type="hidden" name="developId" value="${developId }" />
			<input type="hidden" name="organizationId" value="${organizationId }" />
			<input type="hidden" name="passType" value="${passType}">
		</form:form>
		<c:if test="${not empty reslutMap}">
			<div class="sumit_item has-vositor">
				<c:if test="${type == 2}" var="whiteType">
					<input class="submit_img_f submit_add" type="button" name="" id="addvistor" value="">
				</c:if>
				<c:if test="${!whiteType}">
					<input class="submit_img submit_add" type="button" name="" id="addvistor" value="">
				</c:if>
				<form:form action="${ctx}/wechat/visitor/addVisitor" method="get" id="addVisitorform" style="display:none">
					<input type="hidden" name="openId" value="${openId }" />
				</form:form>
			</div>
			<c:forEach items="${reslutMap }" var="model">
				<div>
					<p class="time_remark current_time">
						<span>
							<c:if test="${not empty model.week }">${model.week }</c:if>
						</span> <span>${model.dateTime }</span> <span>${model.weekDay }</span>
					</p>
					<ul>
						<c:forEach items="${model.orderList }" var="orderModel">
							<li class="recode_item " onclick="getVisitorInfoList(${orderModel.visitorOrderId})">
								<div class="top">
									<span class="visited_name">${orderModel.visitorInfo.visitorName}</span>
									<span class="visited_count">${orderModel.count }人</span>
									<c:if test="${orderModel.visitorOrderStatus==0}">
										<sapn class="visitor_state">未授权</sapn>
									</c:if>
									<c:if test="${orderModel.visitorOrderStatus==1 }">
										<sapn class="visitor_state_ok">已授权</sapn>
									</c:if>
									<c:if test="${orderModel.visitorOrderStatus==2}">
										<sapn class="visitor_state">未通过</sapn>
									</c:if>
								</div>
								<div class="bottom">
									<sapn class="visitor_time">${orderModel.visitorTime}</sapn>
									<span class="visited_company">${orderModel.visitorInfo.visitorCompanyName }</span>
								</div>
							</li>

						</c:forEach>
						<form:form action="${ctx }/wechat/visitor/getVisitorInfoList" method="post" id="getVisitorInfoform">
							<input type="hidden" name="visitorOrderId" id="visitorOrderId" />
							<input type="hidden" name="type" value="${type }" />
							<input type="hidden" name="passType" value="${passType}">
						</form:form>
					</ul>
				</div>
			</c:forEach>
		</c:if>
		<c:if test="${empty reslutMap }">
			<div class="no-visitor-wp">
				<div class="sumit_item">
					<c:if test="${type == 2}" var="whiteType">
						<input class="submit_img_f submit_add" type="button" name="" id="addvistor" value="">
					</c:if>
					<c:if test="${!whiteType}">
						<input class="submit_img submit_add" type="button" name="" id="addvistor" value="">
					</c:if>
					<form:form action="${ctx}/wechat/visitor/addVisitor" method="get" id="addVisitorform" style="display:none">
						<input type="hidden" name="openId" value="${openId }" />
					</form:form>
				</div>
				<div style="width:100%;height:100%;text-align: center;font-size: 1.5rem;font-weight: 600">
					暂无预约，点击按钮添加预约
						<%-- <img src="${ctx }/images/visitor/wujilu.png" style="width: 45%; margin: 2rem auto 0; "> --%>
				</div>
			</div>

		</c:if>
		<div id="tcc" class="tcbj1" style="display:none;">
			<div class="tcck1">
				<div class="load-container load4">
					<div class="loader">Loading...</div>
				</div>
			</div>
		</div>
	</div>
</body>

</html>
