<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<table class="table table-bordered table-condensed" style="font-size: 8pt; ">
    <thead>
    <th>Data Cadastro</th>
    <th>#ID Transação</th>    
    <th>Detalhes</th>
    <th>Metodo de Pagamento</th>
    <th>Situação</th>
</thead>
<tbody>
    <?php
    foreach ($hist_planos as $hist_plano) {
        $adapter_hist_plano->set_hist_plano($hist_plano);
        $cancelar = ($hist_plano['status'] == 1 || $hist_plano['status'] == 2) ? "[" . anchor('planos/cancela_um/' . $hist_plano['id'], 'Cancelar', array('class' => 'cancel')) . "]" : "";
        ?>
        <tr>
            <td><?= date('d/m/Y', strtotime($hist_plano['data_cad'])) ?></td>
            <td><?= $hist_plano['id'] ?></td>
            <td><?= $hist_plano['detalhes']; ?></td>
            <td><?= $adapter_hist_plano->getPagamentoString(); ?></td>
            <td><?= $adapter_hist_plano->getSituacaoString() . " " . $cancelar; ?></td>
        </tr>
    <?php } ?>
</tbody>
</table>
<script>
    $(document).ready(function () {
        $('.cancel').janelaCentro({
            w: 400,
            h: 200,
            confirma: function () {
                return confirm('Deseja mesmo cancelar?');
            }
        });
    });
</script>