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
66044314
Commit
66044314
authored
Sep 02, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into faisal
parents
f406b3cb
06654911
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
641 additions
and
507 deletions
+641
-507
ApprovalMatrix.js
src/container/ApprovalMatrix/ApprovalMatrix.js
+11
-5
CreateApprovalMatrix.js
src/container/ApprovalMatrix/CreateApprovalMatrix.js
+0
-1
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+235
-125
ForgotPassword.js
src/container/ForgotPassword.js
+1
-1
Login.js
src/container/Login.js
+1
-1
UnitBisnis.js
src/container/MasterData/UnitBisnis.js
+12
-7
User.js
src/container/Otorisasi/User.js
+275
-229
AddUser.js
src/container/Otorisasi/User/AddUser.js
+96
-128
EditUser.js
src/container/Otorisasi/User/EditUser.js
+2
-2
ResetPassword.js
src/container/ResetPassword.js
+4
-4
SetPassword.js
src/container/SetPassword.js
+4
-4
No files found.
src/container/ApprovalMatrix/ApprovalMatrix.js
View file @
66044314
...
@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component {
...
@@ -39,6 +39,9 @@ export default class ApprovalMatrix extends Component {
rows
:
null
,
rows
:
null
,
dataLoaded
:
false
,
dataLoaded
:
false
,
popupError
:
false
,
popupError
:
false
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
,
btncreate
:
false
,
btncreate
:
false
,
btnedit
:
false
,
btnedit
:
false
,
load
:
false
,
load
:
false
,
...
@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component {
...
@@ -75,10 +78,11 @@ export default class ApprovalMatrix extends Component {
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
api
.
create
().
checkUploadAM
(
body
).
then
(
response
=>
{
api
.
create
().
checkUploadAM
(
body
).
then
(
response
=>
{
// console.log(response.data)
// console.log(response.data)
let
dataRow
=
[]
if
(
response
.
data
){
if
(
response
.
data
){
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
return
[
index
+
1
,
index
+
1
,
item
.
approval_type_name
,
item
.
approval_type_name
,
...
@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -91,7 +95,7 @@ export default class ApprovalMatrix extends Component {
]
]
})
})
let
columns
=
[
let
columns
=
[
"
ID
"
,
"
Data
"
,
{
{
name
:
"Approval Type"
,
name
:
"Approval Type"
,
options
:
{
options
:
{
...
@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -257,7 +261,7 @@ export default class ApprovalMatrix extends Component {
rows
:
dataRow
rows
:
dataRow
});
});
}
else
{
}
else
{
this
.
setState
({
dataLoaded
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
...
@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -267,7 +271,7 @@ export default class ApprovalMatrix extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
dataLoaded
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
...
@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component {
...
@@ -303,6 +307,8 @@ export default class ApprovalMatrix extends Component {
load
:
true
load
:
true
})
})
}
}
}
else
{
this
.
setState
({
load
:
true
})
}
}
})
})
}
}
...
@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -820,7 +826,7 @@ export default class ApprovalMatrix extends Component {
{
this
.
state
.
visibleUpload
&&
(
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x
"
style
=
{{
backgroundColor
:
'#51c6ea'
,
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x
main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
...
...
src/container/ApprovalMatrix/CreateApprovalMatrix.js
View file @
66044314
...
@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component {
...
@@ -215,7 +215,6 @@ export default class CreateApprovalMatrix extends Component {
this
.
setState
({
errorOrder
:
true
,
msgErrOrder
:
'Order Cannot be Empty.'
})
this
.
setState
({
errorOrder
:
true
,
msgErrOrder
:
'Order Cannot be Empty.'
})
}
}
else
if
(
R
.
isNil
(
this
.
state
.
userId
))
{
else
if
(
R
.
isNil
(
this
.
state
.
userId
))
{
// return alert("Pemberi Persetujuan tidak boleh kosong");
this
.
setState
({
errorApproved
:
true
,
msgErrApproved
:
'Approver Name Cannot be Empty.'
})
this
.
setState
({
errorApproved
:
true
,
msgErrApproved
:
'Approver Name Cannot be Empty.'
})
}
}
else
if
(
R
.
isNil
(
this
.
state
.
operatorId
))
{
else
if
(
R
.
isNil
(
this
.
state
.
operatorId
))
{
...
...
src/container/BudgetTahunan/ProfitLoss.js
View file @
66044314
...
@@ -38,6 +38,7 @@ export default class ProfitLoss extends Component {
...
@@ -38,6 +38,7 @@ export default class ProfitLoss extends Component {
// ["Trade Receivables - Third Party", "142,668", "77,480"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
]
]
}
}
this
.
handleValue
=
this
.
handleValue
.
bind
(
this
)
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -61,6 +62,7 @@ export default class ProfitLoss extends Component {
...
@@ -61,6 +62,7 @@ export default class ProfitLoss extends Component {
item
.
type_report_id
,
item
.
type_report_id
,
item
.
id
,
item
.
id
,
item
.
parent
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
level
,
item
.
description
item
.
description
])
])
...
@@ -71,23 +73,163 @@ export default class ProfitLoss extends Component {
...
@@ -71,23 +73,163 @@ export default class ProfitLoss extends Component {
i
.
type_report_id
,
i
.
type_report_id
,
i
.
id
,
i
.
id
,
i
.
parent
,
i
.
parent
,
i
.
formula
,
i
.
level
,
i
.
level
,
i
.
description
i
.
description
])
])
i
.
children
.
map
(
val
=>
{
i
.
children
.
map
(
val
=>
{
dataTable
.
push
([
if
(
val
.
children
&&
val
.
children
.
length
>
0
)
{
val
.
type_report_id
,
dataTable
.
push
([
val
.
id
,
val
.
type_report_id
,
val
.
parent
,
val
.
id
,
val
.
level
,
val
.
parent
,
val
.
description
val
.
formula
,
])
val
.
level
,
val
.
description
])
val
.
children
.
map
(
items
=>
{
if
(
items
.
children
&&
items
.
children
.
length
>
0
)
{
dataTable
.
push
([
items
.
type_report_id
,
items
.
id
,
items
.
parent
,
items
.
formula
,
items
.
level
,
items
.
description
])
items
.
children
.
map
(
itemss
=>
{
if
(
itemss
.
children
&&
itemss
.
children
.
length
>
0
)
{
dataTable
.
push
([
itemss
.
type_report_id
,
itemss
.
id
,
itemss
.
parent
,
itemss
.
formula
,
itemss
.
level
,
itemss
.
description
])
itemss
.
children
.
map
(
item1
=>
{
if
(
item1
.
children
&&
item1
.
children
.
length
>
0
)
{
dataTable
.
push
([
item1
.
type_report_id
,
item1
.
id
,
item1
.
parent
,
item1
.
formula
,
item1
.
level
,
item1
.
description
])
item1
.
children
.
map
(
item2
=>
{
if
(
item2
.
children
&&
item2
.
children
.
length
>
0
)
{
dataTable
.
push
([
item2
.
type_report_id
,
item2
.
id
,
item2
.
parent
,
item2
.
formula
,
item2
.
level
,
item2
.
description
])
item2
.
children
.
map
(
item3
=>
{
if
(
item3
.
children
&&
item3
.
children
.
length
>
0
)
{
dataTable
.
push
([
item3
.
type_report_id
,
item3
.
id
,
item3
.
parent
,
item3
.
formula
,
item3
.
level
,
item3
.
description
])
item3
.
children
.
map
(
item4
=>
{
if
(
item4
.
children
&&
item4
.
children
.
length
>
0
)
{
dataTable
.
push
([
item4
.
type_report_id
,
item4
.
id
,
item4
.
parent
,
item4
.
formula
,
item4
.
level
,
item4
.
description
])
}
else
{
dataTable
.
push
([
item4
.
type_report_id
,
item4
.
id
,
item4
.
parent
,
item4
.
formula
,
item4
.
level
,
item4
.
description
])
}
})
}
else
{
dataTable
.
push
([
item3
.
type_report_id
,
item3
.
id
,
item3
.
parent
,
item3
.
formula
,
item3
.
level
,
item3
.
description
])
}
})
}
else
{
dataTable
.
push
([
item2
.
type_report_id
,
item2
.
id
,
item2
.
parent
,
item2
.
formula
,
item2
.
level
,
item2
.
description
])
}
})
}
else
{
dataTable
.
push
([
item1
.
type_report_id
,
item1
.
id
,
item1
.
parent
,
item1
.
formula
,
item1
.
level
,
item1
.
description
])
}
})
}
else
{
dataTable
.
push
([
itemss
.
type_report_id
,
itemss
.
id
,
itemss
.
parent
,
itemss
.
formula
,
itemss
.
level
,
itemss
.
description
])
}
})
}
else
{
dataTable
.
push
([
items
.
type_report_id
,
items
.
id
,
items
.
parent
,
items
.
formula
,
items
.
level
,
items
.
description
])
}
})
}
else
{
dataTable
.
push
([
val
.
type_report_id
,
val
.
id
,
val
.
parent
,
val
.
formula
,
val
.
level
,
val
.
description
])
}
})
})
}
else
{
}
else
{
dataTable
.
push
([
dataTable
.
push
([
i
.
type_report_id
,
i
.
type_report_id
,
i
.
id
,
i
.
id
,
i
.
parent
,
i
.
parent
,
i
.
formula
,
i
.
level
,
i
.
level
,
i
.
description
i
.
description
])
])
...
@@ -97,6 +239,7 @@ export default class ProfitLoss extends Component {
...
@@ -97,6 +239,7 @@ export default class ProfitLoss extends Component {
i
.
type_report_id
,
i
.
type_report_id
,
i
.
id
,
i
.
id
,
i
.
parent
,
i
.
parent
,
i
.
formula
,
i
.
level
,
i
.
level
,
i
.
description
i
.
description
])
])
...
@@ -107,6 +250,7 @@ export default class ProfitLoss extends Component {
...
@@ -107,6 +250,7 @@ export default class ProfitLoss extends Component {
item
.
type_report_id
,
item
.
type_report_id
,
item
.
id
,
item
.
id
,
item
.
parent
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
level
,
item
.
description
item
.
description
])
])
...
@@ -137,12 +281,14 @@ export default class ProfitLoss extends Component {
...
@@ -137,12 +281,14 @@ export default class ProfitLoss extends Component {
let
data
=
this
.
state
.
dataTable
let
data
=
this
.
state
.
dataTable
let
indexParent
=
data
.
findIndex
((
val
)
=>
val
[
1
]
==
data
[
tableMeta
.
rowIndex
][
2
])
let
indexParent
=
data
.
findIndex
((
val
)
=>
val
[
1
]
==
data
[
tableMeta
.
rowIndex
][
2
])
if
(
indexParent
>
0
)
{
if
(
indexParent
>
0
)
{
// console.log(indexParent)
let
a
=
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
let
a
=
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
let
jagain
=
data
[
indexParent
][
tableMeta
.
columnIndex
]
let
jagain
=
data
[
indexParent
][
tableMeta
.
columnIndex
]
a
=
data
[
indexParent
][
tableMeta
.
columnIndex
]
=
jagain
==
undefined
?
(
0
+
Number
(
val
))
:
(
jagain
+
Number
(
val
))
a
=
data
[
indexParent
][
tableMeta
.
columnIndex
]
=
jagain
==
undefined
?
(
0
+
Number
(
val
))
:
(
jagain
+
Number
(
val
))
}
else
{
}
else
{
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
data
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
}
// this.forceUpdate()
// console.log(this.state.dataTable)
// console.log(this.state.dataTable)
// this.setState({
// this.setState({
// data: a,
// data: a,
...
@@ -150,6 +296,32 @@ export default class ProfitLoss extends Component {
...
@@ -150,6 +296,32 @@ export default class ProfitLoss extends Component {
}
}
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
)
=>
{
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
// let data = this.state.dataTable2
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
dataTable2
[
tableMeta
.
rowIndex
][
2
])
if
(
indexParent
>
0
)
{
// console.log(indexParent)
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
let
jagain
=
dataTable2
[
indexParent
][
tableMeta
.
columnIndex
]
a
=
dataTable2
[
indexParent
][
tableMeta
.
columnIndex
]
=
jagain
==
undefined
?
(
0
+
Number
(
val
))
:
(
jagain
+
Number
(
val
))
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
}
const
handleValue
=
(
data
)
=>
{
let
total
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
data
.
rowData
[
1
]
==
item
[
2
])
{
total
=
item
[
data
.
columnIndex
]
==
undefined
?
(
total
+
0
)
:
(
total
+
item
[
data
.
columnIndex
])
}
})
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
dataTable2
[
data
.
rowIndex
][
2
])
let
a
=
dataTable2
[
data
.
rowIndex
][
data
.
columnIndex
]
=
total
// console.log(indexParent);
return
a
}
const
columns
=
[{
const
columns
=
[{
name
:
""
,
name
:
""
,
options
:
{
options
:
{
...
@@ -170,11 +342,16 @@ export default class ProfitLoss extends Component {
...
@@ -170,11 +342,16 @@ export default class ProfitLoss extends Component {
options
:
{
options
:
{
display
:
false
display
:
false
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
{
},
{
name
:
"Account"
,
name
:
"Account"
,
options
:
{
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
key
=
{
columnMeta
.
index
}
style
=
{{
...
style
,
top
:
0
,
zIndex
:
102
,
backgroundColor
:
'#354960'
,
width
:
3
00
}}
>
<
TableCell
key
=
{
columnMeta
.
index
}
style
=
{{
...
style
,
top
:
0
,
zIndex
:
102
,
backgroundColor
:
'#354960'
,
width
:
3
88
}}
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
textAlign
:
'left'
}}
>
{
columnMeta
.
name
}
<
/Typography
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
textAlign
:
'left'
}}
>
{
columnMeta
.
name
}
<
/Typography
>
<
/TableCell
>
<
/TableCell
>
),
),
...
@@ -182,69 +359,12 @@ export default class ProfitLoss extends Component {
...
@@ -182,69 +359,12 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
388
}}
>
<
div
style
=
{{
width
:
388
}}
>
{
tableMeta
.
rowData
[
3
]
==
0
?
{
tableMeta
.
rowData
[
4
]
==
0
?
<
span
style
=
{{
fontSize
:
12
,
fontWeight
:
'bold'
}}
>
{
String
(
val
).
toUpperCase
()}
<
/span
>
<
span
style
=
{{
fontSize
:
12
,
fontWeight
:
'bold'
}}
>
{
String
(
val
).
toUpperCase
()}
<
/span
>
:
:
tableMeta
.
rowData
[
3
]
===
1
?
tableMeta
.
rowData
[
4
]
===
1
?
<
span
style
=
{{
fontSize
:
12
,
marginLeft
:
20
}}
>
{
val
}
<
/span>
:
<
span
style
=
{{
fontSize
:
12
,
marginLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
{
val
}
<
/span>
:
<
span
style
=
{{
fontSize
:
12
,
marginLeft
:
40
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
fontSize
:
12
,
marginLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
{
val
}
<
/span
>
}
<
/div
>
)
}
}
},
{
name
:
"Keterangan"
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
backgroundColor
:
'#354960'
,
width
:
96
}}
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
textAlign
:
'center'
}}
>
{
columnMeta
.
name
}
<
/Typography
>
<
/TableCell
>
),
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
TextField
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
InputProps
=
{{
disableUnderline
:
true
}}
inputProps
=
{{
style
:
{
fontSize
:
12
,
color
:
"#5198ea"
}
}}
onChange
=
{
event
=>
{
// console.log(event.target)
updateValue
(
event
.
target
.
value
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
TextField
style
=
{{
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
InputProps
=
{{
disableUnderline
:
true
}}
placeholder
=
""
disabled
=
{
true
}
/
>
<
/span
>
:
tableMeta
.
rowData
[
0
]
===
1
?
<
span
>-<
/span
>
:
<
span
>
validasi
<
/span
>
}
}
<
/div
>
<
/div
>
)
)
...
@@ -258,23 +378,10 @@ export default class ProfitLoss extends Component {
...
@@ -258,23 +378,10 @@ export default class ProfitLoss extends Component {
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
textAlign
:
'center'
}}
>
{
columnMeta
.
name
}
<
/Typography
>
<
Typography
style
=
{{
color
:
'white'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
textAlign
:
'center'
}}
>
{
columnMeta
.
name
}
<
/Typography
>
<
/TableCell
>
<
/TableCell
>
),
),
// customHeadRender: (columnMeta) => (
// <TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell>
// ),
// setCellProps: () => ({
// style: {
// position: "sticky",
// left: 420,
// background: "white",
// zIndex: 101
// }
// }),
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -286,10 +393,10 @@ export default class ProfitLoss extends Component {
...
@@ -286,10 +393,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -303,10 +410,13 @@ export default class ProfitLoss extends Component {
...
@@ -303,10 +410,13 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
tableMeta
.
rowData
[
0
]
===
4
?
null
:
tableMeta
.
rowData
[
0
]
===
1
?
tableMeta
.
rowData
[
0
]
===
1
?
<
span
>-<
/span
>
<
span
>-<
/span
>
:
:
...
@@ -327,7 +437,7 @@ export default class ProfitLoss extends Component {
...
@@ -327,7 +437,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -339,10 +449,10 @@ export default class ProfitLoss extends Component {
...
@@ -339,10 +449,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -356,7 +466,7 @@ export default class ProfitLoss extends Component {
...
@@ -356,7 +466,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -380,7 +490,7 @@ export default class ProfitLoss extends Component {
...
@@ -380,7 +490,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -392,10 +502,10 @@ export default class ProfitLoss extends Component {
...
@@ -392,10 +502,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -409,7 +519,7 @@ export default class ProfitLoss extends Component {
...
@@ -409,7 +519,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -433,7 +543,7 @@ export default class ProfitLoss extends Component {
...
@@ -433,7 +543,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -445,10 +555,10 @@ export default class ProfitLoss extends Component {
...
@@ -445,10 +555,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -462,7 +572,7 @@ export default class ProfitLoss extends Component {
...
@@ -462,7 +572,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -486,7 +596,7 @@ export default class ProfitLoss extends Component {
...
@@ -486,7 +596,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -498,10 +608,10 @@ export default class ProfitLoss extends Component {
...
@@ -498,10 +608,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -515,7 +625,7 @@ export default class ProfitLoss extends Component {
...
@@ -515,7 +625,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -539,7 +649,7 @@ export default class ProfitLoss extends Component {
...
@@ -539,7 +649,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -551,10 +661,10 @@ export default class ProfitLoss extends Component {
...
@@ -551,10 +661,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -568,7 +678,7 @@ export default class ProfitLoss extends Component {
...
@@ -568,7 +678,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -592,7 +702,7 @@ export default class ProfitLoss extends Component {
...
@@ -592,7 +702,7 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
<
FormControlLabel
style
=
{{
margin
:
0
}}
style
=
{{
margin
:
0
}}
...
@@ -604,10 +714,10 @@ export default class ProfitLoss extends Component {
...
@@ -604,10 +714,10 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
value
=
{
value
}
value
=
{
value
}
on
Change
=
{
event
=>
{
on
Blur
=
{(
event
)
=>
{
//
console.log(event.target
)
//
updateValue(event.target.value
)
updateValue
(
event
.
target
.
value
)
handleChange
(
event
.
target
.
value
,
tableMeta
)
this
.
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
}}
/
>
/
>
}
}
...
@@ -621,7 +731,7 @@ export default class ProfitLoss extends Component {
...
@@ -621,7 +731,7 @@ export default class ProfitLoss extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
handleValue
(
tableMeta
)}
value
=
{
handleValue
(
tableMeta
)}
/
>
/
>
<
/span
>
<
/span
>
:
:
...
@@ -705,7 +815,7 @@ export default class ProfitLoss extends Component {
...
@@ -705,7 +815,7 @@ export default class ProfitLoss extends Component {
<
div
style
=
{{
marginTop
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
'100%'
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
data
=
{
this
.
state
.
dataTable
}
data
=
{
dataTable2
}
columns
=
{
columns
}
columns
=
{
columns
}
options
=
{
options
}
options
=
{
options
}
/
>
/
>
...
...
src/container/ForgotPassword.js
View file @
66044314
...
@@ -41,7 +41,7 @@ class ForgotPassword extends Component {
...
@@ -41,7 +41,7 @@ class ForgotPassword extends Component {
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email Cannot be Empty.'
})
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email Cannot be Empty.'
})
}
else
if
(
!
isEmail
)
{
}
else
if
(
!
isEmail
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'
Email Format is Not Correct
.'
})
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'
Please enter a valid email address
.'
})
}
else
{
}
else
{
this
.
verification
()
this
.
verification
()
}
}
...
...
src/container/Login.js
View file @
66044314
...
@@ -77,7 +77,7 @@ class Login extends Component {
...
@@ -77,7 +77,7 @@ class Login extends Component {
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email Cannot be Empty.'
})
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email Cannot be Empty.'
})
}
else
if
(
!
isEmail
)
{
}
else
if
(
!
isEmail
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'
Email Format is Not Correct
.'
})
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'
Please enter a valid email address
.'
})
}
else
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
}
else
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password Cannot be Empty.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password Cannot be Empty.'
})
}
else
{
}
else
{
...
...
src/container/MasterData/UnitBisnis.js
View file @
66044314
...
@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component {
...
@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component {
messageAlert
:
''
,
messageAlert
:
''
,
create
:
false
,
create
:
false
,
edit
:
false
,
edit
:
false
,
load
:
false
load
:
false
,
judul
:
''
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component {
...
@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component {
console
.
log
(
err
);
console
.
log
(
err
);
}
}
else
{
else
{
let
judul
=
resp
.
rows
[
2
]
let
isi
=
resp
.
rows
.
slice
(
3
)
let
isi
=
resp
.
rows
.
slice
(
3
)
let
payload
=
[]
let
payload
=
[]
isi
.
map
((
item
,
index
)
=>
{
isi
.
map
((
item
,
index
)
=>
{
...
@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component {
...
@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component {
let
body
=
{
let
body
=
{
business_unit
:
payload
business_unit
:
payload
}
}
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
console
.
log
(
resp
.
rows
[
1
])
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
api
.
create
().
checkUploadUnitBisnis
(
body
).
then
(
response
=>
{
api
.
create
().
checkUploadUnitBisnis
(
body
).
then
(
response
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
let
dataRow
=
[]
let
dataRow
=
[]
...
@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component {
...
@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component {
}
}
]
]
console
.
log
(
dataRow
);
//
console.log(dataRow);
this
.
setState
({
this
.
setState
({
dataLoaded
:
true
,
dataLoaded
:
true
,
cols
:
columns
,
cols
:
columns
,
...
@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component {
...
@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadUnitBisnis
()}
disabled
=
{
this
.
state
.
buttonError
==
true
?
true
:
false
}
onClick
=
{()
=>
this
.
uploadUnitBisnis
()}
style
=
{{}}
style
=
{{}}
>
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component {
...
@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component {
this
.
fileHandler
(
dt
)
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
}}
onUpload
=
{()
=>
this
.
setState
({
visibleUpload
:
false
,
visibleUnitBisnis
:
false
})}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MASTER DATA - BUSINESS UNIT"
?
this
.
setState
({
visibleUpload
:
false
,
visibleUnitBisnis
:
false
})
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/Otorisasi/User.js
View file @
66044314
...
@@ -38,7 +38,8 @@ export default class UserRole extends Component {
...
@@ -38,7 +38,8 @@ export default class UserRole extends Component {
messageAlert
:
''
,
messageAlert
:
''
,
buttonCreate
:
false
,
buttonCreate
:
false
,
buttonEdit
:
false
,
buttonEdit
:
false
,
load
:
false
load
:
false
,
judul
:
''
}
}
}
}
...
@@ -59,24 +60,25 @@ export default class UserRole extends Component {
...
@@ -59,24 +60,25 @@ export default class UserRole extends Component {
api
.
create
().
getUser
().
then
((
response
)
=>
{
api
.
create
().
getUser
().
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
console
.
log
(
response
.
data
);
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
user_id
-
b
.
user_id
).
map
((
item
,
index
)
=>
{
let
data
=
response
.
data
.
data
return
[
index
,
item
.
user_id
,
item
.
fullname
===
null
?
'-'
:
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
totalCompany
,
item
.
status
]
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
user_id
-
b
.
user_id
).
map
((
item
,
index
)
=>
{
})
return
[
index
,
item
.
user_id
,
item
.
fullname
===
null
?
'-'
:
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
totalCompany
,
item
.
status
]
this
.
setState
({
listUser
:
listData
})
})
}
else
{
this
.
setState
({
listUser
:
listData
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
}
else
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
setTimeout
(()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
setTimeout
(()
=>
{
window
.
location
.
reload
();
localStorage
.
removeItem
(
Constant
.
TOKEN
)
},
1000
);
window
.
location
.
reload
();
}
},
1000
);
})
}
}
})
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -86,23 +88,23 @@ export default class UserRole extends Component {
...
@@ -86,23 +88,23 @@ export default class UserRole extends Component {
getPermission
()
{
getPermission
()
{
let
payload
=
{
let
payload
=
{
menu
:
"user"
menu
:
"user"
}
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
this
.
setState
({
buttonCreate
:
response
.
data
.
data
.
create
,
buttonCreate
:
response
.
data
.
data
.
create
,
buttonEdit
:
response
.
data
.
data
.
edit
,
buttonEdit
:
response
.
data
.
data
.
edit
,
load
:
true
load
:
true
})
})
}
else
{
}
else
{
this
.
setState
({
load
:
true
})
this
.
setState
({
load
:
true
})
}
}
}
}
})
})
}
}
searchUser
()
{
searchUser
()
{
let
payload
=
{
let
payload
=
{
...
@@ -111,24 +113,24 @@ export default class UserRole extends Component {
...
@@ -111,24 +113,24 @@ export default class UserRole extends Component {
api
.
create
().
searchUser
(
payload
).
then
((
response
)
=>
{
api
.
create
().
searchUser
(
payload
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
user_id
-
b
.
user_id
).
map
((
item
,
index
)
=>
{
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
user_id
-
b
.
user_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
user_id
,
item
.
fullname
==
null
?
'-'
:
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
totalCompany
,
item
.
status
]
return
[
index
,
item
.
user_id
,
item
.
fullname
==
null
?
'-'
:
item
.
fullname
,
item
.
email
,
item
.
role_name
,
item
.
totalCompany
,
item
.
status
]
})
})
this
.
setState
({
listUser
:
listData
})
this
.
setState
({
listUser
:
listData
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
window
.
location
.
reload
();
},
1000
);
},
1000
);
}
})
}
}
})
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -146,7 +148,7 @@ export default class UserRole extends Component {
...
@@ -146,7 +148,7 @@ export default class UserRole extends Component {
// let judul = resp.rows[0]
// let judul = resp.rows[0]
let
isi
=
resp
.
rows
.
slice
(
3
)
let
isi
=
resp
.
rows
.
slice
(
3
)
let
payload
=
[]
let
payload
=
[]
console
.
log
(
isi
)
//
console.log(isi)
isi
.
map
((
item
,
index
)
=>
{
isi
.
map
((
item
,
index
)
=>
{
if
(
item
.
length
>
0
)
{
if
(
item
.
length
>
0
)
{
payload
.
push
({
payload
.
push
({
...
@@ -162,153 +164,157 @@ export default class UserRole extends Component {
...
@@ -162,153 +164,157 @@ export default class UserRole extends Component {
let
body
=
{
let
body
=
{
user
:
payload
user
:
payload
}
}
this
.
setState
({
payload
:
body
,
rows
:
[]})
console
.
log
(
resp
.
rows
[
1
])
this
.
setState
({
payload
:
body
,
rows
:
[],
judul
:
resp
.
rows
[
1
][
0
]
})
api
.
create
().
checkUploadUser
(
body
).
then
(
response
=>
{
api
.
create
().
checkUploadUser
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
return
[
index
+
1
,
index
+
1
,
item
.
fullname
,
item
.
fullname
,
item
.
email
,
item
.
email
,
item
.
role
,
item
.
role
,
item
.
start_date
,
item
.
start_date
,
item
.
end_date
,
item
.
end_date
,
item
.
error
item
.
error
]
]
})
})
let
columns
=
[
let
columns
=
[
"Data"
,
"Data"
,
"Full Name"
,
"Full Name"
,
{
{
name
:
"Email"
,
name
:
"Email"
,
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
// console.log(tableMeta)
// console.log(tableMeta)
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'email'
))
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'email'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Role"
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/div
>
);
}
}
},
{
name
:
"Valid From"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Role"
,
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
}
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid To"
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/div
>
}
);
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
}
<
/div
>
}
);
},
}
{
}
name
:
""
,
},
options
:
{
{
display
:
false
name
:
"Valid From"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
]
},
{
this
.
setState
({
name
:
"Valid To"
,
dataLoaded
:
true
,
options
:
{
cols
:
columns
,
customBodyRender
:
(
val
,
tableMeta
)
=>
{
rows
:
dataRow
let
check
=
null
});
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
}
else
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
check
>
-
1
)
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
this
.
setState
({
buttonError
:
true
})
setTimeout
(()
=>
{
console
.
log
(
'masuk'
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
}
window
.
location
.
reload
();
},
1000
);
}
}
})
return
(
}
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
]
this
.
setState
({
dataLoaded
:
true
,
cols
:
columns
,
rows
:
dataRow
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -348,32 +354,66 @@ export default class UserRole extends Component {
...
@@ -348,32 +354,66 @@ export default class UserRole extends Component {
updateUser
(
payload
)
{
updateUser
(
payload
)
{
api
.
create
().
updateUser
(
payload
).
then
((
response
)
=>
{
api
.
create
().
updateUser
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
.
data
.
message
)
console
.
log
(
response
.
data
.
message
)
console
.
log
(
response
.
data
.
status
)
console
.
log
(
response
.
data
.
status
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
getUser
()
this
.
getUser
()
this
.
closeEdit
()
this
.
closeEdit
()
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
window
.
location
.
reload
();
},
1000
);
},
1000
);
}
}
})
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
})
}
}
createUser
(
payload
)
{
api
.
create
().
createUser
(
payload
).
then
((
response
)
=>
{
// console.log(response)
// if (String(response.data.status).toLocaleUpperCase === 'Success' || String(response.data.status).toLocaleUpperCase === 'success') {
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
create
:
false
})
this
.
getUser
()
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
// } else {
// alert(response.data.message)
// this.props.onClickClose()
// this.props.refresh()
// }
})
}
_handleKeyDown
(
e
)
{
_handleKeyDown
(
e
)
{
if
(
e
.
key
===
'Enter'
)
{
if
(
e
.
key
===
'Enter'
)
{
...
@@ -387,27 +427,27 @@ export default class UserRole extends Component {
...
@@ -387,27 +427,27 @@ export default class UserRole extends Component {
uploadUser
()
{
uploadUser
()
{
api
.
create
().
uploadUser
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
uploadUser
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
)
this
.
getUser
()
this
.
getUser
()
this
.
setState
({
visibleUser
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
visibleUser
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
window
.
location
.
reload
();
},
1000
);
},
1000
);
}
})
}
}
})
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
...
@@ -437,7 +477,7 @@ export default class UserRole extends Component {
...
@@ -437,7 +477,7 @@ export default class UserRole extends Component {
<
img
src
=
{
Images
.
editCopy
}
/
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
<
/button
>
)}
)}
{
/* :
{
/* :
null
null
} */
}
} */
}
<
/div
>
<
/div
>
...
@@ -472,7 +512,7 @@ export default class UserRole extends Component {
...
@@ -472,7 +512,7 @@ export default class UserRole extends Component {
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
span
style
=
{{
color
:
tableMeta
.
rowData
[
6
]
===
"Active"
?
"#656565"
:
'rgba(0, 0, 0, 0.25)'
}}
>
{
titleCase
(
val
)
}
<
/span
>
<
span
style
=
{{
color
:
tableMeta
.
rowData
[
6
]
===
"Active"
?
"#656565"
:
'rgba(0, 0, 0, 0.25)'
}}
>
{
val
}
<
/span
>
<
/div
>
<
/div
>
);
);
}
}
...
@@ -516,9 +556,9 @@ export default class UserRole extends Component {
...
@@ -516,9 +556,9 @@ export default class UserRole extends Component {
{
/* <Row> */
}
{
/* <Row> */
}
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
195
,
width
:
'100%'
}}
/
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
195
,
width
:
'100%'
}}
/
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Alert
>
<
/Snackbar
>
<
/Snackbar
>
{
this
.
state
.
visibleUser
?
<
div
>
{
this
.
state
.
visibleUser
?
<
div
>
{
this
.
state
.
load
&&
(
{
this
.
state
.
load
&&
(
...
@@ -675,7 +715,8 @@ export default class UserRole extends Component {
...
@@ -675,7 +715,8 @@ export default class UserRole extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadUser
()}
disabled
=
{
this
.
state
.
buttonError
===
true
?
true
:
false
}
onClick
=
{()
=>
this
.
uploadUser
()}
style
=
{{}}
style
=
{{}}
>
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
@@ -690,6 +731,7 @@ export default class UserRole extends Component {
...
@@ -690,6 +731,7 @@ export default class UserRole extends Component {
onClickClose
=
{
this
.
closeAdd
.
bind
(
this
)}
onClickClose
=
{
this
.
closeAdd
.
bind
(
this
)}
refresh
=
{
this
.
getUser
.
bind
(
this
)}
refresh
=
{
this
.
getUser
.
bind
(
this
)}
data
=
{
this
.
state
.
indexData
}
data
=
{
this
.
state
.
indexData
}
createUser
=
{
this
.
createUser
.
bind
(
this
)}
/
>
/
>
)}
)}
{
this
.
state
.
edit
&&
(
{
this
.
state
.
edit
&&
(
...
@@ -706,7 +748,7 @@ export default class UserRole extends Component {
...
@@ -706,7 +748,7 @@ export default class UserRole extends Component {
{
this
.
state
.
visibleUpload
&&
(
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
...
@@ -731,7 +773,11 @@ export default class UserRole extends Component {
...
@@ -731,7 +773,11 @@ export default class UserRole extends Component {
this
.
fileHandler
(
dt
)
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
}}
onUpload
=
{()
=>
this
.
setState
({
visibleUpload
:
false
,
visibleUser
:
false
})}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
'MASTER DATA - USER'
?
this
.
setState
({
visibleUpload
:
false
,
visibleUser
:
false
})
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/Otorisasi/User/AddUser.js
View file @
66044314
...
@@ -94,7 +94,8 @@ export default class AddUser extends Component {
...
@@ -94,7 +94,8 @@ export default class AddUser extends Component {
let
data
=
this
.
state
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
let
isDate
=
type
!==
''
?
true
:
false
if
(
isDate
&&
type
===
'start_date'
)
{
if
(
isDate
&&
type
===
'start_date'
)
{
this
.
setState
({
...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
this
.
setState
({
...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
...
@@ -107,7 +108,8 @@ export default class AddUser extends Component {
...
@@ -107,7 +108,8 @@ export default class AddUser extends Component {
msgErrorED
:
''
,
msgErrorED
:
''
,
})
})
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
this
.
setState
({
...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
)
,
this
.
setState
({
...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
),
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
...
@@ -120,7 +122,8 @@ export default class AddUser extends Component {
...
@@ -120,7 +122,8 @@ export default class AddUser extends Component {
msgErrorED
:
''
,
msgErrorED
:
''
,
})
})
}
else
{
}
else
{
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
...
@@ -137,17 +140,17 @@ export default class AddUser extends Component {
...
@@ -137,17 +140,17 @@ export default class AddUser extends Component {
clearError
()
{
clearError
()
{
this
.
setState
({
this
.
setState
({
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
})
})
}
}
isEmail
(
email
)
{
isEmail
(
email
)
{
...
@@ -163,66 +166,31 @@ export default class AddUser extends Component {
...
@@ -163,66 +166,31 @@ export default class AddUser extends Component {
}
else
if
(
R
.
isEmpty
(
this
.
state
.
email
))
{
}
else
if
(
R
.
isEmpty
(
this
.
state
.
email
))
{
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'Email Cannot be Empty.'
})
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'Email Cannot be Empty.'
})
}
else
if
(
!
isEmail
)
{
}
else
if
(
!
isEmail
)
{
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'
Email Format Not Recognized
.'
})
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'
Please enter a valid email address
.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
role
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
role
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role
Name
Cannot be Empty.'
})
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Valid From Cannot be Empty.'
})
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Valid From Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'Valid To Cannot be Empty.'
})
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'Valid To Cannot be Empty.'
})
}
else
if
(
this
.
state
.
company
.
length
<
1
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Authorization company cannot be empty'
,
tipeAlert
:
'warning'
})
}
}
// else if (this.state.privileges.length < 1) {
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
// alert('Hak Akses belum di pilih !!')
// }
// }
else
{
else
{
this
.
createUser
()
let
payload
=
{
}
"role_id"
:
this
.
state
.
role
.
role_id
,
}
"email"
:
this
.
state
.
email
,
"fullname"
:
this
.
state
.
fullname
,
createUser
()
{
"password"
:
this
.
state
.
fullname
,
let
payload
=
{
"company"
:
this
.
state
.
company
,
"role_id"
:
this
.
state
.
role
.
role_id
,
"start_date"
:
this
.
state
.
startDate
,
"email"
:
this
.
state
.
email
,
"end_date"
:
this
.
state
.
endDate
"fullname"
:
this
.
state
.
fullname
,
"password"
:
this
.
state
.
fullname
,
"company"
:
this
.
state
.
company
,
"start_date"
:
this
.
state
.
startDate
,
"end_date"
:
this
.
state
.
endDate
}
api
.
create
().
createUser
(
payload
).
then
((
response
)
=>
{
// console.log(response)
// if (String(response.data.status).toLocaleUpperCase === 'Success' || String(response.data.status).toLocaleUpperCase === 'success') {
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
this
.
props
.
refresh
()
},
750
);
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
this
.
props
.
createUser
(
payload
)
// } else {
}
// alert(response.data.message)
// this.props.onClickClose()
// this.props.refresh()
// }
})
}
}
getRole
()
{
getRole
()
{
...
@@ -307,7 +275,7 @@ export default class AddUser extends Component {
...
@@ -307,7 +275,7 @@ export default class AddUser extends Component {
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
this
.
handleItemClick
(
items
)
this
.
handleItemClick
(
items
)
})
})
}
}
...
@@ -318,10 +286,10 @@ export default class AddUser extends Component {
...
@@ -318,10 +286,10 @@ export default class AddUser extends Component {
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
if
(
indexIDs
!==
-
1
)
{
if
(
indexIDs
!==
-
1
)
{
company
.
splice
(
indexIDs
,
1
)
company
.
splice
(
indexIDs
,
1
)
}
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
this
.
handleItemClick
(
items
)
this
.
handleItemClick
(
items
)
})
})
}
}
...
@@ -346,7 +314,7 @@ export default class AddUser extends Component {
...
@@ -346,7 +314,7 @@ export default class AddUser extends Component {
return
(
return
(
// <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
)
?
(
data
.
children
.
length
>
0
?
padding
:
padding
+
30
)
:
padding
+
30
}}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
!
R
.
isNil
(
data
.
children
)
?
(
data
.
children
.
length
>
0
?
padding
:
padding
+
30
)
:
padding
+
30
}}
>
{
R
.
isNil
(
data
.
children
)
?
{
R
.
isNil
(
data
.
children
)
?
null
null
:
:
...
@@ -438,7 +406,7 @@ export default class AddUser extends Component {
...
@@ -438,7 +406,7 @@ export default class AddUser extends Component {
};
};
closeAlert
()
{
closeAlert
()
{
this
.
setState
({
alert
:
false
})
this
.
setState
({
alert
:
false
})
}
}
render
()
{
render
()
{
...
@@ -505,27 +473,27 @@ export default class AddUser extends Component {
...
@@ -505,27 +473,27 @@ export default class AddUser extends Component {
<
div
className
=
"column-2"
>
<
div
className
=
"column-2"
>
<
div
className
=
""
>
<
div
className
=
""
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
,
marginTop
:
7
}}
style
=
{{
width
:
'100%'
,
marginTop
:
7
}}
id
=
"fullname"
id
=
"fullname"
name
=
"fullname"
name
=
"fullname"
label
=
"Full Name"
label
=
"Full Name"
value
=
{
this
.
state
.
fullname
}
value
=
{
this
.
state
.
fullname
}
error
=
{
this
.
state
.
errorFullname
}
error
=
{
this
.
state
.
errorFullname
}
helperText
=
{
this
.
state
.
msgErrorFN
}
helperText
=
{
this
.
state
.
msgErrorFN
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
inputProps
=
{{
inputProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
// defaultValue="Default Value"
// defaultValue="Default Value"
// helperText="Some important text"
// helperText="Some important text"
/
>
/
>
...
@@ -537,27 +505,27 @@ export default class AddUser extends Component {
...
@@ -537,27 +505,27 @@ export default class AddUser extends Component {
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-bottom-20px"
>
<
div
className
=
"margin-bottom-20px"
>
<
TextField
<
TextField
style
=
{{
width
:
'100%'
,
marginTop
:
7
}}
style
=
{{
width
:
'100%'
,
marginTop
:
7
}}
id
=
"email"
id
=
"email"
name
=
"email"
name
=
"email"
label
=
"Email"
label
=
"Email"
value
=
{
this
.
state
.
email
}
value
=
{
this
.
state
.
email
}
error
=
{
this
.
state
.
errorEmail
}
error
=
{
this
.
state
.
errorEmail
}
helperText
=
{
this
.
state
.
msgErrorEM
}
helperText
=
{
this
.
state
.
msgErrorEM
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
inputProps
=
{{
inputProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}
}}
}}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
,
color
:
'#7e8085'
,
}
}
}}
}}
// defaultValue="Default Value"
// defaultValue="Default Value"
// helperText="Some important text"
// helperText="Some important text"
/
>
/
>
...
@@ -569,25 +537,25 @@ export default class AddUser extends Component {
...
@@ -569,25 +537,25 @@ export default class AddUser extends Component {
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listRole
}
{...
this
.
state
.
listRole
}
id
=
"role"
id
=
"role"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
},
()
=>
this
.
clearError
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
},
()
=>
this
.
clearError
())}
debug
debug
renderInput
=
{(
params
)
=>
renderInput
=
{(
params
)
=>
<
TextField
<
TextField
{...
params
}
{...
params
}
label
=
"Role"
label
=
"Role"
margin
=
"normal"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
style
=
{{
marginTop
:
7
}}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
error
=
{
this
.
state
.
errorRoleName
}
error
=
{
this
.
state
.
errorRoleName
}
helperText
=
{
this
.
state
.
msgErrorRN
}
helperText
=
{
this
.
state
.
msgErrorRN
}
InputLabelProps
=
{{
InputLabelProps
=
{{
style
:
{
style
:
{
fontSize
:
11
,
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
color
:
'#7e8085'
}
}
}}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
}
value
=
{
this
.
state
.
role
}
value
=
{
this
.
state
.
role
}
/
>
/
>
...
...
src/container/Otorisasi/User/EditUser.js
View file @
66044314
...
@@ -178,9 +178,9 @@ export default class EditUser extends Component {
...
@@ -178,9 +178,9 @@ export default class EditUser extends Component {
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
email
))
{
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
email
))
{
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'Email Cannot be Empty.'
})
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'Email Cannot be Empty.'
})
}
else
if
(
!
isEmail
)
{
}
else
if
(
!
isEmail
)
{
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'
Email Format Not Recognized
.'
})
this
.
setState
({
errorEmail
:
true
,
msgErrorEM
:
'
Please enter a valid email address
.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
role
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
role
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role
Name
Cannot be Empty.'
})
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'Role Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Valid From Cannot be Empty.'
})
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Valid From Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
...
...
src/container/ResetPassword.js
View file @
66044314
...
@@ -70,15 +70,15 @@ class ResetPassword extends Component {
...
@@ -70,15 +70,15 @@ class ResetPassword extends Component {
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'New Password Cannot be Empty.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'New Password Cannot be Empty.'
})
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Minimum 8 Characters
.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Minimum length : 8
.'
})
}
else
if
(
this
.
isEmail
(
this
.
state
.
password
))
{
}
else
if
(
this
.
isEmail
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Format Should Not Use Email
.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Should not be same as Email Address
.'
})
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Must be a Combination of Characters, Letters and N
umbers.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Must using combination of characters, letters and n
umbers.'
})
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Password Confirmation Cannot be Empty.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Password Confirmation Cannot be Empty.'
})
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'
Password Does Not M
atch.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'
The password and password confirmation do not m
atch.'
})
}
else
{
}
else
{
this
.
confirmPassword
()
this
.
confirmPassword
()
}
}
...
...
src/container/SetPassword.js
View file @
66044314
...
@@ -70,15 +70,15 @@ class SetPassword extends Component {
...
@@ -70,15 +70,15 @@ class SetPassword extends Component {
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'New Password Cannot be Empty.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'New Password Cannot be Empty.'
})
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Minimum 8 Characters
.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Minimum length : 8
.'
})
}
else
if
(
this
.
isEmail
(
this
.
state
.
password
))
{
}
else
if
(
this
.
isEmail
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Format Should Not Use Email
.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Should not be same as Email Address
.'
})
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
New Password Must be a Combination of Characters, Letters and N
umbers.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Invalid password. Must using combination of characters, letters and n
umbers.'
})
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Password Confirmation Cannot be Empty.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Password Confirmation Cannot be Empty.'
})
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'
Password Does Not M
atch.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'
The password and password confirmation do not m
atch.'
})
}
else
{
}
else
{
this
.
confirmPassword
()
this
.
confirmPassword
()
}
}
...
...
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