<ul class="list-group">
	<li class="list-group-item">
		<?php
			$data['a'] = 'i';
			$this->load->view('ventas/navigation', $data);
		?>
	</li>
<?php
$data['clientes'] = $clientes;
if(!empty($ventas)) {
	//$first = true;
	?>
	<li class="list-group-item">
		<div>
			<?php
			foreach($ventas as $k => $v) {
				?>
					<div class="row border rounded pt-2 pb-2 mb-1">
						<div class="col-5">
							<h5>
								<span class="ps-id badge badge-pill badge-info" data-ps-id="<?php echo $v['id_order'];?>"><?php echo $v['id_order'];?></span>
									<?php
										// Link a Cliente
										$v['cliente'] = $v['firstname'] . ' ' . $v['lastname'];
										echo (!empty($v['id_cliente']) ? '<a target="_blank" href="/clientes/view/' . $v['id_cliente'] . '">' . $clientes[$v['id_cliente']] . '</a>' : $v['cliente']);
										if ($v['id_default_group'] == 2) {
											echo ' (Cuenta Invitado)';
										}
									?>
							</h5>
						</div>
						<div class="col-2">
							<?php echo $v['date_add'];?>
						</div>
						<div class="col-2">
							<?php echo $v['carrier_name']; ?>
						</div>
						<div class="col-2">
							<span class="estado-venta badge badge-pill" style="background-color: <?php echo $estados_ventas[$v['current_state']]['fondo'];?>; color: <?php echo $estados_ventas[$v['current_state']]['color'];?>;">
								<?php echo $estados_ventas[$v['current_state']]['nombre']; ?>
							</span>
						</div>
						<div class="col-1 text-right">
							<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modalVenta" data-ps-id="<?php echo $v['id_order']; ?>">
								<i class="fas fa-plus"></i>
							</button>
						</div>
					</div>
				<?php
			}
			?>
		</div>
	</li>
	<?php
}
else {
	?>
	<li>A&uacute;n no hay ventas</li>
	<?php
}
?>
</ul>

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