mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminados datos generales e interior
This commit is contained in:
@ -380,6 +380,17 @@ return [
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'fix_errors' => 'Corrija los siguientes errores antes de continuar:',
|
||||
'titulo_requerido' => 'El campo "Título" es obligatorio.',
|
||||
'tirada_integer_greatherThan_0' => 'Los valores de las tiradas deben ser enteros mayores que 0.',
|
||||
'tirada_pod_nopod' => 'No se pueden mezclar tiradas POD (menor o igual que 30 unidades) con tiradas no POD (mayor que 30 unidades).',
|
||||
'papelFormatoAncho' => 'Seleccione un ancho de libro válido.',
|
||||
'papelFormatoAlto' => 'Seleccione un alto de libro válido.',
|
||||
'papelFormato' => 'Seleccione un formato de libro válido.',
|
||||
'paginasColor' => 'El número de páginas a color debe ser un número entero mayor o igual que 0.',
|
||||
'paginasNegro' => 'El número de páginas en negro debe ser un número entero mayor o igual que 0.',
|
||||
'paginas' => 'El total de páginas tiene que ser mayor que 0.',
|
||||
'tipo_libro' => 'Seleccione el tipo de libro que desea para el presupuesto.',
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'requerido' => 'El campo {field} es obligatorio.',
|
||||
@ -388,11 +399,12 @@ return [
|
||||
'no_lp_for_merma' => 'Inserte líneas de presupuesto para calcular la merma',
|
||||
'ejemplares_envio' => 'El número de ejemplares enviados no coincide con la tirada',
|
||||
'cliente' => 'Debe seleccionar un cliente',
|
||||
'papelFormato' => 'Seleccione un formato',
|
||||
'tipo_libro' => 'Seleccione un tipo de libro',
|
||||
'disenio_interior' => 'Seleccione el diseño del interior',
|
||||
'papel_interior' => 'Seleccione el tipo de papel',
|
||||
'gramaje_interior' => 'Seleccione el gramaje',
|
||||
|
||||
'disenio_interior' => 'Seleccione el tipo de impresión del interior',
|
||||
'papel_interior' => 'Seleccione el tipo de papel para el interior',
|
||||
'papel_interior_especial' => 'Seleccione el papel especial en el desplegable para el interior',
|
||||
'gramaje_interior' => 'Seleccione el gramaje para el interior',
|
||||
|
||||
'pais' => 'Debe seleccionar un país',
|
||||
'integer_greatherThan_0' => 'Número entero > 0 requerido',
|
||||
'greater_than_0' => 'El campo {field} debe ser mayor que 0',
|
||||
@ -400,7 +412,7 @@ return [
|
||||
'sin_gramaje' => "Seleccione gramaje",
|
||||
'tipo_cubierta' => 'Seleccione tipo de cubierta',
|
||||
'opcion_solapas' => 'Seleccione la opción para las solapas',
|
||||
'paginas_multiplo_4' => 'El número de páginas para <b>cosido</b> o <b>grapado</b> debe ser múltiplo de 4',
|
||||
'paginas_multiplo_4' => 'El número total de páginas para <b>cosido</b> y <b>grapado</b> debe ser múltiplo de 4',
|
||||
'paginas_pares' => 'El número de páginas debe ser par',
|
||||
'extras_cubierta' => 'Rellene todos los campos',
|
||||
],
|
||||
|
||||
@ -5,7 +5,6 @@ class DatosGenerales {
|
||||
constructor(domItem, wizardForm, validatorStepper) {
|
||||
|
||||
this.domItem = domItem;
|
||||
this.allowNext = true;
|
||||
|
||||
this.wizardStep = wizardForm.querySelector('#datos-generales');
|
||||
this.validatorStepper = validatorStepper;
|
||||
@ -78,7 +77,7 @@ class DatosGenerales {
|
||||
|
||||
this.cargando = false;
|
||||
|
||||
this.initValidation();
|
||||
this.errores = [];
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +87,6 @@ class DatosGenerales {
|
||||
this.formatoLibro.init();
|
||||
this.cliente.init();
|
||||
|
||||
|
||||
// Inicializa el tipo de impresion
|
||||
this.#handlePaginas();
|
||||
|
||||
@ -111,303 +109,147 @@ class DatosGenerales {
|
||||
this.retractilado5.on('change', this.#eventRetractilado.bind(this));
|
||||
}
|
||||
|
||||
initValidation() {
|
||||
|
||||
const stepper = this.validatorStepper;
|
||||
validate(goToNext = true) {
|
||||
|
||||
this.formValidation = FormValidation.formValidation(this.wizardStep, {
|
||||
fields: {
|
||||
titulo: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: window.translations["validation"].requerido_short
|
||||
},
|
||||
}
|
||||
},
|
||||
cliente_id: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].cliente,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
if (!$(this.excluirRotativa).prop('hidden'))
|
||||
return true;
|
||||
const options = $("#clienteId").select2('data');
|
||||
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
||||
return options !== null && options.length > 0 && hasValidOption;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tirada: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
const value = $("#tirada").val();
|
||||
const value2 = $("#tirada2").val();
|
||||
const value3 = $("#tirada3").val();
|
||||
const value4 = $("#tirada4").val();
|
||||
let tiradas = [value];
|
||||
this.errores = [];
|
||||
|
||||
if (!(value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0)) {
|
||||
return {
|
||||
valid: false,
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
};
|
||||
}
|
||||
if (value2.length > 0 && Number.isInteger(parseInt(value2)) && parseInt(value2) > 0) {
|
||||
tiradas.push(value2);
|
||||
}
|
||||
if (value3.length > 0 && Number.isInteger(parseInt(value3)) && parseInt(value3) > 0) {
|
||||
tiradas.push(value3);
|
||||
}
|
||||
if (value4.length > 0 && Number.isInteger(parseInt(value4)) && parseInt(value4) > 0) {
|
||||
tiradas.push(value4);
|
||||
}
|
||||
// comprobar si hay valores > 30
|
||||
const noPOD = (tiradas.some(tirada => parseInt(tirada) > 30));
|
||||
const siPOD = (tiradas.some(tirada => parseInt(tirada) <= 30));
|
||||
if (noPOD && siPOD) {
|
||||
return {
|
||||
valid: false,
|
||||
message: "No se pueden mezclar tiradas <30 con >30",
|
||||
}
|
||||
}
|
||||
// Titulo
|
||||
if (this.titulo.val().trim() === '') {
|
||||
this.errores.push(window.translations["validation"].titulo_requerido);
|
||||
this.titulo.addClass('is-invalid');
|
||||
} else {
|
||||
this.titulo.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tirada2: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
let field = $("#tirada2");
|
||||
field.val(field.val().replace(/[^0-9]/g, ''));
|
||||
let value = field.value;
|
||||
if (value == '')
|
||||
return true;
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tirada3: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
let field = $("#tirada3");
|
||||
field.val(field.val().replace(/[^0-9]/g, ''));
|
||||
let value = field.value;
|
||||
if (value == '')
|
||||
return true;
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tirada4: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
let field = $("#tirada4");
|
||||
field.val(field.val().replace(/[^0-9]/g, ''));
|
||||
let value = field.value;
|
||||
if (value == '')
|
||||
return true;
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
papel_formato_id: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].papelFormato,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const options = $("#papelFormatoId").select2('data');
|
||||
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
||||
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
|
||||
if (custom_format)
|
||||
return true;
|
||||
return options !== null && options.length > 0 && hasValidOption;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
papel_formato_ancho: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
|
||||
if (!custom_format)
|
||||
return true;
|
||||
const value = $("#papelFormatoAncho").val();
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
papel_formato_alto: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const custom_format = $("#papelFormatoPersonalizado").is(":checked");
|
||||
if (!custom_format)
|
||||
return true;
|
||||
const value = $("#papelFormatoAlto").val();
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
paginasColor: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const value = $("#paginasColor").val();
|
||||
if (value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0) {
|
||||
// Cliente
|
||||
if ($(this.excluirRotativa).prop('hidden')) {
|
||||
if ($('#clienteId').val() === null || $('#clienteId').val().length === 0) {
|
||||
this.errores.push(window.translations["validation"].cliente);
|
||||
$('#clienteId').addClass('is-invalid');
|
||||
} else {
|
||||
$('#clienteId').removeClass('is-invalid');
|
||||
}
|
||||
} else {
|
||||
if (this.cliente.getVal() <= 0) {
|
||||
this.errores.push(window.translations["validation"].cliente);
|
||||
this.cliente.item.addClass('is-invalid');
|
||||
} else {
|
||||
this.cliente.item.removeClass('is-invalid');
|
||||
}
|
||||
}
|
||||
|
||||
if (parseInt(value) % 2 != 0) {
|
||||
return {
|
||||
valid: false,
|
||||
message: window.translations["validation"].paginas_pares
|
||||
};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
paginasNegro: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const value = $("#paginasNegro").val();
|
||||
if (value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0) {
|
||||
// Tirada
|
||||
let tiradas = this.getTiradas();
|
||||
if (tiradas.length === 0 || tiradas.some(tirada =>
|
||||
!Number.isInteger(tirada) ||
|
||||
parseInt(tirada) <= 0 ||
|
||||
tirada == "")) {
|
||||
|
||||
if (parseInt(value) % 2 != 0) {
|
||||
return {
|
||||
valid: false,
|
||||
message: window.translations["validation"].paginas_pares
|
||||
};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
paginas: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: window.translations["validation"].integer_greatherThan_0,
|
||||
callback: function (input) {
|
||||
// Get the selected options
|
||||
const value = $("#paginas").val();
|
||||
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_tipo_libro: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
const divTipoLibro = $('#divTipoLibro'); // Selecciona el div
|
||||
this.errores.push(window.translations["validation"].tirada_integer_greatherThan_0);
|
||||
this.tirada1.addClass('is-invalid');
|
||||
|
||||
divTipoLibro.find('.fv-plugins-message-container').remove();
|
||||
if ($('.tipo-libro.selected').length > 0) {
|
||||
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
|
||||
const value = parseInt($("#paginas").val());
|
||||
if (value % 4 != 0) {
|
||||
divTipoLibro.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].paginas_multiplo_4}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
this.tirada1.removeClass('is-invalid');
|
||||
// Comprobar tiradas POD
|
||||
const noPOD = tiradas.some(tirada => parseInt(tirada) > 30);
|
||||
const siPOD = tiradas.some(tirada => parseInt(tirada) <= 30);
|
||||
if (noPOD && siPOD) {
|
||||
this.errores.push(window.translations["validation"].tirada_pod_nopod);
|
||||
this.tirada1.addClass('is-invalid');
|
||||
}
|
||||
else {
|
||||
this.tirada1.removeClass('is-invalid');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
divTipoLibro.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].tipo_libro}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
// formato libro
|
||||
if (this.checkFormatoPersonalizado.is(':checked')) {
|
||||
if (this.anchoPersonalizado.val().length === 0 || isNaN(this.anchoPersonalizado.val()) ||
|
||||
parseFloat(this.anchoPersonalizado.val()) <= 0) {
|
||||
this.errores.push(window.translations["validation"].papelFormatoAncho);
|
||||
this.anchoPersonalizado.addClass('is-invalid');
|
||||
} else {
|
||||
this.anchoPersonalizado.removeClass('is-invalid');
|
||||
}
|
||||
if (this.altoPersonalizado.val().length === 0 || isNaN(this.altoPersonalizado.val()) ||
|
||||
parseFloat(this.altoPersonalizado.val()) <= 0) {
|
||||
this.errores.push(window.translations["validation"].papelFormatoAlto);
|
||||
this.altoPersonalizado.addClass('is-invalid');
|
||||
} else {
|
||||
this.altoPersonalizado.removeClass('is-invalid');
|
||||
}
|
||||
} else {
|
||||
const options = $("#papelFormatoId").select2('data');
|
||||
const hasValidOption = options.some(option => parseInt(option.id) > 0);
|
||||
if (options !== null && options.length > 0 && hasValidOption) {
|
||||
this.papelFormatoId.removeClass('is-invalid');
|
||||
} else {
|
||||
this.errores.push(window.translations["validation"].papelFormato);
|
||||
this.papelFormatoId.addClass('is-invalid');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
// Paginas
|
||||
if (this.paginasColor.val() == '' || isNaN(this.paginasColor.val()) || parseInt(this.paginasColor.val()) < 0) {
|
||||
this.errores.push(window.translations["validation"].paginasColor);
|
||||
this.paginasColor.addClass('is-invalid');
|
||||
} else {
|
||||
this.paginasColor.removeClass('is-invalid');
|
||||
}
|
||||
if (this.paginasNegro.val() == '' || isNaN(this.paginasNegro.val()) || parseInt(this.paginasNegro.val()) < 0) {
|
||||
this.errores.push(window.translations["validation"].paginasNegro);
|
||||
this.paginasNegro.addClass('is-invalid');
|
||||
} else {
|
||||
this.paginasNegro.removeClass('is-invalid');
|
||||
}
|
||||
if (this.paginas.val() == '' || isNaN(this.paginas.val()) || parseInt(this.paginas.val()) <= 0) {
|
||||
this.errores.push(window.translations["validation"].paginas);
|
||||
this.paginas.addClass('is-invalid');
|
||||
} else {
|
||||
this.paginas.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
// Tipo de libro
|
||||
if ($('.tipo-libro.selected').length > 0) {
|
||||
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
|
||||
const value = parseInt($("#paginas").val());
|
||||
if (value % 4 != 0) {
|
||||
if (parseInt(this.paginas.val()) % 4 != 0) {
|
||||
this.errores.push(window.translations["validation"].paginas_multiplo_4);
|
||||
this.paginas.addClass('is-invalid');
|
||||
} else {
|
||||
this.paginas.removeClass('is-invalid');
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap5: new FormValidation.plugins.Bootstrap5({
|
||||
// Use this for enabling/changing valid/invalid class
|
||||
// eleInvalidClass: '',
|
||||
eleValidClass: '',
|
||||
rowSelector: function (field, ele) {
|
||||
// field is the field name
|
||||
// ele is the field element
|
||||
switch (field) {
|
||||
case 'div_tipo_libro':
|
||||
return '.col-sm-10';
|
||||
case 'titulo':
|
||||
return '.col-sm-8';
|
||||
case 'cliente_id':
|
||||
return '.col-sm-5';
|
||||
case 'papel_formato_id':
|
||||
return '.col-sm-4';
|
||||
case 'papel_formato_ancho':
|
||||
case 'papel_formato_ancho':
|
||||
return '.col-sm-3';
|
||||
case 'tirada':
|
||||
case 'tirada2':
|
||||
case 'tirada3':
|
||||
case 'tirada4':
|
||||
return '.col-sm-2';
|
||||
|
||||
default:
|
||||
return '.col-sm-3';
|
||||
}
|
||||
}
|
||||
}),
|
||||
autoFocus: new FormValidation.plugins.AutoFocus(),
|
||||
submitButton: new FormValidation.plugins.SubmitButton()
|
||||
}
|
||||
}).on('core.form.valid', () => {
|
||||
if (this.allowNext)
|
||||
this.domItem.find('#divTipoLibro').removeClass('is-invalid');
|
||||
} else {
|
||||
this.errores.push(window.translations["validation"].tipo_libro);
|
||||
this.domItem.find('#divTipoLibro').addClass('is-invalid');
|
||||
}
|
||||
|
||||
stepper.next();
|
||||
});
|
||||
const skAlert = document.getElementById('sk-alert');
|
||||
skAlert.innerHTML = '';
|
||||
const uniqueErrors = [...new Set(this.errores)];
|
||||
|
||||
if (uniqueErrors.length > 0) {
|
||||
const message = window.translations["validation"].fix_errors +
|
||||
`<ul class="mb-0">
|
||||
${uniqueErrors.map(err => `<li>${err}</li>`).join('')}
|
||||
</ul>`;
|
||||
popErrorAlert(message, 'sk-alert', false);
|
||||
this.errores = [];
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
document.getElementById('sk-alert').innerHTML = '';
|
||||
this.errores = [];
|
||||
if (goToNext)
|
||||
this.validatorStepper.next();
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -425,11 +267,11 @@ class DatosGenerales {
|
||||
else {
|
||||
this.rl_tipo.addClass('d-none');
|
||||
}
|
||||
if($('.tipo-cubierta.selected').length>0){
|
||||
if ($('.tipo-cubierta.selected').length > 0) {
|
||||
this.rl_tipo_cubierta.text($($('.tipo-cubierta.selected').find('.form-label')).text());
|
||||
this.rl_tipo_cubierta.removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.rl_tipo_cubierta.addClass('d-none');
|
||||
}
|
||||
if (this.checkFormatoPersonalizado.is(':checked')) {
|
||||
@ -478,33 +320,9 @@ class DatosGenerales {
|
||||
|
||||
// servicios extra
|
||||
menu_off = true;
|
||||
/*if(this.prototipo.is(':checked')){
|
||||
this.rl_prototipo.removeClass("d-none");
|
||||
menu_off = false;
|
||||
}
|
||||
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');
|
||||
}
|
||||
*/
|
||||
$('#rl-servicios-extra-items').empty();
|
||||
|
||||
if(this.marcapaginas.is(':checked')){
|
||||
if (this.marcapaginas.is(':checked')) {
|
||||
let $ul = $('<ul>', {
|
||||
class: 'list-group list-group-timeline'
|
||||
});
|
||||
@ -519,7 +337,7 @@ class DatosGenerales {
|
||||
menu_off = false;
|
||||
}
|
||||
|
||||
if(this.retractilado.is(':checked')){
|
||||
if (this.retractilado.is(':checked')) {
|
||||
let $ul = $('<ul>', {
|
||||
class: 'list-group list-group-timeline'
|
||||
});
|
||||
@ -534,7 +352,7 @@ class DatosGenerales {
|
||||
menu_off = false;
|
||||
}
|
||||
|
||||
if(this.retractilado5.is(':checked')){
|
||||
if (this.retractilado5.is(':checked')) {
|
||||
let $ul = $('<ul>', {
|
||||
class: 'list-group list-group-timeline'
|
||||
});
|
||||
@ -550,7 +368,7 @@ class DatosGenerales {
|
||||
}
|
||||
|
||||
const serviciosExtra = $('input[type="checkbox"][data-tarifa-tipo="extra"]:checked');
|
||||
for(let i=0; i<serviciosExtra.length; i++){
|
||||
for (let i = 0; i < serviciosExtra.length; i++) {
|
||||
let $ul = $('<ul>', {
|
||||
class: 'list-group list-group-timeline'
|
||||
});
|
||||
@ -564,10 +382,10 @@ class DatosGenerales {
|
||||
$('#rl-servicios-extra-items').append($ul);
|
||||
}
|
||||
|
||||
if(!menu_off){
|
||||
if (!menu_off) {
|
||||
this.rl_servicios_extra.removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.rl_servicios_extra.addClass('d-none');
|
||||
}
|
||||
|
||||
@ -588,7 +406,7 @@ class DatosGenerales {
|
||||
this.cliente.setOption(datos.clienteId, datos.clienteNombre);
|
||||
this.cliente.setVal(datos.clienteId);
|
||||
|
||||
if(datos.selectedTirada){
|
||||
if (datos.selectedTirada) {
|
||||
this.selectedTirada = datos.selectedTirada;
|
||||
}
|
||||
$(this.cliente).trigger('change');
|
||||
@ -609,7 +427,6 @@ class DatosGenerales {
|
||||
this.checkFormatoPersonalizado.prop('checked', true);
|
||||
this.formatoEstandar.addClass('d-none');
|
||||
this.formatoPersonalizado.removeClass('d-none');
|
||||
this.formValidation.revalidateField('papel_formato_id');
|
||||
this.altoPersonalizado.val(datos.papelFormatoAlto);
|
||||
this.anchoPersonalizado.val(datos.papelFormatoAncho);
|
||||
}
|
||||
@ -636,17 +453,17 @@ class DatosGenerales {
|
||||
this.tiposLibro.find('.image-presupuesto').removeClass('selected');
|
||||
this.domItem.find('#' + datos.tipo).addClass('selected');
|
||||
|
||||
if(datos.tipo == 'cosido'){
|
||||
if (datos.tipo == 'cosido') {
|
||||
this.divPaginasCuaderillo.removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(datos.serviciosExtra){
|
||||
if (datos.serviciosExtra) {
|
||||
|
||||
let serviciosExtra = $('input[type="checkbox"][data-tarifa-tipo="extra"]');
|
||||
|
||||
$(serviciosExtra).each(function() {
|
||||
$(serviciosExtra).each(function () {
|
||||
let tarifaId = $(this).data('tarifa-id') + "";
|
||||
|
||||
if (datos.serviciosExtra.includes(tarifaId)) {
|
||||
@ -654,10 +471,6 @@ 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);
|
||||
@ -702,11 +515,11 @@ class DatosGenerales {
|
||||
getTiradas() {
|
||||
let tiradas = [];
|
||||
tiradas.push(parseInt(this.tirada1.val()));
|
||||
if (this.tirada2.val().length > 0 && parseInt(this.tirada2.val()) > 0)
|
||||
if (this.tirada2.val().length > 0)
|
||||
tiradas.push(parseInt(this.tirada2.val()));
|
||||
if (this.tirada3.val().length > 0 && parseInt(this.tirada3.val()) > 0)
|
||||
if (this.tirada3.val().length > 0)
|
||||
tiradas.push(parseInt(this.tirada3.val()));
|
||||
if (this.tirada4.val().length > 0 && parseInt(this.tirada4.val()) > 0)
|
||||
if (this.tirada4.val().length > 0)
|
||||
tiradas.push(parseInt(this.tirada4.val()));
|
||||
return tiradas;
|
||||
}
|
||||
@ -725,21 +538,18 @@ class DatosGenerales {
|
||||
if (this.checkFormatoPersonalizado.is(':checked')) {
|
||||
this.formatoEstandar.addClass('d-none');
|
||||
this.formatoPersonalizado.removeClass('d-none');
|
||||
this.formValidation.revalidateField('papel_formato_id');
|
||||
}
|
||||
else {
|
||||
this.formatoEstandar.removeClass('d-none');
|
||||
this.formatoPersonalizado.addClass('d-none');
|
||||
this.formValidation.revalidateField('papel_formato_ancho');
|
||||
this.formValidation.revalidateField('papel_formato_alto');
|
||||
}
|
||||
const alto = this.getDimensionLibro().alto;
|
||||
$('#altoFaja').closest('.config-faja').find('.form-text').text('Entre 50 y ' + alto + ' mm');
|
||||
}
|
||||
|
||||
#checkValue(event){
|
||||
#checkValue(event) {
|
||||
let target = event.target;
|
||||
if(target.value < target.min){
|
||||
if (target.value < target.min) {
|
||||
target.value = target.min;
|
||||
}
|
||||
}
|
||||
@ -800,8 +610,6 @@ class DatosGenerales {
|
||||
}
|
||||
}
|
||||
|
||||
this.checkPaginasMultiplo4();
|
||||
|
||||
// Para recalcular el presupuesto
|
||||
element.trigger('change');
|
||||
}
|
||||
@ -844,7 +652,6 @@ class DatosGenerales {
|
||||
else {
|
||||
this.domItem.find('#grapado').show();
|
||||
}
|
||||
this.formValidation.revalidateField('paginas');
|
||||
|
||||
// Se configura dependiento si hay color o no
|
||||
const lastLayoutColor = $('#negroEstandar').hasClass('d-none');
|
||||
@ -856,7 +663,7 @@ class DatosGenerales {
|
||||
this.posPaginasColor.val("");
|
||||
this.pagColorConsecutivas.prop('checked', false);
|
||||
|
||||
if(lastLayoutColor && !this.cargando){
|
||||
if (lastLayoutColor && !this.cargando) {
|
||||
|
||||
$('#divPapelInterior').empty();
|
||||
$('#divGramajeInterior').empty();
|
||||
@ -871,7 +678,7 @@ class DatosGenerales {
|
||||
this.divPaginasColorConsecutivas.removeClass('d-none');
|
||||
this.divPosPaginasColor.removeClass('d-none');
|
||||
|
||||
if(!lastLayoutColor && !this.cargando){
|
||||
if (!lastLayoutColor && !this.cargando) {
|
||||
|
||||
$('#divPapelInterior').empty();
|
||||
$('#divGramajeInterior').empty();
|
||||
@ -880,29 +687,6 @@ class DatosGenerales {
|
||||
}
|
||||
|
||||
$('.calcular-lomo').trigger('change');
|
||||
|
||||
this.checkPaginasMultiplo4();
|
||||
}
|
||||
|
||||
checkPaginasMultiplo4(){
|
||||
|
||||
const divTipoLibro = $('#divTipoLibro'); // Selecciona el div
|
||||
divTipoLibro.find('.fv-plugins-message-container').remove();
|
||||
|
||||
if ($('#cosido').hasClass('selected') || $('#grapado').hasClass('selected')) {
|
||||
const value = parseInt($("#paginas").val());
|
||||
if (value % 4 != 0) {
|
||||
divTipoLibro.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].paginas_multiplo_4}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -982,7 +766,7 @@ class DatosGenerales {
|
||||
|
||||
let servicios = [];
|
||||
|
||||
$(serviciosExtra).each(function() {
|
||||
$(serviciosExtra).each(function () {
|
||||
let tarifaId = $(this).data('tarifa-id');
|
||||
if (tarifaId) {
|
||||
servicios.push(tarifaId);
|
||||
|
||||
@ -16,7 +16,6 @@ class DisenioInterior {
|
||||
|
||||
this.wizardStep = wizardForm.querySelector('#interior-libro');
|
||||
this.validatorStepper = validatorStepper;
|
||||
this.allowNext = true;
|
||||
|
||||
this.disenioInterior = this.domItem.find(".disenio-interior");
|
||||
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
||||
@ -56,10 +55,10 @@ class DisenioInterior {
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => {return this.getTipoImpresion()},
|
||||
tirada: () => {{return this.presupuestoCliente.datosGenerales.getTiradas()[0]}},
|
||||
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
|
||||
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
@ -71,10 +70,10 @@ class DisenioInterior {
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => {return this.getTipoImpresion()},
|
||||
tirada: () => {{return this.presupuestoCliente.datosGenerales.getTiradas()[0]}},
|
||||
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
|
||||
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
@ -94,8 +93,6 @@ class DisenioInterior {
|
||||
this.gramajeNegroForResumen = "";
|
||||
this.papelColorForResumen = "";
|
||||
this.gramajeColorForResumen = "";
|
||||
|
||||
this.initValidation();
|
||||
}
|
||||
|
||||
|
||||
@ -378,229 +375,74 @@ class DisenioInterior {
|
||||
}
|
||||
|
||||
|
||||
initValidation() {
|
||||
validate(goToNext = true) {
|
||||
|
||||
const stepper = this.validatorStepper;
|
||||
let errores = [];
|
||||
|
||||
this.formValidation = FormValidation.formValidation(this.wizardStep, {
|
||||
fields: {
|
||||
div_impresion_interior: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
const divImpresionInterior = $('#divImpresionInterior'); // Selecciona el div
|
||||
// impresion interior
|
||||
if ($('.disenio-interior.selected').length > 0) {
|
||||
$('#divImpresionInterior').removeClass('is-invalid');
|
||||
}
|
||||
else {
|
||||
errores.push(window.translations["validation"].disenio_interior);
|
||||
$('#divImpresionInterior').addClass('is-invalid');
|
||||
}
|
||||
|
||||
divImpresionInterior.find('.fv-plugins-message-container').remove();
|
||||
if ($('.disenio-interior.selected').length > 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
divImpresionInterior.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].disenio_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_papel_interior: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
|
||||
$('#divPapelInterior').find('.fv-plugins-message-container').remove();
|
||||
$('#divPapelEspecialInterior').find('.fv-plugins-message-container').remove();
|
||||
|
||||
const papelSeleccionado = $('.custom-selector-papel input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].papel_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_papel_especial_interior: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
|
||||
$('#divPapelEspecialInterior').find('.fv-plugins-message-container').remove();
|
||||
if ($('#divPapelEspecialInterior').hasClass("d-none")) return true;
|
||||
|
||||
if ($('#papelEspecialInterior').select2('data').length > 0)
|
||||
return true;
|
||||
else {
|
||||
$('#divPapelEspecialInterior').append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].papel_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
div_gramaje_interior: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
|
||||
const divGramajeInterior = $('#divGramajeInterior'); // Selecciona el div
|
||||
|
||||
const gramajeSeleccionado = $('.custom-selector-gramaje input[type="radio"]:checked');
|
||||
if (gramajeSeleccionado.length > 0) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
divGramajeInterior.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].gramaje_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_impresion_interior_color: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
const divImpresionInterior = $('#divImpresionInteriorColor'); // Selecciona el div
|
||||
if (divImpresionInterior.hasClass("d-none")) return true;
|
||||
|
||||
divImpresionInterior.find('.fv-plugins-message-container').remove();
|
||||
if ($('.disenio-interior-color.selected').length > 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
divImpresionInterior.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior_color" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].disenio_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_papel_interior_color: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
const divPapelInterior = $('#divPapelInteriorColor'); // Selecciona el div
|
||||
if (divPapelInteriorColor.hasClass("d-none")) return true;
|
||||
|
||||
$('#divPapelInteriorColor').find('.fv-plugins-message-container').remove();
|
||||
$('#divPapelEspecialInteriorColor').find('.fv-plugins-message-container').remove();
|
||||
|
||||
const papelSeleccionado = $('.custom-selector-papel-color input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
$('#divPapelInteriorColor').append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].papel_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
div_gramaje_interior_color: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
const divGramajeInteriorColor = $('#divGramajeInteriorColor'); // Selecciona el div
|
||||
if (divGramajeInteriorColor.hasClass("d-none")) return true;
|
||||
|
||||
const gramajeSeleccionado = $('.custom-selector-gramaje-color input[type="radio"]:checked');
|
||||
if (gramajeSeleccionado.length > 0) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
divGramajeInteriorColor.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].gramaje_interior}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap5: new FormValidation.plugins.Bootstrap5({
|
||||
// Use this for enabling/changing valid/invalid class
|
||||
// eleInvalidClass: '',
|
||||
eleValidClass: '',
|
||||
rowSelector: function (field, ele) {
|
||||
// field is the field name
|
||||
// ele is the field element
|
||||
switch (field) {
|
||||
case 'div_impresion_interior':
|
||||
case 'div_papel_interior':
|
||||
case 'div_gramaje_interior':
|
||||
case 'div_impresion_interior_color':
|
||||
case 'div_papel_interior_color':
|
||||
case 'div_gramaje_interior_color':
|
||||
case 'div_papel_especial_interior':
|
||||
return '.col-sm-10';
|
||||
default:
|
||||
return '.col-sm-3';
|
||||
}
|
||||
}
|
||||
}),
|
||||
autoFocus: new FormValidation.plugins.AutoFocus(),
|
||||
submitButton: new FormValidation.plugins.SubmitButton()
|
||||
// papel interior
|
||||
const papelSeleccionado = $('.custom-selector-papel input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
if (!$('#divPapelEspecialInterior').hasClass("d-none")) {
|
||||
if ($('#papelEspecialInterior').select2('data').length == 0) {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
errores.push(window.translations["validation"].papel_interior_especial);
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
}
|
||||
}
|
||||
}).on('core.form.valid', () => {
|
||||
if (this.allowNext)
|
||||
stepper.next();
|
||||
});
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
}
|
||||
} else {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
errores.push(window.translations["validation"].papel_interior);
|
||||
}
|
||||
|
||||
// gramaje interior
|
||||
const gramajeSeleccionado = $('.custom-selector-gramaje input[type="radio"]:checked');
|
||||
if (gramajeSeleccionado.length > 0) {
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
}
|
||||
else{
|
||||
$('#divGramajeInterior').addClass('is-invalid');
|
||||
errores.push(window.translations["validation"].gramaje_interior);
|
||||
}
|
||||
|
||||
const skAlert = document.getElementById('sk-alert');
|
||||
skAlert.innerHTML = '';
|
||||
const uniqueErrors = [...new Set(errores)];
|
||||
|
||||
if (uniqueErrors.length > 0) {
|
||||
const message = window.translations["validation"].fix_errors +
|
||||
`<ul class="mb-0">
|
||||
${uniqueErrors.map(err => `<li>${err}</li>`).join('')}
|
||||
</ul>`;
|
||||
popErrorAlert(message, 'sk-alert', false);
|
||||
errores = [];
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
document.getElementById('sk-alert').innerHTML = '';
|
||||
errores = [];
|
||||
if (goToNext)
|
||||
this.validatorStepper.next();
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
getTipoImpresion() {
|
||||
|
||||
let tipo = 'negro';
|
||||
|
||||
@ -130,7 +130,7 @@ class PresupuestoCliente {
|
||||
this.disenioCubierta.processMenuLateral();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#checkTiradas() {
|
||||
|
||||
let tiradas = [parseInt(this.datosGenerales.tirada1.val())];
|
||||
@ -162,7 +162,7 @@ class PresupuestoCliente {
|
||||
|
||||
this.datosGenerales.formValidation.validateField('tirada');
|
||||
return !(noPOD && siPOD);
|
||||
}
|
||||
}*/
|
||||
|
||||
calcularSolapas() {
|
||||
|
||||
@ -217,11 +217,6 @@ class PresupuestoCliente {
|
||||
|
||||
this.#processResumenLateral();
|
||||
|
||||
if (!this.#checkTiradas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.calcularPresupuesto) {
|
||||
|
||||
if (event.target.id === 'divDirecciones') {
|
||||
@ -294,7 +289,7 @@ class PresupuestoCliente {
|
||||
if (currentElement === 'cubierta-libro' && this.disenioCubierta.acabadoCubierta.getVal() == 0) {
|
||||
alertWarningMessage(window.translations.cubiertaSinAcabado, window.translations.cubiertaSinAcabadoText);
|
||||
}
|
||||
this.#goToForm(nextElement);
|
||||
//this.#goToForm(nextElement);
|
||||
}
|
||||
else {
|
||||
this.#goToForm(nextElement);
|
||||
@ -339,38 +334,13 @@ class PresupuestoCliente {
|
||||
|
||||
switch (form) {
|
||||
case 'datos-generales':
|
||||
this.datosGenerales.allowNext = false;
|
||||
validateForm(this.datosGenerales.formValidation).then((status) => {
|
||||
if (status !== 'Valid') {
|
||||
this.datosGenerales.allowNext = true;
|
||||
return false;
|
||||
}
|
||||
if(this.datosGenerales.validate(false))
|
||||
this.#goToForm(nextForm);
|
||||
this.datosGenerales.allowNext = true;
|
||||
return true;
|
||||
}).catch(error => {
|
||||
this.datosGenerales.allowNext = true;
|
||||
console.error('Error al validar:', error);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
|
||||
case 'interior-libro':
|
||||
this.disenioInterior.allowNext = false;
|
||||
validateForm(this.disenioInterior.formValidation).then((status) => {
|
||||
if (status !== 'Valid') {
|
||||
this.disenioInterior.allowNext = true;
|
||||
return false;
|
||||
}
|
||||
if(this.disenioInterior.validate(false))
|
||||
this.#goToForm(nextForm);
|
||||
this.disenioInterior.allowNext = true;
|
||||
return true;
|
||||
}
|
||||
).catch(error => {
|
||||
this.disenioInterior.allowNext = true;
|
||||
console.error('Error al validar:', error);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
|
||||
case 'cubierta-libro':
|
||||
@ -651,11 +621,11 @@ class PresupuestoCliente {
|
||||
|
||||
switch (this.validationStepper._currentIndex) {
|
||||
case 0:
|
||||
this.datosGenerales.formValidation.validate();
|
||||
this.datosGenerales.validate();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.disenioInterior.formValidation.validate();
|
||||
this.disenioInterior.validate();
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -143,4 +143,9 @@
|
||||
|
||||
.dt-no-reorder {
|
||||
cursor: auto !important;
|
||||
}
|
||||
|
||||
div.is-invalid {
|
||||
border: 1px solid #ea5455;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
Reference in New Issue
Block a user