mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
trabajando en leer datos de tipo cubierta
This commit is contained in:
@ -42,6 +42,8 @@ public class HomeController {
|
|||||||
model.addAttribute("pod", variableService.getValorEntero("POD"));
|
model.addAttribute("pod", variableService.getValorEntero("POD"));
|
||||||
model.addAttribute("ancho_alto_min", variableService.getValorEntero("ancho_alto_min"));
|
model.addAttribute("ancho_alto_min", variableService.getValorEntero("ancho_alto_min"));
|
||||||
model.addAttribute("ancho_alto_max", variableService.getValorEntero("ancho_alto_max"));
|
model.addAttribute("ancho_alto_max", variableService.getValorEntero("ancho_alto_max"));
|
||||||
|
|
||||||
|
model.addAttribute("appMode", "public");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// empty translations for authenticated users
|
// empty translations for authenticated users
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import org.springframework.ui.Model;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,6 +18,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
@ -35,7 +38,10 @@ import com.imprimelibros.erp.presupuesto.classes.ImagenPresupuesto;
|
|||||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMaquetacion;
|
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMaquetacion;
|
||||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMarcapaginas;
|
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMarcapaginas;
|
||||||
import com.imprimelibros.erp.presupuesto.dto.Presupuesto;
|
import com.imprimelibros.erp.presupuesto.dto.Presupuesto;
|
||||||
|
import com.imprimelibros.erp.presupuesto.service.PresupuestoService;
|
||||||
import com.imprimelibros.erp.presupuesto.validation.PresupuestoValidationGroups;
|
import com.imprimelibros.erp.presupuesto.validation.PresupuestoValidationGroups;
|
||||||
|
import com.imprimelibros.erp.presupuesto.service.PresupuestoFormDataMapper;
|
||||||
|
import com.imprimelibros.erp.presupuesto.service.PresupuestoFormDataMapper.PresupuestoFormDataDto;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@ -59,15 +65,17 @@ public class PresupuestoController {
|
|||||||
private final TranslationService translationService;
|
private final TranslationService translationService;
|
||||||
private final PresupuestoDatatableService dtService;
|
private final PresupuestoDatatableService dtService;
|
||||||
private final VariableService variableService;
|
private final VariableService variableService;
|
||||||
|
private final PresupuestoFormDataMapper formDataMapper;
|
||||||
|
|
||||||
public PresupuestoController(ObjectMapper objectMapper, TranslationService translationService,
|
public PresupuestoController(ObjectMapper objectMapper, TranslationService translationService,
|
||||||
PresupuestoDatatableService dtService, PresupuestoRepository presupuestoRepository,
|
PresupuestoDatatableService dtService, PresupuestoRepository presupuestoRepository,
|
||||||
VariableService variableService) {
|
VariableService variableService, PresupuestoFormDataMapper formDataMapper) {
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
this.translationService = translationService;
|
this.translationService = translationService;
|
||||||
this.dtService = dtService;
|
this.dtService = dtService;
|
||||||
this.presupuestoRepository = presupuestoRepository;
|
this.presupuestoRepository = presupuestoRepository;
|
||||||
this.variableService = variableService;
|
this.variableService = variableService;
|
||||||
|
this.formDataMapper = formDataMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/public/validar/datos-generales")
|
@PostMapping("/public/validar/datos-generales")
|
||||||
@ -77,12 +85,14 @@ public class PresupuestoController {
|
|||||||
|
|
||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
result.getFieldErrors().forEach(error -> {
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
// errores globales (@ConsistentTiradas...)
|
errores.put(error.getField(), msg);
|
||||||
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
});
|
||||||
|
result.getGlobalErrors().forEach(error -> {
|
||||||
|
errores.put("global", error.getDefaultMessage());
|
||||||
|
});
|
||||||
if (!errores.isEmpty()) {
|
if (!errores.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body(errores);
|
return ResponseEntity.badRequest().body(errores);
|
||||||
}
|
}
|
||||||
@ -106,7 +116,12 @@ public class PresupuestoController {
|
|||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// errores globales (@ConsistentTiradas...)
|
// errores globales (@ConsistentTiradas...)
|
||||||
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
||||||
@ -130,7 +145,12 @@ public class PresupuestoController {
|
|||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// errores globales (@ConsistentTiradas...)
|
// errores globales (@ConsistentTiradas...)
|
||||||
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
||||||
@ -161,7 +181,12 @@ public class PresupuestoController {
|
|||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// errores globales (@ConsistentTiradas...)
|
// errores globales (@ConsistentTiradas...)
|
||||||
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
result.getGlobalErrors().forEach(error -> errores.put("global", error.getDefaultMessage()));
|
||||||
@ -188,7 +213,12 @@ public class PresupuestoController {
|
|||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!errores.isEmpty()) {
|
if (!errores.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body(errores);
|
return ResponseEntity.badRequest().body(errores);
|
||||||
@ -200,7 +230,19 @@ public class PresupuestoController {
|
|||||||
// opciones gramaje interior
|
// opciones gramaje interior
|
||||||
resultado.putAll(presupuestoService.obtenerOpcionesGramajeInterior(presupuesto));
|
resultado.putAll(presupuestoService.obtenerOpcionesGramajeInterior(presupuesto));
|
||||||
|
|
||||||
List<String> opciones = new ObjectMapper().convertValue(resultado.get("opciones_papel_interior"),
|
List<ImagenPresupuesto> opciones_papel = new ObjectMapper().convertValue(
|
||||||
|
presupuestoService
|
||||||
|
.obtenerOpcionesPapelInterior(presupuesto, locale)
|
||||||
|
.get("opciones_papel_interior"),
|
||||||
|
new TypeReference<List<ImagenPresupuesto>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
if (opciones_papel != null && opciones_papel.stream().noneMatch(
|
||||||
|
o -> o.getExtra_data().get("sk-id").equals(String.valueOf(presupuesto.getPapelInteriorId())))) {
|
||||||
|
presupuesto.setPapelInteriorId(Integer.valueOf(opciones_papel.get(0).getExtra_data().get("sk-id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> opciones = new ObjectMapper().convertValue(resultado.get("opciones_gramaje_interior"),
|
||||||
new TypeReference<List<String>>() {
|
new TypeReference<List<String>>() {
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -218,12 +260,17 @@ public class PresupuestoController {
|
|||||||
@PostMapping("/public/get-gramaje-interior")
|
@PostMapping("/public/get-gramaje-interior")
|
||||||
public ResponseEntity<?> getGramajeInterior(
|
public ResponseEntity<?> getGramajeInterior(
|
||||||
@Validated(PresupuestoValidationGroups.Interior.class) Presupuesto presupuesto,
|
@Validated(PresupuestoValidationGroups.Interior.class) Presupuesto presupuesto,
|
||||||
BindingResult result) {
|
BindingResult result, Locale locale) {
|
||||||
|
|
||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!errores.isEmpty()) {
|
if (!errores.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body(errores);
|
return ResponseEntity.badRequest().body(errores);
|
||||||
@ -247,12 +294,17 @@ public class PresupuestoController {
|
|||||||
@PostMapping("/public/get-max-solapas")
|
@PostMapping("/public/get-max-solapas")
|
||||||
public ResponseEntity<?> getMaxSolapas(
|
public ResponseEntity<?> getMaxSolapas(
|
||||||
@Validated(PresupuestoValidationGroups.Interior.class) Presupuesto presupuesto,
|
@Validated(PresupuestoValidationGroups.Interior.class) Presupuesto presupuesto,
|
||||||
BindingResult result) {
|
BindingResult result, Locale locale) {
|
||||||
|
|
||||||
Map<String, String> errores = new HashMap<>();
|
Map<String, String> errores = new HashMap<>();
|
||||||
|
|
||||||
// errores de campos individuales
|
// errores de campos individuales
|
||||||
result.getFieldErrors().forEach(error -> errores.put(error.getField(), error.getDefaultMessage()));
|
result.getFieldErrors().forEach(error -> {
|
||||||
|
String code = Objects.requireNonNullElse(error.getDefaultMessage(), "").replace("{", "").replace("}", "");
|
||||||
|
String msg = messageSource.getMessage(code, null, locale);
|
||||||
|
errores.put(error.getField(), msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!errores.isEmpty()) {
|
if (!errores.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body(errores);
|
return ResponseEntity.badRequest().body(errores);
|
||||||
@ -462,16 +514,6 @@ public class PresupuestoController {
|
|||||||
|
|
||||||
// Buscar el presupuesto
|
// Buscar el presupuesto
|
||||||
Optional<Presupuesto> presupuestoOpt = presupuestoRepository.findById(id);
|
Optional<Presupuesto> presupuestoOpt = presupuestoRepository.findById(id);
|
||||||
boolean isUser = authentication.getAuthorities().stream()
|
|
||||||
.anyMatch(a -> a.getAuthority().equals("ROLE_USER"));
|
|
||||||
|
|
||||||
if (isUser) {
|
|
||||||
// Si es usuario, solo puede ver sus propios presupuestos
|
|
||||||
String username = authentication.getName();
|
|
||||||
if (!presupuestoOpt.get().getUser().getUserName().equals(username)) {
|
|
||||||
presupuestoOpt = Optional.empty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (presupuestoOpt.isEmpty()) {
|
if (presupuestoOpt.isEmpty()) {
|
||||||
// Añadir mensaje flash para mostrar alerta
|
// Añadir mensaje flash para mostrar alerta
|
||||||
@ -481,11 +523,44 @@ public class PresupuestoController {
|
|||||||
return "redirect:/presupuesto";
|
return "redirect:/presupuesto";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si existe, lo añadimos al modelo
|
if (!presupuestoService.canAccessPresupuesto(presupuestoOpt.get(), authentication)) {
|
||||||
model.addAttribute("presupuesto", presupuestoOpt.get());
|
// Añadir mensaje flash para mostrar alerta
|
||||||
|
redirectAttributes.addFlashAttribute("errorMessage",
|
||||||
|
messageSource.getMessage("app.errors.403", null, locale));
|
||||||
|
// Redirigir a la vista de lista
|
||||||
|
return "redirect:/presupuesto";
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
|
||||||
|
.getRequest().getRequestURI();
|
||||||
|
String mode = path.contains("/view/") ? "view" : "edit";
|
||||||
|
if (mode.equals("view")) {
|
||||||
|
model.addAttribute("appMode", "view");
|
||||||
|
} else {
|
||||||
|
model.addAttribute("appMode", "edit");
|
||||||
|
}
|
||||||
|
model.addAttribute("id", presupuestoOpt.get().getId());
|
||||||
return "imprimelibros/presupuestos/presupuesto-form";
|
return "imprimelibros/presupuestos/presupuesto-form";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/api/get", produces = "application/json")
|
||||||
|
public ResponseEntity<PresupuestoFormDataDto> getPresupuesto(
|
||||||
|
@RequestParam("id") Long id, Authentication authentication) {
|
||||||
|
|
||||||
|
Optional<Presupuesto> presupuestoOpt = presupuestoRepository.findById(id);
|
||||||
|
|
||||||
|
if (!presupuestoService.canAccessPresupuesto(presupuestoOpt.get(), authentication)) {
|
||||||
|
return ResponseEntity.status(403).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (presupuestoOpt.isPresent()) {
|
||||||
|
PresupuestoFormDataDto vm = formDataMapper.toFormData(presupuestoOpt.get());
|
||||||
|
return ResponseEntity.ok(vm);
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/datatable/anonimos", produces = "application/json")
|
@GetMapping(value = "/datatable/anonimos", produces = "application/json")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public DataTablesResponse<Map<String, Object>> datatableAnonimos(
|
public DataTablesResponse<Map<String, Object>> datatableAnonimos(
|
||||||
|
|||||||
@ -0,0 +1,266 @@
|
|||||||
|
package com.imprimelibros.erp.presupuesto.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.imprimelibros.erp.presupuesto.dto.Presupuesto;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PresupuestoFormDataMapper {
|
||||||
|
|
||||||
|
public class PresupuestoFormDataDto {
|
||||||
|
|
||||||
|
public DatosGenerales datosGenerales = new DatosGenerales();
|
||||||
|
public Interior interior = new Interior();
|
||||||
|
public Cubierta cubierta = new Cubierta();
|
||||||
|
public Servicios servicios = new Servicios();
|
||||||
|
public Integer selectedTirada;
|
||||||
|
|
||||||
|
// ===== Datos Generales =====
|
||||||
|
public static class DatosGenerales {
|
||||||
|
public String titulo = "";
|
||||||
|
public String autor = "";
|
||||||
|
public String isbn = "";
|
||||||
|
public String tirada1 = "";
|
||||||
|
public String tirada2 = "";
|
||||||
|
public String tirada3 = "";
|
||||||
|
public String tirada4 = "";
|
||||||
|
public Integer ancho;
|
||||||
|
public Integer alto;
|
||||||
|
public boolean formatoPersonalizado = false;
|
||||||
|
public String paginasNegro = "";
|
||||||
|
public String paginasColor = "";
|
||||||
|
public String posicionPaginasColor = "";
|
||||||
|
public String tipoEncuadernacion = "fresado"; // enum name
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== Interior =====
|
||||||
|
public static class Interior {
|
||||||
|
public String tipoImpresion = "negro"; // enum name
|
||||||
|
public Integer papelInteriorId = 3;
|
||||||
|
public Integer gramajeInterior = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== Cubierta =====
|
||||||
|
public static class Cubierta {
|
||||||
|
public String tipoCubierta = "tapaBlanda"; // enum name
|
||||||
|
public int solapasCubierta = 0; // 0/1 para tu UI
|
||||||
|
public String tamanioSolapasCubierta = "80";
|
||||||
|
public Integer cubiertaCaras = 2;
|
||||||
|
|
||||||
|
public Integer papelGuardasId = 3;
|
||||||
|
public Integer gramajeGuardas = 170;
|
||||||
|
public Integer guardasImpresas = 0;
|
||||||
|
public String cabezada = "WHI";
|
||||||
|
|
||||||
|
public Integer papelCubiertaId = 3;
|
||||||
|
public Integer gramajeCubierta = 170;
|
||||||
|
public Integer acabado = 1;
|
||||||
|
|
||||||
|
public SobreCubierta sobrecubierta = new SobreCubierta();
|
||||||
|
public Faja faja = new Faja();
|
||||||
|
|
||||||
|
public static class SobreCubierta {
|
||||||
|
public boolean activo = false;
|
||||||
|
public Integer papelSobrecubiertaId = 2;
|
||||||
|
public Integer gramajeSobrecubierta = 170;
|
||||||
|
public Integer tamanioSolapasSobrecubierta = 80;
|
||||||
|
public Integer acabado = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Faja {
|
||||||
|
public boolean activo = false;
|
||||||
|
public Integer papelFajaId = 2;
|
||||||
|
public Integer gramajeFaja = 170;
|
||||||
|
public Integer alto = 50;
|
||||||
|
public Integer tamanioSolapasFaja = 80;
|
||||||
|
public Integer acabado = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== Servicios / Extras =====
|
||||||
|
public static class Servicios {
|
||||||
|
public List<String> servicios = List.of();
|
||||||
|
public DatosMarcapaginas datosMarcapaginas = new DatosMarcapaginas();
|
||||||
|
public DatosMaquetacion datosMaquetacion = new DatosMaquetacion();
|
||||||
|
|
||||||
|
public static class DatosMarcapaginas {
|
||||||
|
public Integer marcapaginas_tirada = 100;
|
||||||
|
public String tamanio_marcapaginas = "_50x140_";
|
||||||
|
public String caras_impresion = "una_cara";
|
||||||
|
public String papel_marcapaginas = "cartulina_grafica";
|
||||||
|
public Integer gramaje_marcapaginas = 300;
|
||||||
|
public String acabado_marcapaginas = "ninguno";
|
||||||
|
public Resultado resultado = new Resultado();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DatosMaquetacion {
|
||||||
|
public Integer num_caracteres = 200000;
|
||||||
|
public String formato_maquetacion = "A5";
|
||||||
|
public String cuerpo_texto = "medium";
|
||||||
|
public Integer num_columnas = 1;
|
||||||
|
public Integer num_tablas = 0;
|
||||||
|
public Integer num_fotos = 0;
|
||||||
|
public boolean correccion_ortotipografica = false;
|
||||||
|
public boolean texto_mecanografiado = false;
|
||||||
|
public boolean disenio_portada = false;
|
||||||
|
public boolean epub = false;
|
||||||
|
public Resultado resultado = new Resultado();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Resultado {
|
||||||
|
public Integer num_paginas_estimadas = 0; // solo para maquetación
|
||||||
|
public Integer precio_pagina_estimado = 0;
|
||||||
|
public Number precio_unitario = 0; // solo para marcapáginas
|
||||||
|
public Number precio = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ObjectMapper om = new ObjectMapper();
|
||||||
|
|
||||||
|
public PresupuestoFormDataDto toFormData(Presupuesto p) {
|
||||||
|
|
||||||
|
PresupuestoFormDataDto vm = new PresupuestoFormDataDto();
|
||||||
|
|
||||||
|
// ===== Datos Generales
|
||||||
|
vm.datosGenerales.titulo = nz(p.getTitulo(), "");
|
||||||
|
vm.datosGenerales.autor = nz(p.getAutor(), "");
|
||||||
|
vm.datosGenerales.isbn = nz(p.getIsbn(), "");
|
||||||
|
|
||||||
|
vm.datosGenerales.tirada1 = nzStr(p.getTirada1());
|
||||||
|
vm.datosGenerales.tirada2 = nzStr(p.getTirada2());
|
||||||
|
vm.datosGenerales.tirada3 = nzStr(p.getTirada3());
|
||||||
|
vm.datosGenerales.tirada4 = nzStr(p.getTirada4());
|
||||||
|
|
||||||
|
vm.datosGenerales.ancho = p.getAncho();
|
||||||
|
vm.datosGenerales.alto = p.getAlto();
|
||||||
|
vm.datosGenerales.formatoPersonalizado = Boolean.TRUE.equals(p.getFormatoPersonalizado());
|
||||||
|
|
||||||
|
vm.datosGenerales.paginasNegro = nzStr(p.getPaginasNegro());
|
||||||
|
vm.datosGenerales.paginasColor = nzStr(p.getPaginasColor());
|
||||||
|
vm.datosGenerales.posicionPaginasColor = nz(p.getPosicionPaginasColor(), "");
|
||||||
|
|
||||||
|
vm.datosGenerales.tipoEncuadernacion = enumName(p.getTipoEncuadernacion(), "fresado");
|
||||||
|
|
||||||
|
// ===== Interior
|
||||||
|
vm.interior.tipoImpresion = enumName(p.getTipoImpresion(), "negro");
|
||||||
|
vm.interior.papelInteriorId = nz(p.getPapelInteriorId(), 3);
|
||||||
|
vm.interior.gramajeInterior = nz(p.getGramajeInterior(), 80);
|
||||||
|
|
||||||
|
// ===== Cubierta
|
||||||
|
vm.cubierta.tipoCubierta = enumName(p.getTipoCubierta(), "tapaBlanda");
|
||||||
|
vm.cubierta.solapasCubierta = Boolean.TRUE.equals(p.getSolapasCubierta()) ? 1 : 0;
|
||||||
|
vm.cubierta.tamanioSolapasCubierta = String.valueOf(nz(p.getTamanioSolapasCubierta(), 80));
|
||||||
|
vm.cubierta.cubiertaCaras = nz(p.getCubiertaCaras(), 2);
|
||||||
|
|
||||||
|
vm.cubierta.papelGuardasId = nz(p.getPapelGuardasId(), 3);
|
||||||
|
vm.cubierta.gramajeGuardas = nz(p.getGramajeGuardas(), 170);
|
||||||
|
vm.cubierta.guardasImpresas = nz(p.getGuardasImpresas(), 0);
|
||||||
|
vm.cubierta.cabezada = nz(p.getCabezada(), "WHI");
|
||||||
|
|
||||||
|
vm.cubierta.papelCubiertaId = nz(p.getPapelCubiertaId(), 3);
|
||||||
|
vm.cubierta.gramajeCubierta = nz(p.getGramajeCubierta(), 170);
|
||||||
|
vm.cubierta.acabado = nz(p.getAcabado(), 1);
|
||||||
|
|
||||||
|
vm.cubierta.sobrecubierta.activo = Boolean.TRUE.equals(p.getSobrecubierta());
|
||||||
|
vm.cubierta.sobrecubierta.papelSobrecubiertaId = nz(p.getPapelSobrecubiertaId(), 2);
|
||||||
|
vm.cubierta.sobrecubierta.gramajeSobrecubierta = nz(p.getGramajeSobrecubierta(), 170);
|
||||||
|
vm.cubierta.sobrecubierta.tamanioSolapasSobrecubierta = nz(p.getTamanioSolapasSobrecubierta(), 80);
|
||||||
|
vm.cubierta.sobrecubierta.acabado = nz(p.getAcabadoSobrecubierta(), 0);
|
||||||
|
|
||||||
|
vm.cubierta.faja.activo = Boolean.TRUE.equals(p.getFaja());
|
||||||
|
vm.cubierta.faja.papelFajaId = nz(p.getPapelFajaId(), 2);
|
||||||
|
vm.cubierta.faja.gramajeFaja = nz(p.getGramajeFaja(), 170);
|
||||||
|
vm.cubierta.faja.tamanioSolapasFaja = nz(p.getTamanioSolapasFaja(), 80);
|
||||||
|
vm.cubierta.faja.acabado = nz(p.getAcabadoFaja(), 0);
|
||||||
|
vm.cubierta.faja.alto = nz(p.getAltoFaja(), 50);
|
||||||
|
|
||||||
|
// ===== Selected tirada
|
||||||
|
vm.selectedTirada = p.getSelectedTirada();
|
||||||
|
|
||||||
|
// ===== Servicios desde JSONs
|
||||||
|
// servicios_json: acepta ["maquetacion","marcapaginas"] o [{id:...}, ...]
|
||||||
|
vm.servicios.servicios = parseServiciosIds(p.getServiciosJson());
|
||||||
|
|
||||||
|
// datos_maquetacion_json
|
||||||
|
PresupuestoFormDataDto.Servicios.DatosMaquetacion maq = parse(p.getDatosMaquetacionJson(),
|
||||||
|
PresupuestoFormDataDto.Servicios.DatosMaquetacion.class);
|
||||||
|
if (maq != null)
|
||||||
|
vm.servicios.datosMaquetacion = merge(vm.servicios.datosMaquetacion, maq);
|
||||||
|
|
||||||
|
// datos_marcapaginas_json
|
||||||
|
PresupuestoFormDataDto.Servicios.DatosMarcapaginas mp = parse(p.getDatosMarcapaginasJson(),
|
||||||
|
PresupuestoFormDataDto.Servicios.DatosMarcapaginas.class);
|
||||||
|
if (mp != null)
|
||||||
|
vm.servicios.datosMarcapaginas = merge(vm.servicios.datosMarcapaginas, mp);
|
||||||
|
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== Helpers =====
|
||||||
|
|
||||||
|
private static String enumName(Enum<?> e, String def) {
|
||||||
|
return e != null ? e.name() : def;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String nz(String v, String def) {
|
||||||
|
return v != null ? v : def;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer nz(Integer v, Integer def) {
|
||||||
|
return v != null ? v : def;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String nzStr(Integer v) {
|
||||||
|
return v == null ? "" : String.valueOf(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T parse(String json, Class<T> type) {
|
||||||
|
try {
|
||||||
|
if (json == null || json.isBlank())
|
||||||
|
return null;
|
||||||
|
return om.readValue(json, type);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> parseServiciosIds(String json) {
|
||||||
|
if (json == null || json.isBlank())
|
||||||
|
return new ArrayList<>();
|
||||||
|
try {
|
||||||
|
// 1) intentar como lista de strings
|
||||||
|
List<String> ids = om.readValue(json, new TypeReference<List<String>>() {
|
||||||
|
});
|
||||||
|
return ids != null ? ids : new ArrayList<>();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 2) intentar como lista de objetos con 'id'
|
||||||
|
List<Map<String, Object>> list = om.readValue(json, new TypeReference<>() {
|
||||||
|
});
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (Map<String, Object> it : list) {
|
||||||
|
Object id = it.get("id");
|
||||||
|
if (id != null)
|
||||||
|
ids.add(String.valueOf(id));
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
} catch (
|
||||||
|
|
||||||
|
Exception e) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T merge(T base, T override) {
|
||||||
|
// merge muy simple: si override != null, devuélvelo; si no, base
|
||||||
|
// (si quisieras merge campo a campo, usa BeanUtils o MapStruct)
|
||||||
|
return override != null ? override : base;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.imprimelibros.erp.presupuesto;
|
package com.imprimelibros.erp.presupuesto.service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -12,6 +12,7 @@ import java.text.NumberFormat;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -23,6 +24,8 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
import com.imprimelibros.erp.configurationERP.VariableService;
|
import com.imprimelibros.erp.configurationERP.VariableService;
|
||||||
|
import com.imprimelibros.erp.presupuesto.GeoIpService;
|
||||||
|
import com.imprimelibros.erp.presupuesto.PresupuestoRepository;
|
||||||
import com.imprimelibros.erp.presupuesto.classes.ImagenPresupuesto;
|
import com.imprimelibros.erp.presupuesto.classes.ImagenPresupuesto;
|
||||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestadorItems;
|
import com.imprimelibros.erp.presupuesto.classes.PresupuestadorItems;
|
||||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestoFormatter;
|
import com.imprimelibros.erp.presupuesto.classes.PresupuestoFormatter;
|
||||||
@ -954,6 +957,21 @@ public class PresupuestoService {
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean canAccessPresupuesto(Presupuesto presupuesto, Authentication authentication) {
|
||||||
|
|
||||||
|
boolean isUser = authentication.getAuthorities().stream()
|
||||||
|
.anyMatch(a -> a.getAuthority().equals("ROLE_USER"));
|
||||||
|
|
||||||
|
if (isUser) {
|
||||||
|
// Si es usuario, solo puede ver sus propios presupuestos
|
||||||
|
String username = authentication.getName();
|
||||||
|
if (!presupuesto.getUser().getUserName().equals(username)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -23,10 +23,6 @@
|
|||||||
transition: border 0.3s ease;
|
transition: border 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Borde visible cuando está seleccionada === */
|
|
||||||
.image-container.selected {
|
|
||||||
border-color: #92b2a7;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* === Imagen interna === */
|
/* === Imagen interna === */
|
||||||
.image-container img {
|
.image-container img {
|
||||||
@ -37,6 +33,16 @@
|
|||||||
transition: transform 0.3s ease;
|
transition: transform 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Borde cuando está seleccionado, sin JS */
|
||||||
|
.image-container:has(input:checked) {
|
||||||
|
border-color: #92b2a7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Si quieres la animación al seleccionar */
|
||||||
|
.image-container:has(input:checked) .image-presupuesto {
|
||||||
|
animation: zoomPop 800ms cubic-bezier(0.68,-0.55,0.27,1.55);
|
||||||
|
}
|
||||||
|
|
||||||
/* === Animación de zoom con rebote === */
|
/* === Animación de zoom con rebote === */
|
||||||
.image-presupuesto.zoom-anim {
|
.image-presupuesto.zoom-anim {
|
||||||
animation: zoomPop 800ms cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
animation: zoomPop 800ms cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
||||||
|
|||||||
@ -7,17 +7,17 @@ class imagen_presupuesto {
|
|||||||
this.group = data.group || ""; // Grupo al que pertenece el radio
|
this.group = data.group || ""; // Grupo al que pertenece el radio
|
||||||
this.texto = data.texto || ""; // Texto de la etiqueta
|
this.texto = data.texto || ""; // Texto de la etiqueta
|
||||||
this.selected = data.selected || false;
|
this.selected = data.selected || false;
|
||||||
this.extraClass = (data.extraClass && !(data.extraClass===undefined))? (data.extraClass + ' ') : '';
|
this.extraClass = (data.extraClass && !(data.extraClass === undefined)) ? (data.extraClass + ' ') : '';
|
||||||
this.extraData = data.extra_data || {}; // Datos extra opcionales
|
this.extraData = data.extra_data || {}; // Datos extra opcionales
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const contenedor = $('<div>', {
|
const contenedor = $('<label>', {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
class: `${this.extraClass + ' '}image-container imagen-selector${this.selected ? ' selected' : ''}`
|
class: `${this.extraClass + ' '}image-container imagen-selector}`
|
||||||
});
|
});
|
||||||
// Añadir atributos extra al contenedor
|
// Añadir atributos extra al contenedor
|
||||||
for (const [key, value] of Object.entries(this.extraData)) {
|
for (const [key, value] of Object.entries(this.extraData)) {
|
||||||
contenedor.attr(`data-${key}`, value);
|
contenedor.attr(`data-${key}`, value);
|
||||||
}
|
}
|
||||||
contenedor.attr("data-summary-text", this.texto); // Para el resumen
|
contenedor.attr("data-summary-text", this.texto); // Para el resumen
|
||||||
@ -26,7 +26,8 @@ class imagen_presupuesto {
|
|||||||
type: 'radio',
|
type: 'radio',
|
||||||
name: this.group,
|
name: this.group,
|
||||||
value: this.id,
|
value: this.id,
|
||||||
hidden: true
|
hidden: true,
|
||||||
|
checked: this.selected
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -37,13 +38,12 @@ class imagen_presupuesto {
|
|||||||
alt: this.alt
|
alt: this.alt
|
||||||
});
|
});
|
||||||
|
|
||||||
const etiqueta = $('<label>', {
|
const etiqueta = $('<div>', {
|
||||||
for: this.id + '-img',
|
class: 'form-text text-center',
|
||||||
class: 'form-label',
|
|
||||||
text: this.texto
|
text: this.texto
|
||||||
});
|
});
|
||||||
|
|
||||||
contenedor.append(imagen, etiqueta);
|
contenedor.append(input, imagen, etiqueta);
|
||||||
return contenedor;
|
return contenedor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,18 +32,18 @@ export function updatePaginas() {
|
|||||||
|
|
||||||
export function updateTipoImpresion() {
|
export function updateTipoImpresion() {
|
||||||
|
|
||||||
const $selected = $('.opcion-color.selected');
|
const $selected = $('.opcion-color input:checked');
|
||||||
if ($selected.length > 0) {
|
if ($selected.length > 0) {
|
||||||
const resumen = $selected.data('summary-text') || $selected.attr('id');
|
const resumen = $selected.closest('.opcion-color').data('summary-text') || $selected.closest('.opcion-color').attr('id');
|
||||||
$('#summary-tipo-interior').text(resumen);
|
$('#summary-tipo-interior').text(resumen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updatePapelInterior() {
|
export function updatePapelInterior() {
|
||||||
|
|
||||||
const $selected = $('.papel-interior.selected');
|
const $selected = $('.papel-interior input:checked');
|
||||||
if ($selected.length > 0) {
|
if ($selected.length > 0) {
|
||||||
const resumen = $selected.data('summary-text') || $selected.val();
|
const resumen = $selected.closest('.papel-interior').data('summary-text') || $selected.closest('.papel-interior').val();
|
||||||
$('#summary-papel-interior').text(resumen);
|
$('#summary-papel-interior').text(resumen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,12 +58,12 @@ export function updateGramajeInterior() {
|
|||||||
|
|
||||||
export function updateTapaCubierta(){
|
export function updateTapaCubierta(){
|
||||||
|
|
||||||
const $selected = $('.tapa-cubierta.selected');
|
const $selected = $('.tapa-cubierta input:checked');
|
||||||
if ($selected.length > 0) {
|
if ($selected.length > 0) {
|
||||||
const resumen = $selected.data('summary-text') || $selected.attr('id');
|
const resumen = $selected.closest('.tapa-cubierta').data('summary-text') || $selected.closest('.tapa-cubierta').attr('id');
|
||||||
$('#summary-tapa-cubierta').text(resumen);
|
$('#summary-tapa-cubierta').text(resumen);
|
||||||
}
|
}
|
||||||
if($selected.attr('id') === 'tapaBlanda') {
|
if($selected.closest('.tapa-cubierta').attr('id') === 'tapaBlanda') {
|
||||||
|
|
||||||
$('.tapa-blanda-row').removeClass('d-none');
|
$('.tapa-blanda-row').removeClass('d-none');
|
||||||
$('.tapa-dura-row').addClass('d-none');
|
$('.tapa-dura-row').addClass('d-none');
|
||||||
@ -88,9 +88,9 @@ export function updateTapaCubierta(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function updatePapelCubierta() {
|
export function updatePapelCubierta() {
|
||||||
const $selected = $('.papel-cubierta.selected');
|
const $selected = $('.papel-cubierta input:checked');
|
||||||
if ($selected.length > 0) {
|
if ($selected.length > 0) {
|
||||||
const resumen = $selected.data('summary-text') || $selected.val();
|
const resumen = $selected.closest('.papel-cubierta').data('summary-text') || $selected.closest('.papel-cubierta').val();
|
||||||
$('#summary-papel-cubierta').text(resumen);
|
$('#summary-papel-cubierta').text(resumen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
import PresupuestoWizard from './wizard.js';
|
||||||
|
|
||||||
|
const app = new PresupuestoWizard({ mode: 'public' });
|
||||||
|
app.init();
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
import PresupuestoWizard from './wizard.js';
|
||||||
|
|
||||||
|
const app = new PresupuestoWizard({
|
||||||
|
mode: 'view',
|
||||||
|
readonly: true,
|
||||||
|
canSave: false,
|
||||||
|
useSessionCache: false,
|
||||||
|
});
|
||||||
|
app.init();
|
||||||
@ -4,9 +4,16 @@ import TiradaCard from "./tirada-price-card.js";
|
|||||||
import * as Summary from "./summary.js";
|
import * as Summary from "./summary.js";
|
||||||
import { formateaMoneda } from "../utils.js";
|
import { formateaMoneda } from "../utils.js";
|
||||||
|
|
||||||
class PresupuestoCliente {
|
export default class PresupuestoWizard {
|
||||||
|
|
||||||
constructor() {
|
constructor(options = {}) {
|
||||||
|
this.opts = Object.assign({
|
||||||
|
mode: 'public',
|
||||||
|
presupuestoId: null,
|
||||||
|
readonly: false,
|
||||||
|
canSave: false,
|
||||||
|
useSessionCache: true
|
||||||
|
}, options);
|
||||||
|
|
||||||
this.DEBUG = true; // Activar o desactivar el modo de depuración
|
this.DEBUG = true; // Activar o desactivar el modo de depuración
|
||||||
|
|
||||||
@ -168,18 +175,38 @@ class PresupuestoCliente {
|
|||||||
this.summaryTableExtras = $('#summary-servicios-extras');
|
this.summaryTableExtras = $('#summary-servicios-extras');
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
async init() {
|
||||||
|
|
||||||
|
const root = document.getElementById('presupuesto-app');
|
||||||
|
const mode = root?.dataset.mode || 'public';
|
||||||
|
const presupuestoId = root?.dataset.id || null;
|
||||||
|
|
||||||
|
this.opts = { mode, presupuestoId };
|
||||||
|
|
||||||
const stored = sessionStorage.getItem("formData");
|
const stored = sessionStorage.getItem("formData");
|
||||||
|
|
||||||
this.#initDatosGenerales();
|
this.#initDatosGenerales();
|
||||||
this.#initCubierta();
|
|
||||||
|
|
||||||
if (stored) {
|
if (presupuestoId && mode !== 'public') {
|
||||||
this.formData = JSON.parse(stored);
|
await fetch(`/presupuesto/api/get?id=${encodeURIComponent(presupuestoId)}`, {
|
||||||
this.#loadDatosGeneralesData();
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(dto => {
|
||||||
|
this.formData = dto;
|
||||||
|
this.#loadDatosGeneralesData();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (stored) {
|
||||||
|
this.formData = JSON.parse(stored);
|
||||||
|
this.#loadDatosGeneralesData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#initCubierta();
|
||||||
|
|
||||||
Summary.updateEncuadernacion();
|
Summary.updateEncuadernacion();
|
||||||
Summary.updateFormato();
|
Summary.updateFormato();
|
||||||
Summary.updatePaginas();
|
Summary.updatePaginas();
|
||||||
@ -205,10 +232,47 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.opts.canSave) {
|
||||||
|
$('#btn-guardar').on('click', async () => {
|
||||||
|
// compón el payload con lo que ya tienes:
|
||||||
|
const payload = {
|
||||||
|
id: this.opts.presupuestoId,
|
||||||
|
presupuesto: this.#getPresupuestoData(),
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const res = await fetch(this.opts.endpoints.save, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(payload)
|
||||||
|
}).then(r => r.json());
|
||||||
|
|
||||||
|
// feedback
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: window.languageBundle?.get('common.guardado') || 'Guardado',
|
||||||
|
timer: 1800,
|
||||||
|
showConfirmButton: false
|
||||||
|
});
|
||||||
|
// opcional: actualizar window.PRESUPUESTO_ID/resumen con el id devuelto
|
||||||
|
if (res.id) window.PRESUPUESTO_ID = res.id;
|
||||||
|
} catch (e) {
|
||||||
|
Swal.fire({ icon: 'error', title: 'Error al guardar', text: e?.message || '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limpiar el sessionStorage al salir de la página
|
||||||
|
window.addEventListener('beforeunload', () => {
|
||||||
|
sessionStorage.removeItem('formData');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#cacheFormData() {
|
#cacheFormData() {
|
||||||
sessionStorage.setItem("formData", JSON.stringify(this.formData));
|
if (!this.opts.useSessionCache) return;
|
||||||
|
const key = this.opts.mode === 'edit' && this.opts.presupuestoId
|
||||||
|
? `formData:edit:${this.opts.presupuestoId}`
|
||||||
|
: `formData:${this.opts.mode}`;
|
||||||
|
sessionStorage.setItem(key, JSON.stringify(this.formData));
|
||||||
}
|
}
|
||||||
|
|
||||||
#changeTab(idContenidoTab) {
|
#changeTab(idContenidoTab) {
|
||||||
@ -445,7 +509,7 @@ class PresupuestoCliente {
|
|||||||
this.tirada4.val(this.formData.datosGenerales.tirada4);
|
this.tirada4.val(this.formData.datosGenerales.tirada4);
|
||||||
|
|
||||||
this.paginasNegro.val(this.formData.datosGenerales.paginasNegro);
|
this.paginasNegro.val(this.formData.datosGenerales.paginasNegro);
|
||||||
this.paginasColor.val(this.formData.datosGenerales.paginasColor);
|
this.paginasColor.val(this.formData.datosGenerales.paginasColor);;
|
||||||
|
|
||||||
this.posicionPaginasColor.val(this.formData.datosGenerales.posicionPaginasColor);
|
this.posicionPaginasColor.val(this.formData.datosGenerales.posicionPaginasColor);
|
||||||
|
|
||||||
@ -456,7 +520,8 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('.tipo-libro').removeClass('selected');
|
$('.tipo-libro').removeClass('selected');
|
||||||
$('.image-container#' + this.formData.datosGenerales.tipoEncuadernacion).trigger('click');
|
$('input[name="tipoEncuadernacion"][value="' + this.formData.datosGenerales.tipoEncuadernacion + '"]')
|
||||||
|
.prop('checked', true);
|
||||||
this.#updateTipoEncuadernacion();
|
this.#updateTipoEncuadernacion();
|
||||||
|
|
||||||
this.formatoPersonalizado.trigger('change');
|
this.formatoPersonalizado.trigger('change');
|
||||||
@ -563,8 +628,8 @@ class PresupuestoCliente {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.opcion-color', (e) => {
|
$(document).on('change', 'input[name="tipoImpresion"]', (e) => {
|
||||||
|
|
||||||
const data = this.#getPresupuestoData();
|
const data = this.#getPresupuestoData();
|
||||||
Summary.updateTipoImpresion();
|
Summary.updateTipoImpresion();
|
||||||
|
|
||||||
@ -614,8 +679,8 @@ class PresupuestoCliente {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.papel-interior', (e) => {
|
|
||||||
|
|
||||||
|
$(document).on('change', 'input[name="papelInterior"]', (e) => {
|
||||||
const data = this.#getPresupuestoData();
|
const data = this.#getPresupuestoData();
|
||||||
|
|
||||||
Summary.updatePapelInterior();
|
Summary.updatePapelInterior();
|
||||||
@ -770,6 +835,7 @@ class PresupuestoCliente {
|
|||||||
for (let i = 0; i < opciones_color.length; i++) {
|
for (let i = 0; i < opciones_color.length; i++) {
|
||||||
const opcion = opciones_color[i];
|
const opcion = opciones_color[i];
|
||||||
const item = new imagen_presupuesto(opcion);
|
const item = new imagen_presupuesto(opcion);
|
||||||
|
item.group = 'tipoImpresion';
|
||||||
item.extraClass = 'interior-data opcion-color';
|
item.extraClass = 'interior-data opcion-color';
|
||||||
if ((this.formData.interior.tipoImpresion === '' && i === 0) ||
|
if ((this.formData.interior.tipoImpresion === '' && i === 0) ||
|
||||||
this.formData.interior.tipoImpresion === opcion.id) {
|
this.formData.interior.tipoImpresion === opcion.id) {
|
||||||
@ -782,6 +848,7 @@ class PresupuestoCliente {
|
|||||||
for (let i = 0; i < opciones_papel_interior.length; i++) {
|
for (let i = 0; i < opciones_papel_interior.length; i++) {
|
||||||
const opcion = opciones_papel_interior[i];
|
const opcion = opciones_papel_interior[i];
|
||||||
const item = new imagen_presupuesto(opcion);
|
const item = new imagen_presupuesto(opcion);
|
||||||
|
item.group = 'papelInterior';
|
||||||
item.extraClass = 'interior-data papel-interior';
|
item.extraClass = 'interior-data papel-interior';
|
||||||
if (this.formData.interior.papelInteriorId == '' && i === 0 ||
|
if (this.formData.interior.papelInteriorId == '' && i === 0 ||
|
||||||
this.formData.interior.papelInteriorId == opcion.extra_data["sk-id"]) {
|
this.formData.interior.papelInteriorId == opcion.extra_data["sk-id"]) {
|
||||||
@ -823,8 +890,8 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
#getInteriorData() {
|
#getInteriorData() {
|
||||||
|
|
||||||
const tipoImpresion = $('#div-opciones-color .image-container.selected').attr('id') || 'negro';
|
const tipoImpresion = $('#div-opciones-color .image-container input:checked').parent().attr('id') || 'negro';
|
||||||
const papelInteriorId = $('#div-papel-interior .image-container.selected').data('sk-id') || 3;
|
const papelInteriorId = $('#div-papel-interior .image-container input:checked').parent().data('sk-id') || 3;
|
||||||
const gramajeInterior = $('input[name="gramaje-interior"]:checked').data('gramaje') || 90;
|
const gramajeInterior = $('input[name="gramaje-interior"]:checked').data('gramaje') || 90;
|
||||||
return {
|
return {
|
||||||
tipoImpresion: tipoImpresion,
|
tipoImpresion: tipoImpresion,
|
||||||
@ -882,12 +949,12 @@ class PresupuestoCliente {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.tapa-cubierta', (e) => {
|
$(document).on('change', 'input[name="tipoCubierta"]', (e) => {
|
||||||
|
|
||||||
$('.tapa-dura-options').eq(0).removeClass('animate-fadeInUpBounce');
|
$('.tapa-dura-options').eq(0).removeClass('animate-fadeInUpBounce');
|
||||||
$('.tapa-blanda-options').eq(0).removeClass('animate-fadeInUpBounce');
|
$('.tapa-blanda-options').eq(0).removeClass('animate-fadeInUpBounce');
|
||||||
|
|
||||||
if (e.currentTarget.id === 'tapaBlanda') {
|
if (e.currentTarget.value === 'tapaBlanda') {
|
||||||
$('.tapa-blanda-options').eq(0).addClass('animate-fadeInUpBounce');
|
$('.tapa-blanda-options').eq(0).addClass('animate-fadeInUpBounce');
|
||||||
$('.tapa-dura-options').addClass('d-none');
|
$('.tapa-dura-options').addClass('d-none');
|
||||||
$('.tapa-blanda-options').removeClass('d-none');
|
$('.tapa-blanda-options').removeClass('d-none');
|
||||||
@ -898,13 +965,13 @@ class PresupuestoCliente {
|
|||||||
$('.tapa-dura-options').removeClass('d-none');
|
$('.tapa-dura-options').removeClass('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#getPapelesCubierta(e.currentTarget.id);
|
this.#getPapelesCubierta(e.currentTarget.value);
|
||||||
Summary.updateTapaCubierta();
|
Summary.updateTapaCubierta();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.solapas-cubierta', (e) => {
|
$(document).on('change', 'input[name="solapasCubierta"]', (e) => {
|
||||||
|
|
||||||
if (e.currentTarget.id === 'sin-solapas') {
|
if (e.currentTarget.closest('.image-container').id === 'sin-solapas') {
|
||||||
this.divSolapasCubierta.addClass('d-none');
|
this.divSolapasCubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -918,6 +985,7 @@ class PresupuestoCliente {
|
|||||||
Summary.updateTapaCubierta();
|
Summary.updateTapaCubierta();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.papel-cubierta', (e) => {
|
$(document).on('click', '.papel-cubierta', (e) => {
|
||||||
|
|
||||||
const data = this.#getPresupuestoData();
|
const data = this.#getPresupuestoData();
|
||||||
@ -1132,7 +1200,7 @@ class PresupuestoCliente {
|
|||||||
const gramajeGuardas = parseInt($('#papel-guardas option:selected').data('gramaje')) || 170;
|
const gramajeGuardas = parseInt($('#papel-guardas option:selected').data('gramaje')) || 170;
|
||||||
const guardasImpresas = parseInt(this.guardasImpresas) || 0;
|
const guardasImpresas = parseInt(this.guardasImpresas) || 0;
|
||||||
const cabezada = this.cabezada.val() || 'WHI';
|
const cabezada = this.cabezada.val() || 'WHI';
|
||||||
const papelCubiertaId = $('#div-papel-cubierta .image-container.selected').data('sk-id') || this.formData.cubierta.papelCubiertaId || 3;
|
const papelCubiertaId = $('#div-papel-cubierta .image-container input:checked').parent().data('sk-id') || this.formData.cubierta.papelCubiertaId || 3;
|
||||||
const gramajeCubierta = $('input[name="gramaje-cubierta"]:checked').data('gramaje') || this.formData.cubierta.gramajeCubierta || 170;
|
const gramajeCubierta = $('input[name="gramaje-cubierta"]:checked').data('gramaje') || this.formData.cubierta.gramajeCubierta || 170;
|
||||||
const acabado = parseInt($(`input[name="acabado-cubierta"]:checked`).attr('sk-id')) || 1;
|
const acabado = parseInt($(`input[name="acabado-cubierta"]:checked`).attr('sk-id')) || 1;
|
||||||
const sobrecubierta = this.sobrecubierta.hasClass('active');
|
const sobrecubierta = this.sobrecubierta.hasClass('active');
|
||||||
@ -1230,9 +1298,9 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
#loadCubiertaData() {
|
#loadCubiertaData() {
|
||||||
|
|
||||||
$('.tapa-cubierta').removeClass('selected');
|
$('input[name="tipoCubierta"][value="' + this.formData.cubierta.tipoCubierta + '"]')
|
||||||
$(`#${this.formData.cubierta.tipoCubierta}`).addClass('selected');
|
.prop('checked', true);
|
||||||
|
|
||||||
if (this.formData.cubierta.tipoCubierta === 'tapaBlanda') {
|
if (this.formData.cubierta.tipoCubierta === 'tapaBlanda') {
|
||||||
$('.tapa-blanda-options').removeClass('d-none');
|
$('.tapa-blanda-options').removeClass('d-none');
|
||||||
$('.tapa-dura-options').addClass('d-none');
|
$('.tapa-dura-options').addClass('d-none');
|
||||||
@ -1247,7 +1315,7 @@ class PresupuestoCliente {
|
|||||||
this.cabezada.val(this.formData.cubierta.cabezada);
|
this.cabezada.val(this.formData.cubierta.cabezada);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(`#${this.formData.cubierta.tipoCubierta}`).trigger('click');
|
$('input[name="tipoCubierta"][value="' + this.formData.cubierta.tipoCubierta + '"]').trigger('change');
|
||||||
|
|
||||||
if (this.formData.cubierta.solapasCubierta === 0) {
|
if (this.formData.cubierta.solapasCubierta === 0) {
|
||||||
$('.solapas-cubierta#sin-solapas').addClass('selected');
|
$('.solapas-cubierta#sin-solapas').addClass('selected');
|
||||||
@ -1632,7 +1700,3 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
const presupuestoCliente = new PresupuestoCliente();
|
|
||||||
presupuestoCliente.init();
|
|
||||||
});
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<th:block layout:fragment="pagejs">
|
<th:block layout:fragment="pagejs">
|
||||||
<div th:unless="${#authorization.expression('isAuthenticated()')}">
|
<div th:unless="${#authorization.expression('isAuthenticated()')}">
|
||||||
<script th:src="@{/assets/js/pages/imprimelibros/presupuestador/imagen-selector.js}"></script>
|
<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/wizard-home.js}"></script>
|
||||||
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuesto-maquetacion.js}"></script>
|
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuesto-maquetacion.js}"></script>
|
||||||
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuesto-marcapaginas.js}"></script>
|
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuesto-marcapaginas.js}"></script>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,29 +21,32 @@
|
|||||||
|
|
||||||
<div class="ribbon-content mt-4">
|
<div class="ribbon-content mt-4">
|
||||||
<div class="row justify-content-center imagen-container-group mt-3">
|
<div class="row justify-content-center imagen-container-group mt-3">
|
||||||
<div id="tapaBlanda" class="tapa-cubierta image-container imagen-selector selected" th:attr="data-summary-text=#{presupuesto.tapa-blanda}">
|
<label id="tapaBlanda" class="tapa-cubierta image-container imagen-selector" th:attr="data-summary-text=#{presupuesto.tapa-blanda}">
|
||||||
|
<input type="radio" name="tipoCubierta" value="tapaBlanda" hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/tapa-blanda.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/tapa-blanda.png"
|
||||||
alt="">
|
alt="">
|
||||||
<label for="titulo" class="form-label" th:text="#{presupuesto.tapa-blanda}">
|
<div class="form-label" th:text="#{presupuesto.tapa-blanda}">
|
||||||
Tapa blanda
|
Tapa blanda
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<div id="tapaDura" class="tapa-cubierta image-container imagen-selector" th:attr="data-summary-text=#{presupuesto.tapa-dura}">
|
<label id="tapaDura" class="tapa-cubierta image-container imagen-selector" th:attr="data-summary-text=#{presupuesto.tapa-dura}">
|
||||||
|
<input type="radio" name="tipoCubierta" value="tapaDura" hidden>
|
||||||
<img class="image-presupuesto"
|
<img class="image-presupuesto"
|
||||||
src="/assets/images/imprimelibros/presupuestador/tapa-dura-lomo-recto.png" alt="">
|
src="/assets/images/imprimelibros/presupuestador/tapa-dura-lomo-recto.png" alt="">
|
||||||
<label class="form-label" th:text="#{presupuesto.tapa-dura}">
|
<div class="form-label" th:text="#{presupuesto.tapa-dura}">
|
||||||
Tapa dura
|
Tapa dura
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<div id="tapaDuraLomoRedondo" class="tapa-cubierta image-container imagen-selector" th:attr="data-summary-text=#{presupuesto.tapa-dura-lomo-redondo}">
|
<label id="tapaDuraLomoRedondo" class="tapa-cubierta image-container imagen-selector" th:attr="data-summary-text=#{presupuesto.tapa-dura-lomo-redondo}">
|
||||||
|
<input type="radio" name="tipoCubierta" value="tapaDuraLomoRedondo" hidden>
|
||||||
<img class="image-presupuesto"
|
<img class="image-presupuesto"
|
||||||
src="/assets/images/imprimelibros/presupuestador/tapa-dura-lomo-redondo.png" alt="">
|
src="/assets/images/imprimelibros/presupuestador/tapa-dura-lomo-redondo.png" alt="">
|
||||||
<label class="form-label" th:text="#{presupuesto.tapa-dura-lomo-redondo}">
|
<div class="form-label" th:text="#{presupuesto.tapa-dura-lomo-redondo}">
|
||||||
Tapa dura lomo redondo
|
Tapa dura lomo redondo
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -53,21 +56,23 @@
|
|||||||
|
|
||||||
<!-- Bloque de solapas -->
|
<!-- Bloque de solapas -->
|
||||||
<div class="d-flex gap-3">
|
<div class="d-flex gap-3">
|
||||||
<div id="sin-solapas" class="image-container imagen-selector solapas-cubierta selected" th:attr="data-summary-text=#{app.no}">
|
<label id="sin-solapas" class="image-container imagen-selector solapas-cubierta" th:attr="data-summary-text=#{app.no}">
|
||||||
|
<input type="radio" name="solapasCubierta" value="sinSolapas" checked hidden>
|
||||||
<img class="image-presupuesto"
|
<img class="image-presupuesto"
|
||||||
src="/assets/images/imprimelibros/presupuestador/sinSolapasCubierta.png" alt="">
|
src="/assets/images/imprimelibros/presupuestador/sinSolapasCubierta.png" alt="">
|
||||||
<label class="form-label text-center d-block" th:text="#{presupuesto.sin-solapas}">
|
<div class="form-label text-center d-block" th:text="#{presupuesto.sin-solapas}">
|
||||||
Sin solapas
|
Sin solapas
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<div id="con-solapas" class="image-container imagen-selector solapas-cubierta" th:attr="data-summary-text=#{app.yes}">
|
<label id="con-solapas" class="image-container imagen-selector solapas-cubierta" th:attr="data-summary-text=#{app.yes}">
|
||||||
|
<input type="radio" name="solapasCubierta" value="conSolapas" hidden>
|
||||||
<img class="image-presupuesto"
|
<img class="image-presupuesto"
|
||||||
src="/assets/images/imprimelibros/presupuestador/conSolapasCubierta.png" alt="">
|
src="/assets/images/imprimelibros/presupuestador/conSolapasCubierta.png" alt="">
|
||||||
<label class="form-label text-center d-block" th:text="#{presupuesto.con-solapas}">
|
<div class="form-label text-center d-block" th:text="#{presupuesto.con-solapas}">
|
||||||
Con solapas
|
Con solapas
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Inputs -->
|
<!-- Inputs -->
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div class="ribbon-content mt-4">
|
<div class="ribbon-content mt-4">
|
||||||
|
|
||||||
<div class="alert alert-danger alert-dismissible alert-label-icon rounded-label fade show material-shadow d-none"
|
<div class="alert alert-danger alert-label-icon rounded-label fade show material-shadow d-none"
|
||||||
role="alert" id="datos-generales-alert">
|
role="alert" id="datos-generales-alert">
|
||||||
<i class="ri-error-warning-line label-icon"></i>
|
<i class="ri-error-warning-line label-icon"></i>
|
||||||
<strong th:text="#{presupuesto.errores-title}">Corrija los siguientes errores:</strong>
|
<strong th:text="#{presupuesto.errores-title}">Corrija los siguientes errores:</strong>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<select class="form-select select2 datos-generales-data" id="formato">
|
<select class="form-select select2 datos-generales-data" id="formato">
|
||||||
<optgroup th:label="#{presupuesto.orientacion.vertical}">
|
<optgroup th:label="#{presupuesto.orientacion.vertical}">
|
||||||
<option data-ancho="148" data-alto="210" value="148x210">148x210 (A5)</option>
|
<option data-ancho="148" data-alto="210" value="148x210">148x210 (A5)</option>
|
||||||
<option data-ancho="120" data-alto="170" value="120x170">120x170</option>
|
<option data-ancho="170" data-alto="240" value="170x240">170x240</option>
|
||||||
<option data-ancho="210" data-alto="297" value="210x297">210x297 (A4)</option>
|
<option data-ancho="210" data-alto="297" value="210x297">210x297 (A4)</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup th:label="#{presupuesto.orientacion.cuadrado}">
|
<optgroup th:label="#{presupuesto.orientacion.cuadrado}">
|
||||||
@ -195,56 +195,56 @@
|
|||||||
<div class="d-flex flex-wrap justify-content-center gap-3 imagen-container-group">
|
<div class="d-flex flex-wrap justify-content-center gap-3 imagen-container-group">
|
||||||
|
|
||||||
<!-- Opción: Fresado -->
|
<!-- Opción: Fresado -->
|
||||||
<div class="tipo-libro image-container imagen-selector selected datos-generales-data"
|
<label class="tipo-libro image-container imagen-selector datos-generales-data"
|
||||||
th:attr="data-summary-text=#{presupuesto.fresado}" id="fresado">
|
th:attr="data-summary-text=#{presupuesto.fresado}" id="fresado">
|
||||||
<input type="radio" name="tipoEncuadernacion" value="fresado" hidden>
|
<input type="radio" name="tipoEncuadernacion" value="fresado" checked hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/fresado.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/fresado.png"
|
||||||
alt="Fresado" />
|
alt="Fresado" />
|
||||||
<div class="form-text text-center" th:text="#{presupuesto.fresado-descripcion}">
|
<div class="form-text text-center" th:text="#{presupuesto.fresado-descripcion}">
|
||||||
Fresado (a partir de 32 páginas)</div>
|
Fresado (a partir de 32 páginas)</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
|
|
||||||
<!-- Opción: Cosido -->
|
<!-- Opción: Cosido -->
|
||||||
<div class="tipo-libro image-container imagen-selector datos-generales-data"
|
<label class="tipo-libro image-container imagen-selector datos-generales-data"
|
||||||
th:attr="data-summary-text=#{presupuesto.cosido}" id="cosido">
|
th:attr="data-summary-text=#{presupuesto.cosido}" id="cosido">
|
||||||
<input type="radio" name="tipoEncuadernacion" value="cosido" hidden>
|
<input type="radio" name="tipoEncuadernacion" value="cosido" hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/cosido.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/cosido.png"
|
||||||
alt="Cosido" />
|
alt="Cosido" />
|
||||||
<div class="form-text text-center" th:text="#{presupuesto.cosido-descripcion}">
|
<div class="form-text text-center" th:text="#{presupuesto.cosido-descripcion}">
|
||||||
Cosido (a partir de 32 páginas)</div>
|
Cosido (a partir de 32 páginas)</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
|
|
||||||
<!-- Opción: Grapado -->
|
<!-- Opción: Grapado -->
|
||||||
<div class="tipo-libro image-container imagen-selector datos-generales-data"
|
<label class="tipo-libro image-container imagen-selector datos-generales-data"
|
||||||
th:attr="data-summary-text=#{presupuesto.grapado}" id="grapado">
|
th:attr="data-summary-text=#{presupuesto.grapado}" id="grapado">
|
||||||
<input type="radio" name="tipoEncuadernacion" value="grapado" hidden>
|
<input type="radio" name="tipoEncuadernacion" value="grapado" hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/grapado.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/grapado.png"
|
||||||
alt="Grapado" />
|
alt="Grapado" />
|
||||||
<div class="form-text text-center" th:text="#{presupuesto.grapado-descripcion}">
|
<div class="form-text text-center" th:text="#{presupuesto.grapado-descripcion}">
|
||||||
Grapado (entre 12 y 40 páginas)</div>
|
Grapado (entre 12 y 40 páginas)</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<!-- Opción: Espiral -->
|
<!-- Opción: Espiral -->
|
||||||
<div class="tipo-libro image-container imagen-selector datos-generales-data"
|
<label class="tipo-libro image-container imagen-selector datos-generales-data"
|
||||||
th:attr="data-summary-text=#{presupuesto.espiral}" id="espiral">
|
th:attr="data-summary-text=#{presupuesto.espiral}" id="espiral">
|
||||||
<input type="radio" name="tipoEncuadernacion" value="espiral" hidden>
|
<input type="radio" name="tipoEncuadernacion" value="espiral" hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/espiral.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/espiral.png"
|
||||||
alt="Espiral" />
|
alt="Espiral" />
|
||||||
<div class="form-text text-center" th:text="#{presupuesto.espiral-descripcion}">
|
<div class="form-text text-center" th:text="#{presupuesto.espiral-descripcion}">
|
||||||
Espiral (a partir de 20 páginas)</div>
|
Espiral (a partir de 20 páginas)</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<!-- Opción: Wire-O -->
|
<!-- Opción: Wire-O -->
|
||||||
<div class="tipo-libro image-container imagen-selector datos-generales-data"
|
<label class="tipo-libro image-container imagen-selector datos-generales-data"
|
||||||
th:attr="data-summary-text=#{presupuesto.wire-o}" id="wireo">
|
th:attr="data-summary-text=#{presupuesto.wire-o}" id="wireo">
|
||||||
<input type="radio" name="tipoEncuadernacion" value="wireo" hidden>
|
<input type="radio" name="tipoEncuadernacion" value="wireo" hidden>
|
||||||
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/wire-o.png"
|
<img class="image-presupuesto" src="/assets/images/imprimelibros/presupuestador/wire-o.png"
|
||||||
alt="Wire-O" />
|
alt="Wire-O" />
|
||||||
<div class="form-text text-center" th:text="#{presupuesto.wire-o-descripcion}">
|
<div class="form-text text-center" th:text="#{presupuesto.wire-o-descripcion}">
|
||||||
Wire-O (a partir de 20 páginas)</div>
|
Wire-O (a partir de 20 páginas)</div>
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
<div th:fragment="presupuestador">
|
<div id="presupuesto-app"
|
||||||
|
th:data-mode="${appMode} ?: 'public'"
|
||||||
|
th:data-id="${id} ?: ''"
|
||||||
|
th:fragment="presupuestador">
|
||||||
|
|
||||||
<!-- Modales-->
|
<!-- Modales-->
|
||||||
<div
|
<div
|
||||||
th:replace="imprimelibros/partials/modal-form :: modal('maquetacionModal', 'presupuesto.maquetacion', 'modal-md', 'maquetacionModalBody')">
|
th:replace="imprimelibros/partials/modal-form :: modal('maquetacionModal', 'presupuesto.maquetacion', 'modal-md', 'maquetacionModalBody')">
|
||||||
|
|||||||
@ -49,7 +49,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- JS de Buttons y dependencias -->
|
<!-- JS de Buttons y dependencias -->
|
||||||
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/presupuestador.js}"></script>
|
<div th:if="${appMode} == 'view'">
|
||||||
|
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/wizard-publicos.js}"></script>
|
||||||
|
</div>
|
||||||
</th:block>
|
</th:block>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import java.util.Locale;
|
|||||||
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMaquetacion;
|
import com.imprimelibros.erp.presupuesto.classes.PresupuestoMaquetacion;
|
||||||
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.FontSize;
|
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.FontSize;
|
||||||
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.Formato;
|
import com.imprimelibros.erp.presupuesto.maquetacion.MaquetacionMatrices.Formato;
|
||||||
|
import com.imprimelibros.erp.presupuesto.service.PresupuestoService;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class presupuestoMaquetacionTest {
|
class presupuestoMaquetacionTest {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.imprimelibros.erp.presupuesto.classes.PresupuestoMarcapaginas;
|
|||||||
import com.imprimelibros.erp.presupuesto.marcapaginas.Marcapaginas;
|
import com.imprimelibros.erp.presupuesto.marcapaginas.Marcapaginas;
|
||||||
|
|
||||||
import com.imprimelibros.erp.presupuesto.marcapaginas.MarcapaginasRepository;
|
import com.imprimelibros.erp.presupuesto.marcapaginas.MarcapaginasRepository;
|
||||||
|
import com.imprimelibros.erp.presupuesto.service.PresupuestoService;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class presupuestoMarcapaginasTest {
|
class presupuestoMarcapaginasTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user