<vn>
<vn-group>
	<db-form id="order-form" on-ready="onOrderReady">
		<db-model>
			SELECT o.id, o.date_send, o.note, o.company_id,
				ag.description agency, v.code method, c.credit,			
				ad.consignee, ad.zip_code, ad.city, ad.name address
				FROM basket o
					JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id
					LEFT JOIN address_view ad ON ad.id = o.address_id
					JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
					JOIN customer_view c
		</db-model>
	</db-form>
	<db-form id="total-form" on-ready="onImportReady">
		<db-model result-index="1">
			CALL basket_get_vat ();
			SELECT
				IFNULL(SUM(tax_base), 0) tax_base,
				IFNULL(SUM(vat + surcharge), 0) vat
				FROM t_order_vat; 
			DROP TEMPORARY TABLE t_order_vat;
		</db-model>
	</db-form>
	<db-query id="confirm-query" on-ready="onConfirm">
		CALL basket_confirm ();
		SELECT customer_get_debt();
	</db-query>
</vn-group>
<div id="title">
	<h1><t>OrderSummary</t></h1>
</div>
<div id="form" class="confirm">
	<div class="box">
		<div class="form">
			<div class="section">
				<p>
					<t>Arrival</t> 
					<htk-text format="_%A, %e of %B" form="order-form" column="date_send"/>
				</p>
				<p class="small">
					<span id="method"><t>Agency</t></span> 
					<htk-text form="order-form" column="agency"/>
				</p>
			</div>
			<div id="address" class="section">
				<p>
					<htk-text form="order-form" column="consignee"/>
				</p>
				<p class="small">
					<htk-text form="order-form" column="address"/>
				</p>
				<p class="small">
					<htk-text form="order-form" column="zip_code"/>, 
					<htk-text form="order-form" column="city"/>
				</p>
			</div>
			<div class="section">
				<p>
					<t>Total</t> 
					<htk-text id="total" format="%.2d€"/>
				</p>
				<p class="small">
					(<t>TaxBase</t> <htk-text form="total-form" column="tax_base" format="%.2d€"/> +
					<t>VAT</t> <htk-text form="total-form" column="vat" format="%.2d€"/>)
				</p>
			</div>
			<div class="button-bar">
				<button on-click="onModifyClick" id="modify" class="thin modify-order">
					<t>Modify</t>
				</button>
				<button on-click="onConfirmClick" id="confirm" class="thin confirm-order">
					<t>Confirm</t>
				</button>
				<div class="clear"/>
			</div>
		</div>
	</div>
</div>
<div id="success-dialog" class="success-dialog">
	<div>
		<img src="image/ok.svg" alt="_Ok"/>
		<p><t>OrderPlacedSuccessfully</t></p>
		<div class="clear"/>
	</div>
	<button on-click="onAcceptClick" class="thin confirm-order">
		<t>Accept</t>
	</button>
	<div class="clear"/>
</div>
</vn>
