<%@page import="org.mynonglam.dao.AdminDAO"%>
<%@page import="org.mynonglam.entitys.Group"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function checkBlock(){
	if(confirm("Are you sure?")){
		return true;
	}
	else{
		return false;
	}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<%
	List<Group> listGroup = AdminDAO.getListGroup();
%>
<body>
	<h1>Groups Manager</h1>
	
	<div style="overflow: auto; width: 900px; height: 300px;">
		<table>
		<tr style="background: #639ECB; height: 35px; color: white;">
		<th style="border-right: 1px solid white ;">Id group</th><th style="border-right: 1px solid white ;">Group name</th>
		<th style="border-right: 1px solid white ;">Icon group</th><th style="border-right: 1px solid white ;">Description</th><th style="border-right: 1px solid white ;">Date create</th>
		<th style="border-right: 1px solid white ;">Isblock</th>
		<th>Status</th>
		</tr>
		<% for(int i= 0; i < listGroup.size(); i++) {%>
		<tr style="background: #CDE4F6; border-bottom: 1px solid white ;  ">
		<td style="padding-top: 10px; border-right: 1px solid white ; width: 180px;"><%= listGroup.get(i).getIdgroup() %></td><td style="border-right: 1px solid white ; width: 150px;"><%= listGroup.get(i).getGroupname() %></td>
		<td style="border-right: 1px solid white ; width: 90px;"><img src="<%= listGroup.get(i).getIcongroup() %>" width="50px;"></td>
		<td style="border-right: 1px solid white ; width: 200px;"><%= listGroup.get(i).getDescription() %></td><td style="border-right: 1px solid white ;"><%= listGroup.get(i).getDatecreate() %></td>
		<td style="border-right: 1px solid white ;"><%= listGroup.get(i).isIsblock()%></td>
		<% if(listGroup.get(i).isIsblock() == false) {%>
			<td><a href="blockGroup?id=<%=listGroup.get(i).getIdgroup()%>&&status=<%=listGroup.get(i).isIsblock()%>"><input onclick="return checkBlock()" type="button" value="block"></a></td>
		<%}else {%>
			<td><a href="blockGroup?id=<%=listGroup.get(i).getIdgroup()%>&&status=<%=listGroup.get(i).isIsblock()%>"><input onclick="return checkBlock()" type="button" value="unblock"></a></td>
		<%} %>
		</tr>
		<%} %>
		</table>
	</div>
</body>
</html>