<ul class="list-group">
	<li class="list-group-item">
		<div class="row">
			<div class="col-12 col-md-8">
				<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modalCliente" data-id="0">
					<i class="fas fa-plus"></i> Agregar
				</button>
			</div>
			<div class="col-12 col-md-4">
				<form method="get">
					<select name ="periodo" class="form-control select-periodo" onchange="this.form.submit()">
							<option value="0">Todos los tiempos</option>
						<?php
							foreach ($meses_ventas as $k => $v) {
								$selected = '';
								if (!empty($periodo)) {
									if ($periodo == $v) {
										$selected =' selected="selected"';
									}
								}
								echo '<option value="' . $v . '"' . $selected . '>' . mtt($v) . '</option>';
							}
						?>
					</select>
				</form>
			</div>
		</div>
	</li>
<?php
if(!empty($clientes)) {
	?>
	<li class="list-group-item">
		<h4 class="char"><?php echo mtt($periodo); ?> - Total del periodo <?php echo clp($total); ?></h4>
		<div>
			<?php
			$position = 1;
			$data['total'] = $total;
			foreach($clientes as $c) {
				$c['position'] = $position;
				$data['c'] = $c;
				$this->load->view('clientes/single', $data);
				$position++;
			}
			?>
		</div>
	</li>
	<?php
}
else {
	?>
	<li>A&uacute;n no hay clientes con compras para este periodo</li>
	<?php
}
echo '</ul>';
?>

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

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