Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
2eb7878c
Commit
2eb7878c
authored
Aug 28, 2020
by
EKSAD
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
permission button user & user role
parent
6903d5b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
130 deletions
+190
-130
Login.js
src/container/Login.js
+1
-1
ReportItems.js
src/container/MasterData/ReportItems.js
+2
-2
User.js
src/container/Otorisasi/User.js
+129
-97
UserRole.js
src/container/Otorisasi/UserRole.js
+58
-30
No files found.
src/container/Login.js
View file @
2eb7878c
...
...
@@ -112,7 +112,7 @@ class Login extends Component {
}
this
.
props
.
history
.
push
(
'/home/beranda'
)
}
else
{
if
(
response
.
data
.
message
==
'
Incorrect password.
'
)
{
if
(
response
.
data
.
message
==
'
Password is Not Correct
'
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
response
.
data
.
message
})
}
else
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
response
.
data
.
message
})
...
...
src/container/MasterData/ReportItems.js
View file @
2eb7878c
...
...
@@ -838,7 +838,7 @@ export default class ReportItems extends Component {
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"
download
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"
visualisasi
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Visualization'
}
data
-
for
=
"visualisasi"
>
<
button
style
=
{{
...
...
@@ -852,7 +852,7 @@ export default class ReportItems extends Component {
<
img
src
=
{
Images
.
visualisasi
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"
visualisasi
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"
tambah
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Add New'
}
data
-
for
=
"tambah"
>
<
button
...
...
src/container/Otorisasi/User.js
View file @
2eb7878c
...
...
@@ -34,12 +34,16 @@ export default class UserRole extends Component {
buttonError
:
false
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
messageAlert
:
''
,
buttonCreate
:
false
,
buttonEdit
:
false
,
load
:
false
}
}
componentDidMount
()
{
this
.
getUser
()
this
.
getPermission
()
}
closeEdit
()
{
...
...
@@ -72,6 +76,26 @@ export default class UserRole extends Component {
})
}
getPermission
()
{
let
payload
=
{
menu
:
"user"
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
buttonCreate
:
response
.
data
.
data
.
create
,
buttonEdit
:
response
.
data
.
data
.
edit
,
load
:
true
})
}
else
{
this
.
setState
({
load
:
true
})
}
}
})
}
searchUser
()
{
let
payload
=
{
"keyword"
:
this
.
state
.
search
...
...
@@ -355,6 +379,7 @@ export default class UserRole extends Component {
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
/* {tableMeta.rowData[6] === "Active" ? */
}
{
this
.
state
.
buttonEdit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
...
...
@@ -366,6 +391,7 @@ export default class UserRole extends Component {
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
)}
{
/* :
null
} */
}
...
...
@@ -450,15 +476,44 @@ export default class UserRole extends Component {
<
/Alert
>
<
/Snackbar
>
{
this
.
state
.
visibleUser
?
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
118
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
,
}}
>
Master
Data
-
User
<
/label
>
{
/* <div style={{ width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{ width: '50%', backgroundColor: 'white', padding: 10, borderRadius: 7.5 }}>
<TextField
id="input-with-icon-textfield"
name="search"
{
this
.
state
.
load
&&
(
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
118
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
,
}}
>
Master
Data
-
User
<
/label
>
{
/* <div style={{ width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{ width: '50%', backgroundColor: 'white', padding: 10, borderRadius: 7.5 }}>
<TextField
id="input-with-icon-textfield"
name="search"
value={this.state.search}
placeholder={'Search'}
onChange={(e) => {
this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) {
this.searchUser()
} else {
this.getUser()
}
});
}}
onKeyDown={(e) => this._handleKeyDown(e)}
style={{ width: '100%', borderBottomWidth: 0, borderBottomColor: 'red' }}
InputProps={{
style: { fontFamily: 'nunito', borderBottomColor: 'white' },
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/>
</div>
</div> */
}
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
<
img
src
=
{
Images
.
searchBlack
}
style
=
{{
marginRight
:
10
}}
/
>
<
InputBase
style
=
{{
width
:
'100%'
}}
placeholder
=
"Search"
value
=
{
this
.
state
.
search
}
placeholder={'Search'}
onChange
=
{(
e
)
=>
{
this
.
setState
({
search
:
e
.
target
.
value
},
()
=>
{
if
(
this
.
state
.
search
.
length
>
0
)
{
...
...
@@ -468,97 +523,74 @@ export default class UserRole extends Component {
}
});
}}
onKeyDown={(e) => this._handleKeyDown(e)}
style={{ width: '100%', borderBottomWidth: 0, borderBottomColor: 'red' }}
InputProps={{
style: { fontFamily: 'nunito', borderBottomColor: 'white' },
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
inputProps
=
{{
'aria-label'
:
'naked'
}}
/
>
<
/div
>
</div> */
}
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
<
img
src
=
{
Images
.
searchBlack
}
style
=
{{
marginRight
:
10
}}
/
>
<
InputBase
style
=
{{
width
:
'100%'
}}
placeholder
=
"Search"
value
=
{
this
.
state
.
search
}
onChange
=
{(
e
)
=>
{
this
.
setState
({
search
:
e
.
target
.
value
},
()
=>
{
if
(
this
.
state
.
search
.
length
>
0
)
{
this
.
searchUser
()
}
else
{
this
.
getUser
()
}
});
}}
inputProps
=
{{
'aria-label'
:
'naked'
}}
/
>
<
/div
>
{
/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */
}
<
div
style
=
{{
width
:
'20%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadFile
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTables
()}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Create'
}
data
-
for
=
"create"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
add
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"create"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */
}
<
div
style
=
{{
width
:
'20%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadFile
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/a
>
)}
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTables
()}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Create'
}
data
-
for
=
"create"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
add
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/a
>
)}
<
ReactTooltip
border
=
{
true
}
id
=
"create"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
<
/div
>
)}
<
div
style
=
{{
padding
:
25
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
...
...
src/container/Otorisasi/UserRole.js
View file @
2eb7878c
...
...
@@ -32,12 +32,16 @@ class UserRole extends Component {
search
:
''
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
messageAlert
:
''
,
buttonCreate
:
false
,
buttonEdit
:
false
,
load
:
false
}
}
componentDidMount
()
{
this
.
getRole
()
this
.
getPermission
()
}
closeEdit
()
{
...
...
@@ -75,6 +79,26 @@ class UserRole extends Component {
})
}
getPermission
()
{
let
payload
=
{
menu
:
"user role"
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
buttonCreate
:
response
.
data
.
data
.
create
,
buttonEdit
:
response
.
data
.
data
.
edit
,
load
:
true
})
}
else
{
this
.
setState
({
load
:
true
})
}
}
})
}
searchRole
()
{
let
payload
=
{
"keyword"
:
this
.
state
.
search
...
...
@@ -130,23 +154,25 @@ class UserRole extends Component {
console
.
log
(
tableMeta
);
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
}}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick
=
{()
=>
this
.
setState
({
edit
:
true
,
indexData
:
tableMeta
.
rowData
[
1
]
})}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
2
]
!==
"superadmin"
?
<
img
src
=
{
Images
.
editCopy
}
/>
:
null
}
<
/div
>
{
this
.
state
.
buttonEdit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
}}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick
=
{()
=>
this
.
setState
({
edit
:
true
,
indexData
:
tableMeta
.
rowData
[
1
]
})}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
2
]
!==
"superadmin"
?
<
img
src
=
{
Images
.
editCopy
}
/>
:
null
}
<
/div
>
<
/button
>
<
/button
>
)}
<
/div
>
);
}
...
...
@@ -228,19 +254,21 @@ class UserRole extends Component {
<
/div
>
{
/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */
}
<
div
style
=
{{
width
:
'20%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
}}
>
<
a
data
-
tip
=
{
'Create'
}
data
-
for
=
"create"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
add
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/a
>
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Create'
}
data
-
for
=
"create"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
add
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/a
>
)}
<
ReactTooltip
border
=
{
true
}
id
=
"create"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
...
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