Skip to content

feat: Crear expediente - Datos Generales #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export interface DatosGenerales {
name: string;
numero: string;
titulo: string;
clase: string;
tipo: string;
unidad: string;
responsable: string;
}

export interface PresupuestoBase {
Expand All @@ -18,7 +23,12 @@ export interface Expediente {

export const createEmptyExpedienteFormData = (): Expediente => ({
datosGenerales: {
name: '',
numero: '',
titulo: '',
clase: '',
tipo: '',
unidad: '',
responsable: '',
},
presupuestoBase: {
amount: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Form, Formik } from 'formik';
import { TextFieldForm } from '#common/components';
import { SelectForm, TextFieldForm } from '#common/components';
import { DatosGenerales, useCreateExpedienteContext } from '#modules/expedientes/core/providers';
import { datosGeneralesValidations } from '../validations';
import { StepNavigation } from '../step-navigation.component';
Expand All @@ -11,6 +11,7 @@ export const DatosGeneralesStep: React.FC = () => {

const handleSubmit = (values: DatosGenerales) => {
onNextStep('datosGenerales', values);
console.log(values);
};

return (
Expand All @@ -22,7 +23,43 @@ export const DatosGeneralesStep: React.FC = () => {
>
{() => (
<Form className={classes.form}>
<TextFieldForm name="name" label="Nombre" />
<div className={classes.row}>
<TextFieldForm name="numero" label="Número de expediente" required />
</div>
<div className={classes.row}>
<TextFieldForm name="titulo" label="Título de expediente" className={classes.fullRow} />
</div>
<div className={classes.row}>
<SelectForm
name="clase"
label="Clase"
options={[{ id: 'test', nombre: 'test' }]}
className={classes.halfLeft}
required
/>
<SelectForm
name="tipo"
label="Tipo"
options={[{ id: 'test', nombre: 'test' }]}
className={classes.halfRight}
required
/>
</div>
<div className={classes.row}>
<SelectForm
name="unidad"
label="Unidad Proponente"
options={[{ id: 'test', nombre: 'test' }]}
className={classes.halfLeft}
required
/>
<SelectForm
name="responsable"
label="Responsable"
options={[{ id: 'test', nombre: 'test' }]}
className={classes.halfRight}
/>
</div>
<StepNavigation />
</Form>
)}
Expand Down
27 changes: 27 additions & 0 deletions src/modules/expedientes/crear/components/steps/steps.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,30 @@ export const selectForm = css`
width: 10rem;
margin: 0;
`;

export const row = css`
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 16px;

@media (max-width: 768px) {
grid-template-columns: 1fr;
}
`;

export const fullRow = css`
grid-column: 1 / -1;
`;

export const halfLeft = css`
grid-column: 1 / 3;
`;

export const halfRight = css`
grid-column: 3 / -1;

@media (max-width: 768px) {
grid-column: 1 / 3;
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { createFormikValidation } from '@lemoncode/fonk-formik';

const validationSchema = {
field: {
name: [Validators.required],
numero: [Validators.required],
clase: [Validators.required],
tipo: [Validators.required],
unidad: [Validators.required],
},
};

Expand Down