|
@@ -43,6 +43,7 @@ function Manual(props) {
|
43
|
43
|
aredepto: Yup.number().required('Escoge alguna área'),
|
44
|
44
|
fecha: Yup.date("Ingresa una fecha válida"),
|
45
|
45
|
notas: Yup.string("Ingresa una nota válida").min(5, "Ingresa una nota válida").max(150),
|
|
46
|
+ pruebas: Yup.array()
|
46
|
47
|
})
|
47
|
48
|
|
48
|
49
|
const [departamento, setDepartamento] = React.useState('');
|
|
@@ -72,6 +73,7 @@ function Manual(props) {
|
72
|
73
|
aredepto: 1,
|
73
|
74
|
fecha: date,
|
74
|
75
|
notas: "",
|
|
76
|
+ pruebas:[]
|
75
|
77
|
},
|
76
|
78
|
onSubmit: (fields, { resetForm }) => {
|
77
|
79
|
|
|
@@ -100,8 +102,20 @@ function Manual(props) {
|
100
|
102
|
const changeTab = (_event, newValue) => {
|
101
|
103
|
setTab(newValue);
|
102
|
104
|
};
|
103
|
|
-
|
104
|
|
- const { errors, touched, handleSubmit, getFieldProps } = formik;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+ const { errors, touched, handleSubmit, getFieldProps, values, setValues } = formik;
|
|
108
|
+
|
|
109
|
+ const addPrueba = (check,id) => {
|
|
110
|
+ let { pruebas } = values
|
|
111
|
+ let temp ;
|
|
112
|
+ if(check){
|
|
113
|
+ temp = [...pruebas, {id}]
|
|
114
|
+ }else{
|
|
115
|
+ temp = pruebas.filter((test) => test.id !== id);
|
|
116
|
+ }
|
|
117
|
+ setValues({...values, pruebas: temp})
|
|
118
|
+ };
|
105
|
119
|
|
106
|
120
|
return (
|
107
|
121
|
|
|
@@ -109,7 +123,7 @@ function Manual(props) {
|
109
|
123
|
|
110
|
124
|
<Modal.Header>
|
111
|
125
|
<button onClick={onClose} type="button" className="close" data-dismiss="modal">×</button>
|
112
|
|
- <h4 className="modal-title" style={{ color: '#252525' }}>Agregar plaza</h4>
|
|
126
|
+ <h4 className="modal-title" style={{ color: '#252525' }}>Agregar Puesto</h4>
|
113
|
127
|
</Modal.Header>
|
114
|
128
|
<Modal.Body className="modal-body">
|
115
|
129
|
|
|
@@ -118,8 +132,6 @@ function Manual(props) {
|
118
|
132
|
<Tab label="Pruebas" />
|
119
|
133
|
</Tabs>
|
120
|
134
|
|
121
|
|
-
|
122
|
|
-
|
123
|
135
|
<FormikProvider style={{ paddingTop: 25 }} value={formik}>
|
124
|
136
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
125
|
137
|
|
|
@@ -133,7 +145,15 @@ function Manual(props) {
|
133
|
145
|
{
|
134
|
146
|
tests ?
|
135
|
147
|
tests.data.map( test => (
|
136
|
|
- <FormControlLabel control={<Checkbox defaultChecked />} label={test.nombre} />
|
|
148
|
+ <FormControlLabel
|
|
149
|
+ key={test.id}
|
|
150
|
+ control={
|
|
151
|
+ <Checkbox
|
|
152
|
+ onChange={(event)=> addPrueba(event.target.checked,test.id)}
|
|
153
|
+ />
|
|
154
|
+ }
|
|
155
|
+ label={test.nombre}
|
|
156
|
+ />
|
137
|
157
|
)): null
|
138
|
158
|
}
|
139
|
159
|
</FormGroup>
|