Puestos UI
Some checks are pending
Deploy Pruebas / deploy (push) Waiting to run

This commit is contained in:
Your Name
2024-09-06 12:42:03 -06:00
parent 811b7d7369
commit bcdfd0fc0f
2 changed files with 32 additions and 0 deletions

View File

@@ -70,6 +70,34 @@ const app = createApp({
alert(`Error: ${error}`); alert(`Error: ${error}`);
} }
}, },
async descargar() {
store.current.modal_state = 'Generando reporte en Excel...';
$('div.modal#cargando').modal('show');
this.loading = true;
try {
const res = await fetch('action/action_puestos_excel.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
});
const blob = await res.blob();
window.saveAs(blob, `puestos_${new Date().toISOString().slice(0, 10)}.xlsx`);
}
catch (error) {
if (error.response && error.response.status === 413) {
alert('Your request is too large! Please reduce the data size and try again.');
}
else {
alert('An error occurred: ' + error.message);
}
}
finally {
$('#cargando').modal('hide');
this.loading = false;
}
},
async mounted() { async mounted() {
this.puestos = await fetch('action/puesto.php').then(res => res.json()); this.puestos = await fetch('action/puesto.php').then(res => res.json());
this.carreras = await fetch('action/action_carreras.php').then(res => res.json()); this.carreras = await fetch('action/action_carreras.php').then(res => res.json());

View File

@@ -47,6 +47,10 @@
<span class="ing-mas"></span> <span class="ing-mas"></span>
Agregar puesto Agregar puesto
</button> </button>
<button type="button" class="btn btn-success mx-2" @click="descargar()">
<span class="ing-descarga"></span>
Agregar Excel
</button>
</div> </div>
<? <?