<?php 
	$this->load->view('productos/producto_nav');
?>
<ul class="list-group">
	<li class="list-group-item">
		<h2><?php echo $producto['nombre']; ?></h2>
		<ul class="nav nav-pills alt-pills float-right mini-labels">
			<form method="get">
				<li class="nav-item float-left mr-3">
					<label>Canal de Venta</label>
					<select name ="id_canal" class="form-control filtro-id-canal" onchange="this.form.submit()">
					<?php
					echo '<option value="0">Todos</option>';
					foreach ($canales as $k => $v) {
						$selected = '';
						if (!empty($_GET['id_canal'])) {
							if ($_GET['id_canal'] == $k) {
								$selected =' selected="selected"';
							}
						}
						echo '<option value="' . $k . '"' . $selected . '>' . $v . '</option>';
					}
					?>
					</select>
				</li>
				<li class="nav-item float-left mr-3">
					<label>Transportista</label>
					<select name ="id_transportista" class="form-control filtro-id-transportista" onchange="this.form.submit()">
						<?php
							echo '<option value="0">Todos</option>';
							foreach ($transportistas_disponibles as $k => $v) {
								$selected = '';
								if (!empty($_GET['id_transportista'])) {
									if ($_GET['id_transportista'] == $k) {
										$selected =' selected="selected"';
									}
								}
								echo '<option value="' . $k . '"' . $selected . '>' . $v . '</option>';
							}
						?>
					</select>
				</li>
			</form>
		</ul>
	</li>
	<li class="list-group-item">
		<h4>Ventas
			<?php /*
			<span class="badge badge-pill badge-success" data-toggle="tooltip" title="Total Vendido"><?php echo clp($producto['total_ganado']); ?></span>
			<span class="badge badge-pill badge-primary" data-toggle="tooltip" title="Ventas"><?php echo count($producto['ventas']); ?></span>
			<span class="badge badge-pill badge-info" data-toggle="tooltip" title="Unidades Vendidas"><?php echo $producto['vendidos']; ?></span>
			<span class="badge badge-pill badge-warning" data-toggle="tooltip" title="Unidades Reservadas"><?php echo $producto['unidades_reservadas']; ?></span>
			*/ ?>
		</h4>
		<div>
		<?php
			foreach($ventas as $v) {
				$data['v'] = $v;
				$this->load->view('ventas/single', $data);
			}
		?>
		</div>
		<div class="row paginacion">
			<div class="info col-12 col-md-6">
				<?php echo $paginacion['info']; ?>
			</div>
			<div class="col-12 col-md-6">
				<?php echo $paginacion['links']; ?>
			</div>
		</div>
	</li>
</ul>

<?php $this->load->view('ventas/modal'); ?>
<script src="<?php echo js('ventas.js'); ?>"></script>