<?php include 'conexion2.php'; ?>
<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <title>Editar Facturas por Cliente</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">

<div class="container mt-4">
  <h4>Editar Facturas de Cliente</h4>
  <form id="formBuscar" class="row g-3">
    <div class="col-md-2">
      <input type="number" class="form-control" name="customer_id" id="customer_id" placeholder="ID Cliente" required>
    </div>
    <div class="col-md-3">
      <input type="date" class="form-control" name="desde" id="desde">
    </div>
    <div class="col-md-3">
      <input type="date" class="form-control" name="hasta" id="hasta">
    </div>
    <div class="col-md-2">
      <button class="btn btn-primary">Buscar</button>
    </div>
  </form>

  <div id="resultados" class="mt-4"></div>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$('#formBuscar').on('submit', function(e){
  e.preventDefault();
  const data = {
    customer_id: $('#customer_id').val(),
    desde: $('#desde').val(),
    hasta: $('#hasta').val()
  };
  $.post('buscar_facturas.php', data, function(resp){
    $('#resultados').html(resp);
  });
});
</script>

</body>
</html>
