<?php 
   $loja = $_SESSION['loja'];
   $usuario = $_SESSION['usuario'];

require 'script_php/login_verificar.php';
require "script_php/tipousuario.php";
require_once 'gerador/SqlServer.php';



require_once 'script_php/ConexaoSQL.php';

//aniversariantes do dia
$sql = new SqlServer();

$diaAtual = date('Y-d-m');
$diaAtualComparar = date('m-d');

$anisarianteDia2 = false;

$aniversarianteDia = $sql->buscarAniversariantes('$diaAtual');

foreach ($aniversarianteDia as $dadosAniversariantes){

  // Converte a data em timestamp
  $timestamp = strtotime($dadosAniversariantes[0]);
  
  // Extrair ano, mês e dia
  $data = date('m', $timestamp) . '-' . date('d', $timestamp); 
  
  //verificar se tem algum funcionario aniversariando hj
  if($data == $diaAtualComparar){

    $anisarianteDia2 = true;
  }

}


$loja = $_SESSION['loja'];
$usuario = $_SESSION['usuario'];

$tipousuario = tipousuario($usuario, $conexao);
?>

<?php //include_once 'load.php'; ?>


<section class="topo">


<span class="magin-left listamenu">


<a href="index.php">

<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-clouds" viewBox="0 0 16 16">
  <path d="M16 7.5a2.5 2.5 0 0 1-1.456 2.272 3.5 3.5 0 0 0-.65-.824 1.5 1.5 0 0 0-.789-2.896.5.5 0 0 1-.627-.421 3 3 0 0 0-5.22-1.625 5.6 5.6 0 0 0-1.276.088 4.002 4.002 0 0 1 7.392.91A2.5 2.5 0 0 1 16 7.5"/>
  <path d="M7 5a4.5 4.5 0 0 1 4.473 4h.027a2.5 2.5 0 0 1 0 5H3a3 3 0 0 1-.247-5.99A4.5 4.5 0 0 1 7 5m3.5 4.5a3.5 3.5 0 0 0-6.89-.873.5.5 0 0 1-.51.375A2 2 0 1 0 3 13h8.5a1.5 1.5 0 1 0-.376-2.953.5.5 0 0 1-.624-.492z"/>
</svg>

CDC Remoto



</a>

<?php echo $usuario; ?> 



</span>

<section class="alinhar-direita"> 

<button class="btn botaoloja dropdown-toggle loja" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">

   <?php echo $loja; ?>
  </button>

  <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">


<?php

$result = "SELECT * FROM usuarios WHERE usuario = '$usuario' ";

$resultado = mysqli_query($conexao, $result);

while($linha = mysqli_fetch_array($resultado)){
?>

<?php if ($linha['matriz'] == "sim"){ ?>

    <li><a class="nav-link centromenu"   href="script_php/trocar_loja.php?novaloja=<?='matriz' ?>" >MATRIZ</a></li>

<?php } ?>

<?php if ($linha['loja02'] == "sim"){ ?>
   <li><a class="nav-link centromenu" href="script_php/trocar_loja.php?novaloja=<?='loja02' ?>" >LOJA 02</a></li>
<?php } ?>

<?php if ($linha['loja03'] == "sim"){ ?>
   <li><a class="nav-link centromenu" href="script_php/trocar_loja.php?novaloja=<?='loja03' ?>" >LOJA 03</a></li>
<?php } ?>

<?php if ($linha['loja04'] == "sim"){ ?>

   <li><a class="nav-link centromenu" href="script_php/trocar_loja.php?novaloja=<?='loja04' ?>" > LOJA 04 </a></li>
<?php } ?>

<?php if ($linha['loja05'] == "sim"){ ?>

   <li><a class="nav-link centromenu" href="script_php/trocar_loja.php?novaloja=<?='loja05' ?>" >LOJA 05 </a></li>
<?php }  ?>


<?php if ($linha['loja06'] == "sim"){ ?>

   <li><a class="nav-link centromenu" href="script_php/trocar_loja.php?novaloja=<?='loja06' ?>" >LOJA 06 </a></li>
<?php } } ?>

</ul>




<a href="script_php/sair.php">





<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" class="bi bi-power afastar text-danger" viewBox="0 0 16 16">
  <path d="M7.5 1v7h1V1z"/>
  <path d="M3 8.812a5 5 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812"/>
</svg>






</a>



</section>

</section>

<?php include 'menu.php'; ?>

</nav>


</header>
<section class="cabecalhopedidos">

<!-- BUSCAR ANIVERSARIANTE DO DIA -->

<?php 
if($anisarianteDia2){ ?>
<span>
  <!-- <img src="IMG/aniversario.gif" height='50px' alt=""> -->
</span>

<?php } ?>

