mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-12 16:38:48 +00:00
falta procesar el resultado
This commit is contained in:
@ -4,7 +4,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
@Configuration
|
||||
public class SecurityConfig {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.imprimelibros.erp.presupuesto;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
@ -14,16 +15,19 @@ import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.imprimelibros.erp.externalApi.skApiClient;
|
||||
import com.imprimelibros.erp.presupuesto.classes.ImagenPresupuesto;
|
||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMaquetacion;
|
||||
import com.imprimelibros.erp.presupuesto.validation.PresupuestoValidationGroups;
|
||||
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/presupuesto")
|
||||
public class PresupuestoController {
|
||||
|
||||
@ -89,8 +93,9 @@ public class PresupuestoController {
|
||||
@PostMapping("/public/validar/cubierta")
|
||||
public ResponseEntity<?> validarCubierta(
|
||||
@Validated(PresupuestoValidationGroups.Cubierta.class) Presupuesto presupuesto,
|
||||
BindingResult result,
|
||||
@RequestParam(name = "calcular", defaultValue = "true") boolean calcular,
|
||||
BindingResult result, Locale locale) {
|
||||
Locale locale) {
|
||||
|
||||
Map<String, String> errores = new HashMap<>();
|
||||
|
||||
@ -301,4 +306,24 @@ public class PresupuestoController {
|
||||
return ResponseEntity.ok(price);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value="/public/maquetacion/form", produces = MediaType.TEXT_HTML_VALUE)
|
||||
public String getMaquetacionForm(Model model) {
|
||||
model.addAttribute("presupuestoMaquetacion", new PresupuestoMaquetacion());
|
||||
return "imprimelibros/presupuestos/presupuesto-maquetacion-form :: maquetacionForm";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/public/maquetacion")
|
||||
public ResponseEntity<?> getPresupuestoMaquetacion(
|
||||
PresupuestoMaquetacion presupuestoMaquetacion,
|
||||
Model model, Locale locale) {
|
||||
Map<String, Object> resultado = presupuestoService.getPrecioMaquetacion(presupuestoMaquetacion);
|
||||
if((Double)resultado.get("precio") == 0.0 && (Integer)resultado.get("numPaginasEstimadas") == 0
|
||||
&& (Double)resultado.get("precioPaginaEstimado") == 0.0){
|
||||
return ResponseEntity.badRequest().body(messageSource.getMessage("presupuesto.errores.presupuesto-maquetacion", null, locale));
|
||||
}
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -593,81 +593,72 @@ public class PresupuestoService {
|
||||
return price_prototipo;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrecioMaquetacion(Presupuesto presupuesto) {
|
||||
public HashMap<String, Object> getPrecioMaquetacion(PresupuestoMaquetacion presupuestoMaquetacion) {
|
||||
try {
|
||||
if (Boolean.TRUE.equals(presupuesto.getPresupuestoMaquetacion())
|
||||
&& presupuesto.getPresupuestoMaquetacionData() != null
|
||||
&& !presupuesto.getPresupuestoMaquetacionData().equals("{}")) {
|
||||
List<MaquetacionPrecios> lista = maquetacionPreciosRepository.findAll();
|
||||
|
||||
String jsonData = presupuesto.getPresupuestoMaquetacionData();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PresupuestoMaquetacion pm = objectMapper.readValue(jsonData, PresupuestoMaquetacion.class);
|
||||
List<MaquetacionPrecios> lista = maquetacionPreciosRepository.findAll();
|
||||
// helper para obtener un precio por clave
|
||||
java.util.function.Function<String, Double> price = key -> lista.stream()
|
||||
.filter(p -> key.equals(p.getKey()))
|
||||
.map(MaquetacionPrecios::getValue)
|
||||
.findFirst()
|
||||
.orElse(0.0);
|
||||
|
||||
// helper para obtener un precio por clave
|
||||
java.util.function.Function<String, Double> price = key -> lista.stream()
|
||||
.filter(p -> key.equals(p.getKey()))
|
||||
.map(MaquetacionPrecios::getValue)
|
||||
.findFirst()
|
||||
.orElse(0.0);
|
||||
BigDecimal precio = BigDecimal.ZERO;
|
||||
|
||||
BigDecimal precio = BigDecimal.ZERO;
|
||||
// millar_maquetacion * (numCaracteres / 1000.0)
|
||||
BigDecimal millares = BigDecimal.valueOf(presupuestoMaquetacion.getNumCaracteres()).divide(BigDecimal.valueOf(1000), 6,
|
||||
RoundingMode.HALF_UP);
|
||||
precio = precio.add(millares.multiply(BigDecimal.valueOf(price.apply("millar_maquetacion"))));
|
||||
|
||||
// millar_maquetacion * (numCaracteres / 1000.0)
|
||||
BigDecimal millares = BigDecimal.valueOf(pm.getNumCaracteres()).divide(BigDecimal.valueOf(1000), 6,
|
||||
RoundingMode.HALF_UP);
|
||||
precio = precio.add(millares.multiply(BigDecimal.valueOf(price.apply("millar_maquetacion"))));
|
||||
|
||||
// Numero de paginas estimado
|
||||
int numPaginas = 0;
|
||||
Integer matricesPorPagina = maquetacionMatricesRepository.findMatrices(
|
||||
MaquetacionMatrices.Formato.valueOf(pm.getFormato()),
|
||||
MaquetacionMatrices.FontSize.valueOf(pm.getFontSize()));
|
||||
if (matricesPorPagina != null && matricesPorPagina > 0) {
|
||||
numPaginas = pm.getNumCaracteres() / matricesPorPagina;
|
||||
}
|
||||
// Precio por pagina estimado
|
||||
BigDecimal precioRedondeado = precio.setScale(2, RoundingMode.HALF_UP);
|
||||
double precioPaginaEstimado = 0.0;
|
||||
if (numPaginas > 0) {
|
||||
precioPaginaEstimado = precioRedondeado
|
||||
.divide(BigDecimal.valueOf(numPaginas), 2, RoundingMode.HALF_UP)
|
||||
.doubleValue();
|
||||
}
|
||||
|
||||
// tabla, columna, foto
|
||||
precio = precio
|
||||
.add(BigDecimal.valueOf(pm.getNumTablas()).multiply(BigDecimal.valueOf(price.apply("tabla"))));
|
||||
precio = precio.add(
|
||||
BigDecimal.valueOf(pm.getNumColumnas()).multiply(BigDecimal.valueOf(price.apply("columnas"))));
|
||||
precio = precio
|
||||
.add(BigDecimal.valueOf(pm.getNumFotos()).multiply(BigDecimal.valueOf(price.apply("foto"))));
|
||||
|
||||
if (pm.isCorreccionOrtotipografica()) {
|
||||
precio = precio
|
||||
.add(millares.multiply(BigDecimal.valueOf(price.apply("correccion_ortotipografica"))));
|
||||
}
|
||||
if (pm.isTextoMecanografiado()) {
|
||||
precio = precio.add(millares.multiply(BigDecimal.valueOf(price.apply("mecanoescritura_por_millar"))));
|
||||
}
|
||||
if (pm.isDisenioPortada()) {
|
||||
precio = precio.add(BigDecimal.valueOf(price.apply("disenio_portada")));
|
||||
}
|
||||
if (pm.isEpub()) {
|
||||
precio = precio.add(BigDecimal.valueOf(price.apply("epub")));
|
||||
}
|
||||
|
||||
// redondeo final
|
||||
precioRedondeado = precio.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
HashMap<String, Object> out = new HashMap<>();
|
||||
out.put("precio", precioRedondeado.doubleValue());
|
||||
out.put("numPaginasEstimadas", numPaginas);
|
||||
out.put("precioPaginaEstimado", precioPaginaEstimado);
|
||||
return out;
|
||||
// Numero de paginas estimado
|
||||
int numPaginas = 0;
|
||||
Integer matricesPorPagina = maquetacionMatricesRepository.findMatrices(
|
||||
presupuestoMaquetacion.getFormato(),
|
||||
presupuestoMaquetacion.getCuerpoTexto());
|
||||
if (matricesPorPagina != null && matricesPorPagina > 0) {
|
||||
numPaginas = presupuestoMaquetacion.getNumCaracteres() / matricesPorPagina;
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
System.out.println("Error procesando JSON de presupuesto maquetacion: " + e.getMessage());
|
||||
// Precio por pagina estimado
|
||||
BigDecimal precioRedondeado = precio.setScale(2, RoundingMode.HALF_UP);
|
||||
double precioPaginaEstimado = 0.0;
|
||||
if (numPaginas > 0) {
|
||||
precioPaginaEstimado = precioRedondeado
|
||||
.divide(BigDecimal.valueOf(numPaginas), 2, RoundingMode.HALF_UP)
|
||||
.doubleValue();
|
||||
}
|
||||
|
||||
// tabla, columna, foto
|
||||
precio = precio
|
||||
.add(BigDecimal.valueOf(presupuestoMaquetacion.getNumTablas()).multiply(BigDecimal.valueOf(price.apply("tabla"))));
|
||||
precio = precio.add(
|
||||
BigDecimal.valueOf(presupuestoMaquetacion.getNumColumnas()).multiply(BigDecimal.valueOf(price.apply("columnas"))));
|
||||
precio = precio
|
||||
.add(BigDecimal.valueOf(presupuestoMaquetacion.getNumFotos()).multiply(BigDecimal.valueOf(price.apply("foto"))));
|
||||
|
||||
if (presupuestoMaquetacion.isCorreccionOrtotipografica()) {
|
||||
precio = precio
|
||||
.add(millares.multiply(BigDecimal.valueOf(price.apply("correccion_ortotipografica"))));
|
||||
}
|
||||
if (presupuestoMaquetacion.isTextoMecanografiado()) {
|
||||
precio = precio.add(millares.multiply(BigDecimal.valueOf(price.apply("mecanoescritura_por_millar"))));
|
||||
}
|
||||
if (presupuestoMaquetacion.isDisenioPortada()) {
|
||||
precio = precio.add(BigDecimal.valueOf(price.apply("disenio_portada")));
|
||||
}
|
||||
if (presupuestoMaquetacion.isEpub()) {
|
||||
precio = precio.add(BigDecimal.valueOf(price.apply("epub")));
|
||||
}
|
||||
|
||||
// redondeo final
|
||||
precioRedondeado = precio.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
HashMap<String, Object> out = new HashMap<>();
|
||||
out.put("precio", precioRedondeado.doubleValue());
|
||||
out.put("numPaginasEstimadas", numPaginas);
|
||||
out.put("precioPaginaEstimado", precioPaginaEstimado);
|
||||
return out;
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error procesando presupuesto maquetacion: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
package com.imprimelibros.erp.presupuesto.classes;
|
||||
|
||||
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.FontSize;
|
||||
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.Formato;;
|
||||
|
||||
public class PresupuestoMaquetacion {
|
||||
|
||||
private int numCaracteres;
|
||||
private String formato;
|
||||
private String fontSize;
|
||||
private int numTablas;
|
||||
private int numColumnas;
|
||||
private int numFotos;
|
||||
private boolean correccionOrtotipografica;
|
||||
private boolean textoMecanografiado;
|
||||
private boolean disenioPortada;
|
||||
private boolean epub;
|
||||
private int numCaracteres = 200000;
|
||||
private Formato formato = Formato.A5;
|
||||
private FontSize cuerpoTexto = FontSize.medium;
|
||||
private int numTablas = 0;
|
||||
private int numColumnas = 1;
|
||||
private int numFotos = 0;
|
||||
private boolean correccionOrtotipografica = false;
|
||||
private boolean textoMecanografiado = false;
|
||||
private boolean disenioPortada = false;
|
||||
private boolean epub = false;
|
||||
|
||||
public int getNumCaracteres() {
|
||||
return numCaracteres;
|
||||
@ -19,17 +22,17 @@ public class PresupuestoMaquetacion {
|
||||
public void setNumCaracteres(int numCaracteres) {
|
||||
this.numCaracteres = numCaracteres;
|
||||
}
|
||||
public String getFormato() {
|
||||
public Formato getFormato() {
|
||||
return formato;
|
||||
}
|
||||
public void setFormato(String formato) {
|
||||
public void setFormato(Formato formato) {
|
||||
this.formato = formato;
|
||||
}
|
||||
public String getFontSize() {
|
||||
return fontSize;
|
||||
public FontSize getCuerpoTexto() {
|
||||
return cuerpoTexto;
|
||||
}
|
||||
public void setFontSize(String fontSize) {
|
||||
this.fontSize = fontSize;
|
||||
public void setCuerpoTexto(FontSize cuerpoTexto) {
|
||||
this.cuerpoTexto = cuerpoTexto;
|
||||
}
|
||||
public int getNumTablas() {
|
||||
return numTablas;
|
||||
|
||||
@ -160,6 +160,25 @@ presupuesto.paginas=Páginas
|
||||
presupuesto.solapas=Solapas
|
||||
presupuesto.papel-gramaje=Papel y gramaje
|
||||
|
||||
presupuesto.maquetacion=Presupuesto de maquetación
|
||||
presupuesto.maquetacion.num-caracteres=Número de caracteres
|
||||
presupuesto.maquetacion.num-caracteres-descripcion=Caracteres con espacios (obtenidos desde Word)
|
||||
presupuesto.maquetacion.formato=Formato
|
||||
presupuesto.maquetacion.formato-descripcion=Seleccione el tamaño que más se aproxime
|
||||
presupuesto.maquetacion.cuerpo-texto=Cuerpo de texto
|
||||
presupuesto.maquetacion.cuerpo-texto-pequeño=Pequeño
|
||||
presupuesto.maquetacion.cuerpo-texto-medio=Medio (12pt)
|
||||
presupuesto.maquetacion.cuerpo-texto-grande=Grande
|
||||
presupuesto.maquetacion.cuerpo-texto-descripcion=Tamaño de letra usado (medio=12pt)
|
||||
presupuesto.maquetacion.num-columnas=Número de columnas
|
||||
presupuesto.maquetacion.num-columnas-descripcion=Número de columnas en las que se quiere maquetar el libro
|
||||
presupuesto.maquetacion.num-fotos=Número total imágenes/figuras
|
||||
presupuesto.maquetacion.num-tablas=Número de tablas
|
||||
presupuesto.maquetacion.correccion-ortotipografica=Corrección ortotipográfica
|
||||
presupuesto.maquetacion.texto-mecanografiado=Texto mecanografiado
|
||||
presupuesto.maquetacion.diseno-portada=Diseño de portada
|
||||
presupuesto.maquetacion.epub=Generación Epub
|
||||
|
||||
# Errores
|
||||
presupuesto.errores-title=Corrija los siguientes errores:
|
||||
presupuesto.errores.titulo=El título es obligatorio
|
||||
@ -181,4 +200,6 @@ presupuesto.errores.tipo-cubierta=Seleccione el tipo de cubierta
|
||||
presupuesto.errores.solapas-cubierta=Seleccione si desea o no solapas en la cubierta
|
||||
presupuesto.errores.papel-cubierta=Seleccione el tipo de papel para la cubierta
|
||||
presupuesto.errores.gramaje-cubierta=Seleccione el gramaje del papel para la cubierta
|
||||
presupuesto.errores.acabado-cubierta=Seleccione el acabado de la cubierta
|
||||
presupuesto.errores.acabado-cubierta=Seleccione el acabado de la cubierta
|
||||
|
||||
presupuesto.errores.presupuesto-maquetacion=No se pudo calcular el presupuesto de maquetación.
|
||||
@ -0,0 +1,29 @@
|
||||
$(document).on('click', '#maquetacion', function (e) {
|
||||
e.preventDefault();
|
||||
$.get("/presupuesto/public/maquetacion/form", function (data) {
|
||||
$("#maquetacionModalBody").html(data);
|
||||
$("#maquetacionModal").modal("show");
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("submit", "#maquetacionForm", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const $form = $(this);
|
||||
|
||||
$.ajax({
|
||||
url: $form.attr("action"),
|
||||
type: $form.attr("method"),
|
||||
data: $form.serialize(),
|
||||
success: function (data) {
|
||||
// obtener el json devuelto
|
||||
const json = JSON.parse(data);
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
$("#maquetacionModalBody").html(
|
||||
"<div class='alert alert-danger'>" + xhr.responseText + "</div>"
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -18,7 +18,7 @@ class ServiceOptionCard {
|
||||
: '';
|
||||
const $card = $(`
|
||||
<div class="col-lg-2 col-md-3 col-sm-6 mb-3">
|
||||
<input type="checkbox" class="service-checkbox data-price=${this.price} btn-check-service" id="${this.id}" name="services[]" value="${this.id}" autocomplete="off" ${this.checked ? 'checked' : ''} />
|
||||
<input type="checkbox" class="service-checkbox btn-check-service" data-price=${this.price} id="${this.id}" name="services[]" value="${this.id}" autocomplete="off" ${this.checked ? 'checked' : ''} />
|
||||
<label class="btn btn-service-option w-100 text-center py-3 px-2 d-flex flex-column align-items-center justify-content-center h-100" for="${this.id}">
|
||||
${ribbonHtml}
|
||||
<h5 class="service-title mb-1">${this.title}</h5>
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
<div th:unless="${#authorization.expression('isAuthenticated()')}">
|
||||
<script th:src="@{/assets/js/pages/imprimelibros/presupuestador/imagen-selector.js}"></script>
|
||||
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuestador.js}"></script>
|
||||
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuesto-maquetacion.js}"></script>
|
||||
</div>
|
||||
<script th:inline="javascript">
|
||||
window.languageBundle = /*[[${languageBundle}]]*/ {};
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
<div th:fragment="modal (id, title, size, bodyId)">
|
||||
<div class="modal fade" th:id="${id}" tabindex="-1" aria-hidden="true">
|
||||
<div th:class="'modal-dialog ' + ${size}">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" th:text="#{${title}}">Título</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body" th:id="${bodyId}">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,4 +1,12 @@
|
||||
<div th:fragment="presupuestador">
|
||||
<!-- Modales-->
|
||||
<div
|
||||
th:replace="imprimelibros/partials/modal-form :: modal('maquetacionModal', 'presupuesto.maquetacion', 'modal-lg', 'maquetacionModalBody')">
|
||||
</div>
|
||||
|
||||
<div
|
||||
th:replace="imprimelibros/partials/modal-form :: modal('marcapaginasModal', 'presupuesto.marcapaginas', 'modal-lg', 'marcapaginasModalBody')">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xl-9">
|
||||
<div class="card">
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
<div th:fragment="maquetacionForm">
|
||||
<form id="maquetacionForm" th:action="@{/presupuesto/public/maquetacion}" th:object="${presupuestoMaquetacion}" method="get">
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.num-caracteres}" for="num-caracteres">Número de caracteres</label>
|
||||
<input type="number" class="form-control" id="num-caracteres" th:field="*{numCaracteres}" min="1" required>
|
||||
<label th:text="#{presupuesto.maquetacion.num-caracteres-descripcion}" class="form-text text-muted"></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.formato}" for="formato-maquetacion">Formato</label>
|
||||
<select class="form-control" id="formato-maquetacion" th:field="*{formato}" required>
|
||||
<option value="A5" selected>A5</option>
|
||||
<option value="_17x24_">170x240 mm</option>
|
||||
<option value="A4">A4</option>
|
||||
</select>
|
||||
<label th:text="#{presupuesto.maquetacion.formato-descripcion}" class="form-text text-muted"></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.cuerpo-texto}" for="cuerpo-texto">Cuerpo de texto</label>
|
||||
<select class="form-control" id="cuerpo-texto" th:field="*{cuerpoTexto}" required>
|
||||
<option th:text="#{presupuesto.maquetacion.cuerpo-texto-pequeño}" value="small"></option>
|
||||
<option th:text="#{presupuesto.maquetacion.cuerpo-texto-medio}" value="medium" selected>Medio (12pt)
|
||||
</option>
|
||||
<option th:text="#{presupuesto.maquetacion.cuerpo-texto-grande}" value="large">Grande</option>
|
||||
</select>
|
||||
<label th:text="#{presupuesto.maquetacion.cuerpo-texto-descripcion}" class="form-text text-muted"></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.num-columnas}" for="num-columnas">Número de columnas</label>
|
||||
<input type="number" class="form-control" id="num-columnas" th:field="*{numColumnas}" min="1" required>
|
||||
<label th:text="#{presupuesto.maquetacion.num-columnas-descripcion}" class="form-text text-muted"></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.num-tablas}" for="num-tablas">Número de tablas</label>
|
||||
<input type="number" class="form-control" id="num-tablas" th:field="*{numTablas}" min="0" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label th:text="#{presupuesto.maquetacion.num-fotos}" for="num-fotos">Número de fotos</label>
|
||||
<input type="number" class="form-control" id="num-fotos" th:field="*{numFotos}" min="0" required>
|
||||
</div>
|
||||
<div class="form-check form-switch form-switch-custom mb-3 mt-3">
|
||||
<input type="checkbox" class="form-check-input form-switch-custom-primary"
|
||||
id="correccion-ortotipografica" name="correccion-ortotipografica"
|
||||
th:field="*{correccionOrtotipografica}">
|
||||
<label class="form-check-label" for="correccion-ortotipografica">Corrección ortotipográfica</label>
|
||||
</div>
|
||||
<div class="form-check form-switch form-switch-custom mb-3">
|
||||
<input type="checkbox" class="form-check-input form-switch-custom-primary"
|
||||
id="texto-mecanografiado" name="texto-mecanografiado" th:field="*{textoMecanografiado}">
|
||||
<label for="texto-mecanografiado" class="form-check-label" th:text="#{presupuesto.formato-personalizado}">
|
||||
Texto mecanografiado
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-switch form-switch-custom mb-3">
|
||||
<input type="checkbox" class="form-check-input form-switch-custom-primary" id="disenio-portada"
|
||||
name="disenio-portada" th:field="*{disenioPortada}">
|
||||
<label for="disenio-portada" class="form-check-label" th:text="#{presupuesto.maquetacion.diseno-portada}">
|
||||
Diseño de portada
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-switch form-switch-custom">
|
||||
<input type="checkbox" class="form-check-input form-switch-custom-primary" id="epub" name="epub"
|
||||
th:field="*{epub}">
|
||||
<label for="epub" class="form-check-label" th:text="#{presupuesto.maquetacion.epub}">ePub</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-secondary mt-3">Calcular Presupuesto</button>
|
||||
|
||||
</form>
|
||||
<div th:if="${resultado != null}" class="mt-4">
|
||||
<h3>Resultado del Presupuesto</h3>
|
||||
<pre th:text="${resultado}"></pre>
|
||||
</div>
|
||||
</div>
|
||||
@ -37,13 +37,14 @@ class presupuestoMaquetacionTest {
|
||||
|
||||
public String test() {
|
||||
|
||||
Presupuesto presupuesto = new Presupuesto();
|
||||
/*Presupuesto presupuesto = new Presupuesto();
|
||||
presupuesto.setPresupuestoMaquetacion(true);
|
||||
presupuesto.setPresupuestoMaquetacionData(
|
||||
"{\"numCaracteres\":200000,\"formato\":\"A5\",\"fontSize\":\"medium\",\"numTablas\":5,\"numColumnas\":1,\"numFotos\":10,\"correccionOrtotipografica\":true,\"textoMecanografiado\":false,\"disenioPortada\":true,\"epub\":true}");
|
||||
|
||||
Map<String, Object> resultado = presupuestoService.getPrecioMaquetacion(presupuesto);
|
||||
return resultado.toString();
|
||||
return resultado.toString();*/
|
||||
return "{}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user