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
|
.idea
|
||||||
|
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
.opencode
|
||||||
|
|
||||||
|
bun.lock
|
||||||
@@ -2,6 +2,13 @@ export class ExportarLogs {
|
|||||||
#data;
|
#data;
|
||||||
|
|
||||||
constructor(logs) {
|
constructor(logs) {
|
||||||
|
logs.forEach((x) => {
|
||||||
|
x.detalles.forEach((y) => {
|
||||||
|
if (typeof y.valorAnterior == 'undefined') {
|
||||||
|
y.valorAnterior = '.';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
this.#data = this.#extraerInfo(logs);
|
this.#data = this.#extraerInfo(logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
TableHeader,
|
TableHeader,
|
||||||
TableRow
|
TableRow
|
||||||
} from 'carbon-components-svelte';
|
} 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 CrearRepuestoForm from './CrearRepuestoForm.svelte';
|
||||||
import EliminarRepuestoForm from './EliminarRepuestoForm.svelte';
|
import EliminarRepuestoForm from './EliminarRepuestoForm.svelte';
|
||||||
|
import AltaRepuestoForm from './AltaRepuestoForm.svelte';
|
||||||
import ModalStructured from '$lib/components/ModalStructured.svelte';
|
import ModalStructured from '$lib/components/ModalStructured.svelte';
|
||||||
import EditarRepuestoForm from './EditarRepuestoForm.svelte';
|
import EditarRepuestoForm from './EditarRepuestoForm.svelte';
|
||||||
|
|
||||||
@@ -26,10 +27,12 @@
|
|||||||
let openCrear = $state(false);
|
let openCrear = $state(false);
|
||||||
let openEliminar = $state(false);
|
let openEliminar = $state(false);
|
||||||
let openInfo = $state(false);
|
let openInfo = $state(false);
|
||||||
|
let openAlta = $state(false);
|
||||||
let openEditar = $state(false);
|
let openEditar = $state(false);
|
||||||
|
|
||||||
let repuestoEliminar = $state({ id: 0 });
|
let repuestoEliminar = $state({ id: 0 });
|
||||||
let repuestoEditar = $state({ id: 0 });
|
let repuestoEditar = $state({ id: 0 });
|
||||||
|
let repuestoAlta = $state({ id: 0 });
|
||||||
let repuestoInfo = $state();
|
let repuestoInfo = $state();
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -43,7 +46,8 @@
|
|||||||
{ key: 'nombre', value: 'Nombre' },
|
{ key: 'nombre', value: 'Nombre' },
|
||||||
{ key: 'descripcion', value: 'Descripción' },
|
{ key: 'descripcion', value: 'Descripción' },
|
||||||
{ key: 'precio', value: 'Precio' },
|
{ key: 'precio', value: 'Precio' },
|
||||||
{ key: 'marcaId', value: 'Marca' }
|
{ key: 'marcaId', value: 'Marca' },
|
||||||
|
{ key: 'deleted_at', value: 'Estado' }
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -101,15 +105,27 @@
|
|||||||
size="small"
|
size="small"
|
||||||
icon={Information}>Ver registro</Button
|
icon={Information}>Ver registro</Button
|
||||||
>
|
>
|
||||||
<Button
|
{#if p.deleted_at == '✔'}
|
||||||
onclick={() => {
|
<Button
|
||||||
repuestoEliminar = p;
|
onclick={() => {
|
||||||
openEliminar = true;
|
repuestoEliminar = p;
|
||||||
}}
|
openEliminar = true;
|
||||||
kind="ghost"
|
}}
|
||||||
size="small"
|
kind="ghost"
|
||||||
icon={TrashCan}>Eliminar</Button
|
size="small"
|
||||||
>
|
icon={TrashCan}>Eliminar</Button
|
||||||
|
>
|
||||||
|
{:else}
|
||||||
|
<Button
|
||||||
|
onclick={() => {
|
||||||
|
repuestoAlta = p;
|
||||||
|
openAlta = true;
|
||||||
|
}}
|
||||||
|
kind="ghost"
|
||||||
|
size="small"
|
||||||
|
icon={ArrowUp}>Alta</Button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -136,6 +152,15 @@
|
|||||||
repuesto={repuestoEliminar}
|
repuesto={repuestoEliminar}
|
||||||
></EliminarRepuestoForm>
|
></EliminarRepuestoForm>
|
||||||
|
|
||||||
|
<AltaRepuestoForm
|
||||||
|
bind:show={openAlta}
|
||||||
|
onclose={() => {
|
||||||
|
openAlta = false;
|
||||||
|
repuestoAlta = { id: 0 };
|
||||||
|
}}
|
||||||
|
repuesto={repuestoAlta}
|
||||||
|
></AltaRepuestoForm>
|
||||||
|
|
||||||
<EditarRepuestoForm
|
<EditarRepuestoForm
|
||||||
bind:open={openEditar}
|
bind:open={openEditar}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ export async function load({ fetch, depends }) {
|
|||||||
let error = '';
|
let error = '';
|
||||||
if (typeof repuestos === 'string') {
|
if (typeof repuestos === 'string') {
|
||||||
error = repuestos;
|
error = repuestos;
|
||||||
|
} else {
|
||||||
|
if (typeof repuestos[0].deleted_at !== 'undefined')
|
||||||
|
repuestos.forEach((x) => {
|
||||||
|
x.deleted_at = x.deleted_at ? '✗' : '✔';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
repuestos: repuestos,
|
repuestos: repuestos,
|
||||||
|
|||||||
Reference in new issue
Block a user