浏览代码

password mok

amenpunk 3 年之前
父节点
当前提交
5b0158eb34
共有 3 个文件被更改,包括 344 次插入131 次删除
  1. 5 0
      src/App.css
  2. 156 96
      src/Components/Register/temp.js
  3. 183 35
      src/Pages/Contras.jsx

+ 5 - 0
src/App.css

@@ -190,3 +190,8 @@
190 190
     justify-content: space-evenly;
191 191
     align-items :stretch;
192 192
 }
193
+
194
+#password_header{
195
+    margin-bottom: 20px;
196
+    padding-bottom: 20px;
197
+}

+ 156 - 96
src/Components/Register/temp.js

@@ -1,107 +1,167 @@
1
-const SectionStyle = styled(Card)(({ theme }) => ({
2
-    width: '100%',
3
-    maxWidth: 464,
4
-    display: 'flex',
5
-    flexDirection: 'column',
6
-    justifyContent: 'center',
7
-    margin: theme.spacing(2, 0, 2, 2)
8
-}));
1
+import * as React from 'react';
2
+import PropTypes from 'prop-types';
3
+import { useTheme } from '@mui/material/styles';
4
+import Box from '@mui/material/Box';
5
+import Table from '@mui/material/Table';
6
+import TableBody from '@mui/material/TableBody';
7
+import TableCell from '@mui/material/TableCell';
8
+import TableContainer from '@mui/material/TableContainer';
9
+import TableFooter from '@mui/material/TableFooter';
10
+import TablePagination from '@mui/material/TablePagination';
11
+import TableRow from '@mui/material/TableRow';
12
+import Paper from '@mui/material/Paper';
13
+import IconButton from '@mui/material/IconButton';
14
+import FirstPageIcon from '@mui/icons-material/FirstPage';
15
+import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
16
+import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
17
+import LastPageIcon from '@mui/icons-material/LastPage';
9 18
 
