|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
|
|
|
|
|
import { Table } from 'react-bootstrap';
|
|
import { Table } from 'react-bootstrap';
|
|
|
import {
|
|
import {
|
|
|
- Box, Button, LinearProgress,
|
|
|
|
|
- Backdrop, CircularProgress
|
|
|
|
|
|
|
+ Box, Button, LinearProgress,
|
|
|
|
|
+ Backdrop, CircularProgress
|
|
|
} from '@mui/material';
|
|
} from '@mui/material';
|
|
|
|
|
|
|
|
import toast, { Toaster } from 'react-hot-toast';
|
|
import toast, { Toaster } from 'react-hot-toast';
|
|
@@ -15,25 +15,26 @@ import { useSelector } from 'react-redux';
|
|
|
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
|
|
|
|
|
|
let theme = createTheme({
|
|
let theme = createTheme({
|
|
|
- status: {
|
|
|
|
|
- success: '#fd4b4b'
|
|
|
|
|
|
|
+ status: {
|
|
|
|
|
+ success: '#fd4b4b'
|
|
|
|
|
+ },
|
|
|
|
|
+ palette: {
|
|
|
|
|
+ primary: {
|
|
|
|
|
+ main: '#fd4b4b',
|
|
|
},
|
|
},
|
|
|
- palette: {
|
|
|
|
|
- primary: {
|
|
|
|
|
- main: '#fd4b4b',
|
|
|
|
|
- },
|
|
|
|
|
- secondary: {
|
|
|
|
|
- main: '#fd4b4b',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ secondary: {
|
|
|
|
|
+ main: '#fd4b4b',
|
|
|
},
|
|
},
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export function Resume(props) {
|
|
export function Resume(props) {
|
|
|
|
|
|
|
|
- let { handleBack, password: key, handleClose,handleReset } = props
|
|
|
|
|
|
|
+ let { handleBack, password: key, handleClose, handleReset } = props
|
|
|
|
|
+
|
|
|
|
|
+ console.log(key)
|
|
|
|
|
|
|
|
const fmt = React.useRef({ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' })
|
|
const fmt = React.useRef({ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' })
|
|
|
- const [pwdID, setPwdID] = React.useState(null);
|
|
|
|
|
const [loading, setLoading] = React.useState(false);
|
|
const [loading, setLoading] = React.useState(false);
|
|
|
|
|
|
|
|
const auth = useSelector((state) => state.token)
|
|
const auth = useSelector((state) => state.token)
|
|
@@ -52,62 +53,71 @@ export function Resume(props) {
|
|
|
|
|
|
|
|
const pwdMutation = useMutation('password', savePassword);
|
|
const pwdMutation = useMutation('password', savePassword);
|
|
|
const candiMutation = useMutation('candidato', saveCandidato);
|
|
const candiMutation = useMutation('candidato', saveCandidato);
|
|
|
|
|
+ console.log(candiMutation)
|
|
|
|
|
|
|
|
const saveStepper = () => {
|
|
const saveStepper = () => {
|
|
|
|
|
|
|
|
setLoading(true);
|
|
setLoading(true);
|
|
|
|
|
|
|
|
- let {
|
|
|
|
|
- deadpwd, dateToActived, puesto,
|
|
|
|
|
- pwd,nombreEmpresa,nombrepuesto, candidatos
|
|
|
|
|
- } = key;
|
|
|
|
|
|
|
+ let { deadpwd, dateToActived } = key;
|
|
|
|
|
|
|
|
let pwdBody = {
|
|
let pwdBody = {
|
|
|
id: -1,
|
|
id: -1,
|
|
|
- pwd: btoa(pwd),
|
|
|
|
|
|
|
+ pwd: btoa(key.pwd),
|
|
|
link: "www.psicoadmin.com",
|
|
link: "www.psicoadmin.com",
|
|
|
deadpwd: new Date(deadpwd).toISOString(),
|
|
deadpwd: new Date(deadpwd).toISOString(),
|
|
|
state: 1,
|
|
state: 1,
|
|
|
dateToActived: new Date(dateToActived).toISOString(),
|
|
dateToActived: new Date(dateToActived).toISOString(),
|
|
|
- plaza_id: puesto[0].id
|
|
|
|
|
|
|
+ plaza_id: key.puesto[0].id
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ console.log("PWD BODY: ", pwdBody)
|
|
|
|
|
+
|
|
|
pwdMutation.mutate(pwdBody, {
|
|
pwdMutation.mutate(pwdBody, {
|
|
|
- onSuccess: (data) => {
|
|
|
|
|
-
|
|
|
|
|
- let { id: password_id } = data.data;
|
|
|
|
|
- setPwdID(password_id);
|
|
|
|
|
-
|
|
|
|
|
- let candidatoBody = {
|
|
|
|
|
- id: -1,
|
|
|
|
|
- //nombres,
|
|
|
|
|
- //apellidos,
|
|
|
|
|
- //sendmail: sendmail ? 1 : 0,
|
|
|
|
|
- //mail,
|
|
|
|
|
- idContrasenia: password_id,
|
|
|
|
|
- nombrepuesto,
|
|
|
|
|
- nombreEmpresa
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- candiMutation.mutate(candidatoBody, {
|
|
|
|
|
- onSuccess: (data) => {
|
|
|
|
|
|
|
+ onSuccess: (result) => {
|
|
|
|
|
+
|
|
|
|
|
+ let { id: idContrasenia } = result.data;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ let candidatos_body = key.candidatos.map((candi) => ({
|
|
|
|
|
+ "id": -1,
|
|
|
|
|
+ "nombres": candi.nombres,
|
|
|
|
|
+ "apellidos": candi.apellidos,
|
|
|
|
|
+ "mail": candi.mail,
|
|
|
|
|
+ "sendmail": 0,
|
|
|
|
|
+ "idContrasenia": idContrasenia,
|
|
|
|
|
+ "nombrepuesto": 'Senior Software',
|
|
|
|
|
+ "nombreEmpresa": 'Google'
|
|
|
|
|
+ }))
|
|
|
|
|
+
|
|
|
|
|
+ console.log(candidatos_body)
|
|
|
|
|
+
|
|
|
|
|
+ // setLoading(false);
|
|
|
|
|
+ // return;
|
|
|
|
|
|
|
|
|
|
+ queryClient.invalidateQueries('passwords')
|
|
|
|
|
+ setLoading(false);
|
|
|
|
|
+ handleClose();
|
|
|
|
|
+ handleReset();
|
|
|
|
|
+ /*
|
|
|
|
|
+
|
|
|
|
|
+ candiMutation.mutate(candidatos_body, {
|
|
|
|
|
+ onSuccess: (data) => {
|
|
|
queryClient.invalidateQueries('passwords')
|
|
queryClient.invalidateQueries('passwords')
|
|
|
toast.success("Contraseña agregada exitosamente!!")
|
|
toast.success("Contraseña agregada exitosamente!!")
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- console.log("OK LETS GO >> ", data,pwdID)
|
|
|
|
|
|
|
+ console.log("OK LETS GO >> ", data)
|
|
|
setLoading(false);
|
|
setLoading(false);
|
|
|
handleClose();
|
|
handleClose();
|
|
|
handleReset();
|
|
handleReset();
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
onError: () => {
|
|
onError: () => {
|
|
|
toast.error("Ups!! error al crear el candidato")
|
|
toast.error("Ups!! error al crear el candidato")
|
|
|
setLoading(false);
|
|
setLoading(false);
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+*/
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
onError: () => {
|
|
onError: () => {
|
|
@@ -118,13 +128,13 @@ export function Resume(props) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const getLi = (user) => {
|
|
|
|
|
- return (
|
|
|
|
|
- <li style={{ listStyleType: 'none'}}>
|
|
|
|
|
|
|
+ const getLi = (user, i) => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <li key={i} style={{ listStyleType: 'none' }}>
|
|
|
{user.nombres + " " + user.apellidos} - {user.mail}
|
|
{user.nombres + " " + user.apellidos} - {user.mail}
|
|
|
- </li>
|
|
|
|
|
|
|
+ </li>
|
|
|
)
|
|
)
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
@@ -138,17 +148,17 @@ export function Resume(props) {
|
|
|
<thead>
|
|
<thead>
|
|
|
<tr className="table_password">
|
|
<tr className="table_password">
|
|
|
<th>{"Contraseña: "}</th>
|
|
<th>{"Contraseña: "}</th>
|
|
|
- <th>{ key.pwd } - {btoa(key.pwd)}</th>
|
|
|
|
|
|
|
+ <th>{key.pwd} - {btoa(key.pwd)}</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
<tr>
|
|
<tr>
|
|
|
<td className="title_td">{"Candidatos:"}</td>
|
|
<td className="title_td">{"Candidatos:"}</td>
|
|
|
<td colSpan={2}>
|
|
<td colSpan={2}>
|
|
|
- <ul style={{ margin:0, padding:0}}>
|
|
|
|
|
- {key.candidatos.map(u => getLi(u))}
|
|
|
|
|
|
|
+ <ul style={{ margin: 0, padding: 0 }}>
|
|
|
|
|
+ {key.candidatos ? key.candidatos.map((u, i) => getLi(u, i)) : null}
|
|
|
</ul>
|
|
</ul>
|
|
|
- </td>
|
|
|
|
|
|
|
+ </td>
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
<td className="title_td">{"Puesto:"}</td>
|
|
<td className="title_td">{"Puesto:"}</td>
|