Explorar o código

register mokup

amenpunk %!s(int64=3) %!d(string=hai) anos
pai
achega
74984297b4

+ 107 - 0
src/Components/Register/PersonalInfo.js

@@ -0,0 +1,107 @@
1
+import { useFormik, Form, FormikProvider } from 'formik'; // import { useNavigate } from 'react-router-dom';
2
+import * as Yup from 'yup';
3
+
4
+import { 
5
+    Stack, TextField,
6
+} from '@mui/material';
7
+
8
+export function PersonalInfo() {
9
+
10
+    // let navigate = useNavigate()
11
+
12
+    const RegisterSchema = Yup.object().shape({
13
+        nit: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado largo!').required('El nit es requerido'),
14
+        cui: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('Tu CUI/DPI es requerido'),
15
+        direccion: Yup.string().min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!').required('La direccion es requerida'),
16
+        nacimiento: Yup.date().required('Tu fecha  nacimiento es requerida'),
17
+        telefono: Yup.number().required('Tu numero de telefono es requerido').oneOf([Yup.ref('password'), null], 'Las contraseñas no coincidien')
18
+    });
19
+
20
+    const formik = useFormik({
21
+
22
+        initialValues: {
23
+            nit: '',
24
+            cui: '',
25
+            direccion: '',
26
+            nacimiento: new Date(),
27
+            telefono: ''
28
+        },
29
+        validationSchema: RegisterSchema,
30
+        onSubmit: async (values) => {
31
+            // setOpen(true);
32
+            let body = {
33
+                "nit": "5345435",
34
+                "cui": "555555",
35
+                "direccion": "4 calle zona 1",
36
+                "fechacumple": "2021-01-01",
37
+                "telefono" : "45435345",
38
+            }
39
+            console.log(values,body)
40
+
41
+            // let url = 'http://204.48.25.93:8081/registro'
42
+            // let url = 'http://psicoadmin.ditca.org:8081/registro'
43
+        }
44
+
45
+    });
46
+
47
+
48
+    const { errors, touched, handleSubmit, getFieldProps } = formik;
49
+
50
+    return(
51
+        <FormikProvider style={{ padding : 15}} value={formik}>
52
+            <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
53
+                <Stack spacing={3}>
54
+                    <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
55
+                        <TextField
56
+                            label="Numero de Nit"
57
+                            fullWidth
58
+                            {...getFieldProps('nit')}
59
+                            error={Boolean(touched.nit && errors.nit)}
60
+                            helperText={touched.nit && errors.nit}
61
+                        />
62
+
63
+                        <TextField
64
+                            label="CUI/DPI"
65
+                            fullWidth
66
+                            {...getFieldProps('cui')}
67
+                            error={Boolean(touched.cui && errors.cui)}
68
+                            helperText={touched.cui && errors.cui}
69
+                        />
70
+                    </Stack>
71
+
72
+                    <TextField
73
+                        fullWidth
74
+                        type="text"
75
+                        label="Dirección"
76
+                        {...getFieldProps('direccion')}
77
+                        error={Boolean(touched.direccion && errors.direccion)}
78
+                        helperText={touched.direccion && errors.direccion}
79
+                    />
80
+                    
81
+                    <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
82
+                        <TextField
83
+                            type="date"
84
+                            label="Fecha de nacimiento"
85
+                            fullWidth
86
+                            defaultValue={'2021-01-10'}
87
+                            InputLabelProps={{ shrink: true, required: true }}
88
+                            {...getFieldProps('nacimiento')}
89
+                            error={Boolean(touched.nacimiento && errors.nacimiento)}
90
+                            helperText={touched.nacimiento && errors.nacimiento}
91
+                        />
92
+
93
+                        <TextField
94
+                            label="Telefono"
95
+                            fullWidth
96
+                            {...getFieldProps('telefono')}
97
+                            error={Boolean(touched.telefono && errors.telefono)}
98
+                            helperText={touched.telefono && errors.telefono}
99
+                        />
100
+                    </Stack>
101
+
102
+
103
+                </Stack>
104
+            </Form>
105
+        </FormikProvider>
106
+    )
107
+}

+ 19 - 14
src/Components/Register/RegisterForm.jsx

@@ -2,18 +2,18 @@ import React from 'react'
2 2
 import * as Yup from 'yup';
3 3
 import { useState } from 'react';
4 4
 import { useFormik, Form, FormikProvider } from 'formik';
5
-import { useNavigate } from 'react-router-dom';
5
+// import { useNavigate } from 'react-router-dom';
6 6
 import { Icon } from '@iconify/react';
7 7
 
8 8
 import { 
9 9
     Stack, TextField, IconButton, InputAdornment, 
10
-    Button, Backdrop, CircularProgress,
10
+    Backdrop, CircularProgress,
11 11
 } from '@mui/material';
