hecho skeleton de la interfaz

This commit is contained in:
fede committed 2026-06-18 02:58:55 -03:00
1 parent df2412f29a
commit 6c0e44cb45
2 files changed
+68 -6

No files matched your search

+11 -1
View File
@@ -13,10 +13,13 @@
TableRow TableRow
} from 'carbon-components-svelte'; } from 'carbon-components-svelte';
import { Add, Edit, TrashCan } from 'carbon-icons-svelte'; import { Add, Edit, TrashCan } from 'carbon-icons-svelte';
import CrearRepuestoForm from './CrearRepuestoForm.svelte';
let error = $state(''); let error = $state('');
let loading = $state(''); let loading = $state('');
let openCrear = $state(false);
const headers = [ const headers = [
{ key: 'id', value: 'ID' }, { key: 'id', value: 'ID' },
{ key: 'nombre', value: 'Nombre' }, { key: 'nombre', value: 'Nombre' },
@@ -31,7 +34,7 @@
<div class="flex justify-between"> <div class="flex justify-between">
<h1 class="page-title">Gestión de Repuestos</h1> <h1 class="page-title">Gestión de Repuestos</h1>
<!-- onclick={abrirModalCrear} --> <!-- onclick={abrirModalCrear} -->
<Button icon={Add}>Registrar Nuevo Repuesto</Button> <Button icon={Add} onclick={() => (openCrear = true)}>Registrar Nuevo Repuesto</Button>
</div> </div>
{#if error} {#if error}
@@ -69,3 +72,10 @@
</TableContainer> </TableContainer>
{/if} {/if}
</div> </div>
<CrearRepuestoForm
bind:open={openCrear}
onClose={() => {
openCrear = false;
}}
></CrearRepuestoForm>
@@ -1,9 +1,32 @@
<script> <script>
import { Modal } from 'carbon-components-svelte'; import { Button, Modal, NumberInput, TextInput } from 'carbon-components-svelte';
import { Add, CPlusPlus } from 'carbon-icons-svelte';
let { show } = $props(); let { open = $bindable(), onClose } = $props();
let error = $state(''); let error = $state('');
let repuesto = $state({
nombre: '',
descripcion: '',
marca: '',
aliases: [],
precio: 0,
stockMinimo: 0
});
function handleClose() {
reset();
onClose();
}
function reset() {
repuesto = {
nombre: '',
descripcion: '',
marca: '',
aliases: [],
precio: 0,
stockMinimo: 0
};
}
</script> </script>
<form <form
@@ -14,7 +37,8 @@
> >
<Modal <Modal
formId="crearRepuestoForm" formId="crearRepuestoForm"
bind:open={show} bind:open
size={'lg'}
modalHeading="Registrar Repuesto" modalHeading="Registrar Repuesto"
primaryButtonText="Registrar" primaryButtonText="Registrar"
secondaryButtonText="Cerrar" secondaryButtonText="Cerrar"
@@ -23,7 +47,35 @@
{#if error} {#if error}
<div class="error-msg">{error}</div> <div class="error-msg">{error}</div>
{/if} {/if}
<TextInput name="nombre" type="text" labelText="Nombre: " bind:value={usuario.name} /> <TextInput name="nombre" type="text" labelText="Nombre: " bind:value={repuesto.nombre} />
<TextInput name="email" type="text" labelText="Email" bind:value={usuario.email} /> <TextInput
name="descripcion"
type="text"
labelText="Descripcion: "
bind:value={repuesto.descripcion}
/>
<TextInput name="marca" type="text" labelText="Marca: " bind:value={repuesto.marca} />
<NumberInput name="precio" labelText="Precio: " bind:value={repuesto.precio} />
<NumberInput
name="stockMinimo"
labelText="Stock Minimo (es para los avisos): "
bind:value={repuesto.stockMinimo}
/>
<div class="my-2! flex justify-between">
<h5>Aliases</h5>
<Button
size="small"
icon={Add}
onclick={() => {
repuesto.aliases.push('');
}}>Añadir Alias</Button
>
</div>
<div class="flex flex-col gap-2">
{#each repuesto.aliases as _, index}
<TextInput name={`alias-${index}`} bind:value={repuesto.aliases[index]} />
{/each}
</div>
</Modal> </Modal>
</form> </form>