|
@@ -43,6 +43,7 @@ function Manual(props) {
|
|
|
aredepto: Yup.number().required('Escoge alguna área'),
|
|
aredepto: Yup.number().required('Escoge alguna área'),
|
|
|
fecha: Yup.date("Ingresa una fecha válida"),
|
|
fecha: Yup.date("Ingresa una fecha válida"),
|
|
|
notas: Yup.string("Ingresa una nota válida").min(5, "Ingresa una nota válida").max(150),
|
|
notas: Yup.string("Ingresa una nota válida").min(5, "Ingresa una nota válida").max(150),
|
|
|
|
|
+ pruebas: Yup.array()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const [departamento, setDepartamento] = React.useState('');
|
|
const [departamento, setDepartamento] = React.useState('');
|
|
@@ -72,6 +73,7 @@ function Manual(props) {
|
|
|
aredepto: 1,
|
|
aredepto: 1,
|
|
|
fecha: date,
|
|
fecha: date,
|
|
|
notas: "",
|
|
notas: "",
|
|
|
|
|
+ pruebas:[]
|
|
|
},
|
|
},
|
|
|
onSubmit: (fields, { resetForm }) => {
|
|
onSubmit: (fields, { resetForm }) => {
|
|
|
|
|
|
|
@@ -100,8 +102,20 @@ function Manual(props) {
|
|
|
const changeTab = (_event, newValue) => {
|
|
const changeTab = (_event, newValue) => {
|
|
|
setTab(newValue);
|
|
setTab(newValue);
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
- const { errors, touched, handleSubmit, getFieldProps } = formik;
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ const { errors, touched, handleSubmit, getFieldProps, values, setValues } = formik;
|
|
|
|
|
+
|
|
|
|
|
+ const addPrueba = (check,id) => {
|
|
|
|
|
+ let { pruebas } = values
|
|
|
|
|
+ let temp ;
|
|
|
|
|
+ if(check){
|
|
|
|
|
+ temp = [...pruebas, {id}]
|
|
|
|
|
+ }else{
|
|
|
|
|
+ temp = pruebas.filter((test) => test.id !== id);
|
|
|
|
|
+ }
|
|
|
|
|
+ setValues({...values, pruebas: temp})
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
|
|
|
|
@@ -109,7 +123,7 @@ function Manual(props) {
|
|
|
|
|
|
|
|
<Modal.Header>
|
|
<Modal.Header>
|
|
|
<button onClick={onClose} type="button" className="close" data-dismiss="modal">×</button>
|
|
<button onClick={onClose} type="button" className="close" data-dismiss="modal">×</button>
|
|
|
- <h4 className="modal-title" style={{ color: '#252525' }}>Agregar plaza</h4>
|
|
|
|
|
|
|
+ <h4 className="modal-title" style={{ color: '#252525' }}>Agregar Puesto</h4>
|
|
|
</Modal.Header>
|
|
</Modal.Header>
|
|
|
<Modal.Body className="modal-body">
|
|
<Modal.Body className="modal-body">
|
|
|
|
|
|
|
@@ -118,8 +132,6 @@ function Manual(props) {
|
|
|
<Tab label="Pruebas" />
|
|
<Tab label="Pruebas" />
|
|
|
</Tabs>
|
|
</Tabs>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
<FormikProvider style={{ paddingTop: 25 }} value={formik}>
|
|
<FormikProvider style={{ paddingTop: 25 }} value={formik}>
|
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
|
|
|
|
|
@@ -133,7 +145,15 @@ function Manual(props) {
|
|
|
{
|
|
{
|
|
|
tests ?
|
|
tests ?
|
|
|
tests.data.map( test => (
|
|
tests.data.map( test => (
|
|
|
- <FormControlLabel control={<Checkbox defaultChecked />} label={test.nombre} />
|
|
|
|
|
|
|
+ <FormControlLabel
|
|
|
|
|
+ key={test.id}
|
|
|
|
|
+ control={
|
|
|
|
|
+ <Checkbox
|
|
|
|
|
+ onChange={(event)=> addPrueba(event.target.checked,test.id)}
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
|
|
+ label={test.nombre}
|
|
|
|
|
+ />
|
|
|
)): null
|
|
)): null
|
|
|
}
|
|
}
|
|
|
</FormGroup>
|
|
</FormGroup>
|