<?php include "includes/header.php";?>

<?php include "includes/navbar.php";?>

  <div id="wrapper">

    <!-- Sidebar -->
   <?php include "includes/sidebar.php";?>

    <div id="content-wrapper">

      <div class="container-fluid">

        <!-- Breadcrumbs-->
        <ol class="breadcrumb">
          <li class="breadcrumb-item">
            <a href="#">Ola</a>
          </li>
          <li class="breadcrumb-item active"><?php echo $_SESSION['nome'];?></li>
        </ol>

        <!-- Icon Cards-->
        <div class="row">
		      <div class="container">

         
             
 
 <br> <br>
 <div class="container-fluid">

<!-- Breadcrumbs-->

<!-- DataTables Example -->
<div class="card mb-3">
  <div class="card-header">
    <i class="fas fa-table"></i>
    <b>Comprovativos de pagamentos de clientes</b></div>
  <div class="card-body">
    <div class="table-responsive">
      <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
        <thead>
          <tr>
            <th>Item</th>
            <th>Cliente</th>
             <th>Valor pago</th>
              <th>Comprovativo</th>
              <th>Usuario</th>
              <th>Data</th>
          </tr>
        </thead>
       
        <tbody>
            
          <?php 
          $item =1;
          $sqlHistorico = $database->query("SELECT cp.*,cli.* FROM comprovativos cp INNER JOIN clientes cli ON cp.id_cliente=cli.id_cliente");
          while($row = $database->fetch_assoc($sqlHistorico)){
            ?>
           <tr>   
            <td><?php echo $item++;?></td>
            <td><?php echo $row['nome_cliente'];?></td>
             <td><?php echo number_format((float)$row['valor_pago'],2,",",".");?></td>
             <td><a href="#" onclick="verArquivo('comprovativos/<?php echo $row['recibo'];?>')" class="btn btn-sm btn-info">Ver</a></td>
              <td><?php echo $row['usuario'];?></td>
              <td><?php echo $row['data'];?></td>

        </tr>
        
        <?php }
          
          ?>  

         
      
   
               </tbody>
      </table>
    </div>
  </div>
  <div class="card-footer small text-muted">Jonas Dinis Chambela</div>
</div>



</div>

        </div>
      </div>
      <!-- /.container-fluid -->
		  </div>

		 </div>
        
        
        </div>

     
        
<style>
.envelope-fechado{

    animation:piscar 1s infinite;

}

@keyframes piscar{

0%{

opacity:1;

}

50%{

opacity:.3;

}

100%{

opacity:1;

}

}
</style>

<script>

function marcarLida(id,icone){

    fetch("ler_nota.php",{

        method:"POST",

        headers:{
            "Content-Type":"application/x-www-form-urlencoded"
        },

        body:"id="+id

    });

    icone.classList.remove("fa-envelope");
    icone.classList.remove("text-warning");
    icone.classList.remove("envelope-fechado");

    icone.classList.add("fa-envelope-open");
    icone.classList.add("text-success");

}

function verArquivo(caminho) {
  document.getElementById('iframeArquivo').src = caminho;
  $('#verArquivoModal').modal('show');
}

</script>
      <!-- /.container-fluid -->
<!-- Modal para visualização -->
<div class="modal fade" id="verArquivoModal" tabindex="-1" role="dialog" aria-labelledby="verArquivoModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-xl" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="verArquivoModalLabel">Visualizar Arquivo</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Fechar">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <iframe id="iframeArquivo" src="" width="100%" height="600px" style="border:none;"></iframe>
      </div>
    </div>
  </div>
</div>
      <!-- Sticky Footer -->
      <?php include "includes/footer.php";?>

    </div>
    <!-- /.content-wrapper -->

  </div>
  <!-- /#wrapper -->

  <!-- Scroll to Top Button-->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <!-- Logout Modal-->
 <?php include "includes/logout_modal.php";?>
 <?php include "includes/sweatscripFooter.php";?>

