haciendo vista de facturas

This commit is contained in:
2026-01-01 20:00:14 +01:00
parent 9d4320db9a
commit bf823281a5
14 changed files with 6482 additions and 5543 deletions

View File

@ -21,6 +21,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -172,6 +173,30 @@ public class SeriesFacturacionController {
return ResponseEntity.ok(Map.of("ok", true));
}
// -----------------------------
// API: GET for select2
// -----------------------------
@GetMapping("/api/get-series")
@ResponseBody
public Map<String, Object> getSeriesForSelect(
@RequestParam(value = "q", required = false) String q1,
@RequestParam(value = "term", required = false) String q2,
Locale locale) {
String query = (q1 != null && !q1.isBlank()) ? q1
: (q2 != null && !q2.isBlank()) ? q2
: "";
List<Map<String, Object>> results = repo.searchForSelectSeriesFacturacion(query).stream()
.map(s -> {
Map<String, Object> m = new HashMap<>();
m.put("id", s.getId());
m.put("text", s.getNombreSerie());
return m;
})
.toList();
return Map.of("results", results);
}
// -----------------------------
// Payload + validación
// -----------------------------