<%

/**
 * JaDOrT: JASMINe Deployment Orchestration Tool
 * Copyright (C) 2008 Bull S.A.S.
 * Copyright (C) 2008 France Telecom R&D
 * Contact: jasmine@ow2.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: store.jsp 2206 2008-09-05 09:33:33Z alitokmen $
 * --------------------------------------------------------------------------
 */

%>
<%@page import="java.util.*"%>
<%

Map<String, Integer> products = (Map<String, Integer>) request.getAttribute("products");
Map<String, Integer> cartItems = (Map<String, Integer>) request.getAttribute("cartItems");
Integer cartValue = (Integer) request.getAttribute("cartValue");

%>
<html>
<head>
<title>MyStore</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
BODY {
	background:#FEFEFE;
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
	cursor:default;
}

input {
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
}

select {
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
}

TD {
	font-size:13
}

H1 {
	font-size:20
}

A {
	text-decoration:none;
	color:#2B5796
}

A:hover {
	color:#FF6262;
	text-decoration:underline
}
</style>
</head>
<body>
<h1>Welcome to MyStore !</h1>
Your cart has <b><%= cartValue %> &euro;</b> of products<br/><br/>
<b>Here are the products in our store :</b>
<ul>
<%

for(Map.Entry<String, Integer> product : products.entrySet()) {
	out.println("<li><b>" + product.getKey() + "</b>: " + product.getValue() + " &euro; &nbsp; <a href=\"./?buyItem=" + product.getKey() + "\">Add one to your cart</a></li>");
}

%>
</ul>
<b>Here are the contents of your cart :</b>
<ul>
<%

for(Map.Entry<String, Integer> cartItem : cartItems.entrySet()) {
	out.println("<li><b>" + cartItem.getKey() + "</b>: you bought " + cartItem.getValue() + " &nbsp; <a href=\"./?removeItem=" + cartItem.getKey() + "\">Remove one from your cart</a></li>");
}

%>
</ul>
</body>
</html>