mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-02-27 21:29:13 +00:00
solucionado problema con cargar solapas de cubierta y formato. También añadido los lomos desde sk al guardar
This commit is contained in:
@ -128,7 +128,7 @@ public class skApiClient {
|
||||
});
|
||||
}
|
||||
|
||||
public Map<String, Object> getLomos(Map<String, Object> requestBody, Locale locale) {
|
||||
public Map<String, Object> getLomos(Map<String, Object> requestBody) {
|
||||
try {
|
||||
String jsonResponse = performWithRetry(() -> {
|
||||
String url = this.skApiUrl + "api/get-lomos";
|
||||
@ -165,9 +165,8 @@ public class skApiClient {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode root = mapper.readTree(jsonResponse);
|
||||
|
||||
if (root.get("lomoInterior") == null || !root.get("lomoInterior").isInt()) {
|
||||
throw new RuntimeException(
|
||||
messageSource.getMessage("presupuesto.errores.error-interior", new Object[] { 1 }, locale));
|
||||
if (root.get("lomoInterior") == null || !root.get("lomoInterior").isDouble()) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
Double lomoInterior = root.get("lomoInterior").asDouble();
|
||||
@ -178,11 +177,6 @@ public class skApiClient {
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
// Fallback al 80% del ancho
|
||||
Map<String, Object> tamanio = new ObjectMapper().convertValue(
|
||||
requestBody.get("tamanio"),
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
|
||||
return Map.of(
|
||||
"lomoInterior", 0.0,
|
||||
"lomoCubierta", 0.0);
|
||||
|
||||
@ -126,6 +126,13 @@ public class PresupuestoFormatter {
|
||||
},
|
||||
locale);
|
||||
}
|
||||
textoResumen += ms.getMessage(
|
||||
"presupuesto.resumen-lomos",
|
||||
new Object[] {
|
||||
p.getLomo() != null ? Math.round(p.getLomo()) : "N/D",
|
||||
p.getLomoCubierta() != null ? Math.round(p.getLomoCubierta()) : "N/D"
|
||||
},
|
||||
locale);
|
||||
textoResumen += ms.getMessage("presupuesto.resumen-texto-end", null, locale);
|
||||
|
||||
return textoResumen;
|
||||
|
||||
@ -1299,12 +1299,9 @@ public class PresupuestoService {
|
||||
|
||||
public Map<String, Object> obtenerLomos(Presupuesto presupuesto) {
|
||||
try {
|
||||
Long papelInteriorId = presupuesto.getPapelInteriorId() != null ? presupuesto.getPapelInteriorId() : 0L;
|
||||
Long papelCubiertaId = presupuesto.getPapelCubiertaId() != null ? presupuesto.getPapelCubiertaId() : 0L;
|
||||
int paginas = presupuesto.getPaginasNegro() + presupuesto.getPaginasColor();
|
||||
Map<String, Object> response = apiClient.getLomos(papelInteriorId, papelCubiertaId, paginas);
|
||||
Map<String, Object> response = apiClient.getLomos(this.toSkApiRequest(presupuesto));
|
||||
|
||||
return response.get("data") != null ? (Map<String, Object>) response.get("data") : Map.of();
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error obteniendo lomos: " + e.getMessage());
|
||||
return Map.of();
|
||||
|
||||
@ -234,6 +234,7 @@ presupuesto.resumen-texto-acabado-cubierta= <li>Acabado: {0}. </li>
|
||||
presupuesto.resumen-texto-end=</ul>
|
||||
presupuesto.resumen-texto-sobrecubierta=<li>Sobrecubierta impresa en {0} {1} gr. <ul><li>Acabado: {2}</li><li>Solapas: {3} mm.</li></ul></li>
|
||||
presupuesto.resumen-texto-faja=<li>Faja impresa en {0} {1} gr. con un alto de {2} mm. <ul><li>Acabado: {3}</li><li>Solapas: {4} mm.</li></ul></li>
|
||||
presupuesto.resumen-lomos=<li>Dimensiones de los lomos: <ul><li>Lomo interior: {0} mm</li><li>Lomo total: {1} mm</li></ul></li>
|
||||
presupuesto.resumen-deposito-legal=Ejemplares para el Depósito Legal
|
||||
presupuesto.volver-extras=Extras del libro
|
||||
presupuesto.resumen.inicie-sesion=Inicie sesión para continuar
|
||||
|
||||
@ -718,24 +718,23 @@ export default class PresupuestoWizard {
|
||||
.prop('checked', true);
|
||||
this.#updateTipoEncuadernacion();
|
||||
|
||||
this.formatoPersonalizado.trigger('change');
|
||||
|
||||
$('.paginas').trigger('change');
|
||||
|
||||
if (this.formatoPersonalizado.is(':checked')) {
|
||||
this.ancho.val(this.formData.datosGenerales.ancho);
|
||||
this.alto.val(this.formData.datosGenerales.alto);
|
||||
} else {
|
||||
const option = this.formato.find('option').filter(() => {
|
||||
return $(this).data('ancho') == this.formData.datosGenerales.ancho &&
|
||||
$(this).data('alto') == this.formData.datosGenerales.alto;
|
||||
const option = this.formato.find('option').filter((index, element) => {
|
||||
return $(element).data('ancho') == this.formData.datosGenerales.ancho &&
|
||||
$(element).data('alto') == this.formData.datosGenerales.alto;
|
||||
});
|
||||
|
||||
if (option.length) {
|
||||
this.formato.val(option.val()).trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.formatoPersonalizado.trigger('change');
|
||||
$('.paginas').trigger('change');
|
||||
this.ivaReducido.prop('checked', this.formData.datosGenerales.ivaReducido);
|
||||
}
|
||||
|
||||
@ -1226,7 +1225,7 @@ export default class PresupuestoWizard {
|
||||
const dataToStore = this.#getCubiertaData();
|
||||
this.#updateCubiertaData(dataToStore);
|
||||
this.#cacheFormData();
|
||||
|
||||
|
||||
Summary.updateTapaCubierta();
|
||||
});
|
||||
|
||||
@ -1443,7 +1442,10 @@ export default class PresupuestoWizard {
|
||||
#getCubiertaData() {
|
||||
|
||||
const tipoCubierta = $('.tapa-cubierta input:checked').val() || 'tapaBlanda';
|
||||
const solapas = $('.solapas-cubierta input:checked').val() == 'sin-solapas' ? 0 : 1 || 0;
|
||||
let solapas = 0;
|
||||
if(tipoCubierta === 'tapaBlanda'){
|
||||
solapas = $('.solapas-cubierta input:checked').val() == 'conSolapas' ? 1 : 0 || 0;
|
||||
}
|
||||
const tamanioSolapasCubierta = $('#tamanio-solapas-cubierta').val() || '80';
|
||||
const cubiertaCaras = parseInt(this.carasImpresionCubierta.val()) || 2;
|
||||
const papelGuardasId = parseInt($('#papel-guardas option:selected').data('papel-id')) || 3;
|
||||
|
||||
Reference in New Issue
Block a user