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
187e05b1
Commit
187e05b1
authored
Aug 16, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
02881d0d
b0c28986
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
15 deletions
+50
-15
Home.js
src/container/Home.js
+13
-8
EditUser.js
src/container/Otorisasi/User/EditUser.js
+37
-7
No files found.
src/container/Home.js
View file @
187e05b1
...
@@ -144,6 +144,11 @@ export default function MiniDrawer() {
...
@@ -144,6 +144,11 @@ export default function MiniDrawer() {
})
})
}
}
const
logout
=
()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
}
const
handleDrawerOpen
=
()
=>
{
const
handleDrawerOpen
=
()
=>
{
setOpen
(
true
);
setOpen
(
true
);
};
};
...
@@ -196,10 +201,10 @@ export default function MiniDrawer() {
...
@@ -196,10 +201,10 @@ export default function MiniDrawer() {
>
>
<
div
className
=
{
classes
.
toolbarDrawer
}
style
=
{{
<
div
className
=
{
classes
.
toolbarDrawer
}
style
=
{{
backgroundColor
:
'#1a2d3e'
,
backgroundColor
:
'#1a2d3e'
,
height
:
open
?
null
:
78
,
height
:
open
?
203
:
78
,
paddingLeft
:
open
?
null
:
55
,
paddingLeft
:
open
?
null
:
55
,
display
:
open
?
null
:
'grid'
,
display
:
open
?
null
:
'grid'
,
paddingBottom
:
open
?
55
:
null
,
//
paddingBottom: open ? 55 : null,
alignSelf
:
open
?
null
:
'center'
alignSelf
:
open
?
null
:
'center'
}}
>
}}
>
{
open
===
true
?
{
open
===
true
?
...
@@ -223,15 +228,15 @@ export default function MiniDrawer() {
...
@@ -223,15 +228,15 @@ export default function MiniDrawer() {
<
MenuIcon
style
=
{{
fill
:
'white'
}}
/
>
<
MenuIcon
style
=
{{
fill
:
'white'
}}
/
>
<
/IconButton>
}
<
/IconButton>
}
{
open
&&
{
open
&&
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
width
:
'100%'
,
marginTop
:
15
,
marginBottom
:
60
}}
>
<
Typography
style
=
{{
fontSize
:
1
2
,
color
:
'#fff'
,
textAlign
:
'center'
,
fontWeight
:
'bold'
}}
>
John
Doe
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
1
4
,
color
:
'#fff'
,
textAlign
:
'center'
,
fontWeight
:
'bold'
}}
>
{
userFullname
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
1
2
,
color
:
'#fff'
,
textAlign
:
'center'
,
marginTop
:
10
}}
>
john
@
tia
.
com
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
1
4
,
color
:
'#fff'
,
textAlign
:
'center'
,
marginTop
:
10
}}
>
{
userEmail
}
<
/Typography
>
<
/div
>
<
/div
>
}
}
<
/div
>
<
/div
>
<
Divider
/>
<
Divider
/>
{
open
&&
{
open
&&
<
div
style
=
{{
width
:
'100%'
,
textAlign
:
'-webkit-center'
,
marginTop
:
-
4
0
}}
>
<
div
style
=
{{
width
:
'100%'
,
textAlign
:
'-webkit-center'
,
marginTop
:
-
4
5
}}
>
<
div
className
=
{
"sub-color"
}
style
=
{{
width
:
90
,
height
:
90
,
borderRadius
:
50
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
className
=
{
"sub-color"
}
style
=
{{
width
:
90
,
height
:
90
,
borderRadius
:
50
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
style
=
{{
width
:
72
,
height
:
72
,
backgroundColor
:
'#838383'
,
borderRadius
:
50
,
alignSelf
:
'center'
}}
>
<
div
style
=
{{
width
:
72
,
height
:
72
,
backgroundColor
:
'#838383'
,
borderRadius
:
50
,
alignSelf
:
'center'
}}
>
<
/div
>
<
/div
>
...
@@ -279,8 +284,8 @@ export default function MiniDrawer() {
...
@@ -279,8 +284,8 @@ export default function MiniDrawer() {
<
List
component
=
"div"
disablePadding
>
<
List
component
=
"div"
disablePadding
>
{
item
.
subItem
.
map
((
sub
,
indexs
)
=>
{
{
item
.
subItem
.
map
((
sub
,
indexs
)
=>
{
return
(
return
(
<
Link
to
=
{
`
${
url
}
/
${
sub
.
path
}
`
}
>
<
Link
to
=
{
sub
.
label
===
"Logout"
?
`/`
:
`
${
url
}
/
${
sub
.
path
}
`
}
>
<
div
style
=
{{
paddingLeft
:
5
,
}}
className
=
{
selectedSubIndex
===
sub
.
label
?
"active"
:
""
}
onClick
=
{()
=>
selectSub
(
sub
.
label
)}
>
<
div
style
=
{{
paddingLeft
:
5
,
}}
className
=
{
selectedSubIndex
===
sub
.
label
?
"active"
:
""
}
onClick
=
{()
=>
s
ub
.
label
===
"Logout"
?
logout
()
:
s
electSub
(
sub
.
label
)}
>
<
ListItem
button
style
=
{{
paddingLeft
:
61
}}
>
<
ListItem
button
style
=
{{
paddingLeft
:
61
}}
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'#525355'
,
fontSize
:
14
}}
>
{
sub
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'#525355'
,
fontSize
:
14
}}
>
{
sub
.
label
}
<
/Typography
>
<
/ListItem
>
<
/ListItem
>
...
...
src/container/Otorisasi/User/EditUser.js
View file @
187e05b1
...
@@ -7,6 +7,7 @@ import { DatePicker } from '@material-ui/pickers';
...
@@ -7,6 +7,7 @@ import { DatePicker } from '@material-ui/pickers';
import
format
from
"date-fns/format"
;
import
format
from
"date-fns/format"
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
*
as
R
from
'ramda'
const
CustomCheckbox
=
withStyles
({
const
CustomCheckbox
=
withStyles
({
root
:
{
root
:
{
...
@@ -51,7 +52,6 @@ export default class EditUser extends Component {
...
@@ -51,7 +52,6 @@ export default class EditUser extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
getDetailUser
()
this
.
getDetailUser
()
this
.
getRole
()
this
.
getPerusahaan
()
this
.
getPerusahaan
()
}
}
...
@@ -60,27 +60,39 @@ export default class EditUser extends Component {
...
@@ -60,27 +60,39 @@ export default class EditUser extends Component {
let
isDate
=
type
!==
''
?
true
:
false
let
isDate
=
type
!==
''
?
true
:
false
if
(
isDate
&&
type
===
'start_date'
)
{
if
(
isDate
&&
type
===
'start_date'
)
{
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
start_date
:
format
(
e
,
'yyyy-MM-dd'
),
end_date
:
null
},
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
start_date
:
format
(
e
,
'yyyy-MM-dd'
),
end_date
:
null
},
errorFullname
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
})
})
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
end_date
:
format
(
e
,
'yyyy-MM-dd'
)
},
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
end_date
:
format
(
e
,
'yyyy-MM-dd'
)
},
errorFullname
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
})
})
}
else
{
}
else
{
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
[
e
.
target
.
name
]:
e
.
target
.
value
},
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
[
e
.
target
.
name
]:
e
.
target
.
value
},
errorFullname
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
...
@@ -90,6 +102,7 @@ export default class EditUser extends Component {
...
@@ -90,6 +102,7 @@ export default class EditUser extends Component {
getDetailUser
()
{
getDetailUser
()
{
api
.
create
().
getDetailUser
(
this
.
state
.
paramsId
).
then
((
response
)
=>
{
api
.
create
().
getDetailUser
(
this
.
state
.
paramsId
).
then
((
response
)
=>
{
this
.
getRole
()
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
tempData
:
response
.
data
.
data
,
company
:
response
.
data
.
data
.
company
})
this
.
setState
({
tempData
:
response
.
data
.
data
,
company
:
response
.
data
.
data
.
company
})
console
.
log
(
response
.
data
.
data
)
console
.
log
(
response
.
data
.
data
)
...
@@ -100,8 +113,24 @@ export default class EditUser extends Component {
...
@@ -100,8 +113,24 @@ export default class EditUser extends Component {
}
}
validasi
()
{
validasi
()
{
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
fullname
))
{
this
.
setState
({
errorFullname
:
true
,
msgErrorFN
:
'Nama Lengkap tidak boleh kosong'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
email
))
{
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'Email tidak boleh kosong'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
role_name
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role Name tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
// }
else
{
this
.
updateUser
()
this
.
updateUser
()
}
}
}
updateUser
()
{
updateUser
()
{
let
payload
=
{
let
payload
=
{
...
@@ -225,7 +254,8 @@ export default class EditUser extends Component {
...
@@ -225,7 +254,8 @@ export default class EditUser extends Component {
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
fullname
}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
fullname
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// defaultValue="Default Value"
// defaultValue="Default Value"
// helperText="Some important text"
error
=
{
this
.
state
.
errorFullname
}
helperText
=
{
this
.
state
.
msgErrorFN
}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -241,8 +271,8 @@ export default class EditUser extends Component {
...
@@ -241,8 +271,8 @@ export default class EditUser extends Component {
label
=
"Email"
label
=
"Email"
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
email
}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
email
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// defaultValue="Default Value"
error
=
{
this
.
state
.
errorEmail
}
// helperText="Some important text"
helperText
=
{
this
.
state
.
msgErrorEM
}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -254,6 +284,7 @@ export default class EditUser extends Component {
...
@@ -254,6 +284,7 @@ export default class EditUser extends Component {
id
=
"role"
id
=
"role"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
})}
debug
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Role"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Role"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
role
}
value
=
{
this
.
state
.
role
}
/
>
/
>
...
@@ -276,7 +307,6 @@ export default class EditUser extends Component {
...
@@ -276,7 +307,6 @@ export default class EditUser extends Component {
KeyboardButtonProps
=
{{
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
'aria-label'
:
'change date'
,
}}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
/
>
/
>
<
/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