<%@page import="agilpizza.modelo.Pedido"%>
<%@include file="header.jsp"%>
<jsp:useBean id="pedido" scope="session" class="agilpizza.modelo.Pedido"/>

<%@page import="agilpizza.modelo.Pizza"%>
<%@page import="agilpizza.modelo.Bebida"%>
<%@page import="agilpizza.modelo.Ingrediente"%>

<h2>Seu Pedido</h2>

<table border="1">
	<thead>
		<tr>
			<td style="font-weight: bold">Pizzas</td>
			<td style="font-weight: bold">Massa</td>
			<td style="font-weight: bold">Ingredientes</td>
			<td style="font-weight: bold">Preço</td>
		</tr>
	</thead>
	<tbody>
		<% for(Pizza pizza: pedido.getPizzas()) {%>
		<tr>
			<td><%= pizza.getNome() %></td>
			<td><%= pizza.getTipoMassa() %></td>
			<td>
			<table>
				<% for(Ingrediente ingrediente: pizza.getIngredientes()) { %>
				<tr>
					<td style="font-size: 10px"><%= ingrediente.getNome() %></td>
				</tr>
				<% } %>
				<tr>
				<%if (pizza.temBorda()){%>
				<td style="font-size: 10px">Borda	<%= pizza.getBorda()%></td>
				<%} %>
				</tr>
			</table>
			</td>
			<td>R$ <%= String.format("%.2f", pizza.getPreco())%></td>
			<td><a href="RemoverPizza?id=<%= pizza.getId() %>">Remover do Pedido</a></td>
		</tr>
		<%
		}
		%>
	</tbody>
</table>
<br/>
<br/>
<table border="1">
	<thead>
		<tr>
			<td style="font-weight: bold">Bebidas</td>
			<td style="font-weight: bold">Tamanho</td>
			<td style="font-weight: bold">Preço</td>
		</tr>
	</thead>
	<tbody>
		<% for(Bebida bebida: pedido.getBebidas()) {%>
		<tr>
			<td><%=bebida.getNome()%></td>
			<td><%=bebida.getTamanho()%></td>
			<td>R$ <%=String.format("%.2f", bebida.getPreco())%></td>
			<td><a href="RemoverBebida?id=<%= bebida.getId() %>">Remover do Pedido</a></td>
		</tr>
		<%
		}
		%>
	</tbody>
</table>

<br>
<hr>
<br>

<font size="+2">
<b>Preço Total do Pedido: R$ <%=String.format("%.2f", pedido.getPrecoTotal())%></b>
</font>

<%@include file="footer.jsp"%>
