This commit is contained in:
2023-10-03 18:22:51 +00:00
parent 6f4ee51b55
commit c927cb02bb
22 changed files with 800 additions and 335 deletions

View File

@@ -15,6 +15,31 @@ const app = createApp({
});
const data = await res.json();
this.puestos.push(data);
// order by puesto.nombre
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
}
catch (error) {
alert(`Error: ${error}`);
}
},
to_delete: null,
async eliminarPuesto(puesto_id) {
try {
const res = await fetch('action/puesto.php', {
method: 'DELETE',
body: JSON.stringify({
puesto_id
})
});
const data = await res.json();
this.message = data.msg;
// after 3 seconds, remove the message
setTimeout(() => {
this.message = null;
}, 3000);
this.puestos = this.puestos.filter((p) => p.puesto_id !== puesto_id);
// order by puesto.nombre
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
}
catch (error) {
alert(`Error: ${error}`);