<?php 
require_once('xconn.php');
session_start();
 
  if(!isset($_SESSION['d_usuario'])){
    header('Location: index.php');
    exit;
  }else{
    $iUsuario = $_SESSION['c_usuario'];
  }

  if ($conn ->connect_error) {
  die("Connection failed: " . $conn ->connect_error);
  }

?>
<html>
<head>
  <title>Diaso | Brokers</title>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <!--     Fonts and icons     -->
  <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
  <!-- Material Kit CSS -->
  <link href="assets/css/material-dashboard.css?v=2.1.2" rel="stylesheet" />

</head>

<body>
  <div class="wrapper ">
    <div class="sidebar" data-color="azure" data-background-color="black">
      <!--
      Tip 1: You can change the color of the sidebar using: data-color="purple | azure | green | orange | danger"

      Tip 2: you can also add an image using data-image tag
  -->
      <div class="logo">
        <a href="https://diaso.com.mx/" class="simple-text logo-mini">
          Brokers -
          Diaso
        </a>
        <img src="img/logo.png" width="200" height="100"/>
      </div>
      <div class="sidebar-wrapper">
        <ul class="nav">
          <li class="nav-item active">
            <a class="nav-link" href="dashboard.php">
              <i class="material-icons">dashboard</i>
              <p>Dashboard</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="clientes.php">
              <i class="material-icons">dashboard</i>
              <p>Clientes</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="solicitudes.php">
              <i class="material-icons">dashboard</i>
              <p>Solicitudes</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="catalogos.php">
              <i class="material-icons">dashboard</i>
              <p>Catalogos</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="users.php">
              <i class="material-icons">dashboard</i>
              <p>Usuarios</p>
            </a>
          </li>
          
          <li class="nav-item active-pro ">
              <p>Disponible en: Web & Movil</p>
          </li>
          <!-- your sidebar here -->
        </ul>
      </div>
    </div>
    <div class="main-panel">
      <!-- Navbar -->
      <nav class="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top ">
        <div class="container-fluid">
          <div class="navbar-wrapper">
            <a class="navbar-brand" href="javascript:;">Dashboard</a>
          </div>
          <button class="navbar-toggler" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
            <span class="sr-only">Toggle navigation</span>
            <span class="navbar-toggler-icon icon-bar"></span>
            <span class="navbar-toggler-icon icon-bar"></span>
            <span class="navbar-toggler-icon icon-bar"></span>
          </button>
          <div class="collapse navbar-collapse justify-content-end">
            <ul class="navbar-nav">
              <li class="nav-item">
                <a class="nav-link" href="javascript:;">
                  <i class="material-icons">notifications</i> Notificaciones
                </a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link" href="javascript:;" id="navbarDropdownProfile" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <i class="material-icons">person</i>Hola <?php echo', ' . $_SESSION['d_usuario'] . '.'; ?>
                  <p class="d-lg-none d-md-block">
                    Hola, <?php 'Edgar Mejia'; ?>
                  </p>
                </a>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownProfile">
                  <a class="dropdown-item" href="profile.php">Perfil</a>
                  <a class="dropdown-item" href="configuration.php">Configuracion</a>
                  <div class="dropdown-divider"></div>
                  <a class="dropdown-item" href="xlogout.php">Salir</a>
                </div>
              </li>
              <!-- your navbar here -->
            </ul>
          </div>
        </div>
      </nav>
      
      <!-- End Navbar -->
      <div class="content">
        <div class="container-fluid">
          <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">Solicitudes</h4>
                  <p class="card-category">Alta de Solicitudes</p>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table">
                      <thead class=" text-primary">
                        <th>
                          ID
                        </th>
                        <th>
                          Nombre
                        </th>
                        <th>
                          Telefono
                        </th>
                        <th>
                          Correo
                        </th>
                        <th>
                          Usuario
                        </th>
                        <th>
                        </th>
                      </thead>
                      <tbody>
                        <?php
                          $result2 = mysqli_query($conn,"SELECT * FROM t_clientes");
                          while ($valores = mysqli_fetch_array($result2)) {
                            echo '<tr>';
                            echo '<td>' .$valores['c_cliente']. '</td>';
                            echo '<td>' .$valores['d_nombre']. '</td>';
                            echo '<td>' .$valores['c_telefono']. '</td>';
                            echo '<td>' .$valores['d_correo']. '</td>';
                            echo '<td>' .$valores['d_usuario']. '</td>';
                            echo '<td><a href="solicitud.php?id=' .$valores['c_cliente']. '" class="nav-link">Crear Solicitud</a></td>';
                            echo '</tr>';
                          }
                              
                        ?>
                        
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <footer class="footer">
        <div class="container-fluid">
          <nav class="float-left">
            <ul>
              <li>
                <a href="https://diaso.com.mx/">
                  Brokers
                </a>
              </li>
            </ul>
          </nav>
          <div class="copyright float-right">
            &copy;
            <script>
              document.write(new Date().getFullYear())
            </script>, Diaso.
            <a href="xlogout.php" class="btn btn-primary btn-round">Salir</a>
          </div>
          <!-- your footer here -->
        </div>
      </footer>
    </div>
  </div>

  <script src="assets/js/core/jquery.min.js"></script>
  <script src="assets/js/core/popper.min.js"></script>
  <script src="assets/js/core/bootstrap-material-design.min.js"></script>
  <script src="assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>


</body>
</html>