<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

    <%@page import="model.ThongTinSanPham"%>
<%@page import="model.SanPham"%>
<% 
ThongTinSanPham product = (ThongTinSanPham) request.getAttribute("sanpham"); 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='images/style.css' type=text/css>
<link rel=stylesheet href='images/AjaxForm.css' type=text/css>
<script type="text/javascript" src="js/SearchID2.js"></script>
<link rel="stylesheet" type="text/css" href="highslide/highslide.css" />
<script type="text/javascript" src="highslide/highslide-with-html.js"></script>

<Script>
function delall(){
if(confirm('Bạn Thực Sự Nuốn Xóa Toàn Bộ Sản Phẩm ?'))
{return true;}
else {return false;}
}

function numberonly(event) {
	 var chCode = (event.charCode === undefined) ? event.keyCode : event.charCode;
	 if (chCode > 31 && (chCode < 48 || chCode > 57))
	 {return false;}
	 else { return true;}
	  }
document.getElementById("titleMod").innerHTML = "Chi Tiết SP";
</script>
<title>Tat Ca San Pham</title>
</head>

<body>
<% if(product==null) { %>

<div style="border:1px solid #cfcfcf;padding:20px 0px 20px 5px;background-color:#f3f3f3; width:440px ">
<p>
<form action="../ProductController" method="post" onsubmit="return SearchID2(this)">
<input type="hidden" name="rep" value="viewID"/>
Nhập ID sản phẩm
<input name="id" id="id2" type="text" onkeypress="return numberonly(event);">
  <input type="submit" class="UniXT" value="Tìm kiếm">
</form>
</div>

<% } else { 
%>


<script type="text/javascript">
	hs.graphicsDir = 'highslide/graphics/';
	hs.outlineType = 'rounded-white';
	hs.showCredits = false;
	hs.wrapperClassName = 'draggable-header';
</script>
<br>
<center>
<p>
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="silver" cellpadding="3">
    <tr>
		<th style="background: #E3E3E3">ID</th>
        <th style="background: #E3E3E3">Tên Sản Phẩm</th>
		<th style="background: #E3E3E3">Thể Loại</th>
        <th style="background: #E3E3E3">Giá (vnđ)</th>
        <th style="background: #E3E3E3">Mô Tả</th>
        <th style="background: #E3E3E3">Chỉnh Sửa</th>
        <th style="background: #E3E3E3">Xóa</th>
    </tr>  
        <tr align="center">
			<td># <%= product.getId() %></td>
            <td><div>
<a href="#" onclick="return hs.htmlExpand(this, {headingText: '<%= product.getName() %>' })"><%= product.getName() %></a>
<div class="highslide-maincontent">
<% if (product.getImage().trim().substring(0,4).equals("http")) { %>
<img src="<%= product.getImage() %>" width="170" height="180" title="<%= product.getName()%>"> <% } else { %>
<img src="../<%= product.getImage() %>" width="170" height="180" title="<%= product.getName()%>">
<% } %>
	</div>
		</div>
</td>
			<td><%= product.getCategory() %></td>
            <td><%= Math.round(product.getPrice()) %></td>
            <td>          
       <textarea class="UniXT" rows="1" cols="20"><%= product.getDescription() %></textarea>
            </td>
			<td><a href="../ProductController?rep=edit&page=1&id=<%= product.getId()%>"><img border="0" src="images/edit.png" width="25" height="25"></a></td>
			<td><a href="../ProductController?rep=delid&page=1&id=<%= product.getId()%>"><img border="0" src="images/discard.jpg" width="25" height="25"></a></td>
        </tr>                   
    </table>  
</Center>
</body>
<% } %>
</html>