terminado incluyendo el menu lateral

This commit is contained in:
jaimejimenezortega
2025-03-04 20:13:11 +01:00
parent 2587a6b4ac
commit 2edde4943d
4 changed files with 101 additions and 55 deletions

View File

@ -3526,7 +3526,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$id = "service_extra_" . $servicio->id; $id = "service_extra_" . $servicio->id;
array_push($servicios, array_push($servicios,
"<input class=\"calcular-presupuesto form-check-input\" type=\"checkbox\" id=\"{$id}\" "<input class=\"calcular-presupuesto form-check-input\" type=\"checkbox\" id=\"{$id}\"
name=\"{$id}\" value=\"1\" data-tarifa-id=\"{$servicio->id}\" data-tarifa-tipo=\"extra\"> name=\"{$id}\" value=\"1\" data-tarifa-id=\"{$servicio->id}\" data-tarifa-tipo=\"extra\" data-tarifa-nombre=\"{$servicio->nombre}\">
<label class=\"form-check-label\" for=\"{$id}\">{$servicio->nombre}</label>"); <label class=\"form-check-label\" for=\"{$id}\">{$servicio->nombre}</label>");
} }

View File

@ -183,35 +183,8 @@
<div class="rl-servicios-extra rl-item d-none"> <div class="rl-servicios-extra rl-item d-none">
<div class="row">Servicios extra</div> <div class="row">Servicios extra</div>
<div class="row"> <div id="rl-servicios-extra-items" class="row">
<ul class="list-group list-group-timeline">
<li id="rl_prototipo" class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Prototipo</li>
</ul>
<ul class="list-group list-group-timeline">
<li id="rl_ferro" class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Ferro</li>
</ul>
<ul class="list-group list-group-timeline">
<li id="rl_ferroDigital"
class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Ferro digital</li>
</ul>
<ul class="list-group list-group-timeline">
<li id="rl_marcapaginas"
class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Marcapáginas</li>
</ul>
<ul class="list-group list-group-timeline">
<li id="rl_retractilado"
class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Retractilado</li>
</ul>
<ul class="list-group list-group-timeline">
<li id="rl_retractilado5"
class="list-group-item list-group-timeline-primary texto-resumen-lateral d-none">
Retractilado de 5</li>
</ul>
</div> </div>
</div> </div>

View File

