<ul class="list-group">
	<li class="list-group-item">
		<div class="row filtros-puntos mini-labels">
			<div class="col-12 col-md-4">
				<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modalPuntos" data-id="0"><i class="fas fa-plus"></i> Cargar Puntos</h4>

			</div>
		</div>
	</li>
	<li class="list-group-item">
		<div class="table-responsive">
			<table class="table table-striped">
				<thead>
					<tr>
						<th class="text-center">ID</th>
						<th>Cliente</th>
						<th>Descripción</th>
						<th class="text-center">Puntos</th>
						<th class="text-center">Fecha carga</th>
						<th class="text-center">Estado</th>
						<th>Cargador</th>
						<th style="min-width: 130px;">Acciones</th>
					</tr>
				</thead>
				<tbody>
					<?php
					if (!empty($puntos)) {
						foreach($puntos as $p) {
							?>
							<tr id="punto-<?php echo $p['id_loyalty']; ?>">
								<td class="text-center"><?php echo $p['id_loyalty']; ?></td>
								<td><?php echo $clientes[$p['id_customer']]; ?></td>
								<td><?php echo $p['description']; ?></td>
								<td class="text-center"><?php echo $p['points']; ?></td>
								<td class="text-center"><?php echo fechaHora($p['date_add']); ?></td>
								<td class="text-center"><?php echo $estados_puntos[$p['id_loyalty_state']]['nombre']; ?></td>
								<td><?php echo $usuarios[$p['id_creador']]; ?></td>
								<td>
									<?php
									if (in_array($p['id_loyalty_state'], [2])) {
										?>
										<button type="button" class="btn btn-primary btn-sm tt" title="Editar" data-toggle="modal" data-target="#modalPuntos" data-id="<?php echo $p['id_loyalty']; ?>">
											<i class="fas fa-pencil-alt"></i>
										</button>
									<?php
									}
									?>
								</td>
							</tr>
						<?php
						}
					}
					else {
						echo '<tr><td colspan="9" class="text-center">No hay Puntos cargados</td></tr>';
					}
					?>
				</tbody>
			</table>
		</div>
	</li>
</ul>


<?php $this->load->view('puntos/modal_puntos'); ?>

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