<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<title>客服信息</title>
</head>
<body>
<div class="cl pd-20" style=" background-color:#5bacb6">
	<img class="avatar size-XL l" src="${info.customerHead}">
	<dl style="margin-left:80px; color:#fff">
		<dt style="margin-top: 15px;">
			<span class="f-18">${info.customerNick}</span>
		</dt>
	</dl>
</div>
<div class="pd-20">
	<table class="table">
		<tbody>
		<tr>
			<th class="text-r" style="width: 1%;">状态：</th>
			<td>
				${info.customerState == 1 ? "在线上" : (info.customerState == 2 ? "已离开" : "已下线")}
			</td>
		</tr>
		<tr>
			<th class="text-r"></th>
			<td style="width: 20%;">
				<c:choose>
					<c:when test="${info.customerState == 1}" >
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(3, ${info.customerId})">下线</button>
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(2, ${info.customerId})">离开</button>
					</c:when>
					<c:when test="${info.customerState == 2}">
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(1, ${info.customerId})">上线</button>
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(3, ${info.customerId})">下线</button>
					</c:when>
					<c:otherwise>
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(1, ${info.customerId})">上线</button>
						<button class="btn btn-danger" type="button" onclick="edit_customer_state(2, ${info.customerId})">离开</button>
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
		</tbody>
	</table>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<script type="text/javascript">
    function edit_customer_state(state, id) {
        $.ajax({
            type: "GET",
            url: "${pageContext.request.contextPath }/admin/customer/editCustomer",
            traditional: true,
            data: {"customerId":id, "customerState":state},
            dataType: "json",
            success: function (data) {
                if (data.resultCode == 200) {
                    layer.msg("标记成功！",{icon: 1,time:2000}, function () {
                        window.location.reload();
					});
                } else {
                    layer.msg("请求失败，请重试！",{icon: 5,time:2000});
                }
            }
        });
	}
</script>
</body>
</html>