mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
haciendo vista de facturas
This commit is contained in:
@ -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
|
||||
// -----------------------------
|
||||
|
||||
Reference in New Issue
Block a user