Private
Public Access
hecho skeleton de la interfaz
This commit is contained in:
1 parent
df2412f29a
commit
6c0e44cb45
2 files changed
+68
-6
No files matched your search
@@ -13,10 +13,13 @@
|
||||
TableRow
|
||||
} from 'carbon-components-svelte';
|
||||
import { Add, Edit, TrashCan } from 'carbon-icons-svelte';
|
||||
import CrearRepuestoForm from './CrearRepuestoForm.svelte';
|
||||
|
||||
let error = $state('');
|
||||
let loading = $state('');
|
||||
|
||||
let openCrear = $state(false);
|
||||
|
||||
const headers = [
|
||||
{ key: 'id', value: 'ID' },
|
||||
{ key: 'nombre', value: 'Nombre' },
|
||||
@@ -31,7 +34,7 @@
|
||||
<div class="flex justify-between">
|
||||
<h1 class="page-title">Gestión de Repuestos</h1>
|
||||
<!-- onclick={abrirModalCrear} -->
|
||||
<Button icon={Add}>Registrar Nuevo Repuesto</Button>
|
||||
<Button icon={Add} onclick={() => (openCrear = true)}>Registrar Nuevo Repuesto</Button>
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
@@ -69,3 +72,10 @@
|
||||
</TableContainer>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<CrearRepuestoForm
|
||||
bind:open={openCrear}
|
||||
onClose={() => {
|
||||
openCrear = false;
|
||||
}}
|
||||
></CrearRepuestoForm>
|
||||
@@ -1,9 +1,32 @@
|
||||
<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 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>
|
||||
|
||||
<form
|
||||
@@ -14,7 +37,8 @@
|
||||
>
|
||||
<Modal
|
||||
formId="crearRepuestoForm"
|
||||
bind:open={show}
|
||||
bind:open
|
||||
size={'lg'}
|
||||
modalHeading="Registrar Repuesto"
|
||||
primaryButtonText="Registrar"
|
||||
secondaryButtonText="Cerrar"
|
||||
@@ -23,7 +47,35 @@
|
||||
{#if error}
|
||||
<div class="error-msg">{error}</div>
|
||||
{/if}
|
||||
<TextInput name="nombre" type="text" labelText="Nombre: " bind:value={usuario.name} />
|
||||
<TextInput name="email" type="text" labelText="Email" bind:value={usuario.email} />
|
||||
<TextInput name="nombre" type="text" labelText="Nombre: " bind:value={repuesto.nombre} />
|
||||
<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>
|
||||
</form>
|
||||
Reference in new issue
Block a user