<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring3-3.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Order display</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap.min.css}"/>
    <link rel="stylesheet" href="" th:href="@{/resources/css/bootstrap-responsive.min.css}"/>
    <style type="text/css">
        body {
          padding-top: 20px;
          padding-bottom: 40px;
        }
        
        /* Custom container */
        .container-narrow {
          margin: 0 auto;
          max-width: 700px;
        }
        .container-narrow > hr {
          margin: 30px 0;
        }
        
        /* Main marketing message and sign up button */
        .jumbotron {
          margin: 60px 0;
          text-align: center;
        }
        .jumbotron h1 {
          font-size: 72px;
          line-height: 1;
        }
        .jumbotron .btn {
          font-size: 21px;
          padding: 14px 24px;
        }
        
        /* Supporting marketing content */
        .marketing {
          margin: 60px 0;
        }
        .marketing p + h4 {
          margin-top: 28px;
        }
        .promotional{
        	margin: auto;
        	width: 550px;
        }
        .promotional .pull-left{
        	padding-right: 10px;
        }
        .left-column table td, 
        .right-column table td{
        	width: 150px;
        	text-align: center;
        }
    </style>
</head>
<body>
<div class="container-narrow">

	<div class="masthead">
		<ul class="nav nav-pills pull-right">
		  <li><a th:href="@{${searchUrl}}">Search</a></li>
		  <li><a th:href="@{${shoppingCartUrl}}">Shopping cart</a></li>
		  <li><a th:href="@{${orderInquiryUrl}}">Order list</a></li>
		</ul>
		<h3 class="muted"><a href="/" th:href="@{/}"><img th:src="@{/resources/img/logo-CloudScale.png}" /></a></h3>
	</div>
	
	<hr />
	<div th:if="${errors}" class="alert alert-error" th:each="erro : ${errors}">
		<div th:text="${erro}"></div>		
	</div>
	<div th:unless="${errors}">
		<div th:if="${order}">
			<p>
				<strong>Order ID:</strong><span th:text="${order.OId}"></span>
			</p>
			<p>
				<strong>Order Placed on:</strong>
				<span th:text="${order.ODate}"></span>
			</p>
			<p>
				<strong>Shipping Type:</strong>
				<span th:text="${order.OShipType}"></span>
			</p>
			<p>
				<strong>Ship date:</strong>
				<span th:text="${order.OShipDate}"></span>
			</p>
			<p>
				<strong>Order subtotal:</strong>
				<span th:text="${order.OSubTotal}"></span>
			</p>
			<p>
				<strong>Order Tax:</strong>
				<span th:text="${order.OTax}"></span>
			</p>
			<p>
				<strong>Order Total:</strong>
				<span th:text="${order.OTotal}"></span>
			</p>
			
			<div class="pull-left" style="width: 400px">
				<strong>
					Bill To:<br/>
					<span th:text="${order.customer.CFname} + ' ' + ${order.customer.CLname}"></span><br />
				</strong>
				<br />
				<address>
					<span th:text="${order.addressByOShipAddrId.addrStreet1}"></span><br />
					<span th:text="${order.addressByOShipAddrId.addrStreet2}"></span><br />
					<span th:text="${order.addressByOShipAddrId.addrState} + ' ' + ${order.addressByOShipAddrId.addrZip}"></span><br />
					<span th:text="${order.addressByOShipAddrId.country.coName}"></span>
				</address>
				<br />
				Email: <span th:text="${order.customer.CEmail}"></span><br/>
				Phone: <span th:text=" ${order.customer.CPhone}"></span><br/>
				<br />
				Order status: <span th:text="${order.OStatus}"></span><br />
			</div>
			<div class="pull-left">
				<strong>
					Ship to: 
				</strong><br />
				<br />
				<address>
					<span th:text="${order.addressByOBillAddrId.addrStreet1}"></span><br />
					<span th:text="${order.addressByOBillAddrId.addrStreet2}"></span><br />
					<span th:text="${order.addressByOBillAddrId.addrState} + ' ' + ${order.addressByOBillAddrId.addrZip}"></span><br />
					<span th:text="${order.addressByOBillAddrId.country.coName}"></span><br />
				</address>
			</div>
			
			<table class="table">
				<thead>
					<tr>
						<th>
							Item #
						</th>
						<th>
							Title
						</th>
						<th>
							Cost
						</th>
						<th>
							QTY
						</th>
						<th>
							Discount
						</th>
						<th>
							Comment
						</th>
					</tr>	
				</thead>
				<tbody>
					<tr th:each="o : ${orderLines}">
						<td th:text="${o.olId}"></td>
						<td th:text="${o.item.ITitle}"></td>
						<td th:text="${o.item.ICost}"></td>
						<td th:text="${o.olQty}"></td>
						<td th:text="${o.olDiscount}"></td>
						<td th:text="${o.olComment}"></td>
					</tr>
				</tbody>
			</table> 
		</div>
	</div>
</div>
</body>
</html>