|
|
@@ -17,30 +17,35 @@ export function Password(props) {
|
|
|
pwd:
|
|
|
Yup
|
|
|
.string()
|
|
|
- .required('Ingresa un nivel educativo válido')
|
|
|
+ .required('Ingresa un identificador válido')
|
|
|
.min(5,"Ingresa un identificador válido")
|
|
|
.max(50,"identificador demasiado largo"),
|
|
|
- fecha_start: Yup.date("Ingresa una fecha válida"),
|
|
|
- fecha_end: Yup.date("Ingresa una fecha válida"),
|
|
|
+ deadpwd: Yup.date("Ingresa una fecha válida"),
|
|
|
+ dateToActived: Yup.date("Ingresa una fecha válida"),
|
|
|
});
|
|
|
|
|
|
let { handleNext, handleBack, password, setPassword } = props
|
|
|
- console.log(password, setPassword)
|
|
|
|
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
|
- pwd: "",
|
|
|
- fecha_start: new Date(),
|
|
|
- fecha_end: new Date(),
|
|
|
+ pwd: password.pwd ,
|
|
|
+ deadpwd: password.deadpwd,
|
|
|
+ dateToActived: password.dateToActived,
|
|
|
},
|
|
|
onSubmit: (fields) => {
|
|
|
- console.log(fields)
|
|
|
+ console.log('PASS::::',fields)
|
|
|
+ fields['deadpwd'] = new Date(fields.deadpwd).toISOString();
|
|
|
+ fields['dateToActived'] = new Date(fields.dateToActived).toISOString();
|
|
|
+ setPassword({
|
|
|
+ ...password,
|
|
|
+ ...fields
|
|
|
+ })
|
|
|
handleNext()
|
|
|
},
|
|
|
validationSchema: PasswordSchema,
|
|
|
});
|
|
|
|
|
|
- const {errors, touched, handleSubmit, getFieldProps } = formik;
|
|
|
+ const {errors, touched, handleSubmit, getFieldProps, values,setValues } = formik;
|
|
|
|
|
|
return (
|
|
|
<FormikProvider style={{ padding : 25, paddingTop : 5 }} value={formik}>
|
|
|
@@ -64,11 +69,14 @@ export function Password(props) {
|
|
|
label="Fecha de Activación"
|
|
|
fullWidth
|
|
|
inputFormat="dd/MM/yyyy"
|
|
|
- {...getFieldProps('fecha_start')}
|
|
|
- value={new Date()}
|
|
|
- onChange={() => console.log('fecha creacion')}
|
|
|
+ {...getFieldProps('dateToActived')}
|
|
|
+ value={values.dateToActived}
|
|
|
+ onChange={(val) => setValues({ ...values, dateToActived: new Date(val) })
|
|
|
+ }
|
|
|
renderInput={(params) =>
|
|
|
<TextField
|
|
|
+ error={Boolean(touched.dateToActived && errors.dateToActived)}
|
|
|
+ helperText={touched.dateToActived && errors.dateToActived}
|
|
|
disabled={true}
|
|
|
label="Fecha de Activación"
|
|
|
fullWidth
|
|
|
@@ -80,19 +88,21 @@ export function Password(props) {
|
|
|
<LocalizationProvider
|
|
|
dateAdapter={DateFnsUtils}>
|
|
|
<DesktopDatePicker
|
|
|
- label="Fecha de caducidad"
|
|
|
+ label="Fecha de Caducidad"
|
|
|
fullWidth
|
|
|
inputFormat="dd/MM/yyyy"
|
|
|
- {...getFieldProps('fecha_end')}
|
|
|
- value={new Date()}
|
|
|
- onChange={() => console.log('fecha creacion')}
|
|
|
+ {...getFieldProps('deadpwd')}
|
|
|
+ value={values.deadpwd}
|
|
|
+ onChange={(val) => setValues({ ...values, deadpwd: new Date(val) }) }
|
|
|
renderInput={(params) =>
|
|
|
<TextField
|
|
|
+ error={Boolean(touched.deadpwd && errors.deadpwd)}
|
|
|
+ helperText={touched.deadpwd && errors.deadpwd}
|
|
|
disabled={true}
|
|
|
- label="Fecha de caducidad"
|
|
|
+ label="Fecha de Caducidad"
|
|
|
fullWidth
|
|
|
{...params}
|
|
|
- />}
|
|
|
+ />}
|
|
|
/>
|
|
|
</LocalizationProvider>
|
|
|
</Stack>
|