<vn>
<vn-lot-query id="params">
	<vn-spec name="ticket" type="Number"/>
</vn-lot-query>
<db-lot id="ticket-form" lot="params" v-model="ticket">
	CALL myTicket_get(#ticket)
</db-lot>
<div id="title">
	<h1><t>OrderDetail</t></h1>
</div>
<div id="actions" class="action-bar">
	<htk-bar-button
		icon="print"
		tip="_Print delivery note"
		on-click="this.onPrintClick()"/>
</div>
<div id="form" class="hedera-ticket">
	<div class="box vn-w-sm vn-pa-lg">
		<htk-loader class="head" form="ticket-form">
			<h5>#{{ticket.id}}</h5>
			<div>
				<h6><t>ShippingInformation</t></h6>
				<p>
					<t>Preparation</t> {{Vn.Value.format(ticket.shipped, '%D')}}
				</p>
				<p>
					<t>Delivery</t> {{Vn.Value.format(ticket.landed, '%D')}}
				</p>
				<p>
					{{_(ticket.method != 'PICKUP' ? 'Agency' : 'Warehouse')}} {{ticket.agency}}
				</p>
			</div>
			<div class="address">
				<h6><t>DeliveryAddress</t></h6>
				<p>{{ticket.nickname}}</p>
				<p>{{ticket.street}}</p>
				<p>{{ticket.postalCode}} {{ticket.city}} ({{ticket.province}})</p>
			</div>
			<div class="total">
				<p class="important total">
					<t>Total</t> {{Vn.Value.format(ticket.taxBase, '%.2d€')}}
				</p>
				<p class="important total">
					<t>Total + tax</t> {{Vn.Value.format(ticket.total, '%.2d€')}}
				</p>
			</div>
		</htk-loader>
		<htk-repeater form-id="iter" renderer="repeaterFunc">
			<db-model
				property="model"
				id="movements"
				lot="params">
				CALL myTicket_getRows(#ticket)
			</db-model>
			<custom>
				<div class="line">
					<htk-image
						value="{{iter.image}}"
						stamp-column="updated"
						class="photo"
						directory="catalog"
						subdir="200x200"
						full-dir="1600x900"/>
					<div class="info">
						<h2>{{iter.concept}}</h2>
						<p class="tags">
							{{iter.value5}} {{iter.value6}} {{iter.value7}}
						</p>
						<p class="subtotal">
							<span class="discount" id="discount">
								{{Vn.Value.format(this.discountSubtotal(iter), '%.2d€')}} - 
								{{Vn.Value.format(iter.discount, '%.0d%')}} = 
							</span>
							{{Vn.Value.format(this.subtotal(iter), '%.2d€')}}
						</p>
						<p class="amount">
							{{iter.quantity}} x {{Vn.Value.format(iter.price, '%.2d€')}}
						</p>
					</div>
				</div>
			</custom>
		</htk-repeater>
		<htk-repeater form-id="iter" id="services" class="packages">
			<db-model
				property="model"
				on-status-changed="onServicesChanged"
				lot="params">
				CALL myTicket_getServices(#ticket)
			</db-model>
			<custom>
				<div class="line">
					<div class="info">
						<h2>{{iter.description}}</h2>
						<p class="amount">
							{{iter.quantity}} x {{Vn.Value.format(iter.price, '%.2d€')}}
						</p>
						<p class="subtotal">
							{{Vn.Value.format(iter.quantity * iter.price, '%.2d€')}}
						</p>
					</div>
					<div class="clear"/>
				</div>
			</custom>
		</htk-repeater>
		<htk-repeater form-id="iter" id="packages" class="packages">
			<db-model
				property="model"
				on-status-changed="onPackagesChanged"
				lot="params">
				CALL myTicket_getPackages(#ticket)
			</db-model>
			<custom>
				<div class="line">
					<htk-image
						value="{{iter.image}}"
						class="photo"
						directory="catalog"
						subdir="200x200"
						full-dir="1600x900"/>
					<div class="info">
						<h2>{{iter.name}}</h2>
						<p>#{{iter.id}}</p>
						<p class="amount">{{iter.quantity}}</p>
					</div>
					<div class="clear"/>
				</div>
			</custom>
		</htk-repeater>
	</div>
</div>
</vn>
