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
ef751e91
Commit
ef751e91
authored
Aug 13, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update didam
parent
586128e4
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
286 additions
and
300 deletions
+286
-300
index.js
src/api/index.js
+18
-2
CreateApprovalMatrix.js
src/container/ApprovalMatrix/CreateApprovalMatrix.js
+4
-1
User.js
src/container/Otorisasi/User.js
+45
-18
AddUser.js
src/container/Otorisasi/User/AddUser.js
+107
-139
EditUser.js
src/container/Otorisasi/User/EditUser.js
+112
-140
No files found.
src/api/index.js
View file @
ef751e91
...
@@ -95,7 +95,16 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -95,7 +95,16 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
const
createAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/create_approval_matrix'
,
body
)
const
createAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/create_approval_matrix'
,
body
)
const
updateAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/update_approval_matrix'
,
body
)
const
updateAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/update_approval_matrix'
,
body
)
//User
const
getUser
=
()
=>
api
.
get
(
'user/get_all_user'
)
const
getDetailUser
=
(
userId
)
=>
api
.
get
(
`user/get_user_by_id/
${
userId
}
`
)
const
searchUser
=
(
body
)
=>
api
.
post
(
'user/search_user'
,
body
)
const
createUser
=
(
body
)
=>
api
.
get
(
'user/create_user'
,
body
)
const
updateUser
=
(
body
)
=>
api
.
get
(
'user/update_user'
,
body
)
const
deleteUser
=
(
userId
)
=>
api
.
get
(
`user/delete_user/
${
userId
}
`
)
//Template
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
// ------
// ------
// STEP 3
// STEP 3
// ------
// ------
...
@@ -132,7 +141,14 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -132,7 +141,14 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
updatePerusahaan
,
updatePerusahaan
,
getApprovedByAM
,
getApprovedByAM
,
createAM
,
createAM
,
updateAM
updateAM
,
getUser
,
getDetailUser
,
searchUser
,
createUser
,
updateUser
,
deleteUser
,
downloadTemplate
}
}
}
}
...
...
src/container/ApprovalMatrix/CreateApprovalMatrix.js
View file @
ef751e91
...
@@ -57,6 +57,8 @@ export default class CreateApprovalMatrix extends Component {
...
@@ -57,6 +57,8 @@ export default class CreateApprovalMatrix extends Component {
// operator: '',
// operator: '',
startDate
:
''
,
startDate
:
''
,
endDate
:
''
,
endDate
:
''
,
userData
:
[],
value
:
null
}
}
}
}
...
@@ -80,7 +82,7 @@ export default class CreateApprovalMatrix extends Component {
...
@@ -80,7 +82,7 @@ export default class CreateApprovalMatrix extends Component {
options
:
userData
,
options
:
userData
,
getOptionLabel
:
(
option
)
=>
option
.
fullname
,
getOptionLabel
:
(
option
)
=>
option
.
fullname
,
};
};
this
.
setState
({
approvedBy
:
defaultProps
,
userData
:
response
.
data
.
data
})
this
.
setState
({
approvedBy
:
defaultProps
,
userData
:
response
.
data
.
data
,
value
:
userData
[
0
]
})
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
alert
(
response
.
data
.
message
)
}
}
...
@@ -205,6 +207,7 @@ export default class CreateApprovalMatrix extends Component {
...
@@ -205,6 +207,7 @@ export default class CreateApprovalMatrix extends Component {
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
userId
:
newInputValue
.
user_id
},
()
=>
console
.
log
(
this
.
state
.
userId
))}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
userId
:
newInputValue
.
user_id
},
()
=>
console
.
log
(
this
.
state
.
userId
))}
debug
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"debug"
margin
=
"normal"
/>
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"debug"
margin
=
"normal"
/>
}
value
=
{
this
.
state
.
value
}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/Otorisasi/User.js
View file @
ef751e91
...
@@ -4,8 +4,8 @@ import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/
...
@@ -4,8 +4,8 @@ import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/
import
SearchIcon
from
'@material-ui/icons/Search'
;
import
SearchIcon
from
'@material-ui/icons/Search'
;
import
Images
from
"../../assets/Images"
;
import
Images
from
"../../assets/Images"
;
import
MUIDataTable
from
"mui-datatables"
;
import
MUIDataTable
from
"mui-datatables"
;
import
Add
Role
from
'./UserRole/AddRole
'
;
import
Add
User
from
'./User/AddUser
'
;
import
Edit
Role
from
'./UserRole/EditRole
'
import
Edit
User
from
'./User/EditUser
'
import
api
from
"../../api"
;
import
api
from
"../../api"
;
import
{
titleCase
}
from
"../../library/Utils"
;
import
{
titleCase
}
from
"../../library/Utils"
;
import
{
InputAdornment
,
TextField
}
from
"@material-ui/core"
;
import
{
InputAdornment
,
TextField
}
from
"@material-ui/core"
;
...
@@ -18,7 +18,7 @@ export default class UserRole extends Component {
...
@@ -18,7 +18,7 @@ export default class UserRole extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
list
Role
:
[],
list
User
:
[],
indexData
:
{},
indexData
:
{},
add
:
false
,
add
:
false
,
edit
:
false
edit
:
false
...
@@ -26,7 +26,7 @@ export default class UserRole extends Component {
...
@@ -26,7 +26,7 @@ export default class UserRole extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
get
Role
()
this
.
get
User
()
}
}
closeEdit
()
{
closeEdit
()
{
...
@@ -37,27 +37,54 @@ export default class UserRole extends Component {
...
@@ -37,27 +37,54 @@ export default class UserRole extends Component {
this
.
setState
({
add
:
false
})
this
.
setState
({
add
:
false
})
}
}
get
Role
()
{
get
User
()
{
api
.
create
().
get
Role
().
then
((
response
)
=>
{
api
.
create
().
get
User
().
then
((
response
)
=>
{
// console.log(response)
// console.log(response)
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
// console.log(response.data.data)
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
role_id
,
item
.
role_name
,
item
.
access
,
item
.
status
]
return
[
index
,
item
.
user_id
,
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
company
,
item
.
status
]
})
})
console
.
log
(
listData
)
//
console.log(listData)
this
.
setState
({
list
Role
:
listData
})
this
.
setState
({
list
User
:
listData
})
// this.setState({list
Role
: response.data.data}, () => {
// this.setState({list
User
: response.data.data}, () => {
// console.log(this.state.list
Role
)
// console.log(this.state.list
User
)
// })
// })
}
else
{
alert
(
response
.
data
.
message
)
}
// console.log(response.data.data)
})
}
searchUser
()
{
let
payload
=
{
"keyword"
:
this
.
state
.
search
}
api
.
create
().
searchUser
(
payload
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
user_id
,
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
company
,
item
.
status
]
})
this
.
setState
({
listUser
:
listData
})
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
alert
(
response
.
data
.
message
)
}
}
console
.
log
(
response
.
data
.
data
)
})
})
}
}
_handleKeyDown
(
e
)
{
if
(
e
.
key
===
'Enter'
)
{
if
(
this
.
state
.
search
.
length
>
0
)
{
this
.
searchUser
()
}
else
{
this
.
getRole
()
}
}
}
render
()
{
render
()
{
const
columns
=
[{
const
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -160,9 +187,9 @@ export default class UserRole extends Component {
...
@@ -160,9 +187,9 @@ export default class UserRole extends Component {
onChange
=
{(
e
)
=>
{
onChange
=
{(
e
)
=>
{
this
.
setState
({
search
:
e
.
target
.
value
},
()
=>
{
this
.
setState
({
search
:
e
.
target
.
value
},
()
=>
{
if
(
this
.
state
.
search
.
length
>
0
)
{
if
(
this
.
state
.
search
.
length
>
0
)
{
this
.
search
Role
()
this
.
search
User
()
}
else
{
}
else
{
this
.
get
Role
()
this
.
get
User
()
}
}
});
});
}}
}}
...
@@ -190,7 +217,7 @@ export default class UserRole extends Component {
...
@@ -190,7 +217,7 @@ export default class UserRole extends Component {
<
div
style
=
{{
padding
:
25
}}
>
<
div
style
=
{{
padding
:
25
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
data
=
{
data
}
data
=
{
this
.
state
.
listUser
}
columns
=
{
columns
}
columns
=
{
columns
}
options
=
{
options
}
options
=
{
options
}
/
>
/
>
...
@@ -198,13 +225,13 @@ export default class UserRole extends Component {
...
@@ -198,13 +225,13 @@ export default class UserRole extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
this
.
state
.
add
&&
(
{
this
.
state
.
add
&&
(
<
Add
Role
<
Add
User
onClickClose
=
{
this
.
closeAdd
.
bind
(
this
)}
onClickClose
=
{
this
.
closeAdd
.
bind
(
this
)}
data
=
{
this
.
state
.
indexData
}
data
=
{
this
.
state
.
indexData
}
/
>
/
>
)}
)}
{
this
.
state
.
edit
&&
(
{
this
.
state
.
edit
&&
(
<
Edit
Role
<
Edit
User
onClickClose
=
{
this
.
closeEdit
.
bind
(
this
)}
onClickClose
=
{
this
.
closeEdit
.
bind
(
this
)}
data
=
{
this
.
state
.
indexData
}
data
=
{
this
.
state
.
indexData
}
/
>
/
>
...
...
src/container/Otorisasi/User/AddUser.js
View file @
ef751e91
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/User/EditUser.js
View file @
ef751e91
This diff is collapsed.
Click to expand it.
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