<?php 
	$this->load->view('productos/producto_nav');
?>
<ul class="list-group">
	<li class="list-group-item">
		<h2><?php echo $producto['nombre']; ?></h2>
	</li>
	<li class="list-group-item">
		<div class="table-responsive">
			<h4>Ventas PS</h4>
			<table class="table table-striped">
				<thead>
					<tr>
						<th class="text-center">ID PS</th>
						<th class="text-center">Fecha</th>
						<th>Cliente</th>
						<th class="text-center">Cantidad</th>
						<th class="text-center">Estado</th>
						<th class="text-center">Ver</th>
					</tr>
				</thead>
				<tbody>
					<?php
					foreach($ventas_ps as $v) {
						?>
						<tr>
							<td class="text-center">
								<span class="badge badge-pill badge-primary">
									<?php echo $v['id_order']; ?>
								</span>
							</td>
							<td class="text-center">
								<?php echo fecha($v['date_add']); ?>
							</td>
							<td>
								<?php
									$v['cliente'] = $v['firstname'] . ' ' . $v['lastname'];
									echo (!empty($v['id_cliente']) ? '<a target="_blank" href="/clientes/view/' . $v['id_cliente'] . '">' . $v['cliente'] . '</a>' : $v['cliente']);
								?>
							</td>
							<td class="text-center">
								<?php echo $v['product_quantity']; ?>
							</td>
							<td class="text-center">
								<?php echo $v['state']; ?>
							</td>
							<td class="text-center">
								<a href="https://dementegames.cl/admin161m0dq8h/index.php?controller=AdminOrders&id_order=<?php echo $v['id_order']; ?>&vieworder&token=<?php echo !empty($_SESSION['token']) ? $_SESSION['token'] : '';?>" target="_blank"><?php echo $v['id_order']; ?></a>
							</td>
						</tr>
					<?php
					}
					?>
				</tbody>
			</table>
		</div>
	</li>
</ul>