Private
Public Access
feat: exportar logs a csv desde la interfaz del usuario
This commit is contained in:
1 parent
6d123ea01d
commit
605d2e763f
4 files changed
+52
-11
No files matched your search
@@ -20,3 +20,7 @@ AGENTS.md
|
||||
.idea
|
||||
|
||||
*.log
|
||||
|
||||
.opencode
|
||||
|
||||
bun.lock
|
||||
@@ -2,6 +2,13 @@ export class ExportarLogs {
|
||||
#data;
|
||||
|
||||
constructor(logs) {
|
||||
logs.forEach((x) => {
|
||||
x.detalles.forEach((y) => {
|
||||
if (typeof y.valorAnterior == 'undefined') {
|
||||
y.valorAnterior = '.';
|
||||
}
|
||||
});
|
||||
});
|
||||
this.#data = this.#extraerInfo(logs);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
TableHeader,
|
||||
TableRow
|
||||
} from 'carbon-components-svelte';
|
||||
import { Add, Edit, Information, TrashCan } from 'carbon-icons-svelte';
|
||||
import { ArrowUp, Add, Edit, Information, TrashCan } from 'carbon-icons-svelte';
|
||||
import CrearRepuestoForm from './CrearRepuestoForm.svelte';
|
||||
import EliminarRepuestoForm from './EliminarRepuestoForm.svelte';
|
||||
import AltaRepuestoForm from './AltaRepuestoForm.svelte';
|
||||
import ModalStructured from '$lib/components/ModalStructured.svelte';
|
||||
import EditarRepuestoForm from './EditarRepuestoForm.svelte';
|
||||
|
||||
@@ -26,10 +27,12 @@
|
||||
let openCrear = $state(false);
|
||||
let openEliminar = $state(false);
|
||||
let openInfo = $state(false);
|
||||
let openAlta = $state(false);
|
||||
let openEditar = $state(false);
|
||||
|
||||
let repuestoEliminar = $state({ id: 0 });
|
||||
let repuestoEditar = $state({ id: 0 });
|
||||
let repuestoAlta = $state({ id: 0 });
|
||||
let repuestoInfo = $state();
|
||||
|
||||
$effect(() => {
|
||||
@@ -43,7 +46,8 @@
|
||||
{ key: 'nombre', value: 'Nombre' },
|
||||
{ key: 'descripcion', value: 'Descripción' },
|
||||
{ key: 'precio', value: 'Precio' },
|
||||
{ key: 'marcaId', value: 'Marca' }
|
||||
{ key: 'marcaId', value: 'Marca' },
|
||||
{ key: 'deleted_at', value: 'Estado' }
|
||||
];
|
||||
</script>
|
||||
|
||||
@@ -101,15 +105,27 @@
|
||||
size="small"
|
||||
icon={Information}>Ver registro</Button
|
||||
>
|
||||
<Button
|
||||
onclick={() => {
|
||||
repuestoEliminar = p;
|
||||
openEliminar = true;
|
||||
}}
|
||||
kind="ghost"
|
||||
size="small"
|
||||
icon={TrashCan}>Eliminar</Button
|
||||
>
|
||||
{#if p.deleted_at == '✔'}
|
||||
<Button
|
||||
onclick={() => {
|
||||
repuestoEliminar = p;
|
||||
openEliminar = true;
|
||||
}}
|
||||
kind="ghost"
|
||||
size="small"
|
||||
icon={TrashCan}>Eliminar</Button
|
||||
>
|
||||
{:else}
|
||||
<Button
|
||||
onclick={() => {
|
||||
repuestoAlta = p;
|
||||
openAlta = true;
|
||||
}}
|
||||
kind="ghost"
|
||||
size="small"
|
||||
icon={ArrowUp}>Alta</Button
|
||||
>
|
||||
{/if}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
@@ -136,6 +152,15 @@
|
||||
repuesto={repuestoEliminar}
|
||||
></EliminarRepuestoForm>
|
||||
|
||||
<AltaRepuestoForm
|
||||
bind:show={openAlta}
|
||||
onclose={() => {
|
||||
openAlta = false;
|
||||
repuestoAlta = { id: 0 };
|
||||
}}
|
||||
repuesto={repuestoAlta}
|
||||
></AltaRepuestoForm>
|
||||
|
||||
<EditarRepuestoForm
|
||||
bind:open={openEditar}
|
||||
onClose={() => {
|
||||
|
||||
@@ -8,6 +8,11 @@ export async function load({ fetch, depends }) {
|
||||
let error = '';
|
||||
if (typeof repuestos === 'string') {
|
||||
error = repuestos;
|
||||
} else {
|
||||
if (typeof repuestos[0].deleted_at !== 'undefined')
|
||||
repuestos.forEach((x) => {
|
||||
x.deleted_at = x.deleted_at ? '✗' : '✔';
|
||||
});
|
||||
}
|
||||
return {
|
||||
repuestos: repuestos,
|
||||
|
||||
Reference in new issue
Block a user