mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
muchos cambios (y no los papeles)
This commit is contained in:
@ -55,6 +55,11 @@ class DatosGenerales {
|
||||
this.ivaReducido = this.domItem.find("#ivaReducido");
|
||||
this.excluirRotativa = this.domItem.find("#excluirRotativa");
|
||||
this.prototipo = this.domItem.find("#prototipo");
|
||||
this.ferro = this.domItem.find("#ferro");
|
||||
this.ferroDigital = this.domItem.find("#ferroDigital");
|
||||
this.marcapaginas = this.domItem.find("#marcapaginas");
|
||||
this.retractilado = this.domItem.find("#retractilado");
|
||||
this.retractilado5 = this.domItem.find("#retractilado5");
|
||||
|
||||
this.rl_datos_generales = $(".rl-datos-generales");
|
||||
this.rl_tipo = $("#rl_tipo");
|
||||
@ -65,6 +70,11 @@ class DatosGenerales {
|
||||
|
||||
this.rl_servicios_extra = $(".rl-servicios-extra");
|
||||
this.rl_prototipo = $("#rl_prototipo");
|
||||
this.rl_ferro = $("#rl_ferro");
|
||||
this.rl_ferroDigital = $("#rl_ferroDigital");
|
||||
this.rl_marcapaginas = $("#rl_marcapaginas");
|
||||
this.rl_retractilado = $("#rl_retractilado");
|
||||
this.rl_retractilado5 = $("#rl_retractilado5");
|
||||
|
||||
this.initValidation();
|
||||
}
|
||||
@ -93,6 +103,9 @@ class DatosGenerales {
|
||||
this.altoPersonalizado.on("change", this.#checkValue.bind(this));
|
||||
|
||||
this.titulo.on('change', () => { $(".titulo").html(this.titulo.val()); });
|
||||
|
||||
this.retractilado.on('change', this.#eventRetractilado.bind(this));
|
||||
this.retractilado5.on('change', this.#eventRetractilado.bind(this));
|
||||
}
|
||||
|
||||
initValidation() {
|
||||
@ -466,6 +479,47 @@ class DatosGenerales {
|
||||
else{
|
||||
this.rl_prototipo.addClass('d-none');
|
||||
}
|
||||
|
||||
if(this.ferro.is(':checked')){
|
||||
this.rl_ferro.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
else{
|
||||
this.rl_ferro.addClass('d-none');
|
||||
}
|
||||
|
||||
if(this.ferroDigital.is(':checked')){
|
||||
this.rl_ferroDigital.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
else{
|
||||
this.rl_ferroDigital.addClass('d-none');
|
||||
}
|
||||
|
||||
if(this.marcapaginas.is(':checked')){
|
||||
this.rl_marcapaginas.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
else{
|
||||
this.rl_marcapaginas.addClass('d-none');
|
||||
}
|
||||
|
||||
if(this.retractilado.is(':checked')){
|
||||
this.rl_retractilado.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
else{
|
||||
this.rl_retractilado.addClass('d-none');
|
||||
}
|
||||
|
||||
if(this.retractilado5.is(':checked')){
|
||||
this.rl_retractilado5.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
else{
|
||||
this.rl_retractilado5.addClass('d-none');
|
||||
}
|
||||
|
||||
if(!menu_off){
|
||||
this.rl_servicios_extra.removeClass('d-none');
|
||||
}
|
||||
@ -534,6 +588,12 @@ class DatosGenerales {
|
||||
}
|
||||
|
||||
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.retractilado.prop('checked', datos.retractilado);
|
||||
this.retractilado5.prop('checked', datos.retractilado5);
|
||||
|
||||
this.ivaReducido.val(datos.ivaReducido ? 1 : 0).trigger('change');
|
||||
}
|
||||
|
||||
@ -612,6 +672,20 @@ class DatosGenerales {
|
||||
}
|
||||
}
|
||||
|
||||
#eventRetractilado(event) {
|
||||
let target = event.target;
|
||||
if (target.id == 'retractilado') {
|
||||
if (this.retractilado5.is(':checked')) {
|
||||
this.retractilado5.prop('checked', false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.retractilado.is(':checked')) {
|
||||
this.retractilado.prop('checked', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#handleTipolibro(event) {
|
||||
// Accede al ID del elemento que disparó el evento
|
||||
|
||||
@ -11,6 +11,38 @@ import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js';
|
||||
class PresupuestoCliente {
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
// Seleccionar el header y el contenedor del offcanvas
|
||||
var stepperHeader = document.querySelector('#sharedStepper');
|
||||
var offcanvasBody = document.querySelector('#menu-offcanvas .offcanvas-body');
|
||||
|
||||
// Función para verificar el tamaño de la pantalla y mover el contenido
|
||||
function adjustStepperLocation() {
|
||||
if (window.innerWidth < 768) {
|
||||
// Si es un dispositivo móvil o tablet, mover el stepper al offcanvas
|
||||
if (offcanvasBody && stepperHeader) {
|
||||
// Verificar si el stepper ya está en el offcanvas
|
||||
if (!offcanvasBody.contains(stepperHeader)) {
|
||||
offcanvasBody.appendChild(stepperHeader); // Mover al offcanvas
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Si es un dispositivo grande, dejar el stepper en su lugar original
|
||||
var originalContainer = document.querySelector('.bs-stepper-header').parentNode;
|
||||
if (originalContainer && !originalContainer.contains(stepperHeader)) {
|
||||
originalContainer.appendChild(stepperHeader); // Mover de vuelta al contenedor original
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Llamar a la función para ajustar la ubicación al cargar
|
||||
adjustStepperLocation();
|
||||
|
||||
// También ejecutar la función cuando cambie el tamaño de la ventana
|
||||
window.addEventListener('resize', function () {
|
||||
adjustStepperLocation();
|
||||
});
|
||||
*/
|
||||
this.clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
|
||||
|
||||
this.validationStepper = new Stepper(this.clientePresupuestoWizard, {
|
||||
@ -37,7 +69,7 @@ class PresupuestoCliente {
|
||||
this.direcciones = new Direcciones($("#direcciones-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.resumen = new Resumen($("#resumen-libro"), this.datosGenerales, this.disenioInterior, this.disenioCubierta, this.direcciones);
|
||||
|
||||
this.divTiradasPrecios = $("#divTiradasPrecio");
|
||||
this.divTiradasPrecios = $(".divTiradasPrecio");
|
||||
|
||||
this.titulosMenu = $(".titulos-menu");
|
||||
|
||||
@ -50,7 +82,7 @@ class PresupuestoCliente {
|
||||
this.actualizarTiradasEnvio = false;
|
||||
this.calcularPresupuesto = false;
|
||||
|
||||
if(!window.location.href.includes("edit")) {
|
||||
if (!window.location.href.includes("edit")) {
|
||||
this.#processResumenLateral();
|
||||
}
|
||||
}
|
||||
@ -167,7 +199,7 @@ class PresupuestoCliente {
|
||||
this.actualizarTiradasEnvio = false;
|
||||
|
||||
if (!this.direcciones.calcularPresupuesto) {
|
||||
|
||||
|
||||
$('#loader').modal('hide');
|
||||
return;
|
||||
}
|
||||
@ -226,9 +258,9 @@ class PresupuestoCliente {
|
||||
else {
|
||||
this.#goToForm(nextElement);
|
||||
}
|
||||
if(!nextElement.includes('resumen-libro'))
|
||||
if (!nextElement.includes('resumen-libro'))
|
||||
this.#processResumenLateral();
|
||||
else{
|
||||
else {
|
||||
$(".rl-item").addClass('d-none');
|
||||
}
|
||||
}
|
||||
@ -259,7 +291,6 @@ class PresupuestoCliente {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$('html, body').animate({ scrollTop: 0 }, 'slow');
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +411,7 @@ class PresupuestoCliente {
|
||||
}
|
||||
}
|
||||
|
||||
#printPresupuesto(){
|
||||
#printPresupuesto() {
|
||||
|
||||
window.open('/printpresupuestos/generar/' + window.location.href.split("/").pop(), '_blank');
|
||||
}
|
||||
@ -392,7 +423,7 @@ class PresupuestoCliente {
|
||||
total_unidades += parseInt(element.tirada.val());
|
||||
});
|
||||
|
||||
if(total_unidades != parseInt(this.direcciones.getSelectedTirada())){
|
||||
if (total_unidades != parseInt(this.direcciones.getSelectedTirada())) {
|
||||
popErrorAlert("No se puede confirmar el presupuesto. La suma de las unidades enviadas no coincide con la tirada seleccionada.");
|
||||
return;
|
||||
}
|
||||
@ -500,7 +531,7 @@ class PresupuestoCliente {
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio){
|
||||
if (this.actualizarTiradasEnvio) {
|
||||
this.direcciones.insertTirada(tiradas[i]);
|
||||
}
|
||||
|
||||
@ -595,7 +626,13 @@ class PresupuestoCliente {
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
|
||||
prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
ferro: this.datosGenerales.ferro.is(':checked') ? 1 : 0,
|
||||
ferroDigital: this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
|
||||
marcapaginas: this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
|
||||
retractilado: this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
|
||||
retractilado5: this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
|
||||
|
||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||
@ -623,6 +660,11 @@ class PresupuestoCliente {
|
||||
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
|
||||
servicios: {
|
||||
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
|
||||
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
|
||||
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
|
||||
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
|
||||
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
|
||||
},
|
||||
};
|
||||
let lomoRedondo = 0;
|
||||
@ -766,9 +808,40 @@ function initialize(translations) {
|
||||
presupuestoCliente.init();
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
function moveStepperHeader() {
|
||||
if ($(window).width() < 768) { // Dispositivos pequeños (menos de 768px)
|
||||
if (!$('.bs-stepper-header').parent().hasClass('offcanvas-body')) {
|
||||
$('.bs-stepper-header').appendTo('.offcanvas-body');
|
||||
}
|
||||
} else { // Dispositivos medianos y grandes (768px o más)
|
||||
if ($('.bs-stepper-header').parent().hasClass('offcanvas-body')) {
|
||||
$('.bs-stepper-header').insertBefore('.offcanvas-body');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ejecutar la función al cargar la página
|
||||
moveStepperHeader();
|
||||
|
||||
// Ejecutar la función al cambiar el tamaño de la ventana
|
||||
window.addEventListener('resize', function () {
|
||||
moveStepperHeader();
|
||||
});
|
||||
|
||||
function moveStepperHeader() {
|
||||
if ($(window).width() < 768) { // Dispositivos pequeños (menos de 768px)
|
||||
if (!$('.bs-stepper-header').parent().hasClass('offcanvas-body')) {
|
||||
$('.bs-stepper-header').appendTo('.offcanvas-body');
|
||||
}
|
||||
} else { // Dispositivos medianos y grandes (768px o más)
|
||||
if ($('.bs-stepper-header').parent().hasClass('offcanvas-body')) {
|
||||
$('.bs-stepper-header').insertAfter('#menu-offcanvas');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: 'Presupuestos' }, {},
|
||||
@ -780,3 +853,4 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user