<?php include('../fncr-geral/configuracao_geral.php');
@header("Content-Type: text/html; charset=ISO-8859-1",true);

$id_registro = $_GET['r'];
$id_registro = preg_replace("/[^0-9]/", "", $id_registro);

// Emails Vinculos
$sql_emails = $bd->getConexao()->prepare('
SELECT *, DATE_FORMAT(data,"%d/%m/%Y") AS data_envio, DATE_FORMAT(data,"%H:%i") AS hora_envio FROM clubes_emails WHERE id_registro = :id_registro AND tipo = 7 ORDER BY data ASC');
$sql_emails->bindValue(':id_registro', $id_registro, PDO::PARAM_STR);
if( $sql_emails->execute() ) { $resul_emails = $sql_emails->fetchall(PDO::FETCH_ASSOC);}

?>
<div class="row">
  <div class="col-lg-12">
    <section class="panel">
      <table class="table table-striped m-b-none text-small">
        <thead>
        <tr>
          <th class="text-center" width="150">Envio das Credenciais ao clube</th>
        </tr>
        </thead>
        <tbody>
          <tr>
            <td class="text-center"><a data-toggle="modal" href="#modal_email_vinculo_send" data-backdrop="static" data-tipo="1" data-id_registro="<?php echo $id_registro?>" class="btn btn-inverse btn-xs">Enviar</a></td>
          </tr>
        </tbody>
      </table>
    </section>

    <section class="panel">
      <table class="table table-striped m-b-none text-small">
        <thead>
        <tr>
          <th width="100" class="text-center">Data</th>
          <th width="100" class="text-center">Hora</th>
          <th class="text-center">E-mail</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach($resul_emails as $l){ ?>
          <tr>
            <td class="text-center"><?php echo $l['data_envio']?></td>
            <td class="text-center"><?php echo $l['hora_envio']?></td>
            <td class="text-center"><?php echo $l['email']?></td>
          </tr>
        <?php } ?>
        </tbody>
      </table>
    </section>

  </div>
</div>
<?php $bd = null; $bd_fn = null;?>