<!DOCTYPE html>
<?php
Include("includes/con_cliente.php");
 
 session_start();

    if(isset($_SESSION['User']))
    {
        $query="select * from tblogin where nome='".$_SESSION['User']."'";
        $result=mysqli_query($con,$query);
        $resultado = mysqli_fetch_assoc($result);
        $r_resultado = $resultado;
    }
    else
    {
        header("location:index.php");
    }

    $c_cliente="select codigo, nome from hospitais order by nome asc";
    $r_cliente= mysql_query($c_cliente);

    $c_cliente1="select codigo, nome from clientes order by nome asc";
    $r_cliente1= mysql_query($c_cliente1);

    $c_medico="select codigo, nome from medicos order by nome asc";
    $r_medico= mysql_query($c_medico);

    $c_grupo="select codigo, nome from grupo order by nome asc";
    $r_grupo= mysql_query($c_grupo);

    $c_tipo="select codigo, nome from tipo order by nome asc";
    $r_tipo= mysql_query($c_tipo);

    $c_vendedor="select codigo, nome, mail from vendedor order by nome asc";
    $r_vendedor= mysql_query($c_vendedor);

    $c_descricao="select Codigo, Nome, Descricao from descricoes order by nome asc";
    $r_descricao= mysql_query($c_descricao);

    $c_plano="select codigo, nome from planos order by nome asc";
    $r_plano= mysql_query($c_plano);


?>




<html lang="pt-br">
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="node_modules/bootstrap/compiler/bootstrap.css">
    <link rel="stylesheet" href="node_modules/bootstrap/compiler/style.css">

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/simple-sidebar.css" rel="stylesheet">

	<title>OPME - Nova Cirurgia</title>
