<?php session_start();
require_once 'app/Cliente.php';
require_once '../script_php/conexao.php';

$dados = Cliente::listarClientes($conexao);
$cadastrados = Cliente::contarCliente($conexao);
?>

<!doctype html>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>remoto crm</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <link href='css.css' rel="stylesheet">

</head>
  <body>
  
<!--sessao cabecalho-->
<div class='cabecalho'>

<h6 class="textocabecalho">

<a href="#">
<img src="img/logo.png" alt="" width='65px';>
</a>

CADASTRO DE PROFISSIONAIS </h6>

</div>
<!-- fim de uma sessao -->

<div class='campo'>


<a href="index.php?id=1" title='NOVO PROFISSIONAL'>
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-person-add text-info " viewBox="0 0 16 16">
  <path d="M12.5 16a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7m.5-5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0m-2-6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M8 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4"/>
  <path d="M8.256 14a4.5 4.5 0 0 1-.229-1.004H3c.001-.246.154-.986.832-1.664C4.484 10.68 5.711 10 8 10q.39 0 .74.025c.226-.341.496-.65.804-.918Q8.844 9.002 8 9c-5 0-6 3-6 4s1 1 1 1z"/>
</svg>
</a>


<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" class="bi bi-search lupa" viewBox="0 0 16 16">
  <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>
</svg>

<hr>

<p></p>
<h6>
<b>
 <?php echo $cadastrados;?>
</b>

PROFISSIONAIS CADASTRADOS

</h6>
</div>

<?php 
foreach ($dados as $dado){

?>

<!--sessao campo-->
<section class='campo'>


 <!--mensagens na tela-->
 <?php if (isset($_SESSION["msg"])) {
      echo $_SESSION["msg"];
      unset($_SESSION["msg"]);
  }?>

  
<div>
<b>NÚMERO : <?php echo $dado['id']?></b> <br>
<b> TELEFONE:</b> <?php echo $dado['telefone'];?> <br>
<b> NOME: </b><?php echo $dado['nome'];?> <br>
<b>ENDEREÇO: </b> <?php echo $dado['rua'];?> <b>NUMERO:</b><?php echo $dado['numero'];?> </b>BAIRRO:</b> <?php echo $dado['bairro'];?> <b>CIDADE:</b><?php echo $dado['cidade'];?></br>
<b>DATA NASCIMENTO:</b>  <?php

$date = new DateTime($dado['dataNascimento']);
$formattedDate = $date->format('d/m/Y');
echo $formattedDate;?>  <br> <b>PROFISSAO:</b> <?php echo $dado['profissao'];?>  <br>
<b>INSTAGRAM:</b> <?php echo $dado['instagran'];?>  <br> <b> LOJA: </b> <?php echo $dado['loja'];?> 

<div>
    <p></p>
<a href="excluir.php?id=<?=$dado['id']?>" onclick="return confirm('Se você excluir profissional? será excluído definitavemente')">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" class="bi bi-trash text-danger" viewBox="0 0 16 16">
  <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
  <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
</svg>

</a>








</div>

</div>
</section>


<?php } ?>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
  </body>
</html>