@ -165,7 +165,7 @@ class DatosGenerales {
if (value4.length > 0 && Number.isInteger(parseInt(value4)) && parseInt(value4) > 0) { if (value4.length > 0 && Number.isInteger(parseInt(value4)) && parseInt(value4) > 0) {
tiradas.push(value4); tiradas.push(value4);
} }
// comprobar si hay valores > 30 // comprobar si hay valores > 30
const noPOD = (tiradas.some(tirada => parseInt(tirada) > 30)); const noPOD = (tiradas.some(tirada => parseInt(tirada) > 30));
const siPOD = (tiradas.some(tirada => parseInt(tirada) <= 30)); const siPOD = (tiradas.some(tirada => parseInt(tirada) <= 30));
if (noPOD && siPOD) { if (noPOD && siPOD) {
@ -362,7 +362,7 @@ class DatosGenerales {
`); `);
return false; return false;
} }
}, },
} }
} }
@ -478,7 +478,7 @@ class DatosGenerales {
// servicios extra // servicios extra
menu_off = true; menu_off = true;
if(this.prototipo.is(':checked')){ /*if(this.prototipo.is(':checked')){
this.rl_prototipo.removeClass("d-none"); this.rl_prototipo.removeClass("d-none");
menu_off = false; menu_off = false;
} }
@ -493,7 +493,7 @@ class DatosGenerales {
else{ else{
this.rl_ferro.addClass('d-none'); this.rl_ferro.addClass('d-none');
} }
if(this.ferroDigital.is(':checked')){ if(this.ferroDigital.is(':checked')){
this.rl_ferroDigital.removeClass("d-none"); this.rl_ferroDigital.removeClass("d-none");
menu_off = false; menu_off = false;
@ -501,29 +501,67 @@ class DatosGenerales {
else{ else{
this.rl_ferroDigital.addClass('d-none'); this.rl_ferroDigital.addClass('d-none');
} }
*/
$('#rl-servicios-extra-items').empty();
if(this.marcapaginas.is(':checked')){ if(this.marcapaginas.is(':checked')){
this.rl_marcapaginas.removeClass("d-none"); let $ul = $('<ul>', {
class: 'list-group list-group-timeline'
});
let $li = $('<li>', {
class: 'list-group-item list-group-timeline-primary texto-resumen-lateral',
text: 'Marcapáginas'
});
$ul.append($li);
$('#rl-servicios-extra-items').append($ul);
menu_off = false; menu_off = false;
} }
else{
this.rl_marcapaginas.addClass('d-none');
}
if(this.retractilado.is(':checked')){ if(this.retractilado.is(':checked')){
this.rl_retractilado.removeClass("d-none"); let $ul = $('<ul>', {
class: 'list-group list-group-timeline'
});
let $li = $('<li>', {
class: 'list-group-item list-group-timeline-primary texto-resumen-lateral',
text: 'Retractilado'
});
$ul.append($li);
$('#rl-servicios-extra-items').append($ul);
menu_off = false; menu_off = false;
} }
else{
this.rl_retractilado.addClass('d-none');
}
if(this.retractilado5.is(':checked')){ if(this.retractilado5.is(':checked')){
this.rl_retractilado5.removeClass("d-none"); let $ul = $('<ul>', {
class: 'list-group list-group-timeline'
});
let $li = $('<li>', {
class: 'list-group-item list-group-timeline-primary texto-resumen-lateral',
text: 'Retractilado de 5'
});
$ul.append($li);
$('#rl-servicios-extra-items').append($ul);
menu_off = false; menu_off = false;
} }
else{
this.rl_retractilado5.addClass('d-none'); const serviciosExtra = $('input[type="checkbox"][data-tarifa-tipo="extra"]:checked');
for(let i=0; i<serviciosExtra.length; i++){
let $ul = $('<ul>', {
class: 'list-group list-group-timeline'
});
let $li = $('<li>', {
class: 'list-group-item list-group-timeline-primary texto-resumen-lateral',
text: '' + $(serviciosExtra[i]).data('tarifa-nombre')
});
$ul.append($li);
$('#rl-servicios-extra-items').append($ul);
} }
if(!menu_off){ if(!menu_off){
@ -603,9 +641,23 @@ class DatosGenerales {
} }
} }
this.prototipo.prop('checked', datos.prototipo);
this.ferro.prop('checked', datos.ferro); if(datos.serviciosExtra){
this.ferroDigital.prop('checked', datos.ferroDigital);
let serviciosExtra = $('input[type="checkbox"][data-tarifa-tipo="extra"]');
$(serviciosExtra).each(function() {
let tarifaId = $(this).data('tarifa-id') + "";
if (datos.serviciosExtra.includes(tarifaId)) {
$(this).prop('checked', true);
}
});
}
//this.prototipo.prop('checked', datos.prototipo);
//this.ferro.prop('checked', datos.ferro);
//this.ferroDigital.prop('checked', datos.ferroDigital);
this.marcapaginas.prop('checked', datos.marcapaginas); this.marcapaginas.prop('checked', datos.marcapaginas);
this.retractilado.prop('checked', datos.retractilado); this.retractilado.prop('checked', datos.retractilado);
this.retractilado5.prop('checked', datos.retractilado5); this.retractilado5.prop('checked', datos.retractilado5);
@ -805,7 +857,7 @@ class DatosGenerales {
this.pagColorConsecutivas.prop('checked', false); this.pagColorConsecutivas.prop('checked', false);
if(lastLayoutColor && !this.cargando){ if(lastLayoutColor && !this.cargando){
$('#divPapelInterior').empty(); $('#divPapelInterior').empty();
$('#divGramajeInterior').empty(); $('#divGramajeInterior').empty();
$('#negroEstandar').trigger('click'); $('#negroEstandar').trigger('click');
@ -820,7 +872,7 @@ class DatosGenerales {
this.divPosPaginasColor.removeClass('d-none'); this.divPosPaginasColor.removeClass('d-none');
if(!lastLayoutColor && !this.cargando){ if(!lastLayoutColor && !this.cargando){
$('#divPapelInterior').empty(); $('#divPapelInterior').empty();
$('#divGramajeInterior').empty(); $('#divGramajeInterior').empty();
$('#colorEstandar').trigger('click'); $('#colorEstandar').trigger('click');
@ -836,7 +888,7 @@ class DatosGenerales {
const divTipoLibro = $('#divTipoLibro'); // Selecciona el div const divTipoLibro = $('#divTipoLibro'); // Selecciona el div
divTipoLibro.find('.fv-plugins-message-container').remove(); divTipoLibro.find('.fv-plugins-message-container').remove();
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) { if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
const value = parseInt($("#paginas").val()); const value = parseInt($("#paginas").val());
if (value % 4 != 0) { if (value % 4 != 0) {
@ -920,6 +972,26 @@ class DatosGenerales {
} }
} }
getServiciosExtra() {
let serviciosExtra = $('input[type="checkbox"][data-tarifa-tipo="extra"]:checked');
if (serviciosExtra.length === 0) {
return [];
}
let servicios = [];
$(serviciosExtra).each(function() {
let tarifaId = $(this).data('tarifa-id');
if (tarifaId) {
servicios.push(tarifaId);
}
});
return servicios;
}
} }

View File

@ -632,7 +632,7 @@ class PresupuestoCliente {
} }
} }
} }
this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2)); this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2));
this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2)); this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2));
@ -773,12 +773,13 @@ class PresupuestoCliente {
this.datos.excluirRotativa = this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0; this.datos.excluirRotativa = this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0;
this.datos.ivaReducido = this.datosGenerales.ivaReducido.find('option:selected').val(); this.datos.ivaReducido = this.datosGenerales.ivaReducido.find('option:selected').val();
this.datos.servicios = { this.datos.servicios = {
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0, //'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0, //'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0, //'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0, 'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0, 'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0, 'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
'serviciosExtra': this.datosGenerales.getServiciosExtra(),
}; };
let lomoRedondo = 0; let lomoRedondo = 0;