<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorator="/templates/layout">
  <head>
  	<title>Order display</title>
  </head>
<body>
<div layout:fragment="content">
	<div class="alert alert-error" th:if="${!errors.isEmpty()}" th:each="erro : ${errors}">
		<div th:text="${erro}"></div>		
	</div>
	<div th:unless="${!errors.isEmpty()}">
		<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>