mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-24 09:40:21 +00:00
añadidos acabados
This commit is contained in:
@ -131,6 +131,11 @@ public class Presupuesto {
|
|||||||
@Column(name = "gramaje_cubierta")
|
@Column(name = "gramaje_cubierta")
|
||||||
private Integer gramajeCubierta = 240;
|
private Integer gramajeCubierta = 240;
|
||||||
|
|
||||||
|
@NotNull(message = "{presupuesto.errores.acabado-cubierta}", groups = PresupuestoValidationGroups.Cubierta.class)
|
||||||
|
@Column(name = "acabado")
|
||||||
|
private Integer acabado = 1;
|
||||||
|
|
||||||
|
|
||||||
// Getters y Setters
|
// Getters y Setters
|
||||||
|
|
||||||
public String getAutor() {
|
public String getAutor() {
|
||||||
@ -369,4 +374,12 @@ public class Presupuesto {
|
|||||||
this.gramajeCubierta = gramajeCubierta;
|
this.gramajeCubierta = gramajeCubierta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getAcabado() {
|
||||||
|
return acabado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcabado(Integer acabado) {
|
||||||
|
this.acabado = acabado;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class PresupuestoController {
|
|||||||
|
|
||||||
// opciones color
|
// opciones color
|
||||||
Map<String, Object> resultado = presupuestoService.obtenerOpcionesColor(presupuesto, locale);
|
Map<String, Object> resultado = presupuestoService.obtenerOpcionesColor(presupuesto, locale);
|
||||||
|
|
||||||
// opciones papel interior
|
// opciones papel interior
|
||||||
resultado.putAll(presupuestoService.obtenerOpcionesPapelInterior(presupuesto, locale));
|
resultado.putAll(presupuestoService.obtenerOpcionesPapelInterior(presupuesto, locale));
|
||||||
|
|
||||||
@ -76,6 +76,7 @@ public class PresupuestoController {
|
|||||||
}
|
}
|
||||||
Map<String, Object> resultado = new HashMap<>();
|
Map<String, Object> resultado = new HashMap<>();
|
||||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto)));
|
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto)));
|
||||||
|
resultado.putAll(presupuestoService.obtenerOpcionesAcabadosCubierta(presupuesto, locale));
|
||||||
return ResponseEntity.ok(resultado);
|
return ResponseEntity.ok(resultado);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,4 +202,14 @@ public class PresupuestoController {
|
|||||||
return ResponseEntity.ok(resultado);
|
return ResponseEntity.ok(resultado);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/public/get-acabados-cubierta")
|
||||||
|
public ResponseEntity<?> getAcabadosCubierta(
|
||||||
|
Presupuesto presupuesto,
|
||||||
|
BindingResult result, Locale locale) {
|
||||||
|
|
||||||
|
Map<String, Object> resultado = presupuestoService.obtenerOpcionesAcabadosCubierta(presupuesto, locale);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(resultado);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.imprimelibros.erp.configurationERP.VariableService;
|
import com.imprimelibros.erp.configurationERP.VariableService;
|
||||||
@ -23,6 +24,9 @@ public class PresupuestoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected VariableService variableService;
|
protected VariableService variableService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected MessageSource messageSource;
|
||||||
|
|
||||||
private final PresupuestadorItems presupuestadorItems;
|
private final PresupuestadorItems presupuestadorItems;
|
||||||
|
|
||||||
public PresupuestoService(PresupuestadorItems presupuestadorItems) {
|
public PresupuestoService(PresupuestadorItems presupuestadorItems) {
|
||||||
@ -60,16 +64,16 @@ public class PresupuestoService {
|
|||||||
opciones.add(opcionColor);
|
opciones.add(opcionColor);
|
||||||
}
|
}
|
||||||
ImagenPresupuesto opcionColorHq = this.presupuestadorItems.getImpresionColorPremium(locale);
|
ImagenPresupuesto opcionColorHq = this.presupuestadorItems.getImpresionColorPremium(locale);
|
||||||
if(Presupuesto.TipoImpresion.colorhq.equals(presupuesto.getTipoImpresion()))
|
if (Presupuesto.TipoImpresion.colorhq.equals(presupuesto.getTipoImpresion()))
|
||||||
opcionColorHq.setSelected(true);
|
opcionColorHq.setSelected(true);
|
||||||
opciones.add(opcionColorHq);
|
opciones.add(opcionColorHq);
|
||||||
} else {
|
} else {
|
||||||
ImagenPresupuesto opcionNegro = this.presupuestadorItems.getImpresionNegro(locale);
|
ImagenPresupuesto opcionNegro = this.presupuestadorItems.getImpresionNegro(locale);
|
||||||
if(Presupuesto.TipoImpresion.negro.equals(presupuesto.getTipoImpresion()))
|
if (Presupuesto.TipoImpresion.negro.equals(presupuesto.getTipoImpresion()))
|
||||||
opcionNegro.setSelected(true);
|
opcionNegro.setSelected(true);
|
||||||
opciones.add(opcionNegro);
|
opciones.add(opcionNegro);
|
||||||
ImagenPresupuesto opcionNegroHq = this.presupuestadorItems.getImpresionNegroPremium(locale);
|
ImagenPresupuesto opcionNegroHq = this.presupuestadorItems.getImpresionNegroPremium(locale);
|
||||||
if(Presupuesto.TipoImpresion.negrohq.equals(presupuesto.getTipoImpresion()))
|
if (Presupuesto.TipoImpresion.negrohq.equals(presupuesto.getTipoImpresion()))
|
||||||
opcionNegroHq.setSelected(true);
|
opcionNegroHq.setSelected(true);
|
||||||
opciones.add(opcionNegroHq);
|
opciones.add(opcionNegroHq);
|
||||||
}
|
}
|
||||||
@ -342,7 +346,63 @@ public class PresupuestoService {
|
|||||||
} else {
|
} else {
|
||||||
return 0; // Default case, no valid type
|
return 0; // Default case, no valid type
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> obtenerOpcionesAcabadosCubierta(Presupuesto presupuesto, Locale locale) {
|
||||||
|
Map<String, Object> resultado = new HashMap<>();
|
||||||
|
List<Object> opciones = new ArrayList<>();
|
||||||
|
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-ninguno", null, locale));
|
||||||
|
put("sk-id", 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-brillo-1c", null, locale));
|
||||||
|
put("sk-id", 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-mate-1c", null, locale));
|
||||||
|
put("sk-id", 5);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-mate-1c-antirrayado", null, locale));
|
||||||
|
put("sk-id", 8);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-mate-uvi", null, locale));
|
||||||
|
put("sk-id", 2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-mate-uvi3d", null, locale));
|
||||||
|
put("sk-id", 3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-mate-uvi-braile", null, locale));
|
||||||
|
put("sk-id", 4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
opciones.add(new HashMap<>() {
|
||||||
|
{
|
||||||
|
put("name", messageSource.getMessage("presupuesto.acabado-plastificado-sandy-1c", null, locale));
|
||||||
|
put("sk-id", 9);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
resultado.put("opciones_acabados_cubierta", opciones);
|
||||||
|
return resultado;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,6 +88,17 @@ presupuesto.volver-interior=Volver a diseño interior
|
|||||||
presupuesto.continuar-extras-libro=Continuar a extras del libro
|
presupuesto.continuar-extras-libro=Continuar a extras del libro
|
||||||
presupuesto.offset=Offset
|
presupuesto.offset=Offset
|
||||||
presupuesto.estucado=Estucado
|
presupuesto.estucado=Estucado
|
||||||
|
presupuesto.acabado=Acabado
|
||||||
|
presupuesto.acabado-cubierta-descripcion=Seleccione el acabado para la cubierta
|
||||||
|
presupuesto.acabado-cubierta-aviso=La falta de plastificado en la cubierta puede comprometer su calidad, ya que aumenta el riesgo de agrietamiento en los pliegues o hendidos, afectando su apariencia y resistencia.
|
||||||
|
presupuesto.acabado-ninguno=Sin acabado
|
||||||
|
presupuesto.acabado-plastificado-brillo-1c=Plastificado Brillo 1/C
|
||||||
|
presupuesto.acabado-plastificado-mate-1c=Plastificado Mate 1/C
|
||||||
|
presupuesto.acabado-plastificado-mate-1c-antirrayado=Plastificado Mate 1/C Antirrayado
|
||||||
|
presupuesto.acabado-plastificado-mate-uvi=Plastificado Mate 1/C + Reserva UVI
|
||||||
|
presupuesto.acabado-plastificado-mate-uvi3d=Plastificado Mate 1/C + Reserva UVI 3D
|
||||||
|
presupuesto.acabado-plastificado-mate-uvi-braile=Plastificado Mate 1/C + Reserva UVI Braille
|
||||||
|
presupuesto.acabado-plastificado-sandy-1c=Plastificado Sandy 1/C (tacto arena)
|
||||||
|
|
||||||
# Errores
|
# Errores
|
||||||
presupuesto.errores-title=Corrija los siguientes errores:
|
presupuesto.errores-title=Corrija los siguientes errores:
|
||||||
@ -109,4 +120,5 @@ presupuesto.errores.gramaje-interior=Seleccione el gramaje del papel para el int
|
|||||||
presupuesto.errores.tipo-cubierta=Seleccione el tipo de cubierta
|
presupuesto.errores.tipo-cubierta=Seleccione el tipo de cubierta
|
||||||
presupuesto.errores.solapas-cubierta=Seleccione si desea o no solapas en la 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.papel-cubierta=Seleccione el tipo de papel para la cubierta
|
||||||
presupuesto.errores.gramaje-cubierta=Seleccione el gramaje del 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
|
||||||
@ -39,6 +39,7 @@ class PresupuestoCliente {
|
|||||||
cabezada: 'WHI',
|
cabezada: 'WHI',
|
||||||
papelCubiertaId: 3,
|
papelCubiertaId: 3,
|
||||||
gramajeCubierta: 170,
|
gramajeCubierta: 170,
|
||||||
|
acabado: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ class PresupuestoCliente {
|
|||||||
this.guardasCubierta = $('#papel-guardas');
|
this.guardasCubierta = $('#papel-guardas');
|
||||||
this.guardasImpresas = $('#guardas-impresas');
|
this.guardasImpresas = $('#guardas-impresas');
|
||||||
this.cabezada = $('#cabezada');
|
this.cabezada = $('#cabezada');
|
||||||
|
this.divAcabadoCubierta = $('#div-acabado-cubierta');
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -198,7 +200,7 @@ class PresupuestoCliente {
|
|||||||
#nextDatosGenerales() {
|
#nextDatosGenerales() {
|
||||||
|
|
||||||
let data = this.#getDatosGeneralesData();
|
let data = this.#getDatosGeneralesData();
|
||||||
data = {
|
data = {
|
||||||
...data,
|
...data,
|
||||||
...{
|
...{
|
||||||
papelInteriorId: this.formData.interior.papelInteriorId,
|
papelInteriorId: this.formData.interior.papelInteriorId,
|
||||||
@ -537,8 +539,22 @@ class PresupuestoCliente {
|
|||||||
$('.max-solapa-text').text(function (_, textoActual) {
|
$('.max-solapa-text').text(function (_, textoActual) {
|
||||||
return textoActual.replace(/\d+/, maxSolapas);
|
return textoActual.replace(/\d+/, maxSolapas);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.divAcabadoCubierta.empty();
|
||||||
|
for (const opcion of data.opciones_acabados_cubierta) {
|
||||||
|
const item = `
|
||||||
|
<input type="radio" class="btn-check" id="acabado-cubierta-${opcion['sk-id']}" name="acabado-cubierta" sk-id="${opcion['sk-id']}">
|
||||||
|
<label class="btn btn-outline-primary material-shadow" for="acabado-cubierta-${opcion['sk-id']}">
|
||||||
|
${opcion.name}
|
||||||
|
</label>
|
||||||
|
`;
|
||||||
|
this.divAcabadoCubierta.append(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
$(`input[type="radio"][name="acabado-cubierta"][sk-id="${this.formData.cubierta.acabado}"]`).prop('checked', true);
|
||||||
|
|
||||||
this.#loadCubiertaData(data);
|
this.#loadCubiertaData(data);
|
||||||
|
|
||||||
this.#changeTab('pills-cover');
|
this.#changeTab('pills-cover');
|
||||||
|
|
||||||
const dataInterior = this.#getInteriorData();
|
const dataInterior = this.#getInteriorData();
|
||||||
@ -593,7 +609,7 @@ class PresupuestoCliente {
|
|||||||
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.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"]) {
|
||||||
item.setSelected(true);
|
item.setSelected(true);
|
||||||
}
|
}
|
||||||
@ -758,14 +774,14 @@ class PresupuestoCliente {
|
|||||||
this.#changeTab('pills-inside');
|
this.#changeTab('pills-inside');
|
||||||
/*const data = this.#getPresupuestoData();
|
/*const data = this.#getPresupuestoData();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/presupuesto/public/validar/cubierta',
|
url: '/presupuesto/public/validar/cubierta',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
this.#changeTab('pills-inside');
|
this.#changeTab('pills-inside');
|
||||||
},
|
},
|
||||||
error: (xhr, status, error) => {
|
error: (xhr, status, error) => {
|
||||||
console.error("Error al validar los datos de cubierta: ", xhr.responseText);
|
console.error("Error al validar los datos de cubierta: ", xhr.responseText);
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
});
|
});
|
||||||
@ -850,6 +866,7 @@ class PresupuestoCliente {
|
|||||||
const cabezada = this.cabezada.val() || 'WHI';
|
const cabezada = this.cabezada.val() || 'WHI';
|
||||||
const papelCubiertaId = $('#div-papel-cubierta .image-container.selected').data('sk-id') || 3;
|
const papelCubiertaId = $('#div-papel-cubierta .image-container.selected').data('sk-id') || 3;
|
||||||
const gramajeCubierta = $('input[name="gramaje-cubierta"]:checked').data('gramaje') || 240;
|
const gramajeCubierta = $('input[name="gramaje-cubierta"]:checked').data('gramaje') || 240;
|
||||||
|
const acabado = parseInt($('.acabado-cubierta.selected').data('sk-id')) || 1;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tipoCubierta: tipoCubierta,
|
tipoCubierta: tipoCubierta,
|
||||||
@ -861,7 +878,8 @@ class PresupuestoCliente {
|
|||||||
guardasImpresas: guardasImpresas,
|
guardasImpresas: guardasImpresas,
|
||||||
cabezada: cabezada,
|
cabezada: cabezada,
|
||||||
papelCubiertaId: papelCubiertaId,
|
papelCubiertaId: papelCubiertaId,
|
||||||
gramajeCubierta: gramajeCubierta
|
gramajeCubierta: gramajeCubierta,
|
||||||
|
acabadado: acabado
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,6 +895,7 @@ class PresupuestoCliente {
|
|||||||
this.formData.cubierta.cabezada = data.cabezada;
|
this.formData.cubierta.cabezada = data.cabezada;
|
||||||
this.formData.cubierta.papelCubiertaId = data.papelCubiertaId;
|
this.formData.cubierta.papelCubiertaId = data.papelCubiertaId;
|
||||||
this.formData.cubierta.gramajeCubierta = data.gramajeCubierta;
|
this.formData.cubierta.gramajeCubierta = data.gramajeCubierta;
|
||||||
|
this.formData.cubierta.acabado = data.acabado;
|
||||||
}
|
}
|
||||||
|
|
||||||
#addGramajesCubierta(gramajes) {
|
#addGramajesCubierta(gramajes) {
|
||||||
@ -910,8 +929,8 @@ class PresupuestoCliente {
|
|||||||
else {
|
else {
|
||||||
$('.tapa-dura-options').removeClass('d-none');
|
$('.tapa-dura-options').removeClass('d-none');
|
||||||
$('.tapa-blanda-options').addClass('d-none');
|
$('.tapa-blanda-options').addClass('d-none');
|
||||||
$('#papel-guardas option[data-papel-id="' +
|
$('#papel-guardas option[data-papel-id="' +
|
||||||
this.formData.cubierta.guardasPapelId + '"][data-gramaje="' +
|
this.formData.cubierta.guardasPapelId + '"][data-gramaje="' +
|
||||||
this.formData.cubierta.guardasGramaje + '"]').prop('selected', true).trigger('change');
|
this.formData.cubierta.guardasGramaje + '"]').prop('selected', true).trigger('change');
|
||||||
this.guardasImpresas.val(this.formData.cubierta.guardasImpresas);
|
this.guardasImpresas.val(this.formData.cubierta.guardasImpresas);
|
||||||
this.cabezada.val(this.formData.cubierta.cabezada);
|
this.cabezada.val(this.formData.cubierta.cabezada);
|
||||||
@ -933,7 +952,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.carasImpresionCubierta.val(this.formData.cubierta.cubiertaCaras);
|
this.carasImpresionCubierta.val(this.formData.cubierta.cubiertaCaras);
|
||||||
|
|
||||||
}
|
}
|
||||||
/******************************
|
/******************************
|
||||||
* END CUBIERTA
|
* END CUBIERTA
|
||||||
|
|||||||
@ -216,6 +216,29 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- End Ribbon Shape -->
|
<!-- End Ribbon Shape -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Ribbon Shape -->
|
||||||
|
<div class="card ribbon-box border shadow-none mb-lg-0 material-shadow mt-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="ribbon ribbon-primary ribbon-shape" th:text="#{presupuesto.acabado}">Acabado
|
||||||
|
</div>
|
||||||
|
<h5 class="fs-14 text-end" th:text="#{presupuesto.acabado-cubierta-descripcion}">
|
||||||
|
Acabado de la cubierta</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ribbon-content mt-4">
|
||||||
|
<div class="hstack gap-2 justify-content-center flex-wrap mx-4">
|
||||||
|
<p th:text="#{presupuesto.acabado-cubierta-aviso}"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="div-acabado-cubierta" class="hstack gap-2 justify-content-center flex-wrap">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Ribbon Shape -->
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-4 w-100">
|
<div class="d-flex justify-content-between align-items-center mt-4 w-100">
|
||||||
<button id="btn-prev-cubierta" type="button" class="btn btn-light d-flex align-items-center btn-change-tab-cubierta">
|
<button id="btn-prev-cubierta" type="button" class="btn btn-light d-flex align-items-center btn-change-tab-cubierta">
|
||||||
<i class=" ri-arrow-left-circle-line label-icon align-middle fs-16 me-2"></i>
|
<i class=" ri-arrow-left-circle-line label-icon align-middle fs-16 me-2"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user