<?php
$title = 'Мои заказы';
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/head.php');
?>
<div class="container theme-showcase" role="main">
	<div class="page-header">
		<h1>Мои заказы</h1>
	</div>
	<div class="row">
		<?
		$query = $db->query("SELECT * FROM `purchased` WHERE `id_user`='".$user['id']."' ORDER BY `status` ASC");
		if($query->num_rows == 0){
			?>
			<div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> Заказы отсутствуют!</div>
			<?
		}
		while($order = $query->fetch_assoc()){
			$product = $db->query("SELECT * FROM `products` WHERE `id`='".$order['id_product']."'")->fetch_assoc();
			?>
			<div class="well">
				<h2><?=outputNameProduct($order['id_product'], 1)?></h2>
				<b>Дата заказа:</b> <?=datef($order['date'])?><br>
				<b>Колличество:</b> <?=$order['col']?><br>
				<b>Стоимость:</b> <?=$product['price'] * $order['col']?><br>
				<b>Статус:</b> <?=statusOrder($order['id'])?>
			</div>
			<?
		}?>
	</div>
</div>
<?
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/foot.php');
?>