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
4d9de44b
Commit
4d9de44b
authored
Aug 13, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update didam
parent
22820550
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
188 additions
and
48 deletions
+188
-48
package-lock.json
package-lock.json
+10
-3
index.html
public/index.html
+1
-1
manifest.json
public/manifest.json
+2
-2
Index.js
src/Utils/Index.js
+8
-3
index.js
src/api/index.js
+1
-1
Home.js
src/container/Home.js
+22
-16
Login.js
src/container/Login.js
+21
-4
AddRole.js
src/container/Otorisasi/UserRole/AddRole.js
+70
-11
EditRole.js
src/container/Otorisasi/UserRole/EditRole.js
+50
-7
Constant.js
src/library/Constant.js
+3
-0
No files found.
package-lock.json
View file @
4d9de44b
...
...
@@ -2544,6 +2544,13 @@
"requires"
:
{
"axios"
:
"^0.19.0"
,
"ramda"
:
"^0.25.0"
},
"dependencies"
:
{
"ramda"
:
{
"version"
:
"0.25.0"
,
"resolved"
:
"https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz"
,
"integrity"
:
"sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ=="
}
}
},
"aproba"
:
{
...
...
@@ -11559,9 +11566,9 @@
}
},
"ramda"
:
{
"version"
:
"0.2
5.0
"
,
"resolved"
:
"https://registry.npmjs.org/ramda/-/ramda-0.2
5.0
.tgz"
,
"integrity"
:
"sha512-
GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ
=="
"version"
:
"0.2
7.1
"
,
"resolved"
:
"https://registry.npmjs.org/ramda/-/ramda-0.2
7.1
.tgz"
,
"integrity"
:
"sha512-
PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw
=="
},
"randombytes"
:
{
"version"
:
"2.1.0"
,
...
...
public/index.html
View file @
4d9de44b
...
...
@@ -26,7 +26,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>
React
App
</title>
<title>
TIA
App
</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
...
...
public/manifest.json
View file @
4d9de44b
{
"short_name"
:
"
React
App"
,
"name"
:
"
Create React App Sample
"
,
"short_name"
:
"
TIA
App"
,
"name"
:
"
TIA App
"
,
"icons"
:
[
{
"src"
:
"favicon.ico"
,
...
...
src/Utils/Index.js
View file @
4d9de44b
...
...
@@ -7,6 +7,7 @@ import Grid from '@material-ui/core/Grid';
import
{
Typography
,
Avatar
}
from
'@material-ui/core'
;
import
Images
from
'../assets/Images'
;
import
{
Link
,
useRouteMatch
}
from
'react-router-dom'
;
import
Constant
from
'../library/Constant'
;
const
useStyles
=
makeStyles
({
avatar
:
{
...
...
@@ -29,10 +30,14 @@ function FadeMenu() {
const
handleClose
=
()
=>
{
setAnchorEl
(
null
);
localStorage
.
clear
()
window
.
location
.
reload
();
};
const
handleLogout
=
()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
setAnchorEl
(
null
);
}
const
classes
=
useStyles
();
let
{
path
,
url
}
=
useRouteMatch
();
...
...
@@ -69,7 +74,7 @@ function FadeMenu() {
<
/div
>
<
/Link
>
<
/MenuItem
>
<
MenuItem
onClick
=
{
handle
Close
}
>
<
MenuItem
onClick
=
{
handle
Logout
}
>
<
div
style
=
{{
display
:
'flex'
,
padding
:
10
}}
>
<
img
src
=
{
Images
.
logout
}
style
=
{{
height
:
20
,
width
:
20
,
marginRight
:
20
}}
/
>
<
Typography
>
Logout
<
/Typography
>
...
...
src/api/index.js
View file @
4d9de44b
...
...
@@ -129,7 +129,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
getAM
,
getPerusahaan
,
createPerusahaan
,
updatePerusahaan
updatePerusahaan
,
getApprovedByAM
,
createAM
,
updateAM
...
...
src/container/Home.js
View file @
4d9de44b
...
...
@@ -38,6 +38,7 @@ import Beranda from './Beranda';
import
{
Avatar
}
from
'@material-ui/core'
;
import
HomeRoutes
from
'../router/homeRoutes'
import
ArraySide
from
'../library/Array'
import
Constant
from
'../library/Constant'
;
const
drawerWidth
=
307
;
...
...
@@ -124,9 +125,10 @@ export default function MiniDrawer() {
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
[
selectedIndex
,
setSelectedIndex
]
=
React
.
useState
([]);
React
.
useEffect
(()
=>
{
// alert(ArraySide)
})
// React.useEffect(() => {
// //
// })
const
handleDrawerOpen
=
()
=>
{
setOpen
(
true
);
};
...
...
@@ -220,34 +222,36 @@ export default function MiniDrawer() {
}
{
open
&&
<
div
style
=
{{
marginLeft
:
20
,
marginTop
:
20
}}
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
1
2
}}
>
APLIKASI
<
/Typography
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
1
4
,
fontFamily
:
'nunito'
}}
>
APLIKASI
<
/Typography
>
<
/div
>
}
<
List
>
{
ArraySide
.
map
((
item
,
index
)
=>
(
<
div
style
=
{{
marginTop
:
index
===
0
?
null
:
10
}}
>
{
item
.
subItem
!=
null
?
<
div
style
=
{{
justifyContent
:
'space-between'
,
flexDirection
:
'row'
,
display
:
'flex'
,
paddingRight
:
10
}}
onClick
=
{()
=>
selectedIndex
==
0
?
setSelectedIndex
(
index
)
:
setSelectedIndex
(
0
)}
>
<
div
style
=
{{
justifyContent
:
'space-between'
,
flexDirection
:
'row'
,
display
:
'flex'
,
padding
Left
:
10
,
padding
Right
:
10
}}
onClick
=
{()
=>
selectedIndex
==
0
?
setSelectedIndex
(
index
)
:
setSelectedIndex
(
0
)}
>
<
ListItem
button
key
=
{
item
.
label
}
>
<
ListItemIcon
><
img
src
=
{
item
.
img
}
/></
ListItemIcon
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'white'
,
fontSize
:
14
}}
>
{
item
.
label
}
<
/Typography
>
<
/ListItem
>
{
item
.
subItem
!=
null
?
(
index
===
selectedIndex
?
<
ExpandLess
style
=
{{
color
:
"white"
,
marginLeft
:
50
,
alignSelf
:
'center'
}}
/> : <ExpandMore style={{ color: "white", marginLeft: 50, alignSelf: 'center' }} /
>
)
:
null
}
<
/div
>
:
item
.
label
===
'PENGATURAN'
?
open
?
<
Link
to
=
{
`
${
url
}
/
${
item
.
path
}
`
}
>
<
ListItem
button
key
=
{
item
.
label
}
onClick
=
{()
=>
null
}
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'white'
,
fontSize
:
14
}}
>
{
item
.
label
}
<
/Typography
>
<
/ListItem
>
<
/Link> : null
:
<
/Link> : null
:
<
Link
to
=
{
`
${
url
}
/
${
item
.
path
}
`
}
>
<
ListItem
button
key
=
{
item
.
label
}
onClick
=
{()
=>
setSelectedIndex
(
index
)}
>
<
ListItemIcon
><
img
src
=
{
item
.
img
}
/></
ListItemIcon
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
}}
>
{
item
.
label
}
<
/Typography
>
<
/ListItem
>
<
div
style
=
{{
paddingLeft
:
10
}}
>
<
ListItem
button
key
=
{
item
.
label
}
onClick
=
{()
=>
setSelectedIndex
(
index
)}
>
<
ListItemIcon
><
img
src
=
{
item
.
img
}
/></
ListItemIcon
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'white'
,
fontSize
:
14
}}
>
{
item
.
label
}
<
/Typography
>
<
/ListItem
>
<
/div
>
<
/Link
>
}
{
item
.
subItem
!=
null
&&
...
...
@@ -257,9 +261,11 @@ export default function MiniDrawer() {
{
item
.
subItem
.
map
((
sub
,
index
)
=>
{
return
(
<
Link
to
=
{
`
${
url
}
/
${
sub
.
path
}
`
}
>
<
ListItem
style
=
{{
paddingLeft
:
72
}}
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
}}
>
{
sub
.
label
}
<
/Typography
>
<
/ListItem
>
<
div
style
=
{{
paddingLeft
:
10
}}
>
<
ListItem
style
=
{{
paddingLeft
:
72
}}
>
<
Typography
style
=
{{
fontFamily
:
'nunito'
,
color
:
'white'
,
fontSize
:
14
}}
>
{
sub
.
label
}
<
/Typography
>
<
/ListItem
>
<
/div
>
<
/Link
>
)
})}
...
...
src/container/Login.js
View file @
4d9de44b
...
...
@@ -28,12 +28,13 @@ class Login extends Component {
errorEmail
:
false
,
errorPassword
:
false
,
msgEmail
:
''
,
msgPassword
:
''
msgPassword
:
''
,
rememberMe
:
false
}
}
componentDidMount
()
{
// this.coba
()
this
.
getUser
()
}
handleChange
(
e
)
{
...
...
@@ -53,7 +54,6 @@ class Login extends Component {
validateLogin
()
{
var
isEmail
=
this
.
isEmail
(
this
.
state
.
email
)
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email harus diisi!'
})
}
else
if
(
!
isEmail
)
{
...
...
@@ -73,6 +73,14 @@ class Login extends Component {
api
.
create
().
login
(
payload
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
===
'success'
)
{
localStorage
.
setItem
(
Constant
.
TOKEN
,
response
.
data
.
data
.
token
)
if
(
this
.
state
.
rememberMe
)
{
localStorage
.
setItem
(
Constant
.
EMAIL
,
this
.
state
.
email
)
localStorage
.
setItem
(
Constant
.
PASSWORD
,
this
.
state
.
password
)
// console.log(this.state.email, this.state.password)
}
else
{
localStorage
.
setItem
(
Constant
.
EMAIL
,
''
)
localStorage
.
setItem
(
Constant
.
PASSWORD
,
''
)
}
this
.
props
.
history
.
push
(
'/home/beranda'
)
}
else
{
if
(
response
.
data
.
message
==
'Password Salah!'
)
{
...
...
@@ -84,6 +92,15 @@ class Login extends Component {
})
}
getUser
()
{
var
email
=
localStorage
.
getItem
(
Constant
.
EMAIL
)
var
password
=
localStorage
.
getItem
(
Constant
.
PASSWORD
)
if
(
email
!=
''
&&
password
!=
''
)
{
this
.
setState
({
email
,
password
})
}
}
render
()
{
return
(
<
div
style
=
{{
flex
:
1
,
display
:
'flex'
}}
>
...
...
@@ -141,7 +158,7 @@ class Login extends Component {
/
>
<
div
style
=
{{
flexDirection
:
'row'
,
width
:
'100%'
,
marginTop
:
this
.
state
.
errorPassword
?
26
:
16
}}
>
<
CustomCheckbox
name
=
"checked-remember"
/>
<
CustomCheckbox
name
=
"checked-remember"
checked
=
{
this
.
state
.
rememberMe
}
onChange
=
{()
=>
this
.
setState
({
rememberMe
:
!
this
.
state
.
rememberMe
})}
/
>
<
span
style
=
{{
color
:
'rgba(0, 0, 0, 0.5)'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Remember
Me
<
/span
>
<
Link
to
=
{{
pathname
:
'/forgot-password'
}}
style
=
{{
textDecoration
:
'none'
}}
><
span
style
=
{{
marginLeft
:
30
,
color
:
'#51c6ea'
,
cursor
:
'pointer'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lupa
Kata
Sandi
?
<
/span></
Link
>
<
/div
>
...
...
src/container/Otorisasi/UserRole/AddRole.js
View file @
4d9de44b
...
...
@@ -6,6 +6,7 @@ import RemoveIcon from '@material-ui/icons/Remove';
import
{
DateTimePicker
,
KeyboardDatePicker
,
DatePicker
}
from
"@material-ui/pickers"
;
import
format
from
"date-fns/format"
;
import
localeID
from
"date-fns/locale/id"
import
*
as
R
from
'ramda'
const
CustomCheckbox
=
withStyles
({
root
:
{
...
...
@@ -32,7 +33,13 @@ export default class AddRole extends Component {
roleName
:
''
,
startDate
:
null
,
endDate
:
null
,
date
:
new
Date
()
date
:
new
Date
(),
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
}
}
...
...
@@ -48,16 +55,51 @@ export default class AddRole extends Component {
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
if
(
isDate
&&
type
==
'start_date'
)
{
this
.
setState
({...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
)})
this
.
setState
({...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
else
if
(
isDate
&&
type
==
'end_date'
)
{
this
.
setState
({...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
)})
this
.
setState
({...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
),
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
else
{
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
this
.
setState
({...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
}
updateRole
()
{
validasi
()
{
if
(
R
.
isEmpty
(
this
.
state
.
roleName
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role Name tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
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
.
addRole
()
}
}
addRole
()
{
// let startDate = format(this.state.tempData.start_date, 'yyyy-MM-dd')
// let endDate = format(this.state.tempData.end_date, 'yyyy-MM-dd')
let
payload
=
{
...
...
@@ -199,6 +241,8 @@ export default class AddRole extends Component {
name
=
"roleName"
label
=
"User Role"
value
=
{
this
.
state
.
roleName
}
error
=
{
this
.
state
.
errorRoleName
}
helperText
=
{
this
.
state
.
msgErrorRN
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// defaultValue="Default Value"
// helperText="Some important text"
...
...
@@ -216,6 +260,8 @@ export default class AddRole extends Component {
label
=
"Berlaku Mulai"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
startDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'start_date'
)}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
...
...
@@ -234,6 +280,8 @@ export default class AddRole extends Component {
label
=
"Berlaku Hingga"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
endDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'end_date'
)}
minDate
=
{
this
.
state
.
startDate
}
KeyboardButtonProps
=
{{
...
...
@@ -380,14 +428,25 @@ export default class AddRole extends Component {
<
/div
>
<
div
className
=
"border-top grid grid-2x"
style
=
{{
height
:
56
,
backgroundColor
:
'#f5f5f5'
,
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
style
=
{{
alignSelf
:
'center'
}}
>
<
div
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Batal
<
/span
>
<
/div
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Batal
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
div
onClick
=
{()
=>
this
.
updateRole
()}
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Simpan
<
/span
>
<
/div
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
validasi
()}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Simpan
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/Otorisasi/UserRole/EditRole.js
View file @
4d9de44b
...
...
@@ -5,6 +5,7 @@ import AddIcon from '@material-ui/icons/Add';
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
{
DateTimePicker
,
KeyboardDatePicker
,
DatePicker
}
from
"@material-ui/pickers"
;
import
format
from
"date-fns/format"
;
import
*
as
R
from
'ramda'
const
CustomCheckbox
=
withStyles
({
root
:
{
color
:
'#51c6ea'
,
...
...
@@ -27,7 +28,13 @@ export default class EditRole extends Component {
privileges
:
[],
checked
:
false
,
selectedIndex
:
0
,
date
:
new
Date
()
date
:
new
Date
(),
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
}
}
...
...
@@ -44,15 +51,32 @@ export default class EditRole extends Component {
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
if
(
isDate
&&
type
==
'start_date'
)
{
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
start_date
:
format
(
e
,
'yyyy-MM-dd'
)
}
},
()
=>
{
console
.
log
(
this
.
state
.
tempData
)
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
start_date
:
format
(
e
,
'yyyy-MM-dd'
),
end_date
:
null
},
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
else
if
(
isDate
&&
type
==
'end_date'
)
{
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
end_date
:
format
(
e
,
'yyyy-MM-dd'
)
}
},
()
=>
{
console
.
log
(
this
.
state
.
tempData
)
this
.
setState
({
...
data
,
tempData
:
{
...
this
.
state
.
tempData
,
end_date
:
format
(
e
,
'yyyy-MM-dd'
)
},
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
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
},
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
}
...
...
@@ -68,6 +92,19 @@ export default class EditRole extends Component {
})
}
validasi
()
{
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
.
updateRole
()
}
}
updateRole
()
{
// let startDate = format(this.state.tempData.start_date, 'yyyy-MM-dd')
...
...
@@ -212,6 +249,8 @@ export default class EditRole extends Component {
name
=
"role_name"
label
=
"User Role"
value
=
{
this
.
state
.
tempData
==
null
?
''
:
this
.
state
.
tempData
.
role_name
}
error
=
{
this
.
state
.
errorRoleName
}
helperText
=
{
this
.
state
.
msgErrorRN
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// defaultValue="Default Value"
// helperText="Some important text"
...
...
@@ -229,6 +268,8 @@ export default class EditRole extends Component {
label
=
"Berlaku Mulai"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
tempData
==
null
?
null
:
this
.
state
.
tempData
.
start_date
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'start_date'
)}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
...
...
@@ -247,6 +288,8 @@ export default class EditRole extends Component {
label
=
"Berlaku Hingga"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
tempData
==
null
?
null
:
this
.
state
.
tempData
.
end_date
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
minDate
=
{
this
.
state
.
tempData
==
null
?
null
:
this
.
state
.
tempData
.
start_date
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'end_date'
)}
KeyboardButtonProps
=
{{
...
...
@@ -405,7 +448,7 @@ export default class EditRole extends Component {
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
updateRole
()}
onClick
=
{()
=>
this
.
validasi
()}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Simpan
<
/span
>
...
...
src/library/Constant.js
View file @
4d9de44b
const
Constant
=
{
TOKEN
:
null
,
USER
:
null
,
EMAIL
:
'TOKEN'
,
PASSWORD
:
'PASSWORD'
}
export
default
Constant
;
\ No newline at end of file
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