<?php
    require_once "lib.php";
    $lib = new lib("http://localhost:8080/gits/fertimicro/webservice/index.php"); 
    // $lib = new lib("http://fertimicro.pitaya-organicos.com/webservice/index.php"); 
?>
<!doctype html>
<html lang="en">
  <head>
    <title>FERTIMICRO</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="stylesheet" href="css/style2.css">
    <link rel="stylesheet" href="css/icomoon/styles.css">
    <link rel="stylesheet" type="text/css" href="DataTables/datatables.min.css" />
    <style>
    .cuadro{ background:#aaaa;}
    </style>
    
  </head>
  <body id="body" class="flexbox-container">
      <div id="main-container" class="container">
        <div class="">
            <div class="">
                <?php 
                $uri_ajust = "";
                ?>
                <?php
                    $data = "pet=productos&act=cat&data=".$_GET["p"];
                    $productos= $lib->webservice_get($data);
                    foreach ($productos as $producto) {
                ?>
                <div class="card">
                    <div class="card-body m-4">
                    <nav aria-label="breadcrumb">
                        <a class="btn btn-danger text-white" onClick="Jvascript:window.close();">CERRAR</a></li>
                        
                    </nav>
                        <div class="row m-2">
                            <div class="col-md-12">
                                <!-- <img class="card-img-top" src="productos/ferti-liquida-12-24-12.jpg" alt="Fertilizantes Líquidos" style="width:20%;">
                                <h5 class="text-center">FORMULA-LIQUIDA</h5>
                                <h1 class="text-center">10-20-10</h1> -->
                                <div class="row">
                                    <div class="col-md-12">
                                        <div id="p-descrpcion" class="row">
                                            <div class="col-md-8">
                                                <div class="row">
                                                    <div class="col-md-12 text-center">
                                                        <img class="card-img-top" src="pics-productos/<?php echo $producto->id_producto;?>.jpg" alt="Fertilizantes Líquidos" style="width:30%;">
                                                        <h5><?php echo $producto->producto;?></h5>
                                                        <!-- <h1>10-20-10</h1> -->
                                                        
                                                        <p class="text-justify mt-5"><?php echo $producto->descripcion;?></p>
                                                    <?php if(!empty($producto->recomendacion)){?>
                                                        <h2 class="mt-5">RECOMENDACIONES DE USO:</h2>
                                                        <ul class="ferti-list text-left mt-4">
                                                        <?php
                                                            $lista = explode("\n",$producto->recomendacion);
                                                            foreach ($lista as $r) {
                                                                echo "<li>".$r."</li>";
                                                            }
                                                        ?>
                                                        </ul>
                                                        <?php }?>
                                                    </div>
                                                </div>
                                                <!-- <div class="row">
                                                    <div class="col-md-12">
                                                        <table class="table table-resonsive">
                                                            <thead>
                                                                <th>Rhizobacteria (UFC) 1*10 7 Micorrizas (Glomus Intraradix) 20,000 (Lombricomposta) 100%</th>
                                                            </thead>
                                                        </table>
                                                    </div>
                                                </div> -->
                                            </div>
                                            <div id="sidebar" class="col-md-4">
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <div class="card">
                                                            <div class="row">
                                                            <?php if(!empty($producto->presentacion)){?>
                                                                <div class="col-md-12">
                                                                    <h3>PRESENTACIONES</h3>
                                                                    <ul class="ferti-list text-left">
                                                                     <?php
                                                                        $listaP = explode(",",$producto->presentacion);
                                                                        foreach ($listaP as $p) {
                                                                            echo "<li>".$p."</li>";
                                                                        }
                                                                    ?>
                                                                    </ul>
                                                                </div>
                                                            <?php }?>
                                                            </div>
                                                            
                                                            <div class="row">
                                                            <?php if(!empty($producto->activos)){?>
                                                                <div class="col-md-12">
                                                                    <h3>COMPOSICION</h3>
                                                                    <ul class="ferti-list text-left">
                                                                     <?php
                                                                     
                                                                        //  $listaP = explode("-",$producto->activos);
                                                                        //  foreach ($listaP as $p) {
                                                                        //      $p = str_replace("_","</td><td width='100px'>",$p);
                                                                        //      echo "<li>
                                                                        //      <table class='table-condensed text-center'><tr><td width='100px'>".
                                                                        //      $p
                                                                        //      ."</td></tr></table></li>";
                                                                        //  }

                                                                        $listaP = explode("-",$producto->activos);
                                                                         foreach ($listaP as $p) {
                                                                             $p = str_replace("_"," ",$p);
                                                                            if($p != ""){
                                                                                echo "<li>".$p."</li>";
                                                                            }
                                                                         }
                                                                        
                                                                     
                                                                    ?>
                                                                    </ul>
                                                                </div>
                                                            <?php }?>
                                                            </div>
                                                            <!-- <div class="row">
                                                                <div class="col-md-12">
                                                                    <h3>MÁS INFORMACIÓN</h3>
                                                                    <ul class="ferti-list text-left">
                                                                        <li>Safety Data Sheet</li>
                                                                    </ul>
                                                                </div>
                                                            </div> -->
                                                           
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <?php        
                    }
                ?>
                
            </div>
            
        </div>
          
      </div> <!-- /container -->

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
        <script type="text/javascript" src="DataTables/datatables.min.js"></script>
        <link rel="stylesheet" type="text/css" href="DataTables/FixedColumns-3.2.4/css/fixedColumns.dataTables.min.css" />
    <script>
        $(document).ready(function () {
             $('#tabla-convencionales').DataTable();
        });
    </script>
  </body>
</html>