amenpunk лет назад: 2
Родитель
Сommit
8168acc53d
3 измененных файлов с 80 добавлено и 24 удалено
  1. 78 0
      src/Components/Password/Operation.jsx
  2. 2 21
      src/Components/Password/Rows.js
  3. 0 3
      src/Pages/ContrasV2.jsx

+ 78 - 0
src/Components/Password/Operation.jsx

@@ -0,0 +1,78 @@
1
+import * as React from 'react';
2
+
3
+import { Edit as EditIcon, Send as SendIcon } from '@mui/icons-material'
4
+import {
5
+    Button, Dialog, DialogActions, DialogContent,
6
+    DialogContentText, DialogTitle
7
+} from '@mui/material'
8
+
9
+import { useQuery } from 'react-query'
10
+import { Service } from '../../Utils/HTTP.js'
11
+import useAuth from '../../Auth/useAuth.js';
12
+
13
+export function Operation(props) {
14
+
15
+    let [open, setOpen] = React.useState(false);
16
+    const handleOpen = (status) => setOpen(status);
17
+
18
+    return (
19
+        <div>
20
+            <div className="operation_buttons">
21
+                <EditIcon onClick={() => setOpen(true)} className="icon_op" />
22
+                <SendIcon className="icon_op" />
23
+            </div>
24
+            {
25
+                open ? 
26
+                <ModalEdit 
27
+                    password={props}
28
+                    open={open}
29
+                    handleOpen={handleOpen}
30
+                    /> 
31
+                : null
32
+            }
33
+        </div>
34
+    )
35
+}
36
+
37
+function ModalEdit(props) {
38
+
39
+    let { password, open, handleOpen} = props
40
+    let { pwd, plz } = password
41
+    const auth = useAuth();
42
+    const token = React.useRef(auth.getToken());
43
+    const getPassword = async () => {
44
+        let rest = new Service(`/contrasenia/${pwd}/${plz}`)
45
+        return await rest.getQuery(token.current)
46
+    }
47
+
48
+    let { data, status, } = useQuery('contra', getPassword);
49
+    console.log(data, status)
50
+
51
+
52
+    return (
53
+        <Dialog
54
+            open={open}
55
+            onClose={() => handleOpen(false)}
56
+            aria-labelledby="alert-dialog-title"
57
+            aria-describedby="alert-dialog-description"
58
+        >
59
+            <DialogTitle id="alert-dialog-title">
60
+                {pwd}
61
+            </DialogTitle>
62
+            <DialogContent>
63
+                <DialogContentText id="alert-dialog-description">
64
+                    Let Google help apps determine location. This means sending anonymous
65
+                    location data to Google, even when no apps are running.
66
+                </DialogContentText>
67
+            </DialogContent>
68
+            <DialogActions>
69
+                <Button onClick={() => handleOpen(false)}>Disagree</Button>
70
+                <Button onClick={() => handleOpen(false)} autoFocus>
71
+                    Agree
72
+                </Button>
73
+            </DialogActions>
74
+        </Dialog>
75
+    )
76
+}
77
+
78
+

+ 2 - 21
src/Components/Password/Rows.js

@@ -1,5 +1,4 @@
1
-import EditIcon from '@mui/icons-material/Edit';
2
-import SendIcon from '@mui/icons-material/Send';
1
+import { Operation } from './Operation'
3 2
 
4 3
 export const Encabezados = [
5 4
     {
@@ -51,15 +50,6 @@ export const niveles_educativos = [
51 50
     "Cursos"
52 51
 ]
53 52
 
54
-
55
-export const departamentos = [
56
-    "Guatemala",
57
-    "Guatemala",
58
-    "Guatemala",
59
-    "Guatemala",
60
-    "Guatemala",
61
-]
62
-
63 53
 export function Build(pwds) {
64 54
     return pwds.map(password => {
65 55
         let { candidato: user, plaza_id, pwd } = password
@@ -68,17 +58,8 @@ export function Build(pwds) {
68 58
             name: user.nombre,
69 59
             apell: user.apellidos,
70 60
             mail: user.mail,
71
-            op: <OpButtons plz={plaza_id} pwd={pwd}  />
61
+            op: <Operation plz={plaza_id} pwd={pwd} />
72 62
         }
73 63
     })
74 64
 }
75 65
 
76
-
77
-function OpButtons(props){
78
-    return(
79
-        <div className="operation_buttons">
80
-            <EditIcon onClick={() => console.log(props)} className="icon_op"/>
81
-            <SendIcon className="icon_op"/>
82
-        </div>
83
-    )
84
-}

+ 0 - 3
src/Pages/ContrasV2.jsx

@@ -20,10 +20,7 @@ export function Contrasv2() {
20 20
         return await rest.getQuery(token.current)
21 21
     }
22 22
 
23
-    // const { data : { data : result} } = useQuery('passwords', getAllPwd );
24 23
     const { data  } = useQuery('passwords', getAllPwd );
25
-    console.log('data>>', data)
26
-
27 24
 
28 25
     const options = {
29 26
         filterType: 'checkbox',