Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rede De Mentores
Frontend
Commits
52e7b153
Commit
52e7b153
authored
Jun 29, 2020
by
johnnyloreano
Browse files
save
parent
70783075
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/RedeHorarioCard/RedeHorarioCard.jsx
View file @
52e7b153
...
...
@@ -13,7 +13,7 @@ function RedeHorarioCard({ mentoria }) {
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
[
timeInfo
,
setTimeInfo
]
=
React
.
useState
(
''
);
const
[
dateInfo
,
setDateInfo
]
=
React
.
useState
(
''
);
const
[
mentoriaSelect
,
setMentoriaSelect
]
=
React
.
useState
(
mentoria
);
const
{
enqueueSnackbar
}
=
useSnackbar
();
...
...
@@ -21,7 +21,7 @@ function RedeHorarioCard({ mentoria }) {
enqueueSnackbar
(
msg
,
{
variant
,
autoHideDuration
});
};
const
{
dateTime
}
=
mentoria
;
const
{
dateTime
}
=
mentoria
Select
;
const
sortedTimes
=
dateTime
.
sort
((
dateTimeA
,
dateTimeB
)
=>
dateTimeA
.
dayOfTheMonth
.
split
(
'
/
'
)[
0
]
-
dateTimeB
.
dayOfTheMonth
.
split
(
'
/
'
)[
0
])
.
sort
((
dateTimeA
,
dateTimeB
)
=>
dateTimeA
.
dayOfTheMonth
.
split
(
'
/
'
)[
1
]
-
dateTimeB
.
dayOfTheMonth
.
split
(
'
/
'
)[
1
]);
...
...
@@ -59,17 +59,23 @@ function RedeHorarioCard({ mentoria }) {
});
function
onConfirm
(
data
)
{
const
newMentoria
=
{
...
mentoriaSelect
};
newMentoria
.
datetime
.
forEach
(
element
=>
{
console
.
log
(
element
);
});
console
.
log
(
data
.
date
);
// DIA DDO MES ANO DIA
console
.
log
(
data
.
hour
);
// HORARIO DO NEGÓCIO AHAAAAAAAAAAAAAAAA
const
token
=
sessionStorage
.
getItem
(
'
token
'
);
const
headers
=
{
headers
:
{
Authorization
:
`Bearer
${
token
}
`
}
};
marcarMentoria
(
headers
,
{
idMentoria
:
mentoria
.
idMentoria
,
choice
:
data
})
.
then
((
res
)
=>
(
res
.
status
===
200
?
enqueue
(
'
Mentoria cadastrada com sucesso
'
,
'
success
'
)
:
console
.
log
(
'
Falha ao marcar mentoria. Código:
'
,
res
.
status
)))
.
catch
((
err
)
=>
{
enqueue
(
'
Erro ao marcar mentoria
'
);
console
.
error
(
err
);
});
//
marcarMentoria(headers, { idMentoria: mentoria.idMentoria, choice: data })
//
.then((res) => (
//
res.status === 200
//
? enqueue('Mentoria cadastrada com sucesso', 'success')
//
: console.log('Falha ao marcar mentoria. Código: ', res.status)))
//
.catch((err) => {
//
enqueue('Erro ao marcar mentoria');
//
console.error(err);
//
});
}
return
(
...
...
@@ -77,10 +83,10 @@ function RedeHorarioCard({ mentoria }) {
<>
<
RedeMarcarMentoria
opened
=
{
open
}
image
=
{
`
${
urlFiles
}
/
${
mentoria
.
image
}
`
}
title
=
{
mentoria
.
title
}
userName
=
{
mentoria
.
mentorInfos
.
name
}
userImage
=
{
`
${
urlFiles
}
/
${
mentoria
.
mentorInfos
.
image
}
`
}
image
=
{
`
${
urlFiles
}
/
${
mentoria
Select
.
image
}
`
}
title
=
{
mentoria
Select
.
title
}
userName
=
{
mentoria
Select
.
mentorInfos
.
name
}
userImage
=
{
`
${
urlFiles
}
/
${
mentoria
Select
.
mentorInfos
.
image
}
`
}
date
=
{
dateInfo
}
hour
=
{
timeInfo
}
onClose
=
{
()
=>
setOpen
(
false
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment