|
@@ -80,16 +80,20 @@ function Candidatos(props) {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<FormikProvider style={{ padding: 25 }} value={formik}>
|
|
<FormikProvider style={{ padding: 25 }} value={formik}>
|
|
|
- <Typography style={{ padding: !home? 5: 0, marginBottom: !home? 15: 0 }}>
|
|
|
|
|
- { home ? "": "Ingresa la informacion del candidato" }
|
|
|
|
|
|
|
+ <Typography style={{ padding: !home ? 5 : 0, marginBottom: !home ? 15 : 0 }}>
|
|
|
|
|
+ {home ? "" : "Ingresa la informacion del candidato"}
|
|
|
</Typography>
|
|
</Typography>
|
|
|
<Divider />
|
|
<Divider />
|
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
<Form autoComplete="off" noValidate onSubmit={handleSubmit}>
|
|
|
<Stack spacing={3}>
|
|
<Stack spacing={3}>
|
|
|
|
|
|
|
|
- <Stack style={{ paddingTop:!home? 15 :0, background:'' }} direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
|
|
|
|
|
+ <Stack
|
|
|
|
|
+ style={{ paddingTop: !home ? 15 : 0, paddingBottom: !home ? 15 : 0 }}
|
|
|
|
|
+ direction={{ xs: 'column', sm: 'row' }}
|
|
|
|
|
+ spacing={2}>
|
|
|
|
|
+
|
|
|
<TextField
|
|
<TextField
|
|
|
- style={{ display: home ?'none': 'block',background:'' }}
|
|
|
|
|
|
|
+ style={{ display: home ? 'none' : 'block', background: '' }}
|
|
|
label="Nombre"
|
|
label="Nombre"
|
|
|
{...getFieldProps('nombres')}
|
|
{...getFieldProps('nombres')}
|
|
|
error={Boolean(touched.nombres && errors.nombres)}
|
|
error={Boolean(touched.nombres && errors.nombres)}
|
|
@@ -97,7 +101,7 @@ function Candidatos(props) {
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<TextField
|
|
<TextField
|
|
|
- style={{ display: home ?'none': 'block' }}
|
|
|
|
|
|
|
+ style={{ display: home ? 'none' : 'block' }}
|
|
|
label="Apellidos"
|
|
label="Apellidos"
|
|
|
{...getFieldProps('apellidos')}
|
|
{...getFieldProps('apellidos')}
|
|
|
error={Boolean(touched.apellidos && errors.apellidos)}
|
|
error={Boolean(touched.apellidos && errors.apellidos)}
|
|
@@ -105,9 +109,9 @@ function Candidatos(props) {
|
|
|
/>
|
|
/>
|
|
|
</Stack>
|
|
</Stack>
|
|
|
|
|
|
|
|
- <Stack style={{ marginTop:0}} direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
|
|
|
|
|
+ <Stack direction={{ xs: 'column', sm: 'row' }} >
|
|
|
<TextField
|
|
<TextField
|
|
|
- style={{ display: home ?'none': 'block' }}
|
|
|
|
|
|
|
+ style={{ display: home ? 'none' : 'block' }}
|
|
|
fullWidth
|
|
fullWidth
|
|
|
type="email"
|
|
type="email"
|
|
|
label="Correo Electronico"
|
|
label="Correo Electronico"
|
|
@@ -169,7 +173,7 @@ export function Loading() {
|
|
|
|
|
|
|
|
function ModalForm(props) {
|
|
function ModalForm(props) {
|
|
|
|
|
|
|
|
- let { pwdinfo, closeModal,home } = props
|
|
|
|
|
|
|
+ let { pwdinfo, closeModal, home } = props
|
|
|
const auth = useSelector((state) => state.token)
|
|
const auth = useSelector((state) => state.token)
|
|
|
let [candidatos, setCandidatos] = React.useState([]);
|
|
let [candidatos, setCandidatos] = React.useState([]);
|
|
|
let [password, setPassword] = React.useState();
|
|
let [password, setPassword] = React.useState();
|
|
@@ -194,8 +198,6 @@ function ModalForm(props) {
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
React.useEffect(() => {
|
|
|
let { pwd, plz } = pwdinfo;
|
|
let { pwd, plz } = pwdinfo;
|
|
|
- console.log('PWDINOF',{pwd,plz})
|
|
|
|
|
-
|
|
|
|
|
let rest = new Service(`/contrasenia/${home ? pwd : btoa(pwd)}/${plz}`)
|
|
let rest = new Service(`/contrasenia/${home ? pwd : btoa(pwd)}/${plz}`)
|
|
|
|
|
|
|
|
rest.getQuery(auth.token)
|
|
rest.getQuery(auth.token)
|
|
@@ -203,7 +205,7 @@ function ModalForm(props) {
|
|
|
|
|
|
|
|
let json_data = resp;
|
|
let json_data = resp;
|
|
|
let mapCandi = resp.data.candidatospwds.map(pwd => {
|
|
let mapCandi = resp.data.candidatospwds.map(pwd => {
|
|
|
- let { apellidos, nombre, mail,id } = pwd.candi
|
|
|
|
|
|
|
+ let { apellidos, nombre, mail, id } = pwd.candi
|
|
|
return { nombres: nombre, apellidos, mail, id }
|
|
return { nombres: nombre, apellidos, mail, id }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -222,7 +224,7 @@ function ModalForm(props) {
|
|
|
})
|
|
})
|
|
|
.catch(error => console.log(error))
|
|
.catch(error => console.log(error))
|
|
|
|
|
|
|
|
- }, [auth.token, pwdinfo, reset,home])
|
|
|
|
|
|
|
+ }, [auth.token, pwdinfo, reset, home])
|
|
|
|
|
|
|
|
const saveCandidato = async (body) => {
|
|
const saveCandidato = async (body) => {
|
|
|
let rest = new Service('/passwordcandidato/candidato')
|
|
let rest = new Service('/passwordcandidato/candidato')
|
|
@@ -231,11 +233,12 @@ function ModalForm(props) {
|
|
|
|
|
|
|
|
function onSubmit(fields) {
|
|
function onSubmit(fields) {
|
|
|
|
|
|
|
|
- let candi_body = candidatos.map( c => {
|
|
|
|
|
- return {...c,
|
|
|
|
|
|
|
+ let candi_body = candidatos.map(c => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...c,
|
|
|
'nombrepuesto': 'test',
|
|
'nombrepuesto': 'test',
|
|
|
- 'nombreEmpresa' : 'dit',
|
|
|
|
|
- "idContrasenia" : password.id,
|
|
|
|
|
|
|
+ 'nombreEmpresa': 'dit',
|
|
|
|
|
+ "idContrasenia": password.id,
|
|
|
"sendmail": 1,
|
|
"sendmail": 1,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -257,10 +260,9 @@ function ModalForm(props) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
rest.putQuery(body_req, auth.token)
|
|
rest.putQuery(body_req, auth.token)
|
|
|
- .then( async _result => {
|
|
|
|
|
- queryClient.invalidateQueries('passwords')
|
|
|
|
|
|
|
+ .then(async _result => {
|
|
|
|
|
|
|
|
- //TODO: insert into passwordcanidato/candidato
|
|
|
|
|
|
|
+ queryClient.invalidateQueries('passwords')
|
|
|
await saveCandidato(candi_body)
|
|
await saveCandidato(candi_body)
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -287,16 +289,18 @@ function ModalForm(props) {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Row>
|
|
<Row>
|
|
|
- <Col>
|
|
|
|
|
- <form style={{ padding: !home? 20: 0, maxWidth: 950 }} onSubmit={handleSubmit(onSubmit)}>
|
|
|
|
|
|
|
+ <Col >
|
|
|
|
|
+ <form style={{ padding: !home ? 20 : 0, maxWidth: 950 }} onSubmit={handleSubmit(onSubmit)}>
|
|
|
<Stack spacing={4}>
|
|
<Stack spacing={4}>
|
|
|
|
|
|
|
|
<TextField
|
|
<TextField
|
|
|
{...register('pwd')}
|
|
{...register('pwd')}
|
|
|
variant="filled"
|
|
variant="filled"
|
|
|
- disabled
|
|
|
|
|
type="text"
|
|
type="text"
|
|
|
label="Contraseña Cifrada"
|
|
label="Contraseña Cifrada"
|
|
|
|
|
+ InputProps={{
|
|
|
|
|
+ readOnly: home
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
|
@@ -306,11 +310,13 @@ function ModalForm(props) {
|
|
|
variant="filled"
|
|
variant="filled"
|
|
|
value={password ? atob(password.pwd) : ""}
|
|
value={password ? atob(password.pwd) : ""}
|
|
|
type="text"
|
|
type="text"
|
|
|
- disabled
|
|
|
|
|
|
|
+ InputProps={{
|
|
|
|
|
+ readOnly: home
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
- !home ?
|
|
|
|
|
|
|
+ !home ?
|
|
|
<FormControlLabel
|
|
<FormControlLabel
|
|
|
label="Activo?"
|
|
label="Activo?"
|
|
|
control={
|
|
control={
|
|
@@ -378,7 +384,7 @@ function ModalForm(props) {
|
|
|
</Controller>
|
|
</Controller>
|
|
|
</LocalizationProvider>
|
|
</LocalizationProvider>
|
|
|
|
|
|
|
|
- { !home?
|
|
|
|
|
|
|
+ {!home ?
|
|
|
<DialogActions style={{ paddingTop: 25, 'justifyContent': "flex-start" }}>
|
|
<DialogActions style={{ paddingTop: 25, 'justifyContent': "flex-start" }}>
|
|
|
<Button onClick={() => closeModal(false)}>
|
|
<Button onClick={() => closeModal(false)}>
|
|
|
Cerrar
|
|
Cerrar
|
|
@@ -386,16 +392,16 @@ function ModalForm(props) {
|
|
|
<Button type="submit" style={{ color: 'white', background: 'var(--main)' }} >
|
|
<Button type="submit" style={{ color: 'white', background: 'var(--main)' }} >
|
|
|
Guardar
|
|
Guardar
|
|
|
</Button>
|
|
</Button>
|
|
|
- </DialogActions> :
|
|
|
|
|
|
|
+ </DialogActions> :
|
|
|
|
|
|
|
|
- <DialogActions
|
|
|
|
|
|
|
+ <DialogActions
|
|
|
style={{
|
|
style={{
|
|
|
justifyContent: "flex-start",
|
|
justifyContent: "flex-start",
|
|
|
}} >
|
|
}} >
|
|
|
- <Button onClick={() => {
|
|
|
|
|
|
|
+ <Button onClick={() => {
|
|
|
console.log('close modal')
|
|
console.log('close modal')
|
|
|
console.log(closeModal)
|
|
console.log(closeModal)
|
|
|
- closeModal(true)
|
|
|
|
|
|
|
+ closeModal(true)
|
|
|
}}>
|
|
}}>
|
|
|
Cerrar
|
|
Cerrar
|
|
|
</Button>
|
|
</Button>
|
|
@@ -407,7 +413,7 @@ function ModalForm(props) {
|
|
|
</form>
|
|
</form>
|
|
|
<Toaster position="bottom-right" />
|
|
<Toaster position="bottom-right" />
|
|
|
</Col>
|
|
</Col>
|
|
|
- <Col>
|
|
|
|
|
|
|
+ <Col >
|
|
|
<Candidatos
|
|
<Candidatos
|
|
|
home={home}
|
|
home={home}
|
|
|
add={addCandidato}
|
|
add={addCandidato}
|