<div class="row justify-content-center">
	<div class="col-10 col-md-12">
		<h3 class="headline">Dine ordrer</h3><span class="line margin-bottom-35"></span><div class="clearfix"></div>
	</div>
</div>

<div class="row justify-content-center">
	<div class="col-10 col-md-12">

		<table class="cart-table responsive-table">

			<tr>
				<th>Ordrenummer</th>
				<th>Produkter</th>
				<th>Dato</th>
				<th>Status</th>
				<th class="text-right">Beløb</th>
				<th class="text-right">Betalt</th>
			</tr>

			<{section name="i" loop=$my_orders}>
				<tr>
					<td class="align-top"><a href="<{$my_orders[i]->getPublicUrl()|escape}>">
						<{$my_orders[i]->getWebshopOrderId()|escape}></a>
					</td>

					<td style="width:300px;">
						<{assign var="products" value=$my_orders[i]->getOrderProducts()}>
						<{section name="j" loop=$products}>
							<div class="clearfix mb-2">
								<{assign var="p" value=$products[j]->getProduct()}>

								<{assign var="image" value=$p->getImage()}>
								<{if $image}>
									<a href="<{$p->getRemoteUrl()|escape}>"><img src="<{$image->getSrc(50, 50, 'box')}>" alt="" class="rounded pull-left mr-3"></a>
								<{/if}>

								<a href="<{$p->getRemoteUrl()|escape}>"><{$products[j]->getAmount()}> stk. <{$products[j]->getName()|escape}></a>

								<{assign var="attributes" value=$products[j]->getAttributes()}>
								<{if $attributes}>
									<ul>
										<{section name="k" loop=$attributes}>
											<li><{$attributes[k].name}>: <{$attributes[k].val}></li>
										<{/section}>
									</ul>
								<{/if}>

								<{assign var="file" value=$products[j]->getFile()}>
								<{if $file}>
									<p><strong>Download:</strong> <a href="<{$products[j]->getFileDownloadUrl()|escape}>"><{$file->filename|escape}></a></p>
								<{/if}>
							</div>
						<{/section}>

						<{if !$my_orders[i]->hasReviews() && $settings.settings.show_reviews}>
							<p><a href="<{$my_orders[i]->getReviewUrl()|escape}>" class="btn btn-primary button color proceed">Skriv anmeldelse</a></p>
						<{/if}>

						<{if $webshop->useReturnCenter() && !$my_orders[i]->getIsCreditNote()}>
							<p><a href="<{$my_orders[i]->getReturnUrl()|escape}>">Retuner varer</a></p>
						<{/if}>

					</td>
					<td class="align-top"><{$my_orders[i]->getTime()|date_format:"%d.%m.%Y %H:%M:%S"}></td>
					<td class="align-top">
						<{if $my_orders[i]->getStatus() == "new"}>
							<{t}>Ubehandlet<{/t}>
						<{elseif $my_orders[i]->getStatus() == "process"}>
							<{t}>Igang<{/t}>
						<{elseif $my_orders[i]->getStatus() == "pending"}>
							<{t}>Venter<{/t}>
						<{elseif $my_orders[i]->getStatus() == "ready"}>
							<{t}>Klar<{/t}>
						<{elseif $my_orders[i]->getStatus() == "sent"}>
							<{t}>Sendt<{/t}>
						<{elseif $my_orders[i]->getStatus() == "credit"}>
							<{t}>Kreditnota<{/t}>
						<{elseif $my_orders[i]->getStatus() == "cancelled"}>
							<{t}>Annulleret<{/t}>
						<{else}>
							<{$my_orders[i]->getStatus()|escape}>
						<{/if}>

						<{if $my_orders[i]->getTrackingNumbers()}>
							<p>
								<{assign var="shipping" value=$my_orders[i]->getShipping()}>
								<{assign var="tracking_numbers" value=$my_orders[i]->getTrackingNumbers()}>

								<strong><{t}>Følg din ordre hos<{/t}> <{$shipping->getName()|escape}>:</strong><br>

								<{section name="k" loop=$tracking_numbers}>
									<{if $shipping && $shipping->getTrackingUrl()}>
										<a href="<{$shipping->getTrackingUrl($tracking_numbers[k])|escape}>" target="_blank"><{$tracking_numbers[k]|escape}></a><br>
									<{else}>
										<{$tracking_numbers[k]|escape}><{if !$smarty.section.k.last}>,<{/if}>
									<{/if}>
								<{/section}>
							</p>
						<{/if}>
					</td>

					<td class="text-right align-top"><{$my_orders[i]->getTotalPrice()|number_format:2:",":"."}> <{$webshop->getCurrency()}></td>
					<td class="text-right align-top">
						<{if $my_orders[i]->getIsPaid()}>
							Ja
						<{else}>
							<a class="btn btn-primary button color proceed" href="<{$my_orders[i]->getPaymentUrl()|escape}>">Nej, betal nu</a>
						<{/if}>
					</td>
				</tr>
			<{/section}>

		</table>

		<br>

		<div class="clearfix"></div>

	</div>
</div>