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
92e9e0de
Commit
92e9e0de
authored
Aug 19, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkbox
parent
cafd8bd4
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
239 additions
and
154 deletions
+239
-154
AddUser.js
src/container/Otorisasi/User/AddUser.js
+124
-89
EditUser.js
src/container/Otorisasi/User/EditUser.js
+82
-50
UserRole.js
src/container/Otorisasi/UserRole.js
+2
-1
Profile.js
src/container/Profile.js
+31
-14
No files found.
src/container/Otorisasi/User/AddUser.js
View file @
92e9e0de
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/User/EditUser.js
View file @
92e9e0de
...
@@ -20,6 +20,16 @@ const CustomCheckbox = withStyles({
...
@@ -20,6 +20,16 @@ const CustomCheckbox = withStyles({
checked
:
{},
checked
:
{},
})((
props
)
=>
<
Checkbox
color
=
"default"
{...
props
}
/>
)
;
})((
props
)
=>
<
Checkbox
color
=
"default"
{...
props
}
/>
)
;
const
CustomCheckboxDisabled
=
withStyles
({
root
:
{
color
:
'#d5d5d5'
,
'&$checked'
:
{
color
:
'#d5d5d5'
,
},
},
checked
:
{},
})((
props
)
=>
<
Checkbox
color
=
"default"
{...
props
}
/>
)
;
export
default
class
EditUser
extends
Component
{
export
default
class
EditUser
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -218,21 +228,32 @@ export default class EditUser extends Component {
...
@@ -218,21 +228,32 @@ export default class EditUser extends Component {
// <li>
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)?
{
R
.
isNil
(
data
.
children
)
?
null
null
:
:
data
.
children
.
length
<
1
?
data
.
children
.
length
<
1
?
null
null
:
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span
>
<
/span
>
}
}
<
span
>
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/>
:
<
CustomCheckbox
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/
>
/
>
}
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
<
/div
>
...
@@ -246,49 +267,49 @@ export default class EditUser extends Component {
...
@@ -246,49 +267,49 @@ export default class EditUser extends Component {
}
}
handleCollapse
(
item
)
{
handleCollapse
(
item
)
{
let
path
=
this
.
searchIt
({
children
:
this
.
state
.
listCompany
},
item
.
id
)
let
path
=
this
.
searchIt
({
children
:
this
.
state
.
listCompany
},
item
.
id
)
let
listCompany
=
this
.
state
.
listCompany
let
listCompany
=
this
.
state
.
listCompany
let
arrayPath
=
[]
let
arrayPath
=
[]
if
(
path
.
length
>
1
)
{
if
(
path
.
length
>
1
)
{
arrayPath
=
path
.
split
(
'-'
);
arrayPath
=
path
.
split
(
'-'
);
arrayPath
=
arrayPath
.
map
((
item
)
=>
{
return
item
})
arrayPath
=
arrayPath
.
map
((
item
)
=>
{
return
item
})
}
else
{
}
else
{
arrayPath
.
push
(
path
)
arrayPath
.
push
(
path
)
}
}
let
pathSelect
=
null
let
pathSelect
=
null
if
(
arrayPath
.
length
==
1
)
{
if
(
arrayPath
.
length
==
1
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]]
}
else
if
(
arrayPath
.
length
==
2
)
{
}
else
if
(
arrayPath
.
length
==
2
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]]
}
else
if
(
arrayPath
.
length
==
3
)
{
}
else
if
(
arrayPath
.
length
==
3
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]]
}
else
if
(
arrayPath
.
length
==
4
)
{
}
else
if
(
arrayPath
.
length
==
4
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]]
}
else
if
(
arrayPath
.
length
==
5
)
{
}
else
if
(
arrayPath
.
length
==
5
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]]
}
else
if
(
arrayPath
.
length
==
6
)
{
}
else
if
(
arrayPath
.
length
==
6
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]].
children
[
arrayPath
[
5
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]].
children
[
arrayPath
[
5
]]
}
else
if
(
arrayPath
.
length
==
7
)
{
}
else
if
(
arrayPath
.
length
==
7
)
{
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]].
children
[
arrayPath
[
5
]].
children
[
arrayPath
[
6
]]
pathSelect
=
listCompany
[
arrayPath
[
0
]].
children
[
arrayPath
[
1
]].
children
[
arrayPath
[
2
]].
children
[
arrayPath
[
3
]].
children
[
arrayPath
[
4
]].
children
[
arrayPath
[
5
]].
children
[
arrayPath
[
6
]]
}
}
pathSelect
.
collapse
=
!
pathSelect
.
collapse
pathSelect
.
collapse
=
!
pathSelect
.
collapse
// console.log(pathSelect.collapse)
// console.log(pathSelect.collapse)
this
.
setState
({
listCompany
},
()
=>
console
.
log
(
pathSelect
))
this
.
setState
({
listCompany
},
()
=>
console
.
log
(
pathSelect
))
}
}
searchIt
=
(
node
,
search
,
path
=
''
,
position
=
0
)
=>
{
searchIt
=
(
node
,
search
,
path
=
''
,
position
=
0
)
=>
{
if
(
node
.
id
&&
node
.
id
===
search
)
{
return
path
!==
''
?
`
${
path
}
-
${
position
}
`
:
position
;
}
if
(
node
.
id
&&
node
.
id
===
search
)
{
return
path
!==
''
?
`
${
path
}
-
${
position
}
`
:
position
;
}
if
(
!
node
.
children
)
{
return
false
}
if
(
!
node
.
children
)
{
return
false
}
const
index
=
node
.
children
.
findIndex
((
x
)
=>
x
.
id
&&
x
.
id
===
search
);
const
index
=
node
.
children
.
findIndex
((
x
)
=>
x
.
id
&&
x
.
id
===
search
);
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
return
path
!==
''
?
`
${
path
}
-
${
index
}
`
:
index
;
return
path
!==
''
?
`
${
path
}
-
${
index
}
`
:
index
;
}
}
for
(
let
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
node
.
children
.
length
;
i
++
)
{
const
result
=
this
.
searchIt
(
node
.
children
[
i
],
search
,
path
!==
''
?
`
${
path
}
-
${
i
}
`
:
i
,
i
);
const
result
=
this
.
searchIt
(
node
.
children
[
i
],
search
,
path
!==
''
?
`
${
path
}
-
${
i
}
`
:
i
,
i
);
if
(
result
)
{
if
(
result
)
{
return
result
;
return
result
;
}
}
}
}
...
@@ -311,7 +332,7 @@ export default class EditUser extends Component {
...
@@ -311,7 +332,7 @@ export default class EditUser extends Component {
className
=
"btn btn-circle btn-white"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
>
<
img
src
=
{
Images
.
close
}
/
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -488,10 +509,21 @@ export default class EditUser extends Component {
...
@@ -488,10 +509,21 @@ export default class EditUser extends Component {
{
item
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
{
item
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span>
}
<
/span>
}
<
span
>
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
item
)}
onChange
=
{()
=>
this
.
handleItemClick
(
item
)}
/>
:
<
CustomCheckbox
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
item
)}
checked
=
{
this
.
handleItemChecked
(
item
)}
onChange
=
{()
=>
this
.
handleItemClick
(
item
)}
onChange
=
{()
=>
this
.
handleItemClick
(
item
)}
/
>
/
>
}
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
item
.
company_name
)}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
item
.
company_name
)}
<
/Typography
>
<
/div
>
<
/div
>
...
...
src/container/Otorisasi/UserRole.js
View file @
92e9e0de
...
@@ -100,6 +100,7 @@ class UserRole extends Component {
...
@@ -100,6 +100,7 @@ class UserRole extends Component {
name
:
"Action"
,
name
:
"Action"
,
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
console
.
log
(
tableMeta
);
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
button
<
button
...
@@ -112,7 +113,7 @@ class UserRole extends Component {
...
@@ -112,7 +113,7 @@ class UserRole extends Component {
onClick
=
{()
=>
this
.
setState
({
edit
:
true
,
indexData
:
tableMeta
.
rowData
[
1
]
})}
onClick
=
{()
=>
this
.
setState
({
edit
:
true
,
indexData
:
tableMeta
.
rowData
[
1
]
})}
>
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
4
]
===
"Aktif"
?
{
tableMeta
.
rowData
[
2
]
!==
"superadmin"
&&
tableMeta
.
rowData
[
4
]
===
"Aktif"
?
<
img
src
=
{
Images
.
editCopy
}
/>
:
<
img
src
=
{
Images
.
editCopy
}
/>
:
null
null
}
}
...
...
src/container/Profile.js
View file @
92e9e0de
...
@@ -253,9 +253,21 @@ export default class Profile extends Component {
...
@@ -253,9 +253,21 @@ export default class Profile extends Component {
};
};
async
onDrop
(
pictureFiles
)
{
async
onDrop
(
pictureFiles
)
{
console
.
log
(
pictureFiles
);
this
.
setState
({
pictures
:
pictureFiles
})
// console.log(response);
// console.log(pictureFiles);
// console.log(pictureDataURLs);
// this.setState({
// pictures: this.state.pictures.concat(pictureFiles),
// });
}
async
uploadFoto
(){
let
formData
=
new
FormData
()
let
formData
=
new
FormData
()
formData
.
append
(
'file'
,
pictureFiles
[
0
])
formData
.
append
(
'file'
,
this
.
state
.
pictures
[
0
])
let
response
=
await
api
.
create
().
uploadFoto
(
formData
)
api
.
create
().
uploadFoto
(
formData
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
uploadVisible
:
false
},
()
=>
{
this
.
setState
({
uploadVisible
:
false
},
()
=>
{
...
@@ -265,12 +277,7 @@ export default class Profile extends Component {
...
@@ -265,12 +277,7 @@ export default class Profile extends Component {
})
})
}
}
}
}
// console.log(response);
})
// console.log(pictureFiles);
// console.log(pictureDataURLs);
// this.setState({
// pictures: this.state.pictures.concat(pictureFiles),
// });
}
}
render
()
{
render
()
{
...
@@ -487,11 +494,21 @@ export default class Profile extends Component {
...
@@ -487,11 +494,21 @@ export default class Profile extends Component {
<
/div
>
<
/div
>
<
ImageUploader
<
ImageUploader
withIcon
=
{
true
}
withIcon
=
{
true
}
buttonText
=
'Choose images'
withPreview
buttonText
=
'Pilih Gambar'
onChange
=
{
this
.
onDrop
}
onChange
=
{
this
.
onDrop
}
imgExtension
=
{[
'.jpg'
,
'.gif'
,
'.png'
,
'.gif'
,
'.jpeg'
]}
imgExtension
=
{[
'.jpg'
,
'.gif'
,
'.png'
,
'.gif'
,
'.jpeg'
]}
maxFileSize
=
{
5242880
}
maxFileSize
=
{
1000000
}
label
=
{
"Max file size: 1 Mb, accepted: jpg or png"
}
/
>
/
>
{
this
.
state
.
pictures
.
length
>
0
?
<
div
style
=
{{
display
:
'grid'
,
margin
:
20
}}
>
<
div
style
=
{{
justifySelf
:
'center'
}}
>
<
span
className
=
"main-color"
style
=
{{
color
:
'#fff'
,
padding
:
20
,
paddingBottom
:
10
,
paddingTop
:
10
,
borderRadius
:
15
,
cursor
:
'pointer'
}}
onClick
=
{()
=>
this
.
uploadFoto
()}
>
Upload
Foto
<
/span
>
<
/div
>
<
/div> : nul
l
}
<
/div
>
<
/div
>
<
/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