package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.Locale;
import javax.ejb.Local;
import java.text.DecimalFormatSymbols;
import webservice.CurrencyConvertor;
import webservice.Currency;
import Java.Shoppingcart;
import Java.ShoppingcartItem;
import java.text.DecimalFormat;
import java.util.Collections;
import Java.DatabaseKoppeling;
import java.util.List;
public final class c_005fshoppingcart_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
response.setHeader("X-Powered-By", "JSP/2.2");
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;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write(" \n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>Winkelwagen</title>\n");
out.write(" <script src=\"include/jquery-1.9.1.min.js\"></script>\n");
out.write(" <link href=\"css/main.css\" rel=\"stylesheet\" />\n");
out.write(" ");
Shoppingcart cart = null;
String username = (String)session.getAttribute("username");
if(username == null || !DatabaseKoppeling.checkUsername(username)) {
response.sendRedirect("loguit.jsp");
}
out.write("\n");
out.write(" \n");
out.write(" ");
String currencyparam = (String) request.getParameter("value");
String currency = (String)session.getAttribute("cur");
if(currencyparam != null) {
currency = currencyparam;
session.setAttribute("cur", currency);
}
String curCurrency;
if("usd".equals(currency))
{
currency = "USD";
session.setAttribute("currentCurrency", currency);
curCurrency = "USD";
}
else
{
currency = "EUR";
session.setAttribute("currentCurrency", currency);
curCurrency = "EUR";
}
out.write("\n");
out.write(" <style>\n");
out.write(" table#shoppingcart {\n");
out.write(" width:100%;\n");
out.write(" }\n");
out.write(" \n");
out.write(" #shoppingcart th {\n");
out.write(" border-bottom:2px solid gray;\n");
out.write(" }\n");
out.write(" \n");
out.write(" #shoppingcart tr td {\n");
out.write(" border-bottom: 1px solid gray;\n");
out.write(" }\n");
out.write(" \n");
out.write(" a.menu {\n");
out.write(" float:right; \n");
out.write(" border:2px white; \n");
out.write(" background: none;\n");
out.write(" }\n");
out.write("\n");
out.write(" a.menu img {\n");
out.write(" padding-left: 10px;\n");
out.write(" }\n");
out.write("\n");
out.write(" a.menu:hover {\n");
out.write(" margin-top: -10px;\n");
out.write(" padding: 10px;\n");
out.write(" background: black;\n");
out.write(" }\n");
out.write(" span.menubutton {\n");
out.write(" display: none;\n");
out.write(" }\n");
out.write(" </style>\n");
out.write(" \n");
out.write(" <script>\n");
out.write(" function showusermenu() {\n");
out.write(" $(\".menubutton\").css(\"display\", \"block\");\n");
out.write(" }\n");
out.write(" \n");
out.write(" function hideusermenu() {\n");
out.write(" $(\".menubutton\").css(\"display\", \"none\");\n");
out.write(" }\n");
out.write(" </script>\n");
out.write(" </head>\n");
out.write(" <body>\n");
out.write(" <div id=\"header\">\n");
out.write(" <a href=\"index.jsp\">Startpagina</a>\n");
out.write(" <a href=\"mainpage.jsp\">Home</a> \n");
out.write(" <a href=\"c_shoppingcart.jsp\" style=\"color:#ffffff;\">Winkelwagen</a>\n");
out.write(" <a href=\"c_orders.jsp\">Bestellingen</a>\n");
out.write(" <a style='float:right; margin-right: 22%; text-align: right;' class=\"unselectable menu\" \n");
out.write(" onmouseover=\"Javascript:showusermenu();\"\n");
out.write(" onmouseout='Javascript:hideusermenu();'>");
out.print(username);
out.write("<br>\n");
out.write(" <span onclick=\"Javascript:location.href='ServletChangeType?newtype=Photographer';\" class=\"menubutton\">\n");
out.write(" Photographer\n");
out.write(" </span>\n");
out.write(" <span onclick=\"Javascript:location.href='loguit.jsp';\" class=\"menubutton\">Log uit</span>\n");
out.write(" </a>\n");
out.write(" <a id=\"cur_eur\" href=\"c_shoppingcart.jsp?value=eur\" style=\"float:right;\">€</a>\n");
out.write(" <a id=\"cur_dol\" href=\"c_shoppingcart.jsp?value=usd\" style=\"float:right;\">$</a>\n");
out.write(" </div>\n");
out.write(" <div id=\"content\">\n");
out.write(" <br>\n");
out.write(" <h1>Winkelwagen</h1> \n");
out.write(" \n");
out.write(" <form action=\"ServletUpdateCookie\" method=\"post\">\n");
out.write(" <table id =\"shoppingcart\">\n");
out.write(" <tr>\n");
out.write(" <th>Foto Nummer</th>\n");
out.write(" <th>Product</th>\n");
out.write(" <th>Kleur</th>\n");
out.write(" <th>Stukprijs</th>\n");
out.write(" <th>Aantal</th>\n");
out.write(" <th>Prijs</th>\n");
out.write(" <th>Verwijderen</th>\n");
out.write(" </tr>\n");
out.write(" ");
cart = new Shoppingcart();
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie c : cookies) {
if (c.getName().equals("SHOPPINGCART")) {
cart = new Shoppingcart(c.getValue());
break;
}
}
}
cart.sort();
String curSymbol = "€";
double totalprice = 0.0;
session.setAttribute("carttoupdate", cart);
for (int i = 0; i < cart.size(); i++) {
ShoppingcartItem item = cart.get(i);
int amount = item.getAmount();
String photo = item.getPhoto();
double price = 0.00;
if("USD".equals(curCurrency))
{
curSymbol = "$";
double conversionRate = new CurrencyConvertor().getCurrencyConvertorSoap().conversionRate(Currency.EUR, Currency.USD);
price = (DatabaseKoppeling.getItemPrice(photo, item.getProduct()))*conversionRate;
} else {
price = DatabaseKoppeling.getItemPrice(photo, item.getProduct());
}
totalprice += price*amount;
out.write("\n");
out.write(" <tr>\n");
out.write(" <td>");
out.print(photo);
out.write("</td>\n");
out.write(" <td>");
out.print(item.getProduct());
out.write("</td>\n");
out.write(" <td>");
out.print(item.getColor());
out.write("</td>\n");
out.write(" <td>");
out.print(curSymbol + new DecimalFormat("0.00").format(price));
out.write("</td>\n");
out.write(" <td><input name=\"quantity");
out.print(i);
out.write("\" type=\"number\" value=\"");
out.print(amount);
out.write("\" style=\"Width:50px\" onchange=\"document.forms[0].submit();\"/></td>\n");
out.write(" <td>");
out.print(curSymbol + new DecimalFormat("0.00").format(price*amount));
out.write("</td>\n");
out.write(" <td align=\"center\"><input type=\"image\" src=\"images/delete.png\" name=\"delete");
out.print(i);
out.write("\" value=\"Verwijderen\" height=\"25px\" width=\"25px\" align=\"center\"></td>\n");
out.write(" </tr>\n");
out.write(" ");
}
out.write("\n");
out.write(" <tr>\n");
out.write(" <td style=\"border: 0px;\"></td>\n");
out.write(" <td style=\"border: 0px;\"></td>\n");
out.write(" <td style=\"border: 0px;\"></td>\n");
out.write(" <td style=\"border: 0px;\"></td>\n");
out.write(" <td style=\"border: 0px; text-align:right;\"><br><b>Totaalprijs: </b></td>\n");
out.write(" <td style=\"border: 0px;\"><br>");
out.print(curSymbol + new DecimalFormat("0.00").format(totalprice));
out.write("</td>\n");
out.write(" <td style=\"border: 0px; padding-right: 10px;\"><br><div style=\"min-height: 50px; \"> ");
out.write("\n");
out.write(" <input type=\"hidden\" value=\"APWZXRPFQTPMW\">\n");
out.write(" <input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" alt=\"PayPal - The safer, easier way to pay online!\" style=\"float :right\" onclick=\"window.location='paypal.jsp?cur=");
out.print(curCurrency);
out.write("';\"/>\n");
out.write(" <img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">\n");
out.write(" </div></td>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" </form>\n");
out.write(" <!--<input id=\"appel\" type=\"button\" value=\"Afrekenen\" onclick=\"window.location='paypal.jsp';\" />\n");
out.write(" -->\n");
out.write(" \n");
out.write(" \n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}