Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
1801d700
Commit
1801d700
authored
4 years ago
by
Lucas Eduardo Schoenfelder
Browse files
Options
Downloads
Patches
Plain Diff
added snackbar to provide feedback
parent
ea696ba0
No related branches found
No related tags found
6 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!32
Homologa
,
!31
Fix console error
,
!30
Centraliza axios
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/ReportModal.js
+41
-44
41 additions, 44 deletions
src/Components/ReportModal.js
with
41 additions
and
44 deletions
src/Components/ReportModal.js
+
41
−
44
View file @
1801d700
...
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
...
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import
React
,
{
useContext
}
from
'
react
'
;
import
React
,
{
useContext
,
useState
}
from
'
react
'
;
import
{
Button
}
from
'
@material-ui/core
'
;
import
{
Button
}
from
'
@material-ui/core
'
;
import
Modal
from
'
@material-ui/core/Modal
'
;
import
Modal
from
'
@material-ui/core/Modal
'
;
import
Backdrop
from
'
@material-ui/core/Backdrop
'
;
import
Backdrop
from
'
@material-ui/core/Backdrop
'
;
...
@@ -28,6 +28,7 @@ import ReportUserForm from './ReportUserForm.js'
...
@@ -28,6 +28,7 @@ import ReportUserForm from './ReportUserForm.js'
import
ReportRecursoForm
from
'
./ReportRecursoForm.js
'
import
ReportRecursoForm
from
'
./ReportRecursoForm.js
'
import
ReportColecaoForm
from
'
./ReportColecaoForm.js
'
import
ReportColecaoForm
from
'
./ReportColecaoForm.js
'
import
{
postRequest
}
from
'
./HelperFunctions/getAxiosConfig
'
import
{
postRequest
}
from
'
./HelperFunctions/getAxiosConfig
'
import
SnackbarComponent
from
'
./SnackbarComponent.js
'
function
CloseModalButton
(
props
)
{
function
CloseModalButton
(
props
)
{
return
(
return
(
...
@@ -39,6 +40,7 @@ function CloseModalButton (props) {
...
@@ -39,6 +40,7 @@ function CloseModalButton (props) {
export
default
function
ReportModal
(
props
)
{
export
default
function
ReportModal
(
props
)
{
const
{
state
}
=
useContext
(
Store
)
const
{
state
}
=
useContext
(
Store
)
const
[
snackbarOpen
,
handleSnackbar
]
=
useState
(
false
)
const
handleSubmit
=
(
complaint_reason_id
,
description
)
=>
{
const
handleSubmit
=
(
complaint_reason_id
,
description
)
=>
{
const
url
=
`/complaints/`
const
url
=
`/complaints/`
...
@@ -52,7 +54,11 @@ export default function ReportModal (props) {
...
@@ -52,7 +54,11 @@ export default function ReportModal (props) {
}
}
}
}
postRequest
(
url
,
payload
,
(
data
)
=>
{
console
.
log
(
data
)},
(
error
)
=>
{
console
.
log
(
error
)})
postRequest
(
url
,
payload
,
(
data
)
=>
{
console
.
log
(
data
)
props
.
handleClose
();
handleSnackbar
(
true
);
},
(
error
)
=>
{
console
.
log
(
error
)})
}
}
...
@@ -73,49 +79,40 @@ export default function ReportModal (props) {
...
@@ -73,49 +79,40 @@ export default function ReportModal (props) {
}
}
}
}
/* const renderForm = (formType) => {
switch (formType) {
case 'colecao':
return (
<ReportCollectionForm
handleClose={props.handleClose}
handleSubmit={handleSubmit}
/>
);
break;
}
} */
return
(
return
(
<
StyledModal
<
React
.
Fragment
>
aria
-
labelledby
=
"
transition-modal-title
"
<
SnackbarComponent
snackbarOpen
=
{
snackbarOpen
}
severity
=
{
"
success
"
}
handleClose
=
{()
=>
{
handleSnackbar
(
false
)}}
text
=
{
"
Sua reclamação foi recebida.
"
}
aria
-
describedby
=
"
transition-modal-description
"
/
>
open
=
{
props
.
open
}
<
StyledModal
aria
-
labelledby
=
"
transition-modal-title
"
centered
=
"
true
"
aria
-
describedby
=
"
transition-modal-description
"
onClose
=
{
props
.
handleClose
}
open
=
{
props
.
open
}
closeAfterTransition
BackdropComponent
=
{
Backdrop
}
centered
=
"
true
"
BackdropProps
=
{{
onClose
=
{
props
.
handleClose
}
timeout
:
500
,
closeAfterTransition
}}
BackdropComponent
=
{
Backdrop
}
>
BackdropProps
=
{{
<
Fade
in
=
{
props
.
open
}
>
timeout
:
500
,
<
ReportContainer
>
}}
<
Header
>
>
<
span
style
=
{{
width
:
"
32px
"
}}
/
>
<
Fade
in
=
{
props
.
open
}
>
<
h2
>
O
que
está
acontecendo
?
<
/h2
>
<
ReportContainer
>
<
CloseModalButton
handleClose
=
{
props
.
handleClose
}
/
>
<
Header
>
<
/Header
>
<
span
style
=
{{
width
:
"
32px
"
}}
/
>
<
h2
>
O
que
está
acontecendo
?
<
/h2
>
<
Content
>
<
CloseModalButton
handleClose
=
{
props
.
handleClose
}
/
>
{
<
/Header
>
renderForm
(
props
.
form
)
}
<
Content
>
<
/Content
>
{
<
/ReportContainer
>
renderForm
(
props
.
form
)
<
/Fade
>
}
<
/StyledModal
>
<
/Content
>
<
/ReportContainer
>
<
/Fade
>
<
/StyledModal
>
<
/React.Fragment
>
)
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment