1
1
import React , { useState , useEffect } from "react"
2
2
import { toast } from "react-toastify"
3
+ import Popup from "reactjs-popup"
3
4
4
5
import { Background } from "../../styles"
5
- import { GridContainer } from "./styles"
6
+ import { GridContainer , CreateNewContainer } from "./styles"
6
7
import Api from "../../services/api"
7
8
import { useSession } from "../../store/session"
8
9
import Ombudsman from "./Ombudsman"
9
10
import Prefecture from "./Prefecture"
11
+ import CreateOmbudsmanPopup from "./CreateOmbudsmanPopup"
12
+ import CreatePrefecturePopup from "./CreatePrefecturePopup"
10
13
11
14
interface ResponseOmbudsman {
12
15
attendance : string
@@ -33,7 +36,7 @@ interface ResponsePrefecture {
33
36
}
34
37
35
38
const InformationPage : React . FC = ( ) => {
36
- const { city } = useSession ( )
39
+ const { city, profile } = useSession ( )
37
40
const [ prefecture , setPrefecture ] = useState < IPrefecture > ( )
38
41
const [ ombudsman , setOmbudsman ] = useState < IOmbudsman > ( )
39
42
@@ -65,6 +68,24 @@ const InformationPage: React.FC = () => {
65
68
66
69
return (
67
70
< Background >
71
+ { profile . role === "master" && (
72
+ < CreateNewContainer >
73
+ < Popup
74
+ trigger = { < button > Criar nova ouvidoria</ button > }
75
+ position = "center center"
76
+ modal
77
+ >
78
+ < CreateOmbudsmanPopup />
79
+ </ Popup >
80
+ < Popup
81
+ trigger = { < button > Criar nova ouvidoria</ button > }
82
+ position = "center center"
83
+ modal
84
+ >
85
+ < CreatePrefecturePopup />
86
+ </ Popup >
87
+ </ CreateNewContainer >
88
+ ) }
68
89
< GridContainer >
69
90
{ ombudsman && prefecture && (
70
91
< >
0 commit comments