|
@@ -4,10 +4,18 @@ import * as Yup from 'yup';
|
4
|
4
|
import { useFormik, Form, FormikProvider } from 'formik';
|
5
|
5
|
|
6
|
6
|
import {
|
7
|
|
- Box, Button, Stack,
|
8
|
|
- TextField, Autocomplete
|
|
7
|
+ Box, Button, Stack, Checkbox,
|
|
8
|
+ TextField, Autocomplete,
|
9
|
9
|
} from '@mui/material';
|
10
|
10
|
|
|
11
|
+import {
|
|
12
|
+ CheckBox as CheckBoxIcon,
|
|
13
|
+ CheckBoxOutlineBlank as CheckBoxOutlineBlankIcon
|
|
14
|
+} from '@mui/icons-material';
|
|
15
|
+
|
|
16
|
+const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
|
|
17
|
+const checkedIcon = <CheckBoxIcon fontSize="small" />;
|
|
18
|
+
|
11
|
19
|
export function StepTwo(props) {
|
12
|
20
|
|
13
|
21
|
const PlazaScheme = Yup.object().shape({
|
|
@@ -15,12 +23,10 @@ export function StepTwo(props) {
|
15
|
23
|
});
|
16
|
24
|
|
17
|
25
|
let { handleNext, handleBack } = props
|
18
|
|
- const [value, setValue] = React.useState(top100Films[0]);
|
19
|
|
- const [inputValue, setInputValue] = React.useState('');
|
20
|
26
|
|
21
|
27
|
const formik = useFormik({
|
22
|
28
|
initialValues: {
|
23
|
|
- puesto: {},
|
|
29
|
+ puesto: {}
|
24
|
30
|
},
|
25
|
31
|
onSubmit: (fields) => {
|
26
|
32
|
console.log('SUBMIT > ',fields)
|
|
@@ -29,7 +35,7 @@ export function StepTwo(props) {
|
29
|
35
|
validationSchema: PlazaScheme,
|
30
|
36
|
});
|
31
|
37
|
|
32
|
|
- const {errors, touched, handleSubmit, getFieldProps } = formik;
|
|
38
|
+ const {errors, touched, handleSubmit, getFieldProps, setValues } = formik;
|
33
|
39
|
|
34
|
40
|
return (
|
35
|
41
|
<FormikProvider style={{ padding : 25 }} value={formik}>
|
|
@@ -38,36 +44,36 @@ export function StepTwo(props) {
|
38
|
44
|
|
39
|
45
|
<Autocomplete
|
40
|
46
|
multiple
|
41
|
|
- autoSelect={true}
|
42
|
|
- id="tags-standard"
|
|
47
|
+ id="checkboxes-tags-demo"
|
43
|
48
|
options={top100Films}
|
|
49
|
+ disableCloseOnSelect
|
44
|
50
|
getOptionLabel={(option) => option.label}
|
45
|
|
- onChange={(event, newValue) => {
|
46
|
|
- console.log('NEW VAL', newValue[0])
|
47
|
|
- setValue(newValue[0]);
|
|
51
|
+ onChange={(a,b,c) => {
|
|
52
|
+ setValues({
|
|
53
|
+ puesto : b[0]
|
|
54
|
+ })
|
48
|
55
|
}}
|
49
|
|
- inputValue={inputValue}
|
50
|
|
- onInputChange={(event, newInputValue) => {
|
51
|
|
- console.log('NEW', newInputValue)
|
52
|
|
- setInputValue(newInputValue);
|
53
|
|
- }}
|
54
|
|
-
|
55
|
|
-
|
|
56
|
+ renderOption={(props, option, { selected }) => (
|
|
57
|
+ <li {...props}>
|
|
58
|
+ <Checkbox
|
|
59
|
+ icon={icon}
|
|
60
|
+ checkedIcon={checkedIcon}
|
|
61
|
+ // style={{ marginRight: 8 }}
|
|
62
|
+ checked={selected}
|
|
63
|
+ />
|
|
64
|
+ {option.label}
|
|
65
|
+ </li>
|
|
66
|
+ )}
|
56
|
67
|
renderInput={(params) => (
|
57
|
|
- <TextField
|
|
68
|
+ <TextField
|
58
|
69
|
{...getFieldProps('puesto')}
|
59
|
|
- {...params}
|
60
|
70
|
error={Boolean(touched.puesto && errors.puesto)}
|
61
|
71
|
helperText={touched.puesto && errors.puesto}
|
62
|
|
- variant="standard"
|
63
|
|
- label="Buscar Plaza"
|
64
|
|
- placeholder="Favorites"
|
65
|
|
- fullWidth
|
66
|
|
-
|
|
72
|
+ {...params}
|
|
73
|
+ label="Checkboxes" placeholder="Favorites"
|
67
|
74
|
/>
|
68
|
75
|
)}
|
69
|
|
- />
|
70
|
|
-
|
|
76
|
+ />
|
71
|
77
|
|
72
|
78
|
<Box sx={{ mb: 2 }}>
|
73
|
79
|
<div style={{ paddingTop : 15}}>
|