mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-02-28 21:59:13 +00:00
hehco
This commit is contained in:
@ -318,6 +318,50 @@ export default class PresupuestoWizard {
|
||||
document.body.removeChild(a);
|
||||
});
|
||||
|
||||
$(document)
|
||||
.off('click.login-required', '.btn-login-required')
|
||||
.on('click.login-required', '.btn-login-required', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const rawId = this.opts.presupuestoId || window.PRESUPUESTO_ID || $('#presupuesto_id').val();
|
||||
const presupuestoId = rawId ? parseInt(rawId, 10) : null;
|
||||
|
||||
if (!presupuestoId || Number.isNaN(presupuestoId)) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'No se encontró el presupuesto',
|
||||
text: 'Vuelve a generar el resumen e inténtalo de nuevo.',
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-secondary me-2',
|
||||
cancelButton: 'btn btn-light'
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await $.ajax({
|
||||
url: '/presupuesto/public/prepare-claim',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ presupuestoId })
|
||||
});
|
||||
window.location.assign('/presupuesto/claim');
|
||||
} catch (err) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'No se pudo continuar',
|
||||
text: 'Inténtalo de nuevo en unos segundos.',
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-secondary me-2',
|
||||
cancelButton: 'btn btn-light'
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user