<?php $r="../";
require_once($r."inc/funciones.php");
validNotSession($r);
?>

<!DOCTYPE html>
<html lang="es">
  <?php include $r."inc/head.php"; ?>

<body class="fixed-nav sticky-footer bg-dark" id="page-top">
  <?php include $r."inc/nav.php"; ?>
    <div class="content-wrapper">
        <div class="container-fluid">
            <div class="card mb-3">
                <div class="card-header">
                    <h3>Diapositivas Slider HOME <button class="btn btn-primary float-right"><i class="fa fa-plus"></i> NUEVA</button></h3>
                </div>
                <div class="card-header" style="background-color:#fff">
                    <? $sqllider = $mysqli->query("SELECT bg_slider, titulo, texto, id FROM z_slider_home ORDER by orden"); 
    			    while($rowslider = $sqllider->fetch_assoc()) { ?>
                    <div id="diapositiva<?= $rowslider['id']; ?>" class="row mb-1 p-1 border border-muted rounded">
                        <div class="col-sm-3 col-md-2 p-0"><img src="../<?= $r.$rowslider['bg_slider']; ?>" class="img-fluid"></div>
                        <div class="col-sm-9 col-md-8"><strong><?= $rowslider['titulo']; ?></strong><p><?= str_replace(array("<br/>", "</br>"), "",$rowslider['texto']); ?></p></div>
                        <div class="col-xs-12 col-md-2 text-center"><button class="btn btn-primary">EDITAR</button></div>
                    </div>
                    <? } ?>
                </div>
                <div class="mt-2"></div>
                <div class="card-header">
                    <h3>Diapositivas Slider HOME CATEGORIAS <button class="btn btn-primary float-right"><i class="fa fa-plus"></i> NUEVA</button></h3>
                </div>
                <div class="card-header" style="background-color:#fff">
                    <? $sqllider = $mysqli->query("SELECT bg_slider, titulo, texto, id FROM z_slider_home ORDER by orden"); 
    			    while($rowslider = $sqllider->fetch_assoc()) { ?>
                    <div id="diapositiva<?= $rowslider['id']; ?>" class="row mb-1 p-1 border border-muted rounded">
                        <div class="col-sm-3 col-md-2 p-0"><img src="../<?= $r.$rowslider['bg_slider']; ?>" class="img-fluid"></div>
                        <div class="col-sm-9 col-md-8"><strong><?= $rowslider['titulo']; ?></strong><p><?= str_replace(array("<br/>", "</br>"), "",$rowslider['texto']); ?></p></div>
                        <div class="col-xs-12 col-md-2 text-center"><button class="btn btn-primary">EDITAR</button></div>
                    </div>
                    <? } ?>
                </div>
            </div>
        </div>
    </div>


<!-- The Modal -->
<div class="modal" id="actionsliders">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">DIAPOSITIVA</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        <form action="/action_page.php">
          <div class="form-group">
            <label for="email">Email address:</label>
            <input type="email" class="form-control" placeholder="Enter email" id="email">
          </div>
          <div class="form-group">
            <label for="pwd">Password:</label>
            <input type="password" class="form-control" placeholder="Enter password" id="pwd">
          </div>
          <div class="form-group form-check">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox"> Remember me
            </label>
          </div>
          <button type="submit" class="btn btn-primary">Submit</button>
        </form>
      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-success float-right" data-dismiss="modal">ACTUALIZAR</button>
        <button type="button" class="btn btn-danger float-left" data-dismiss="modal">CERRAR</button>
      </div>

    </div>
  </div>
</div>
  <?php include $r."inc/foot.php"; ?>
  <script>
      function newslide(){
          console.log('hi');
      }
      function edit_slide(item){
          console.log(item);
          $('#actionsliders').modal('show');
      }
  </script>
</body>
</html>