/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/9.0.39
 * Generated at: 2021-06-10 05:02:43 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.dao.ProductDao;
import com.entities.Product;
import com.dao.CategoryDao;
import com.entities.Category;
import com.dao.CategoriesDao;
import com.entities.Categories;
import com.artifacts.FactoryProvider;
import com.artifacts.Helper;
import java.util.List;

public final class products_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent,
                 org.apache.jasper.runtime.JspSourceImports {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  static {
    _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
    _jspx_dependants.put("/components/modal.jsp", Long.valueOf(1623301249650L));
    _jspx_dependants.put("/components/bootstrapcss.jsp", Long.valueOf(1623299747715L));
  }

  private static final java.util.Set<java.lang.String> _jspx_imports_packages;

  private static final java.util.Set<java.lang.String> _jspx_imports_classes;

  static {
    _jspx_imports_packages = new java.util.HashSet<>();
    _jspx_imports_packages.add("javax.servlet");
    _jspx_imports_packages.add("javax.servlet.http");
    _jspx_imports_packages.add("javax.servlet.jsp");
    _jspx_imports_classes = new java.util.HashSet<>();
    _jspx_imports_classes.add("com.dao.CategoryDao");
    _jspx_imports_classes.add("java.util.List");
    _jspx_imports_classes.add("com.dao.ProductDao");
    _jspx_imports_classes.add("com.entities.Product");
    _jspx_imports_classes.add("com.entities.Category");
    _jspx_imports_classes.add("com.artifacts.Helper");
    _jspx_imports_classes.add("com.dao.CategoriesDao");
    _jspx_imports_classes.add("com.artifacts.FactoryProvider");
    _jspx_imports_classes.add("com.entities.Categories");
  }

  private volatile javax.el.ExpressionFactory _el_expressionfactory;
  private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public java.util.Set<java.lang.String> getPackageImports() {
    return _jspx_imports_packages;
  }

  public java.util.Set<java.lang.String> getClassImports() {
    return _jspx_imports_classes;
  }

  public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
    if (_el_expressionfactory == null) {
      synchronized (this) {
        if (_el_expressionfactory == null) {
          _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
        }
      }
    }
    return _el_expressionfactory;
  }

  public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
    if (_jsp_instancemanager == null) {
      synchronized (this) {
        if (_jsp_instancemanager == null) {
          _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
        }
      }
    }
    return _jsp_instancemanager;
  }

  public void _jspInit() {
  }

  public void _jspDestroy() {
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
      final java.lang.String _jspx_method = request.getMethod();
      if ("OPTIONS".equals(_jspx_method)) {
        response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
        return;
      }
      if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) {
        response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
        response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS");
        return;
      }
    }

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("    \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write(" \r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE html>\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta charset=\"ISO-8859-1\">\r\n");
      out.write("<meta name=\"viewport\" content=\"width-device-width, inital-scale=1.0\">\r\n");
      out.write("        <title>Artifacts|Products</title>\r\n");
      out.write("        <link rel = \"icon\" href = \"images/icon.jpg\" type = \"image/x-icon\">\r\n");
      out.write("        <link rel=\"stylesheet\" href=\"stylec.css\">\r\n");
      out.write("        \r\n");
      out.write("        \r\n");
      out.write("      \r\n");
      out.write("      <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css\"/>\r\n");
      out.write("         <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css\">\r\n");
      out.write("        <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\">\r\n");
      out.write("        <link href=\"https://fonts.googleapis.com/css2?family=Kaushan+Script&family=Poppins:wght@300;400;500;600;700;900&display=swap\" rel=\"stylesheet\">\r\n");
      out.write("        ");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\" integrity=\"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\" crossorigin=\"anonymous\">\r\n");
      out.write("<link rel=\"stylesheet\" href=\"stylepc.css\">\r\n");
      out.write("\r\n");
      out.write("<script src=\"https://code.jquery.com/jquery-3.6.0.min.js\" integrity=\"sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=\" crossorigin=\"anonymous\"></script>\r\n");
      out.write("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js\" integrity=\"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q\" crossorigin=\"anonymous\"></script>\r\n");
      out.write("<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js\" integrity=\"sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl\" crossorigin=\"anonymous\"></script>\r\n");
      out.write("<script src=\"scripts.js\"></script>");
      out.write("\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("    \r\n");
      out.write("            <a href=\"about.jsp\">\r\n");
      out.write("            <img src=\"images/logos1.png\" class=\"logo\">\r\n");
      out.write("            </a> \r\n");
      out.write("            <h1>Products</h1>\r\n");
      out.write("           \r\n");
      out.write("            \r\n");
      out.write("            \r\n");
      out.write("          \r\n");
      out.write("         ");

            CategoriesDao cadao = new CategoriesDao(FactoryProvider.getFactory());
            List<Categories> calist = cadao.getCategoriees();
            
            String cats = request.getParameter("cates");
           
            CategoryDao cdao = new CategoryDao(FactoryProvider.getFactory());
           
            
            List<Category>clist = null;
            if(cats==null){
            	clist = cdao.getCategory();
            }
            else{
            	
            	int cids =Integer.parseInt(cats.trim());
            	clist = cdao.getAllCategoryById(cids);
            	
            }
            
            String cat = request.getParameter("cate");
            
            ProductDao dao = new ProductDao(FactoryProvider.getFactory());
            List<Product> list =null;
            if(cat==null){
            	list = dao.getAllProducts();
            }
            else{
            	
            	int cid =Integer.parseInt(cat.trim());
            	list = dao.getAllProductsById(cid);
            	
            }
            
      out.write("\r\n");
      out.write("           \r\n");
      out.write("   <div class=\"row\">\r\n");
      out.write("       <div class=\"col-md-4\" >   \r\n");
      out.write("       <nav id=\"menu\">\r\n");
      out.write("\r\n");
      out.write("        <ul class=\"parent-menu\">\r\n");
      out.write("        <li><a href=\"index.jsp\"><strong>Home</strong></a></li>\r\n");
      out.write("        <li><a href=\"#\" data-toggle=\"modal\"  data-target=\"#cart\">\r\n");
      out.write("                 Cart <i class=\"fa fa-shopping-bag\"></i><span class=\"cart-items\">(0)</span>\r\n");
      out.write("                 </a></li>\r\n");
      out.write("        <li><a href=\"#\"><strong>Categories</strong></a></li>\r\n");
      out.write("        \r\n");
      out.write("        ");

       							for(Categories categories: calist){
       						
       						
       						
       						
      out.write("\r\n");
      out.write("\r\n");
      out.write("            <li><a href=\"products.jsp?cates=");
      out.print(categories.getCategoriesId());
      out.write('"');
      out.write('>');
      out.print(categories.getCategoriesTitle() );
      out.write("</a>\r\n");
      out.write("\r\n");
      out.write("                <ul>\r\n");
      out.write("                 ");

       							for(Category category: clist){
       						
       						
       						
       						
      out.write("\r\n");
      out.write("\r\n");
      out.write("                    <li><a href=\"products.jsp?cate=");
      out.print(category.getCategoryId());
      out.write('"');
      out.write('>');
      out.print(category.getCategoryTitle() );
      out.write("</a></li>\r\n");
      out.write("                     ");
} 
      out.write("\r\n");
      out.write("\r\n");
      out.write("                    \r\n");
      out.write("                </ul>\r\n");
      out.write("\r\n");
      out.write("            </li>\r\n");
      out.write("             ");
} 
      out.write("\r\n");
      out.write("\r\n");
      out.write("            \r\n");
      out.write("        </ul>\r\n");
      out.write("\r\n");
      out.write("    </nav>  \r\n");
      out.write("    </div>\r\n");
      out.write("      \r\n");
      out.write("           \r\n");
      out.write("            \r\n");
      out.write("\r\n");
      out.write("     \r\n");
      out.write(" \r\n");
      out.write("<div class=\"col-md-8\">\r\n");
      out.write("\r\n");
      out.write("<div class=\"row-mt-1\">\r\n");
      out.write("<div class=\"col-md-12\">\r\n");
      out.write("<div class=\"card-columns\">\r\n");
      out.write("\r\n");
  for (Product product: list){ 
      out.write("\r\n");
      out.write("           <div class=\"card\">\r\n");
      out.write("           <div class=\"card-body\">\r\n");
      out.write("   <div class=\"container-fluid text-center\">       \r\n");
      out.write("  <img src=\"images/products/");
      out.print(product.getpPhoto() );
      out.write("\" style=\"max-height: 270px; max-width: 100%; width: auto;\"class=\"card-img-top m-2\" alt=\"....\" >\r\n");
      out.write("  </div> \r\n");
      out.write("  <h2 class=\"card-title\">");
      out.print(product.getpName() );
      out.write("</h2>\r\n");
      out.write("  \r\n");
      out.write("  <p class=\"card-text\">");
      out.print(Helper.get10Words(product.getpDesc()) );
      out.write("</p>\r\n");
      out.write("  <p class=\"price\"> Rs.");
      out.print(product.getpPrice() );
      out.write("</p>\r\n");
      out.write("  <div class=\"rating\">\r\n");
      out.write("                        <i class=\"fa fa-star\"></i>\r\n");
      out.write("                        <i class=\"fa fa-star\"></i>\r\n");
      out.write("                        <i class=\"fa fa-star\"></i>\r\n");
      out.write("                        <i class=\"fa fa-star\"></i>\r\n");
      out.write("                        <i class=\"fa fa-star-o\"></i>\r\n");
      out.write("                    </div>\r\n");
      out.write("  \r\n");
      out.write("  </div> \r\n");
      out.write("  <div class=\"card-footer\">\r\n");
      out.write("  \r\n");
      out.write("         <button class=\"btn btn-outline-primary\" onclick= \"add_to_cart( '");
      out.print(product.getpPhoto());
      out.write("' , ");
      out.print( product.getpId());
      out.write(" , '");
      out.print( product.getpName());
      out.write("' , ");
      out.print( product.getpPrice() );
      out.write(")\" >Add to Cart</button>  \r\n");
      out.write("  \r\n");
      out.write("  </div>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("</div>  \r\n");
 } 
      out.write("   \r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
      out.write("</div>\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("   \r\n");
      out.write("             \r\n");
      out.write("     <!----------------------------footer-------------------------->\r\n");
      out.write("        <section id=\"footer\">\r\n");
      out.write("        <img src=\"images/logos2.png\" class=\"footer-img\">\r\n");
      out.write("       \r\n");
      out.write("        \r\n");
      out.write("        <div class=\"social-links\">\r\n");
      out.write("            <i class=\"fa fa-facebook\"></i>\r\n");
      out.write("            <i class=\"fa fa-whatsapp\"></i>\r\n");
      out.write("            <i class=\"fa fa-instagram\"></i>\r\n");
      out.write("            <i class=\"fa fa-twitter\"></i>\r\n");
      out.write("            <p>=============Copyright Artifact's &amp; Terms &amp; Conditions============</p>\r\n");
      out.write("            \r\n");
      out.write("        </div>\r\n");
      out.write("        \r\n");
      out.write("    </section>\r\n");
      out.write("   \r\n");
      out.write("   ");
      out.write("<!-- Button trigger modal -->\r\n");
      out.write("\r\n");
      out.write("<!-- Modal -->\r\n");
      out.write("<div class=\"modal fade\" id=\"cart\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\r\n");
      out.write("  <div class=\"modal-dialog modal-lg\" role=\"document\">\r\n");
      out.write("    <div class=\"modal-content\">\r\n");
      out.write("      <div class=\"modal-header\">\r\n");
      out.write("        <h5 class=\"modal-title\" id=\"exampleModalLabel\">Cart</h5>\r\n");
      out.write("        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\r\n");
      out.write("          <span aria-hidden=\"true\">&times;</span>\r\n");
      out.write("        </button>\r\n");
      out.write("      </div>\r\n");
      out.write("      <div class=\"modal-body\">\r\n");
      out.write("        <div class=\"cart-body\">\r\n");
      out.write("        \r\n");
      out.write("        \r\n");
      out.write("        \r\n");
      out.write("        </div>\r\n");
      out.write("      </div>\r\n");
      out.write("      <div class=\"modal-footer\">\r\n");
      out.write("        <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>\r\n");
      out.write("        <button type=\"button\" class=\"btn btn-primary  checkout-btn\" onclick=\"goToCheckout()\">Checkout</button>\r\n");
      out.write("      </div>\r\n");
      out.write("    </div>\r\n");
      out.write("  </div>\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("<div id=\"snackbar\">Product is Added To Cart</div>");
      out.write("\r\n");
      out.write("    \r\n");
      out.write("    \r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
