<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.util.List"%>
<%@page import="model.ConnectDb"%>
<%@page import="model.SanPham"%>
<%@page import="model.ThongTinSanPham"%>
<%@page import="java.text.Normalizer"%>
<%@page import="java.text.Normalizer.Form"%>
<% 
List<ThongTinSanPham> sanpham = new SanPham().category();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='images/style.css' type=text/css>
<title>Search</title>
<script>
function scate(){
var namepd = document.getElementById("searchname").style.display = "none";;
var catepd = document.getElementById("searchcate").style.display = "block";;
}
function sname(){
var namepd = document.getElementById("searchname").style.display = "block";;
var catepd = document.getElementById("searchcate").style.display = "none";;
}
document.getElementById("titleCustomer").innerHTML = "Tìm Kiếm Sản Phẩm";
</script>
</head>
<body>
<div style="border:1px solid #cfcfcf;padding:18px 0px 28px 5px;background-color:#f3f3f3; width:438px ">
<p>
<div align="left" id="searchcate" style="margin-left: 35px; display:none">
<form action="ProductByCategory" method="post">
Tên thể loại
<input size="31" name="category" type="text">
  <input type="submit" class="UniXT"  value="Tìm kiếm">
</form>
<a onmousedown="return sname();" href="#">Tìm theo tên sản phẩm ?</a>
</div>

<div align="left" id="searchname" style="margin-left: 35px; display: block">
<form action="Search" method="post">
Tên sản phẩm &nbsp;&nbsp;
<input name="name" type="text" size="25"><br>
Thể loại &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
<select class="UniXT" name="cate">
  <option value="all">Tất cả</option>
  <% for(int i  = 0; i < sanpham.size(); i++) { %>
<% if (sanpham.get(i).getCategory() !=null) {
String cateshow = sanpham.get(i).getCategory().replaceAll("Đ", "D");
	cateshow = cateshow.replaceAll("đ", "d");
	cateshow =	Normalizer.normalize(cateshow, Form.NFD).replaceAll("[^\\p{ASCII}]", "");
%>
  <option  value="<%= cateshow %>"> <%= sanpham.get(i).getCategory() %></option>
<% }} %>
</select>
<input class="UniXT" type="submit" value="Tìm kiếm">
</form>
<a onmousedown="return scate();" href="#">Tìm theo thể loại ?</a>
</div>
</div>
</body>
</html>