<?php



?>

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

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="icon" href="../../../../favicon.ico">

  <title>Cliente</title>

  <!-- Bootstrap core CSS -->
  <link href="assets/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/css/navbar-top-fixed.css" rel="stylesheet">
  <link href="assets/css/table-fixed.css" rel="stylesheet">

  <script type="text/javascript" charset="utf8" src="assets/DataTables/datatables.js"></script>
  <link rel="stylesheet" type="text/css" href="assets/DataTables/datatables.css">
  <link rel="stylesheet" type="text/css" href="assets/DataTables/Select-1.2.6/css/select.dataTables.min.css">

</head>


<body>
  <?php
  $options = [
    "GF" => "GEOFRUT",
    "SF" => "SOFRUCO",
    "RB" => "RIO BLANCO",
    "RBM" => "RIO BLANCO MEXICO",
    "CT" => "CALINT",
    "ASJ" => "SAN JOSE",
    "MA" => "MONTE ALTO",
    "PG" => "PURA GESEX",
    "LL" => "LOS LIRIOS",
    "TR" => "TRUMAO",
    "PR" => "PRUNESCO",
    "LZ" => "INGLOBO",
    "AS" => "AGUA SANTA",
    "QE" => "QUELEN",
    "QED" => "QUELEN DESTINO",
    "AF" => "AGROFRUTA",
    "SUN" => "SUNFRUIT",
    "TF" => "TRIOFRUIT",
    "PV" => "PROVEX",
  ];
  ?>

  <form id="fmarchivo">
    <div class="col-sm">
      Archivo
      <select class="form-control" id="cliente_id" name="cliente_id">
        <?php
        foreach ($options as $value => $name) {
          echo "<option value='$value'>$name</option>";
        }
        ?>
      </select>
      <a class="btn btn-primary" href="#" role="button" onclick="subirArchivo();">Guardar Cliente</a>
    </div>
  </form>

  <script type="text/javascript">
    function subirArchivo() {
      var formData = new FormData($("#fmarchivo")[0]);

      //hacemos la petición ajax  
      $.ajax({
        url: 'guardar_cliente.php',
        type: 'POST',
        // Form data
        //datos del formulario
        data: formData,
        //necesario para subir archivos via ajax
        cache: false,
        contentType: false,
        processData: false,
        //mientras enviamos el archivo
        beforeSend: function() {

        },
        //una vez finalizado correctamente
        success: function(data) {
          alert("CAMBIADO");

        },
        //si ha ocurrido un error
        error: function() {

        }
      });

    }
  </script>


  <script src="assets/js/jquery-slim.min.js"></script>
  <script src="assets/js/jquery-3.3.1.js"></script>
  <script src="assets/js/popper.min.js"></script>
  <script src="assets/js/bootstrap.min.js"></script>


  <script type="text/javascript" charset="utf8" src="assets/DataTables/DataTables-1.10.18/js/jquery.dataTables.js"></script>
  <script type="text/javascript" charset="utf8" src="assets/DataTables/Select-1.2.6/js/dataTables.select.min.js"></script>
</body>

</html>