añadido mensaje para avisar de la cubierta sin acabado

This commit is contained in:
2025-02-09 10:07:27 +01:00
parent cf6d4318c3
commit 32398d8742
4 changed files with 45 additions and 8 deletions

View File

@ -3,7 +3,7 @@
export const alertConfirmationDelete = (title,type="primary") => {
return Swal.fire({
title: '¿Estás seguro?',
title: '¿Está seguro?',
text: "Esta acción es irreversible.",
icon: 'warning',
showCancelButton: true,
@ -28,4 +28,16 @@ export const alertSuccessMessage = (title,type="primary") => {
icon: "success",
timer : 2000
})
}
export const alertWarningMessage = (title,message,type="primary") => {
return Swal.fire({
title: title,
text: message,
icon: "warning",
customClass: {
confirmButton: 'btn btn-primary'
},
buttonsStyling: false
})
}

View File

@ -4,6 +4,7 @@ import DisenioCubierta from './disenioCubierta.js';
import Direcciones from './direcciones.js';
import Resumen from './resumen.js';
import Ajax from '../../components/ajax.js';
import { alertWarningMessage } from '../../components/alerts/sweetAlert.js';
import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js';
@ -290,6 +291,10 @@ class PresupuestoCliente {
if (currentElement !== 'resumen-libro') {
this.#validateCurrentForm(currentElement, nextElement);
if (currentElement === 'cubierta-libro' && this.disenioCubierta.acabadoCubierta.getVal() == 0) {
alertWarningMessage(window.translations.cubiertaSinAcabado, window.translations.cubiertaSinAcabadoText);
}
this.#goToForm(nextElement);
}
else {
this.#goToForm(nextElement);
@ -486,8 +491,8 @@ class PresupuestoCliente {
(response) => {
// check if response object has a property named 'id'
if (response.id) {
const new_location = window.location.href.replace(id, response.id);
const new_location = window.location.href.replace(id, response.id);
window.location.href = new_location;
}
else {
@ -496,7 +501,7 @@ class PresupuestoCliente {
},
(error) => {
console.error('Error al duplicar el presupuesto:', error);
}
}
).post();
}
@ -650,6 +655,9 @@ class PresupuestoCliente {
case 2:
if (this.disenioCubierta.acabadoCubierta.getVal() == 0) {
alertWarningMessage(window.translations.cubiertaSinAcabado, window.translations.cubiertaSinAcabadoText);
}
this.disenioCubierta.formValidation.validate();
break;
@ -666,6 +674,11 @@ class PresupuestoCliente {
#prevtStep() {
if (this.validationStepper._currentIndex >= 1 && this.validationStepper._currentIndex <= 4) {
if(this.validationStepper._currentIndex == 2){
if (this.disenioCubierta.acabadoCubierta.getVal() == 0) {
alertWarningMessage(window.translations.cubiertaSinAcabado, window.translations.cubiertaSinAcabadoText);
}
}
this.validationStepper.previous();
}
$('html, body').animate({ scrollTop: 0 }, 'slow');