|
@@ -17,30 +17,35 @@ export function Password(props) {
|
17
|
17
|
pwd:
|
18
|
18
|
Yup
|
19
|
19
|
.string()
|
20
|
|
- .required('Ingresa un nivel educativo válido')
|
|
20
|
+ .required('Ingresa un identificador válido')
|
21
|
21
|
.min(5,"Ingresa un identificador válido")
|
22
|
22
|
.max(50,"identificador demasiado largo"),
|
23
|
|
- fecha_start: Yup.date("Ingresa una fecha válida"),
|
24
|
|
- fecha_end: Yup.date("Ingresa una fecha válida"),
|
|
23
|
+ deadpwd: Yup.date("Ingresa una fecha válida"),
|
|
24
|
+ dateToActived: Yup.date("Ingresa una fecha válida"),
|
25
|
25
|
});
|
26
|
26
|
|
27
|
27
|
let { handleNext, handleBack, password, setPassword } = props
|
28
|
|
- console.log(password, setPassword)
|
29
|
28
|
|
30
|
29
|
const formik = useFormik({
|
31
|
30
|
initialValues: {
|
32
|
|
- pwd: "",
|
33
|
|
- fecha_start: new Date(),
|
34
|
|
- fecha_end: new Date(),
|
|
31
|
+ pwd: password.pwd ,
|
|
32
|
+ deadpwd: password.deadpwd,
|
|
33
|
+ dateToActived: password.dateToActived,
|
35
|
34
|
},
|
36
|
35
|
onSubmit: (fields) => {
|
37
|
|
- console.log(fields)
|
|
36
|
+ console.log('PASS::::',fields)
|
|
37
|
+ fields['deadpwd'] = new Date(fields.deadpwd).toISOString();
|
|
38
|
+ fields['dateToActived'] = new Date(fields.dateToActived).toISOString();
|
|
39
|
+ setPassword({
|
|
40
|
+ ...password,
|
|
41
|
+ ...fields
|
|
42
|
+ })
|
38
|
43
|
handleNext()
|
39
|
44
|
},
|
40
|
45
|
validationSchema: PasswordSchema,
|
41
|
46
|
});
|
42
|
47
|
|
43
|
|
- const {errors, touched, handleSubmit, getFieldProps } = formik;
|
|
48
|
+ const {errors, touched, handleSubmit, getFieldProps, values,setValues } = formik;
|
44
|
49
|
|
45
|
50
|
return (
|
46
|
51
|
<FormikProvider style={{ padding : 25, paddingTop : 5 }} value={formik}>
|
|
@@ -64,11 +69,14 @@ export function Password(props) {
|
64
|
69
|
label="Fecha de Activación"
|
65
|
70
|
fullWidth
|
66
|
71
|
inputFormat="dd/MM/yyyy"
|
67
|
|
- {...getFieldProps('fecha_start')}
|
68
|
|
- value={new Date()}
|
69
|
|
- onChange={() => console.log('fecha creacion')}
|
|
72
|
+ {...getFieldProps('dateToActived')}
|
|
73
|
+ value={values.dateToActived}
|
|
74
|
+ onChange={(val) => setValues({ ...values, dateToActived: new Date(val) })
|
|
75
|
+ }
|
70
|
76
|
renderInput={(params) =>
|
71
|
77
|
<TextField
|
|
78
|
+ error={Boolean(touched.dateToActived && errors.dateToActived)}
|
|
79
|
+ helperText={touched.dateToActived && errors.dateToActived}
|
72
|
80
|
disabled={true}
|
73
|
81
|
label="Fecha de Activación"
|
74
|
82
|
fullWidth
|
|
@@ -80,19 +88,21 @@ export function Password(props) {
|
80
|
88
|
<LocalizationProvider
|
81
|
89
|
dateAdapter={DateFnsUtils}>
|
82
|
90
|
<DesktopDatePicker
|
83
|
|
- label="Fecha de caducidad"
|
|
91
|
+ label="Fecha de Caducidad"
|
84
|
92
|
fullWidth
|
85
|
93
|
inputFormat="dd/MM/yyyy"
|
86
|
|
- {...getFieldProps('fecha_end')}
|
87
|
|
- value={new Date()}
|
88
|
|
- onChange={() => console.log('fecha creacion')}
|
|
94
|
+ {...getFieldProps('deadpwd')}
|
|
95
|
+ value={values.deadpwd}
|
|
96
|
+ onChange={(val) => setValues({ ...values, deadpwd: new Date(val) }) }
|
89
|
97
|
renderInput={(params) =>
|
90
|
98
|
<TextField
|
|
99
|
+ error={Boolean(touched.deadpwd && errors.deadpwd)}
|
|
100
|
+ helperText={touched.deadpwd && errors.deadpwd}
|
91
|
101
|
disabled={true}
|
92
|
|
- label="Fecha de caducidad"
|
|
102
|
+ label="Fecha de Caducidad"
|
93
|
103
|
fullWidth
|
94
|
104
|
{...params}
|
95
|
|
- />}
|
|
105
|
+ />}
|
96
|
106
|
/>
|
97
|
107
|
</LocalizationProvider>
|
98
|
108
|
</Stack>
|