<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="model.User"%>
    <%@page import="java.util.List"%>

   
<% List<User> us = (List<User>) request.getAttribute("alluser");
if(us == null){	
%><%} else {
	int TrangHienTai = Integer.parseInt(request.getParameter("page"));
	int TongSoTrang = (Integer)request.getAttribute("TongSoTrang");
	%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='images/style.css' type=text/css>
<title>Thong Tin Khach Hang</title>
<script src="js/CheckChoice.js" type="text/javascript" charset="utf-8"></script>
<script src="js/DelChoiced.js" type="text/javascript" charset="utf-8"></script>
<Script>
function delall(){
if(confirm('Bạn thực sự muốn xóa Toàn Bộ Khách Hàng ?'))
{return true;}
else {return false;}
}
function del(){
	if(confirm('Bạn Thực Sự Muốn Xóa Khách Hàng Này ?'))
	{return true;}
	else {return false;}
	}
document.title="Toàn Bộ Khách Hàng";
document.getElementById("titleMod").innerHTML = "Khách Hàng";
</script>
</head>
<body>
<p>
<% if (us.size() == 0){ %><div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 20px 10px;background-color:#f3f3f3; width:320px "><b>Chưa có khách hàng nào</b></div><p><br><br><%} else { %>
<br>
<table class="tablext" border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="silver" cellpadding="3">
    <tr>
    	<th style="background: #E3E3E3"><input class="UniXT" id ="checkAll" onclick = "return checkHow();" type="checkbox" /></th>
    	<th style="background: #E3E3E3">STT</th>
        <th style="background: #E3E3E3">User</th>
        <th style="background: #E3E3E3">Email</th>
		<th style="background: #E3E3E3">Tên Thật</th>
        <th style="background: #E3E3E3">CMND</th>
        <th style="background: #E3E3E3">Địa Chỉ</th>
        <th style="background: #E3E3E3">Điện Thoại</th>
        <th style="background: #E3E3E3">Xóa</th>
      
    </tr> 
    <% for(int i  = us.size()-1; i >=0 ; i--) { %>
        <tr align="center">
        	<td><input class="UniXT" onclick = "return checkIsAll();" name= "idchoiced<%= us.size() - i %>" id= "lxt<%= us.size() - i %>" type="checkbox" value = "<%= us.get(i).getUserName() %>"/></td>
       		<td><%= us.size()- i %></td>
            <td><%= us.get(i).getUserName() %></td>
            <td><%= us.get(i).getEmail() %></td>
			<td><%= us.get(i).getRealname() %></td>
            <td><%= us.get(i).getCmnd() %></td>
            <td><%= us.get(i).getAddress() %></td>     
			<td><%= us.get(i).getPhone() %></td>
			<td><a onclick = "return  del();" href="../AUser?rep=delacustomer&usern=<%= us.get(i).getUserName()  %>&page=<%= TrangHienTai %>"><img border="0" src="images/discard.jpg" width="25" height="25" title="Xóa"></a></td>
        </tr>     
   <% }  %>
           <tr><td colspan="9" valign="baseline" align="right">
        <Br>
<form method="post" action="../AUser" onsubmit="return delall();">
<input type="hidden" name="rep" value="delall">
	<input onclick="return deleteIDChoiced('AUser', '<%= TrangHienTai %>');" class ="UniXT" type="button" value = "Xóa chọn"/>
	<input type="submit" class="UniXT" value="Xóa toàn bộ"/>
	</form></td></tr>
    </table>  

    <br><p>
    <B>Trang</B> <% for (int t = 1; t <= TongSoTrang; t++){%>
       <a href="../AUser?rep=view&page=<%= t %>"><% if(TrangHienTai==t){ %></a><span style="padding: 5px 5px 5px 5px; background: #F5F5FF; border:0px ; font-size: 14px"><% } %> <%= t %></span>
       <% } %>
    
</body>
<% }} %>
</html>