botones albaran finalizado

This commit is contained in:
2025-04-22 00:50:31 +02:00
parent fc1b69f2fe
commit 2050f0ae1e
8 changed files with 375 additions and 178 deletions

View File

@ -471,6 +471,83 @@ class AlbaranComponent {
}
});
});
$('#add_iva_albaran_' + this.id).on('click', (e) => {
e.preventDefault();
const albaranId = this.id;
const url = `/albaranes/addIvaAlbaran`;
const data = { albaranId: albaranId };
$.ajax({
url: url,
type: 'POST',
data: data,
success: (response) => {
if (response.success) {
this.table.ajax.reload(null, false);
} else {
Swal.fire({
title: 'Error',
text: 'No se ha podido añadir el IVA al albarán',
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
}
},
error: (xhr, status, error) => {
console.error(error);
}
});
});
$('#nueva_linea_albaran_' + this.id).on('click', (e) => {
e.preventDefault();
const albaranId = this.id;
const url = `/albaranes/nuevaLineaAlbaran`;
const data = { albaranId: albaranId };
$.ajax({
url: url,
type: 'POST',
data: data,
success: (response) => {
if (response.success) {
this.table.ajax.reload(null, false);
} else {
Swal.fire({
title: 'Error',
text: 'No se ha podido añadir la línea al albarán',
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
}
},
error: (xhr, status, error) => {
console.error(error);
}
});
});
$('#imprimir_albaran_' + this.id).on('click', (e) => {
var albaran_id = this.id;
window.open('/print-albaran/generar/'+ albaran_id , '_blank');
});
}
_initAutoNumericInputs() {