<ul class="list-group">
	<li class="list-group-item">
		<div class="mt-2">
			<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modalProducto" data-id="0">
				<i class="fas fa-plus"></i> Agregar
			</button>
			<?php
					if ($_SESSION['usuario']['admin']) {
					?>
					<span class="badge badge-pill badge-danger" title="Total Comprado"><?php echo clp($totales[0]['compras']);?></span>
					<span class="badge badge-pill badge-warning" title="Costo Stock Actual"><?php echo clp($totales[0]['costo_stock']);?></span>
					<span class="badge badge-pill badge-info" title="Precio Venta Stock Actual"><?php echo clp($totales[0]['pvp_stock']); ?></span>
					<span class="badge badge-pill badge-primary" title="Total Vendido"><?php echo clp($totales[0]['valor_ventas']); ?></span>
					<span class="badge badge-pill badge-success" title="Utilidad Estimada"><?php echo clp($totales[0]['utilidad_ventas']); ?></span>
				<?php
				}
			?>
		</div>
	</li>
<?php

if(!empty($productos)) {
	foreach($productos as $k => $proveedor) {
		?>
		<li class="list-group-item">
			<h4 class="proveedor clickable" data-toggle="collapse" href="#collapse<?php echo $k;?>"><?php echo $proveedores[$k];?>
				<?php
					if ($_SESSION['usuario']['admin']) {
					?>
						<span class="badge badge-pill badge-danger" title="Total Comprado"><?php echo clp($totales[$k]['compras']);?></span>
						<span class="badge badge-pill badge-warning" title="Costo Stock Actual"><?php echo clp($totales[$k]['costo_stock']);?></span>
						<span class="badge badge-pill badge-info" title="Precio Venta Stock Actual"><?php echo clp($totales[$k]['pvp_stock']); ?></span>
						<span class="badge badge-pill badge-primary" title="Total Vendido"><?php echo clp($totales[$k]['valor_ventas']); ?></span>
						<span class="badge badge-pill badge-success" title="Utilidad Estimada"><?php echo clp($totales[$k]['utilidad_ventas']); ?></span>
					<?php
					}
				?>
			</h4>
			<div class="collapse" id="collapse<?php echo $k; ?>">
				<?php
				foreach($proveedor as $p) {
					$data['p'] = $p;
					$this->load->view('productos/single', $data);
				}
				?>
			</div>
		</li>
		<?php
	}
}
else {
	?>
	<li class="list-group-item">A&uacute;n no hay ventas</li>
	<?php
}
?>
</ul>

<?php $this->load->view('productos/modal'); ?>

<script src="<?php echo js('productos.js'); ?>"></script>
