mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminada funcionalidad reimpresion presupuestos
This commit is contained in:
@ -180,6 +180,7 @@ class PresupuestoAdminEdit {
|
||||
this.fileUploadDropzone.init()
|
||||
}
|
||||
|
||||
$('#reprint').on('click', this.reprintPresupuesto.bind(this));
|
||||
}
|
||||
|
||||
|
||||
@ -401,12 +402,12 @@ class PresupuestoAdminEdit {
|
||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||
self.POD.val(response.data.POD);
|
||||
|
||||
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||
response.data.total_aceptado_revisado : response.data.resumen.total_aceptado;
|
||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
||||
|
||||
|
||||
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
||||
|
||||
|
||||
$('#created_by').html(response.data.created_by);
|
||||
$('#updated_by').html(response.data.updated_by);
|
||||
$('#created_at').html(response.data.created_at);
|
||||
@ -677,6 +678,66 @@ class PresupuestoAdminEdit {
|
||||
})
|
||||
}
|
||||
|
||||
reprintPresupuesto() {
|
||||
|
||||
const id = window.location.href.split("/").pop();
|
||||
new Ajax('/presupuestoadmin/hasFiles',
|
||||
{ id: id }, {},
|
||||
function (response) {
|
||||
if (response.status === 'success') {
|
||||
if (response.hasFiles) {
|
||||
|
||||
Swal.fire({
|
||||
title: 'El presupuesto tiene archivos adjuntos',
|
||||
text: '¿Desea incluir los mismos ficheros en el nuevo presupuesto?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger me-1',
|
||||
cancelButton: 'btn btn-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
}).then((result) => {
|
||||
new Ajax('/presupuestoadmin/reprint',
|
||||
{ id: id, duplicateFiles: result.isConfirmed?1:0 }, {},
|
||||
function (response) {
|
||||
if (response.success === true) {
|
||||
Swal.fire({
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
window.open('/presupuestoadmin/edit/' + response.id, '_blank');
|
||||
} else {
|
||||
popErrorAlert(response.mensaje);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
popErrorAlert(error);
|
||||
}
|
||||
).post();
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
popErrorAlert(response.mensaje);
|
||||
}
|
||||
$('#loader').modal('hide');
|
||||
},
|
||||
function (error) {
|
||||
console.error(error);
|
||||
$('#loader').modal('hide');
|
||||
}
|
||||
).get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
@ -704,4 +765,5 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
console.log("Error getting translations:", error);
|
||||
}
|
||||
).post();
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user