10
-const ContentStyle = styled('div')(({ theme }) => ({
11
-    maxWidth: 480,
12
-    margin: 'auto',
13
-    display: 'flex',
14
-    minHeight: '100vh',
15
-    flexDirection: 'column',
16
-    justifyContent: 'center',
17
-    padding: theme.spacing(12, 0)
18
-}));
19
+function TablePaginationActions(props) {
20
+  const theme = useTheme();
21
+  const { count, page, rowsPerPage, onPageChange } = props;
19 22
 
20
-const RootStyle = styled(Page)(({ theme }) => ({
21
-    [theme.breakpoints.up('md')]: {
22
-        display: 'flex'
23
-    }
24
-}));
23
+  const handleFirstPageButtonClick = (event) => {
24
+    onPageChange(event, 0);
25
+  };
25 26
 
26
-function temp () {
27
-    return(
28
-        <RootStyle title="Register | Minimal-UI">
27
+  const handleBackButtonClick = (event) => {
28
+    onPageChange(event, page - 1);
29
+  };
29 30
 
30
-            <AuthLayout>
31
-                Ya tiene una cuenta?&nbsp;
32
-                <Link to="/login" component={RouterLink}>
33
-                    Ingresa
34
-                </Link>
35
-            </AuthLayout>
31
+  const handleNextButtonClick = (event) => {
32
+    onPageChange(event, page + 1);
33
+  };
36 34
 
37
-            <SectionStyle>
38
-                <Typography variant="h3" sx={{ px: 5, mt: 10, mb: 5 }}>
39
-                    Efectividad para tus procesos de reclutamiento
40
-                </Typography>
41
-                <img alt="register" src={Mock} />
42
-            </SectionStyle>
35
+  const handleLastPageButtonClick = (event) => {
36
+    onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
37
+  };
43 38
 
44
-            <Container>
45
-                <ContentStyle>
46
-                    <Box sx={{ mb: 5 }}>
47
-                        <Typography variant="h4" gutterBottom>
48
-                            Empieza de forma gratuita.
49
-                        </Typography>
50
-                        <Typography sx={{ color: 'text.secondary' }}>
51
-                            Gratis para siempre. No se necesita tarjeta de crédito.
52
-                        </Typography>
53
-                    </Box>
39
+  return (
40
+    <Box sx={{ flexShrink: 0, ml: 2.5 }}>
41
+      <IconButton
42
+        onClick={handleFirstPageButtonClick}
43
+        disabled={page === 0}
44
+        aria-label="first page"
45
+      >
46
+        {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
47
+      </IconButton>
48
+      <IconButton
49
+        onClick={handleBackButtonClick}
50
+        disabled={page === 0}
51
+        aria-label="previous page"
52
+      >
53
+        {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
54
+      </IconButton>
55
+      <IconButton
56
+        onClick={handleNextButtonClick}
57
+        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
58
+        aria-label="next page"
59
+      >
60
+        {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
61
+      </IconButton>
62
+      <IconButton
63
+        onClick={handleLastPageButtonClick}
64
+        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
65
+        aria-label="last page"
66
+      >
67
+        {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
68
+      </IconButton>
69
+    </Box>
70
+  );
71
+}
72
+
73
+TablePaginationActions.propTypes = {
74
+  count: PropTypes.number.isRequired,
75
+  onPageChange: PropTypes.func.isRequired,
76
+  page: PropTypes.number.isRequired,
77
+  rowsPerPage: PropTypes.number.isRequired,
78
+};
79
+
80
+function createData(name, calories, fat) {
81
+  return { name, calories, fat };
82
+}
83
+
84
+const rows = [
85
+  createData('Cupcake', 305, 3.7),
86
+  createData('Donut', 452, 25.0),
87
+  createData('Eclair', 262, 16.0),
88
+  createData('Frozen yoghurt', 159, 6.0),
89
+  createData('Gingerbread', 356, 16.0),
90
+  createData('Honeycomb', 408, 3.2),
91
+  createData('Ice cream sandwich', 237, 9.0),
92
+  createData('Jelly Bean', 375, 0.0),
93
+  createData('KitKat', 518, 26.0),
94
+  createData('Lollipop', 392, 0.2),
95
+  createData('Marshmallow', 318, 0),
96
+  createData('Nougat', 360, 19.0),
97
+  createData('Oreo', 437, 18.0),
98
+].sort((a, b) => (a.calories < b.calories ? -1 : 1));
99
+
100
+export default function CustomPaginationActionsTable() {
101
+  const [page, setPage] = React.useState(0);
102
+  const [rowsPerPage, setRowsPerPage] = React.useState(5);
103
+
104
+  // Avoid a layout jump when reaching the last page with empty rows.
105
+  const emptyRows =
106
+    page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;
54 107
 
55
-                    <Stepper activeStep={activeStep} orientation="vertical">
56
-                        {steps.map((step, index) => (
57
-                            <Step key={step.label}>
58
-                                <StepLabel
59
-                                    optional={
60
-                                        index === 2 ? (
61
-                                            <Typography variant="caption">Last step</Typography>
62
-                                        ) : null
63
-                                    }
64
-                                >
65
-                                    {step.label}
66
-                                </StepLabel>
67
-                                <StepContent style={{ padding: 25 }}>
68
-                                    {step.description}
69
-                                </StepContent>
70
-                            </Step>
71
-                        ))}
72
-                    </Stepper>
73
-                    {activeStep === steps.length && (
74
-                        <Paper square elevation={0} sx={{ p: 3 }}>
75
-                            <Typography>All steps completed - you&apos;re finished</Typography>
76
-                            <Button onClick={handleReset} sx={{ mt: 1, mr: 1 }}>
77
-                                Reset
78
-                            </Button>
79
-                        </Paper>
80
-                    )}
108
+  const handleChangePage = (event, newPage) => {
109
+    setPage(newPage);
110
+  };
81 111
 
82
-                    <Typography variant="body2" align="center" sx={{ color: 'text.secondary', mt: 3 }}>
83
-                        Estoy de acuerdo con las {" "}
84
-                        <Link underline="always" sx={{ color: "#d32f2f" }}>
85
-                            Condiciones de servicio
86
-                        </Link>
87
-                        {" "}y{" "}
88
-                        <Link underline="always" sx={{ color: "#d32f2f" }}>
89
-                            Política de privacidad
90
-                        </Link>
91
-                        .
92
-                    </Typography>
112
+  const handleChangeRowsPerPage = (event) => {
113
+    setRowsPerPage(parseInt(event.target.value, 10));
114
+    setPage(0);
115
+  };
93 116
 
94
-                    <div>
95
-                        <Typography variant="subtitle2" sx={{ mt: 3, textAlign: 'center' }}>
96
-                            Ya tiene una cuenta?&nbsp;
97
-                            <Link to="/login" component={RouterLink}>
98
-                                Ingresa
99
-                            </Link>
100
-                        </Typography>
101
-                    </div>
102
-                </ContentStyle>
117
+  return (
118
+    <TableContainer component={Paper}>
119
+      <Table sx={{ minWidth: 500 }} aria-label="custom pagination table">
120
+        <TableBody>
121
+          {(rowsPerPage > 0
122
+            ? rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
123
+            : rows
124
+          ).map((row) => (
125
+            <TableRow key={row.name}>
126
+              <TableCell component="th" scope="row">
127
+                {row.name}
128
+              </TableCell>
129
+              <TableCell style={{ width: 160 }} align="right">
130
+                {row.calories}
131
+              </TableCell>
132
+              <TableCell style={{ width: 160 }} align="right">
133
+                {row.fat}
134
+              </TableCell>
135
+            </TableRow>
136
+          ))}
103 137
 
104
-            </Container>
105
-        </RootStyle>
106
-    )
138
+          {emptyRows > 0 && (
139
+            <TableRow style={{ height: 53 * emptyRows }}>
140
+              <TableCell colSpan={6} />
141
+            </TableRow>
142
+          )}
143
+        </TableBody>
144
+        <TableFooter>
145
+          <TableRow>
146
+            <TablePagination
147
+              rowsPerPageOptions={[5, 10, 25, { label: 'All', value: -1 }]}
148
+              colSpan={3}
149
+              count={rows.length}
150
+              rowsPerPage={rowsPerPage}
151
+              page={page}
152
+              SelectProps={{
153
+                inputProps: {
154
+                  'aria-label': 'rows per page',
155
+                },
156
+                native: true,
157
+              }}
158
+              onPageChange={handleChangePage}
159
+              onRowsPerPageChange={handleChangeRowsPerPage}
160
+              ActionsComponent={TablePaginationActions}
161
+            />
162
+          </TableRow>
163
+        </TableFooter>
164
+      </Table>
165
+    </TableContainer>
166
+  );
107 167
 }

+ 183 - 35
src/Pages/Contras.jsx

@@ -1,44 +1,192 @@
1
-import $ from 'jquery'  
2
-import { Button, Col , Row } from 'react-bootstrap'
1
+import * as React from 'react';
2
+import PropTypes from 'prop-types';
3
+import { useTheme } from '@mui/material/styles';
3 4
 
4
-export function Contras() {
5
+import { 
6
+    Table, TableBody, TableCell, TableContainer, TableFooter, TableRow, TablePagination,
7
+    IconButton, Paper, Box, Card
8
+} from '@mui/material';
9
+
10
+import { Row, Col, Container } from 'react-bootstrap';
11
+
12
+import {
13
+    LastPage as LastPageIcon, 
14
+    KeyboardArrowRight,
15
+    KeyboardArrowLeft,
16
+    FirstPage as FirstPageIcon
17
+} from '@mui/icons-material/'
18
+
19
+function createData(name, calories, fat) {
20
+  return { name, calories, fat };
21
+}
22
+
23
+function TablePaginationActions(props) {
24
+
25
+    const theme = useTheme();
26
+    const { count, page, rowsPerPage, onPageChange } = props;
27
+
28
+    const handleFirstPageButtonClick = (event) => {
29
+        onPageChange(event, 0);
30
+    };
5 31
 
32
+    const handleBackButtonClick = (event) => {
33
+        onPageChange(event, page - 1);
34
+    };
6 35
 
7
-    const QueryV1 = async () => {
8
-         await $.post('http://psicoadmin.ditca.org:8081/user?user=patrik&password=12345');
9
-    }
10
-    
11
-    const FetchV2 = async () => {
12
-        await fetch('http://psicoadmin.ditca.org:8081/user?user=patrik&password=12345', { method : 'POST' });
13
-    }
36
+    const handleNextButtonClick = (event) => {
37
+        onPageChange(event, page + 1);
38
+    };
14 39
 
40
+    const handleLastPageButtonClick = (event) => {
41
+        onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
42
+    };
15 43
 
16 44
     return (
45
+        <Box sx={{ flexShrink: 0, ml: 2.5 }}>
46
+        <IconButton
47
+        onClick={handleFirstPageButtonClick}
48
+        disabled={page === 0}
49
+        aria-label="first page"
50
+        >
51
+        {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
52
+        </IconButton>
53
+        <IconButton
54
+        onClick={handleBackButtonClick}
55
+        disabled={page === 0}
56
+        aria-label="previous page"
57
+        >
58
+        {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
59
+        </IconButton>
60
+        <IconButton
61
+        onClick={handleNextButtonClick}
62
+        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
63
+        aria-label="next page"
64
+        >
65
+        {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
66
+        </IconButton>
67
+        <IconButton
68
+        onClick={handleLastPageButtonClick}
69
+        disabled={page >= Math.ceil(count / rowsPerPage) - 1}
70
+        aria-label="last page"
71
+        >
72
+        {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
73
+        </IconButton>
74
+        </Box>
75
+    );
76
+}
77
+
78
+
79
+
80
+const rows = [
81
+  createData('Cupcake', 305, 3.7),
82
+  createData('Donut', 452, 25.0),
83
+  createData('Eclair', 262, 16.0),
84
+  createData('Frozen yoghurt', 159, 6.0),
85
+  createData('Gingerbread', 356, 16.0),
86
+  createData('Honeycomb', 408, 3.2),
87
+  createData('Ice cream sandwich', 237, 9.0),
88
+  createData('Jelly Bean', 375, 0.0),
89
+  createData('KitKat', 518, 26.0),
90
+  createData('Lollipop', 392, 0.2),
91
+  createData('Marshmallow', 318, 0),
92
+  createData('Nougat', 360, 19.0),
93
+  createData('Oreo', 437, 18.0),
94
+].sort((a, b) => (a.calories < b.calories ? -1 : 1));
95
+
96
+export function Contras() {
97
+  const [page, setPage] = React.useState(0);
98
+  const [rowsPerPage, setRowsPerPage] = React.useState(5);
99
+
100
+  // Avoid a layout jump when reaching the last page with empty rows.
101
+  const emptyRows =
102
+    page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;
103
+
104
+  const handleChangePage = (event, newPage) => {
105
+    setPage(newPage);
106
+  };
107
+
108
+  const handleChangeRowsPerPage = (event) => {
109
+    setRowsPerPage(parseInt(event.target.value, 10));
110
+    setPage(0);
111
+  };
112
+
113
+  return (
114
+
17 115
         <div className="content-section">
18 116
             <div className="main">
19
-                <h1>Passwords</h1>
20
-
21
-                    <Row>
22
-                        <Col>
23
-                            <Button onClick={QueryV1}> Request tipo 1 </Button>
24
-                        </Col>
25
-                    </Row>
26
-                    <hr/>
27
-                    
28
-                    <Row>
29
-                        <Col>
30
-                            <Button onClick={FetchV2}> Request tipo 2 </Button>
31
-                        </Col>
32
-                    </Row>
33
-                    <hr/>
34
-                    
35
-                    <Row>
36
-                        <Col>
37
-                            <Button >Request tipo 3</Button>
38
-                        </Col>
39
-                    </Row>
40
-
41
-            </div>
42
-        </div>
43
-    )
117
+
118
+      <Container>
119
+
120
+      <Row id="password_header">
121
+        <Col>
122
+          <Card>
123
+          <h1>Buscar Contrasena</h1>
124
+          </Card>
125
+        </Col>
126
+      </Row>
127
+
128
+
129
+      <Row>
130
+      <Col>
131
+
132
+
133
+
134
+
135
+    <TableContainer component={Paper}>
136
+      <Table sx={{ minWidth: 500 }} aria-label="custom pagination table">
137
+        <TableBody>
138
+          {(rowsPerPage > 0
139
+            ? rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
140
+            : rows
141
+          ).map((row) => (
142
+            <TableRow key={row.name}>
143
+              <TableCell component="th" scope="row">
144
+                {row.name}
145
+              </TableCell>
146
+              <TableCell style={{ width: 160 }} align="right">
147
+                {row.calories}
148
+              </TableCell>
149
+              <TableCell style={{ width: 160 }} align="right">
150
+                {row.fat}
151
+              </TableCell>
152
+            </TableRow>
153
+          ))}
154
+
155
+          {emptyRows > 0 && (
156
+            <TableRow style={{ height: 53 * emptyRows }}>
157
+              <TableCell colSpan={6} />
158
+            </TableRow>
159
+          )}
160
+        </TableBody>
161
+        <TableFooter>
162
+          <TableRow>
163
+            <TablePagination
164
+              rowsPerPageOptions={[5, 10, 25, { label: 'All', value: -1 }]}
165
+              colSpan={3}
166
+              count={rows.length}
167
+              rowsPerPage={rowsPerPage}
168
+              page={page}
169
+              SelectProps={{
170
+                inputProps: {
171
+                  'aria-label': 'rows per page',
172
+                },
173
+                native: true,
174
+              }}
175
+              onPageChange={handleChangePage}
176
+              onRowsPerPageChange={handleChangeRowsPerPage}
177
+              ActionsComponent={TablePaginationActions}
178
+            />
179
+          </TableRow>
180
+        </TableFooter>
181
+      </Table>
182
+    </TableContainer>
183
+
184
+      </Col>
185
+      </Row>
186
+
187
+      </Container>
188
+
189
+      </div>
190
+      </div>
191
+  );
44 192
 }