</head>
<body>
  <script 
    src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js">
      
  </script>

	<div id="page-content-wrapper">

		<!--<nav class="navbar navbar-expand-lg navbar-light border-bottom fixed-top" style="background-color: #008080">
			<a style="color: #FFFAFA"><?php echo $resultado["nome"];?></a>
	        <button class="btn btn-outline-light" id="menu-toggle" style="margin-left: 150px">Voltar</button>
	        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
	        </button>

	    </nav> -->

	    <nav class="navbar navbar-expand-sm navbar-light justify-content-end fixed-top" style="background-color: #008080">
		    <a style="color: #FFFAFA">OPME - <?php echo $resultado["nome"];?></a>
		    <a class="btn btn-outline-light ml-auto mr-1" href="mnu.php" role="button">Voltar</a>
		    <!--<button class="btn btn-outline-light ml-auto mr-1">Voltar</button>-->
		    
		    
		</nav>

	


		<div class="view" style="background-color:#D3D3D3 ">
    <!--<div class="view" style="background-image:url(img/wall1.png); background-repeat: no-repeat; background-size: cover; background-position: center center;">-->
          <div class="tab-content" id="myTabContent" style="margin-top: 50px;" >
            <div class="tab-pane fade show active" id="meidcos" role="tabpanel" aria-labelledby="medicos-tab">                                     
                <div class="container">
                    <form method="POST" action="agendando.php" enctype="multipart/form-data">
                    <!--<form method="POST" action="api/agendando.php" enctype="multipart/form-data"> -->
                        <br>
                        <input class="form-control " style="text-transform: uppercase; width: 200px" required type="date" name="data" >
                        <input class="form-control " style="text-transform: uppercase; width: 100px; margin-top: 5px;" required type="time" name="hora" placeholder="hora da Cirurgia">
                        
                        
                        <select class="custom-select " id="CirHospital" style=" margin-top: 5px;" required name="clientehospital">
                            <option value="">Selecione o Hospital...</option>
                              <?php
                                while($l_cliente=mysql_fetch_array($r_cliente)){
                                  echo "<option value='" .$l_cliente['1']."'>".$l_cliente['1']."</option>";
                                }
                              ?>
                        </select>

                        <select class="custom-select " id="CirFaturamento" style=" margin-top: 5px;" required name="clientefaturamento">
                            <option value="">Selecione o Cliente...</option>
                              <?php
                                  while($l1_cliente=mysql_fetch_array($r_cliente1)){
                                    echo "<option value='" .$l1_cliente['1']."'>".$l1_cliente['1']."</option>";
                                  }
                              ?>
                        </select>

                        <select class="custom-select " id="CirMedico" style="margin-top: 5px;" required name="medico">
                            <option value="">Selecione o Médico...</option>
                              <?php
                                  while($l_medico=mysql_fetch_array($r_medico)){
                                    echo "<option value='" .$l_medico['1']."'>".$l_medico['1']."</option>";
                                  }
                              ?>
                        </select>

                        <select class="custom-select " id="GrupoCirurgia" style=" margin-top: 5px;" required name="grupo">
                          <option value="">Selecione o Grupo...</option>
                          <?php
                              while($l_grupo=mysql_fetch_array($r_grupo)){
                                echo "<option value='" .$l_grupo['1']."'>".$l_grupo['1']."</option>";
                              }
                          ?>
                        </select>

                        <select class="custom-select " id="inputGroupSelect04" style=" margin-top: 5px;" required name="tipo">
                          <option value="">Selecione o Tipo de Cirurgia...</option>
                          <?php
                              while($l_tipo=mysql_fetch_array($r_tipo)){
                                echo "<option value='" .$l_tipo['1']."'>".$l_tipo['1']."</option>";
                              }

                          ?>
                        </select>

                        <select class="custom-select " id="inputGroupSelect04" style=" margin-top: 5px;" required name="vendedor">
                          <option value="">Selecione o Vendedor...</option>
                            <?php
                              while($l_vendedor=mysql_fetch_array($r_vendedor)){
                                echo "<option value='" .$l_vendedor['1']."'>".$l_vendedor['1']."</option>";
                              }
                            ?>
                          
                        </select>

                          <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
                          <select name="sldescricao" class="custom-select" id="inputGroupSelect04" style=" margin-top: 10px;" required name="vendedor">
                            <option value="">Selecione a Descrição Cirúrgica...</option>
                              <?php
                                while($l_descricao=mysql_fetch_array($r_descricao)){
                                  echo "<option value='" .$l_descricao['1']."'data-evolucao='".$l_descricao['2']."' >".$l_descricao['1']."</option>";
                                }
                              ?>
                          </select>


                        <textarea name="txtdescricao" class="form-control " rows="3" style="margin-top: 3px; text-transform: uppercase;" required type="textarea"  placeholder="Descrição da Utilização da Caixa" onkeypress="return sem_acento(event);"></textarea>

                        <script type="text/javascript">
                            $(document).ready(function () {

                                $('select[name="sldescricao"]').on('change', function () {
                                    var evolucao = $('select[name="sldescricao"] > option:selected').data('evolucao');

                                    $('textarea[name="txtdescricao"]').text(evolucao);
                                });

                            })
                        </script>

<!--BRONCA -------->





                        <input class="form-control " style="margin-top: 10px;text-transform: uppercase;" required type="text" name="paciente" placeholder="Nome do Paciente" onkeypress="return sem_acento(event);">

                        <select class="custom-select " id="inputGroupSelect04" style=" margin-top: 5px;" required name="plano">
                          <option value="">Selecione o Plano de Saúde...</option>
                            <?php
                                while($l_plano=mysql_fetch_array($r_plano)){
                                  echo "<option value='" .$l_plano['1']."'>".$l_plano['1']."</option>";
                                }
                            ?>
                          
                        </select>

                        <input class="form-control " style="margin-top: 9px;text-transform: uppercase;" required type="text" name="pessoa" placeholder="Solicitante" onkeypress="return sem_acento(event);" value="<?php echo $_SESSION['User'];?>">
                      <!-- <imput class="form-control " name="pessoa" value="<?=$resultado?>"> -->
                        

                        <button class="btn btn-primary btn-block" style="margin-bottom: 10px;margin-top: 10px;" type="submit" name="btnReload" >Cadastrar Cirurgia</button>


                    </form>
                </div>
          </div>

          </div>
        </div>
     </div>

<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/popper.js/dist/popper.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

 <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Menu Toggle Script -->
  <script>
    $("#menu-toggle").click(function(e) {
      e.preventDefault();
      $("#wrapper").toggleClass("toggled");
    });
  </script>

  

  
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

  


</body>
</html>