<!--#include file="Conn.asp"--><%Checklogin()%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理区域</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link rel="stylesheet" href="css/alert.css" type="text/css" />
<script language="javascript" src="system/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
</head>
<body class="clear">
<!--#include file="panel.asp"-->
<div id="man_zone">
	<div class="searchForm homeSearch">
	<form method="post" action="/searchResult.asp"  accept-charset="UTF-8">
		<input class="keywords " id="keyword" name="keywords" placeholder="请输入联系人 / 电话 / 邮箱 / 微信 / WhatsApp.."  >
		<input class="searchSubmit" type="submit" value="客户检索">
	</form>
	</div>
</div>

<%
	Set Rs=Server.CreateObject("ADODB.RecordSet")
		sqlstr="select cs_code,em_user,cs_claimdate from customer left join employee on customer.cs_belong=employee.id where customer.id in(select cs_id from claimRecord where isread=0 and originalEmp='"&Session("employee_name")&"')"
	    Rs.open sqlstr,conn,1,1		
		If Not Rs.bof and Not Rs.eof Then
%>
		
		<div class="modal" id="modal">
			<div class="modal-wraper">
				<div class="modal-content">
					<div class="popup-title">距离上次登录之后,以下客户已经被认领</div>
					<div class="popup-content">
						<ul>
							<% For i=1 to Rs.Recordcount %>
							<li><span class="prominent"><%=TextUncode(Rs("cs_code"))%></span> 被 <span class="prominent"><%=TextUncode(Rs("em_user"))%></span> 于 <span><%=TextUncode(Rs("cs_claimdate"))%></span> 认领</li>
							<%
								Rs.moveNext
								Next
							%>
						</ul>
					</div>	
						<div class="close" onclick="closePopup()">已读</div>
				</div>		
			</div>
		</div>

<%
		End If
		Rs.close
		conn.execute("update claimRecord set isread=1 where originalEmp='"&Session("employee_name")&"' and isread=0")
	Set Rs=Nothing
%>


<script>
  // 检查是否首次登陆或是否过期
  const em = localStorage.getItem('em');
  const currentTime = new Date().getTime();
  const expirationTime = 24 * 60 * 60 * 1000; // 24小时的有效时间
  console.log(em);
  if (!em || em!=='em<%=Session("employee_id")%>' ) {
    // 如果是首次登陆或已过期,显示弹窗
			$("#modal").addClass("active");
			setTimeout(function() {
				$("#modal").find(".modal-content").addClass("active");
			}, 0);

    // 存储当前时间戳
    localStorage.setItem('em', 'em<%=Session("employee_id")%>');
  }

  // 关闭弹窗的函数
  function closePopup() {
   			$("#modal").removeClass("active");
  }
</script>

</body>
</html>