<!DOCTYPE html>
<html lang="en">

<?php
Include("../includes/con_cliente.php");

 require_once('../connection.php');
    session_start();

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


  $result_nota = "SELECT * FROM tborcamentocirurgia WHERE nrorc = '3131'";
  //$result_nota = "SELECT * FROM tbnf WHERE nota = '".$P_nota."'";
  $resultado_nota = mysqli_query($con,$result_nota);
  $row_nota = mysqli_fetch_assoc($resultado_nota);

  $result_alunos = "SELECT * FROM tbapontorca WHERE nrorc = 3131 ";
  $resultado_alunos = mysqli_query($con, $result_alunos);

?>


<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="Controle SCA">
  <meta name="author" content="Fabio Freitas">

  <title>SCA - Acompanhamento de Orçamentos</title>

  <!-- Bootstrap core CSS -->
  <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!--<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">-->

  <!-- Custom styles for this template -->
  <link href="../css/simple-sidebar.css" rel="stylesheet">

</head>

<body>

  <div class="d-flex" id="wrapper">

    <!-- Sidebar -->
    <div class="bg-light border-right" id="sidebar-wrapper">
      <div class="sidebar-heading">SCA - Orçamentos </div>
      <div class="list-group list-group-flush">
        <a href="#" class="list-group-item list-group-item-action bg-light">Dashboard</a>
        <a href="#" class="list-group-item list-group-item-action bg-light">Apontamentos</a>
        <a href="#" class="list-group-item list-group-item-action bg-light">Workflow</a>
        <!--<a href="#" class="list-group-item list-group-item-action bg-light">Events</a>
        <a href="#" class="list-group-item list-group-item-action bg-light">Profile</a>
        <a href="#" class="list-group-item list-group-item-action bg-light">Status</a> -->
      </div>
    </div>
    <!-- /#sidebar-wrapper -->

    <!-- Page Content -->
    <div id="page-content-wrapper" style="background-image:url('../img/ajumed.png');background-repeat: no-repeat;background-position: center;background-size: wrap;" >

      <nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
        <button class="btn btn-primary" id="menu-toggle"> << Menu >></button>

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav ml-auto mt-2 mt-lg-0">
            <li class="nav-item active">
              <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Link</a>
            </li>
           <!-- <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Dropdown
              </a>
              <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#">Something else here</a>
              </div> 
            </li>-->
          </ul>
        </div>
      </nav>

      <div class="container-fluid">
        <h1 class="mt-4">Dados do Orçamentos</h1>
        <div class="row mt-2 mx-6">
            <div class="card-body border border-dark rounded" >
              <h4 class="card-title"></h4>
                <div class="form-row">
                    
                    <div class="col-md-1 mb-4">
                        <label for="txtcliente">Orçamento:</label>
                        <input type="text" class="text-info form-control" id="txtcliente" name="txtcliente" value="<?php echo $row_nota['nrorc']; ?>" readonly>
                    </div>
                    <div class="col-md-1 mb-4">
                        <label for="txtemissao">Data Orc.:</label>
                        <input type="text" class="text-info form-control" id="txtemissao" name="txtemissao" value="<?php echo date("d/m/y",strtotime($row_nota['dtOrcamento']));?>"readonly>
                    </div>
                    <div class="col-md-1 mb-4">
                        <label for="txtpaciente">Dt.Cirur.:</label>
                        <input type="text" class="text-info form-control" id="txtpaciente" name="txtpaciente" value="<?php echo date("d/m/y",strtotime($row_nota['dtCirurgia']));?>" readonly>
                    </div>
                    <div class="col-md-1 mb-4">
                        <label for="txthospital">Dt.Aprov.:</label>
                        <input type="text" class="text-info form-control" id="txthospital" name="txthospital" value="<?php echo date("d/m/y",strtotime($row_nota['dtAprovacao']));?>" readonly>
                    </div>
                    <div class="col-md-0 mb-4">
                        <label for="txtcidade">Cliente:</label>
                        <input type="text" class="text-info form-control" id="txtcidade" name="txtcidade" value="<?php echo $row_nota['cliente'];?>" readonly>
                    </div>
                    <div class="col-md-0 mb-4">
                        <label for="txtplano">Hospital:</label>
                        <input type="text" class="text-info form-control" id="txtplano" name="txtplano" value="<?php echo $row_nota['hospital'];?>" readonly>
                    </div>
                    <div class="col-md-0 mb-4">
                        <label for="txtmedico">Plano de Saúde:</label>
                        <input type="text" class="text-info form-control" id="txtmedico" name="txtmedico" value="<?php echo $row_nota['planoSaude'];?>" readonly>
                    </div>
                    <div class="col-md-0 mb-4">
                        <label for="txtcirurgia">Paciente:</label>
                        <input type="text" class="text-info form-control" id="txtcirurgia" name="txtcirurgia" value="<?php echo $row_nota['paciente'];?>"readonly>
                    </div>
                    <div class="col-md-1 mb-4">
                        <label for="txtgrupo">Valor R$:</label>
                        <input type="text" class="text-info form-control" id="txtgrupo" name="txtgrupo" value="<?php echo $row_nota['vlrOrcado'];?>" readonly>
                    </div>
                    <!--<div class="col-md-2 mb-4">
                        <label for="txttipo">Tipo:</label>
                        <input type="text" class="text-info form-control" id="txttipo" name="txttipo" value="<?php echo $row_nota['tipo'];?>" readonly>
                    </div>
                    <div class="col-md-2 mb-4">
                        <label for="txtvendedor">Vendedor:</label>
                        <input type="text" class="text-info form-control" id="txtvendedor" name="txtvendedor" value="<?php echo $row_nota['representante'];?>" readonly>
                    </div> -->

                </div>
            </div>
        </div>
        <div style="margin-top: 1rem;" >
          <div class="row mt-0 mx-6" >
            <div class="card-body border border-dark rounded">
              <h4 class="card-title">Status</h4>
              <div class="form-row">
                <div class="col-md-2 mb-4">
                    <label for="txtinstrumentador">Cotado:</label>
                    <select class="text-info form-control" id="txtinstrumentador" required name="txtinstrumentador" >
                        <option value="0">Sim</option>
                        <option value="1">Nâo</option>
                    </select>
                </div>
                <div class="col-md-2 mb-4">
                    <label for="txtinstrumentador">Com Cirurgia:</label>
                    <select class="text-info form-control" id="txtinstrumentador" required name="txtinstrumentador" >
                        <option value="0">Sim</option>
                        <option value="1">Nâo</option>
                    </select>
                </div>
                <div class="col-md-2 mb-4">
                    <label for="txtinstrumentador">Em Negociação:</label>
                    <select class="text-info form-control" id="txtinstrumentador" required name="txtinstrumentador" >
                        <option value="0">Sim</option>
                        <option value="1">Nâo</option>
                    </select>
                </div>
                <div class="col-md-2 mb-4">
                    <label for="txtinstrumentador">Aprovado:</label>
                    <select class="text-info form-control" id="txtinstrumentador" required name="txtinstrumentador" >
                        <option value="0">Sim</option>
                        <option value="1">Nâo</option>
                    </select>
                </div>
                <div class="col-md-2 mb-4">
                    <label for="txtinstrumentador">Faturado:</label>
                    <select class="text-info form-control" id="txtinstrumentador" required name="txtinstrumentador" >
                        <option value="0">Sim</option>
                        <option value="1">Nâo</option>
                    </select>
                </div>
              </div>
            </div>
          </div>
        </div>

        <div style="margin-top: 1rem;" >
          <div class="row mt-0 mx-6" >
            <div class="card-body border border-dark rounded" >
              <h4 class="card-title">Apontamentos</h4>
              <div class="table-responsive-xl">
                <table style="font-size: 9px; overflow: auto;" class="table table-striped table-responsive-md btn-table table-hover table-bordered">
            <thead>
              <tr class="info">
                <th>Id</th>
                <th>Nr.Orçamento</th>
                <th>Data</th>
                <th>Apontamento</th>
                <th>Usuário</th>

              </tr>
            </thead>
            <tbody>
              <?php while($rows_alunos = mysqli_fetch_assoc($resultado_alunos)){ ?>
                <tr onclick="location.href = 'detalheprocesso.php?id=<?php echo $rows_alunos['id']; ?>'" style="cursor: hand;">
                  <td><?php echo $rows_alunos['id']; ?></td>
                  <td><?php echo $rows_alunos['nrorc']; ?></td>
                  <td><?php echo $rows_alunos['data']; ?></td>
                  <td><?php echo $rows_alunos['apontamento']; ?></td>
                  <td><?php echo $rows_alunos['usuario']; ?></td>
                  <td>
                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal<P><?php echo $rows_alunos['aplicacao']; ?></P>">Visualizar</button>
                    
                    <button type="button" class="btn btn-warning btn-sm" data-toggle="modal" data-target="#exampleModal" data-whatever="<?php echo $rows_alunos['aplicacao']; ?>" data-whateverstatus="<?php echo $rows_alunos['Status']; ?>" data-whatevermatricula="<?php echo $rows_alunos['id']; ?>">
                      Editar
                  </td>
                </tr>
                <!-- Modal VISUALIZA -->
                <div class="modal fade" id="myModal<P><?php echo $rows_alunos['tipo']; ?></P>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                  <div class="modal-dialog" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title w-100 text-center" id="myModalLabel"><?php echo $rows_alunos['tipo']; ?></h4>
                      </div>
                      <div class="modal-body">
                        <P>Id: <?php echo $rows_alunos['id']; ?></P>
                        <P>Controle de Validade: <?php echo $rows_alunos['validade']; ?></P>
                        <P>Situação: <?php echo $rows_alunos['Status']; ?></P>
                        <P>Alteração: <?php echo $rows_alunos['controle']; ?></P>
                        <P>Usuário: <?php echo $rows_alunos['usuario']; ?></P>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- FIM Modal VISUALIZA -->
              <?php } ?>
            </tbody>
           </table>

              </div>
              




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










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

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

  <!-- Bootstrap core JavaScript -->
  <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>

</body>

</html>

