Private
Public Access
falla
This commit is contained in:
1 parent
6c0e44cb45
commit
90e76d4963
11 files changed
+112
-38
No files matched your search
@@ -6,17 +6,9 @@ export const load: PageLoad = async ({ fetch }) => {
|
||||
let grupos: Grupo[] = [];
|
||||
let permisos: Permiso[] = [];
|
||||
|
||||
try {
|
||||
grupos = await obtenerGrupos(fetch);
|
||||
} catch {
|
||||
// token might not be available on server
|
||||
}
|
||||
grupos = await obtenerGrupos(fetch);
|
||||
|
||||
try {
|
||||
permisos = await obtenerPermisos(fetch);
|
||||
} catch {
|
||||
// token might not be available on server
|
||||
}
|
||||
permisos = await obtenerPermisos(fetch);
|
||||
|
||||
return { grupos, permisos };
|
||||
};
|
||||
@@ -18,8 +18,15 @@
|
||||
let error = $state('');
|
||||
let loading = $state('');
|
||||
|
||||
let { data } = $props();
|
||||
let openCrear = $state(false);
|
||||
|
||||
$effect(() => {
|
||||
if (data.error) {
|
||||
error = data.error;
|
||||
}
|
||||
});
|
||||
|
||||
const headers = [
|
||||
{ key: 'id', value: 'ID' },
|
||||
{ key: 'nombre', value: 'Nombre' },
|
||||
@@ -54,19 +61,21 @@
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{#each [{ id: 1 }] as p (p.id)}
|
||||
<TableRow>
|
||||
{#each headers as header}
|
||||
<TableCell>{String(p[header.key] ?? '-')}</TableCell>
|
||||
{/each}
|
||||
<TableCell class="acciones-cell">
|
||||
<!-- onclick={() => abrirModalEditar(p)} -->
|
||||
<Button kind="ghost" size="small" icon={Edit}>Editar</Button>
|
||||
<!-- onclick={() => abrirModalEliminar(p)} -->
|
||||
<Button kind="ghost" size="small" icon={TrashCan}>Eliminar</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
{#if typeof data.repuestos !== 'string'}
|
||||
{#each data.repuestos as p}
|
||||
<TableRow>
|
||||
{#each headers as header}
|
||||
<TableCell>{String(p[header.key] ?? '-')}</TableCell>
|
||||
{/each}
|
||||
<TableCell class="acciones-cell">
|
||||
<!-- onclick={() => abrirModalEditar(p)} -->
|
||||
<Button kind="ghost" size="small" icon={Edit}>Editar</Button>
|
||||
<!-- onclick={() => abrirModalEliminar(p)} -->
|
||||
<Button kind="ghost" size="small" icon={TrashCan}>Eliminar</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
{/if}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { obtenerRepuestos } from '$lib/hooks/repuestos/obtenerRepuestos';
|
||||
|
||||
export let ssr = false;
|
||||
export async function load({ fetch }) {
|
||||
const repuestos = await obtenerRepuestos(fetch);
|
||||
|
||||
let error = '';
|
||||
if (typeof repuestos === 'string') {
|
||||
error = repuestos;
|
||||
}
|
||||
return {
|
||||
repuestos: repuestos,
|
||||
error: error
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { Button, Modal, NumberInput, TextInput } from 'carbon-components-svelte';
|
||||
import { Add, CPlusPlus } from 'carbon-icons-svelte';
|
||||
import { Add } from 'carbon-icons-svelte';
|
||||
|
||||
let { open = $bindable(), onClose } = $props();
|
||||
|
||||
|
||||
Reference in new issue
Block a user