<ul class="list-group">
	<li class="list-group-item">
		<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>
		<?php 
			if ($_SESSION['usuario']['admin']) {
			?>
			<a type="button" class="btn btn-success btn-sm" href="/clientes/ranking/<?php echo date('Ym'); ?>">
				<i class="fas fa-trophy"></i> Ranking
			</a>
			<?php
			} 
		?>
	</li>
<?php
if(!empty($clientes)) {
	$current_char = '';
	foreach($clientes as $c) {

		$c['char'] = substr(normaliza($c['nombre']), 0, 1);
		if ($current_char != $c['char']) {
			if ($current_char != '') {
				echo '</div></li>';
			}
			$current_char = $c['char'];
			?>
			<li class="list-group-item">
				<h4 class="char clickable" data-toggle="collapse" href="#collapse<?php echo $c['char']?>"><?php echo strtoupper($c['char']); ?></h4>
				<div class="collapse" id="collapse<?php echo $c['char']; ?>">
		<?php
		}
		$data['c'] = $c;
		$this->load->view('clientes/single', $data);
	}
	?>
	</div></li>
	<?php
}
else {
	?>
	<li>A&uacute;n no hay clientes</li>
	<?php
}
echo '</ul>';
?>

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