Browse Source

last step mockup :godmode:

amenpunk 2 years ago
parent
commit
0b308439d7

+ 14 - 4
src/Components/Modal/PasswordModal.jsx

@@ -9,21 +9,27 @@ import {
9 9
 import { Puesto } from '../Password/Steps/puesto'
10 10
 import { Password } from '../Password/Steps/password'
11 11
 import { Candidato } from '../Password/Steps/candidato'
12
+import { Resume } from '../Password/Steps/resume'
12 13
 
13 14
 export function HelpModal(props) {
14 15
 
15 16
     let { visible, handleClose } = props
16 17
     const now = React.useRef(new Date());
17 18
 
18
-
19 19
     const [activeStep, setActiveStep] = React.useState(0);
20 20
     const [skipped, setSkipped] = React.useState(new Set());
21 21
 
22 22
     const [password, setPassword] = React.useState({
23 23
         puesto: [],
24 24
         pwd: "",
25
-        deadpwd: now,
26
-        dateToActived: now,
25
+        deadpwd: now.current,
26
+        dateToActived: now.current,
27
+        nombres:"",
28
+        apellidos:"",
29
+        mail:"",
30
+        sendmail:true,
31
+        nombrepuesto:"",
32
+        nombreEmpresa:"",
27 33
     });
28 34
 
29 35
     const isStepSkipped = (step) => {
@@ -83,7 +89,11 @@ export function HelpModal(props) {
83 89
         },
84 90
         {
85 91
             label: 'Confirmar',
86
-            operation: <h1>guardar</h1>
92
+            operation: 
93
+                <Resume
94
+                    handleBack={handleBack}
95
+                    password={password}
96
+                />
87 97
         },
88 98
     ];
89 99
 

+ 35 - 25
src/Components/Password/Steps/candidato.jsx

@@ -11,31 +11,40 @@ import {
11 11
 export function Candidato(props) {
12 12
 
13 13
     const CandidatoSchema = Yup.object().shape({
14
-        firstName:
14
+        nombres:
15 15
             Yup.string()
16 16
                 .min(2, 'Demasiado corto!')
17 17
                 .max(50, 'Demasiado largo!')
18 18
                 .required("Ingresa un nombre válido"),
19
-        lastName:
19
+        apellidos:
20 20
             Yup.string()
21 21
                 .required("Ingresa un apellido válido")
22 22
                 .min(2, 'Demasiado corto!').max(50, 'Demasiado Largo!'),
23
-        puesto:
23
+        mail:
24 24
             Yup.string()
25
+                .email("Correo no valido")
25 26
                 .required("Ingrea un puesto válido"),
26
-        niveles_educativo:
27
-            Yup.number('Ingresa un valor válido')
27
+        sendmail:
28
+            Yup.bool()
28 29
                 .required('Ingresa un nivel educativo válido'),
30
+        nombrepuesto:
31
+            Yup.string('Ingresa un valor válido')
32
+                .required('Ingresa un nombre válido'),
33
+        nombreEmpresa:
34
+            Yup.string('Ingresa un valor válido')
35
+                .required('Ingresa un nombre válido'),
29 36
     });
30 37
 
31 38
     let { handleNext, handleBack, password, setPassword } = props
32 39
 
33 40
     const formik = useFormik({
34 41
         initialValues: {
35
-            firstName: password.firstName,
36
-            lastName: password.lastName,
37
-            puesto: password.puesto,
38
-            niveles_educativo: password.niveles_educativo,
42
+            nombres: password.nombres,
43
+            apellidos: password.apellidos,
44
+            sendmail: password.sendmail,
45
+            mail : password.mail,
46
+            nombrepuesto: password.nombrepuesto,
47
+            nombreEmpresa: password.nombreEmpresa,
39 48
         },
40 49
         onSubmit: (fields) => {
41 50
             setPassword({ ...password, ...fields })
@@ -54,34 +63,35 @@ export function Candidato(props) {
54 63
                         <TextField
55 64
                             label="Nombre"
56 65
                             fullWidth
57
-                            {...getFieldProps('firstName')}
58
-                            error={Boolean(touched.firstName && errors.firstName)}
59
-                            helperText={touched.firstName && errors.firstName}
66
+                            {...getFieldProps('nombres')}
67
+                            error={Boolean(touched.nombres && errors.nombres)}
68
+                            helperText={touched.nombres && errors.nombres}
60 69
                         />
61 70
 
62 71
                         <TextField
63 72
                             label="Apellidos"
64 73
                             fullWidth
65
-                            {...getFieldProps('lastName')}
66
-                            error={Boolean(touched.lastName && errors.lastName)}
67
-                            helperText={touched.lastName && errors.lastName}
74
+                            {...getFieldProps('apellidos')}
75
+                            error={Boolean(touched.apellidos && errors.apellidos)}
76
+                            helperText={touched.apellidos && errors.apellidos}
68 77
                         />
69 78
                     </Stack>
70 79
 
71 80
                     <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
72 81
                         <TextField
73 82
                             fullWidth
74
-                            type="text"
83
+                            type="email"
75 84
                             label="Correo Electronico"
76
-                            {...getFieldProps('puesto')}
77
-                            error={Boolean(touched.puesto && errors.puesto)}
78
-                            helperText={touched.puesto && errors.puesto}
85
+                            {...getFieldProps('mail')}
86
+                            error={Boolean(touched.mail && errors.mail)}
87
+                            helperText={touched.mail && errors.mail}
79 88
                         />
80 89
                         <FormGroup>
81 90
 
82 91
                             <FormControlLabel
83 92
                                 control={
84 93
                                     <Checkbox
94
+                                        {...getFieldProps('sendmail')}
85 95
                                         defaultChecked
86 96
                                         color="default"
87 97
                                     />
@@ -98,17 +108,17 @@ export function Candidato(props) {
98 108
                             fullWidth
99 109
                             type="text"
100 110
                             label="Puesto"
101
-                            {...getFieldProps('puesto')}
102
-                            error={Boolean(touched.puesto && errors.puesto)}
103
-                            helperText={touched.puesto && errors.puesto}
111
+                            {...getFieldProps('nombrepuesto')}
112
+                            error={Boolean(touched.nombrepuesto && errors.nombrepuesto)}
113
+                            helperText={touched.nombrepuesto && errors.nombrepuesto}
104 114
                         />
105 115
                         <TextField
106 116
                             fullWidth
107 117
                             type="text"
108 118
                             label="Empresa"
109
-                            {...getFieldProps('puesto')}
110
-                            error={Boolean(touched.puesto && errors.puesto)}
111
-                            helperText={touched.puesto && errors.puesto}
119
+                            {...getFieldProps('nombreEmpresa')}
120
+                            error={Boolean(touched.nombreEmpresa && errors.nombreEmpresa)}
121
+                            helperText={touched.nombreEmpresa && errors.nombreEmpresa}
112 122
                         />
113 123
                     </Stack>
114 124
 

+ 104 - 0
src/Components/Password/Steps/resume.jsx

@@ -0,0 +1,104 @@
1
+import * as React from 'react';
2
+import Table from '@mui/material/Table';
3
+import TableBody from '@mui/material/TableBody';
4
+import TableCell from '@mui/material/TableCell';
5
+import TableContainer from '@mui/material/TableContainer';
6
+import TableHead from '@mui/material/TableHead';
7
+import TableRow from '@mui/material/TableRow';
8
+import Paper from '@mui/material/Paper';
9
+import {
10
+    Typography, Divider, Box, Button
11
+} from '@mui/material';
12
+
13
+const TAX_RATE = 0.07;
14
+
15
+function ccyFormat(num) {
16
+    return `${num.toFixed(2)}`;
17
+}
18
+
19
+function priceRow(qty, unit) {
20
+    return qty * unit;
21
+}
22
+
23
+function createRow(desc, qty, unit) {
24
+    const price = priceRow(qty, unit);
25
+    return { desc, qty, unit, price };
26
+}
27
+
28
+function subtotal(items) {
29
+    return items.map(({ price }) => price).reduce((sum, i) => sum + i, 0);
30
+}
31
+
32
+const rows = [
33
+    createRow('Paperclips (Box)', 100, 1.15),
34
+    createRow('Paper (Case)', 10, 45.99),
35
+    createRow('Waste Basket', 2, 17.99),
36
+];
37
+
38
+const invoiceSubtotal = subtotal(rows);
39
+const invoiceTaxes = TAX_RATE * invoiceSubtotal;
40
+const invoiceTotal = invoiceTaxes + invoiceSubtotal;
41
+
42
+export function Resume(props) {
43
+    let {handleBack, password } = props
44
+    console.log("FINAL::", password)
45
+
46
+    return (
47
+        <React.Fragment>
48
+            <Typography  variant="h6">
49
+                Resumen:
50
+            </Typography>
51
+            <Divider sx={{paddingTop : 1}}/>
52
+            <TableContainer component={Paper}>
53
+                <Table sx={{ minWidth: 700 }} aria-label="spanning table">
54
+                    <TableBody>
55
+                        {rows.map((row) => (
56
+                            <TableRow key={row.desc}>
57
+                                <TableCell>{row.desc}</TableCell>
58
+                                <TableCell align="right">{row.qty}</TableCell>
59
+                                <TableCell align="right">{row.unit}</TableCell>
60
+                                <TableCell align="right">{ccyFormat(row.price)}</TableCell>
61
+                            </TableRow>
62
+                        ))}
63
+
64
+                        <TableRow>
65
+                            <TableCell rowSpan={3} />
66
+                            <TableCell colSpan={2}>Subtotal</TableCell>
67
+                            <TableCell align="right">{ccyFormat(invoiceSubtotal)}</TableCell>
68
+                        </TableRow>
69
+                        <TableRow>
70
+                            <TableCell>Tax</TableCell>
71
+                            <TableCell align="right">{`${(TAX_RATE * 100).toFixed(0)} %`}</TableCell>
72
+                            <TableCell align="right">{ccyFormat(invoiceTaxes)}</TableCell>
73
+                        </TableRow>
74
+                        <TableRow>
75
+                            <TableCell colSpan={2}>Total</TableCell>
76
+                            <TableCell align="right">{ccyFormat(invoiceTotal)}</TableCell>
77
+                        </TableRow>
78
+                    </TableBody>
79
+                </Table>
80
+            </TableContainer>
81
+
82
+                    <Box sx={{ mb: 2 }}>
83
+                        <div style={{ paddingTop: 15 }}>
84
+                            <Button
85
+                                type="submit"
86
+                                className="registerBtn"
87
+                                variant="contained"
88
+                                sx={{ mt: 1, mr: 1 }}
89
+                            >
90
+                                {'Guardar'}
91
+                            </Button>
92
+                            <Button
93
+                                disabled={false}
94
+                                onClick={handleBack}
95
+                                sx={{ mt: 1, mr: 1 }}
96
+                            >
97
+                                Regresar
98
+                            </Button>
99
+                        </div>
100
+                    </Box>
101
+
102
+        </React.Fragment>
103
+    );
104
+}