12 12
 
13 13
 import eyeFill from '@iconify/icons-eva/eye-fill';
14 14
 import eyeOffFill from '@iconify/icons-eva/eye-off-fill';
15
-import toast, { Toaster } from 'react-hot-toast';
16
-import { V1, V2 } from '../../Utils/HTTP'
15
+import { Toaster } from 'react-hot-toast';
16
+// import { V1, V2 } from '../../Utils/HTTP'
17 17
 
18 18
 export function RegisterForm() {
19 19
 
@@ -24,7 +24,7 @@ export function RegisterForm() {
24 24
         setOpen(false);
25 25
     };
26 26
     
27
-    let navigate = useNavigate()
27
+    // let navigate = useNavigate()
28 28
 
29 29
     const RegisterSchema = Yup.object().shape({
30 30
         firstName: Yup.string()
@@ -63,8 +63,9 @@ export function RegisterForm() {
63 63
             }
64 64
 
65 65
             let url = 'http://204.48.25.93:8081/registro'
66
+            console.log(body, url)
66 67
             // let url = 'http://psicoadmin.ditca.org:8081/registro'
67
-            V1(url, body);
68
+            // V1(url, body);
68 69
             // V2(url, body);
69 70
             setOpen(false)
70 71
             //
@@ -75,7 +76,7 @@ export function RegisterForm() {
75 76
     const { errors, touched, handleSubmit, getFieldProps } = formik;
76 77
 
77 78
     return (
78
-        <FormikProvider value={formik}>
79
+        <FormikProvider style={{ padding : 15 }} value={formik}>
79 80
             <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
80 81
                 <Stack spacing={3}>
81 82
                     <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
@@ -143,13 +144,17 @@ export function RegisterForm() {
143 144
                         helperText={touched.password_confirm && errors.password_confirm}
144 145
                     />
145 146
 
146
-                    <Button 
147
-                        type="submit"
148
-                        size="large"
149
-                        style={{ backgroundColor : '#d32f2f'}}
150
-                        variant="contained" >
151
-                        Registrarme
152
-                    </Button>
147
+
148
+        {/*
149
+            <Button 
150
+            type="submit"
151
+            size="large"
152
+            style={{ backgroundColor : '#d32f2f'}}
153
+            variant="contained" >
154
+            Registrarme
155
+            </Button>
156
+            */
157
+        }
153 158
 
154 159
                 </Stack>
155 160
             </Form>

+ 8 - 9
src/Pages/Register.jsx

@@ -6,10 +6,11 @@ import {
6 6
     Box, Card, Link, Container, Typography,
7 7
     StepLabel,Step,Stepper, Button,Paper, StepContent
8 8
 } from '@mui/material';
9
-import AuthLayout from '../Components/Register/AuthLayout';
10 9
 
11 10
 import Page from '../Components/Register/Page';
12 11
 import { RegisterForm } from '../Components/Register/RegisterForm';
12
+import { PersonalInfo } from '../Components/Register/PersonalInfo.js';
13
+import AuthLayout from '../Components/Register/AuthLayout';
13 14
 
14 15
 import Mock from  '../Images/register_mok.png'
15 16
 import useAuth from '../Auth/useAuth';
@@ -44,11 +45,9 @@ const steps = [
44 45
     {
45 46
         label: 'Información de tu cuenta',
46 47
         description: <RegisterForm/>
47
-    },
48
-    {
48
+    }, {
49 49
         label: 'Datos Personales',
50
-        description:
51
-        'An ad group contains one or more ads which target a shared set of keywords.',
50
+        description: <PersonalInfo/>
52 51
     },
53 52
 ];
54 53
 
@@ -118,23 +117,23 @@ export function Register() {
118 117
             >
119 118
               {step.label}
120 119
             </StepLabel>
121
-            <StepContent>
120
+        <StepContent style={{ padding : 25}}>
122 121
               {step.description}
123 122
               <Box sx={{ mb: 2 }}>
124
-                <div>
123
+                <div style={{ paddingTop  : 15}}>
125 124
                   <Button
126 125
                     variant="contained"
127 126
                     onClick={handleNext}
128 127
                     sx={{ mt: 1, mr: 1 }}
129 128
                   >
130
-                    {index === steps.length - 1 ? 'Finish' : 'Continue'}
129
+                    {index === steps.length - 1 ? 'Registrarme' : 'Siguiente'}
131 130
                   </Button>
132 131
                   <Button
133 132
                     disabled={index === 0}
134 133
                     onClick={handleBack}
135 134
                     sx={{ mt: 1, mr: 1 }}
136 135
                   >
137
-                    Back
136
+                    Regresar
138 137
                   </Button>
139 138
                 </div>
140 139
               </Box>