|
@@ -10,8 +10,7 @@ import toast, { Toaster } from 'react-hot-toast';
|
10
|
10
|
|
11
|
11
|
import { useMutation, useQueryClient } from 'react-query';
|
12
|
12
|
import { Service } from '../../../Utils/HTTP.js'
|
13
|
|
-import useAuth from '../../../Auth/useAuth.js'
|
14
|
|
-import { useSelector } from 'react-query';
|
|
13
|
+import { useSelector } from 'react-redux';
|
15
|
14
|
|
16
|
15
|
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
17
|
16
|
|
|
@@ -32,11 +31,13 @@ let theme = createTheme({
|
32
|
31
|
export function Resume(props) {
|
33
|
32
|
|
34
|
33
|
let { handleBack, password: key, handleClose,handleReset } = props
|
|
34
|
+
|
35
|
35
|
const fmt = React.useRef({ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' })
|
36
|
36
|
const [pwdID, setPwdID] = React.useState(null);
|
37
|
37
|
const [loading, setLoading] = React.useState(false);
|
|
38
|
+
|
38
|
39
|
const auth = useSelector((state) => state.token)
|
39
|
|
- // const token = auth.getToken();
|
|
40
|
+ const profile = useSelector((state) => state.user.profile)
|
40
|
41
|
const queryClient = useQueryClient();
|
41
|
42
|
|
42
|
43
|
const savePassword = async (body) => {
|
|
@@ -57,10 +58,9 @@ export function Resume(props) {
|
57
|
58
|
setLoading(true);
|
58
|
59
|
|
59
|
60
|
let {
|
60
|
|
- deadpwd, dateToActived, puesto, pwd,
|
61
|
|
- nombres, apellidos, sendmail, nombrepuesto, nombreEmpresa,mail
|
|
61
|
+ deadpwd, dateToActived, puesto,
|
|
62
|
+ pwd,nombreEmpresa,nombrepuesto, candidatos
|
62
|
63
|
} = key;
|
63
|
|
- console.log("KEY: ", key)
|
64
|
64
|
|
65
|
65
|
let pwdBody = {
|
66
|
66
|
id: -1,
|
|
@@ -80,10 +80,10 @@ export function Resume(props) {
|
80
|
80
|
|
81
|
81
|
let candidatoBody = {
|
82
|
82
|
id: -1,
|
83
|
|
- nombres,
|
84
|
|
- apellidos,
|
85
|
|
- sendmail: sendmail ? 1 : 0,
|
86
|
|
- mail,
|
|
83
|
+ //nombres,
|
|
84
|
+ //apellidos,
|
|
85
|
+ //sendmail: sendmail ? 1 : 0,
|
|
86
|
+ //mail,
|
87
|
87
|
idContrasenia: password_id,
|
88
|
88
|
nombrepuesto,
|
89
|
89
|
nombreEmpresa
|
|
@@ -118,6 +118,14 @@ export function Resume(props) {
|
118
|
118
|
})
|
119
|
119
|
}
|
120
|
120
|
|
|
121
|
+ const getLi = (user) => {
|
|
122
|
+ return (
|
|
123
|
+ <li style={{ listStyleType: 'none'}}>
|
|
124
|
+ {user.nombres + " " + user.apellidos} - {user.mail}
|
|
125
|
+ </li>
|
|
126
|
+ )
|
|
127
|
+ }
|
|
128
|
+
|
121
|
129
|
return (
|
122
|
130
|
<React.Fragment>
|
123
|
131
|
<ThemeProvider theme={theme}>
|
|
@@ -128,30 +136,34 @@ export function Resume(props) {
|
128
|
136
|
) : null}
|
129
|
137
|
<Table>
|
130
|
138
|
<thead>
|
131
|
|
- <tr>
|
132
|
|
- <th>{key.pwd}</th>
|
133
|
|
- <th>{btoa(key.pwd)}</th>
|
|
139
|
+ <tr className="table_password">
|
|
140
|
+ <th>{"Contraseña: "}</th>
|
|
141
|
+ <th>{ key.pwd } - {btoa(key.pwd)}</th>
|
134
|
142
|
</tr>
|
135
|
143
|
</thead>
|
136
|
144
|
<tbody>
|
137
|
145
|
<tr>
|
138
|
|
- <td className="title_td">{"Candidato"}</td>
|
139
|
|
- <td colSpan={2}>{key.nombres + " " + key.apellidos} - {key.mail}</td>
|
|
146
|
+ <td className="title_td">{"Candidatos:"}</td>
|
|
147
|
+ <td colSpan={2}>
|
|
148
|
+ <ul style={{ margin:0, padding:0}}>
|
|
149
|
+ {key.candidatos.map(u => getLi(u))}
|
|
150
|
+ </ul>
|
|
151
|
+ </td>
|
140
|
152
|
</tr>
|
141
|
153
|
<tr>
|
142
|
|
- <td className="title_td">{"Puesto"}</td>
|
|
154
|
+ <td className="title_td">{"Puesto:"}</td>
|
143
|
155
|
<td colSpan={2}>{key.puesto.length > 0 ? key.puesto[0].nombrepuesto : ''}</td>
|
144
|
156
|
</tr>
|
145
|
157
|
<tr>
|
146
|
|
- <td className="title_td">{"Empresa"}</td>
|
147
|
|
- <td colSpan={2}>{key.nombreEmpresa}</td>
|
|
158
|
+ <td className="title_td">{"Empresa:"}</td>
|
|
159
|
+ <td colSpan={2}>{profile.nombre}</td>
|
148
|
160
|
</tr>
|
149
|
161
|
<tr>
|
150
|
|
- <td className="title_td">{"Fecha Activación"}</td>
|
|
162
|
+ <td className="title_td">{"Fecha Activación:"}</td>
|
151
|
163
|
<td colSpan={2}>{new Date(key.dateToActived).toLocaleDateString('es-GT', fmt.current)}</td>
|
152
|
164
|
</tr>
|
153
|
165
|
<tr>
|
154
|
|
- <td className="title_td">{"Fecha de Vencimiento"}</td>
|
|
166
|
+ <td className="title_td">{"Fecha de Vencimiento:"}</td>
|
155
|
167
|
<td colSpan={2}>{new Date(key.deadpwd).toLocaleDateString('es-GT', fmt.current)}</td>
|
156
|
168
|
</tr>
|
157
|
169
|
</tbody>
|