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
a4779251
Commit
a4779251
authored
Sep 07, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
c3f4073c
4a5b3424
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1179 additions
and
197 deletions
+1179
-197
index.js
src/api/index.js
+6
-2
EmailVerification.js
src/container/EmailVerification.js
+4
-0
ForgotPassword.js
src/container/ForgotPassword.js
+4
-0
CreatePerusahaan.js
src/container/MasterData/Perusahaan/CreatePerusahaan.js
+21
-7
DeletePerusahaan.js
src/container/MasterData/Perusahaan/DeletePerusahaan.js
+90
-0
Perusahaan.js
src/container/MasterData/Perusahaan/Perusahaan.js
+91
-15
ReportItems.js
src/container/MasterData/ReportItems.js
+215
-71
CreateReportItems.js
...container/MasterData/formReportItems/CreateReportItems.js
+98
-3
EditReportItems.js
src/container/MasterData/formReportItems/EditReportItems.js
+99
-2
User.js
src/container/Otorisasi/User.js
+100
-20
AddUser.js
src/container/Otorisasi/User/AddUser.js
+70
-23
EditUser.js
src/container/Otorisasi/User/EditUser.js
+66
-18
UserRole.js
src/container/Otorisasi/UserRole.js
+76
-2
AddRole.js
src/container/Otorisasi/UserRole/AddRole.js
+121
-15
EditRole.js
src/container/Otorisasi/UserRole/EditRole.js
+114
-15
Profile.js
src/container/Profile.js
+1
-1
ResetPassword.js
src/container/ResetPassword.js
+1
-1
SetPassword.js
src/container/SetPassword.js
+2
-2
No files found.
src/api/index.js
View file @
a4779251
...
@@ -104,6 +104,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -104,6 +104,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
getDetailPerusahaan
=
(
id
)
=>
api
.
get
(
`company/get_company_by_id/
${
id
}
`
)
const
getDetailPerusahaan
=
(
id
)
=>
api
.
get
(
`company/get_company_by_id/
${
id
}
`
)
const
uploadPerusahaan
=
(
body
)
=>
api
.
post
(
'company/import_company'
,
body
)
const
uploadPerusahaan
=
(
body
)
=>
api
.
post
(
'company/import_company'
,
body
)
const
searchPerusahaan
=
(
body
)
=>
api
.
post
(
'company/search_company'
,
body
)
const
searchPerusahaan
=
(
body
)
=>
api
.
post
(
'company/search_company'
,
body
)
const
deletePerusahaan
=
(
id
)
=>
api
.
post
(
`company/delete_company/
${
id
}
`
)
// APPROVAL MATRIX
// APPROVAL MATRIX
const
getAM
=
()
=>
api
.
get
(
'approval_matrix/get_all_approval_matrix'
)
const
getAM
=
()
=>
api
.
get
(
'approval_matrix/get_all_approval_matrix'
)
...
@@ -125,7 +126,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -125,7 +126,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
searchUser
=
(
body
)
=>
api
.
post
(
'user/search_user'
,
body
)
const
searchUser
=
(
body
)
=>
api
.
post
(
'user/search_user'
,
body
)
const
createUser
=
(
body
)
=>
api
.
post
(
'user/create_user'
,
body
)
const
createUser
=
(
body
)
=>
api
.
post
(
'user/create_user'
,
body
)
const
updateUser
=
(
body
)
=>
api
.
post
(
'user/update_user'
,
body
)
const
updateUser
=
(
body
)
=>
api
.
post
(
'user/update_user'
,
body
)
const
deleteUser
=
(
userId
)
=>
api
.
ge
t
(
`user/delete_user/
${
userId
}
`
)
const
deleteUser
=
(
userId
)
=>
api
.
pos
t
(
`user/delete_user/
${
userId
}
`
)
const
changePassword
=
(
body
)
=>
api
.
post
(
'/user/change_password'
,
body
)
const
changePassword
=
(
body
)
=>
api
.
post
(
'/user/change_password'
,
body
)
const
checkUploadUser
=
(
body
)
=>
api
.
post
(
'/user/check_import'
,
body
)
const
checkUploadUser
=
(
body
)
=>
api
.
post
(
'/user/check_import'
,
body
)
const
uploadUser
=
(
body
)
=>
api
.
post
(
'/user/import_user'
,
body
)
const
uploadUser
=
(
body
)
=>
api
.
post
(
'/user/import_user'
,
body
)
...
@@ -143,6 +144,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -143,6 +144,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
getItemReportHierarki
=
(
body
)
=>
api
.
post
(
'item_report/get_item_report_hierarki'
,
body
)
const
getItemReportHierarki
=
(
body
)
=>
api
.
post
(
'item_report/get_item_report_hierarki'
,
body
)
const
saveVisualisasiReport
=
(
body
)
=>
api
.
post
(
'item_report/save_visualization'
,
body
)
const
saveVisualisasiReport
=
(
body
)
=>
api
.
post
(
'item_report/save_visualization'
,
body
)
const
getReportParent
=
(
body
)
=>
api
.
post
(
'item_report/get_parent_item_report'
,
body
)
const
getReportParent
=
(
body
)
=>
api
.
post
(
'item_report/get_parent_item_report'
,
body
)
const
deleteReportItems
=
(
id
)
=>
api
.
post
(
`item_report/delete_item_report/
${
id
}
`
)
//PARAMETER
//PARAMETER
const
getAllParameter
=
()
=>
api
.
get
(
'/setting/get_all_setting'
)
const
getAllParameter
=
()
=>
api
.
get
(
'/setting/get_all_setting'
)
...
@@ -271,7 +273,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -271,7 +273,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deleteAttachment
,
deleteAttachment
,
getDetailReportMB
,
getDetailReportMB
,
deleteUnitBisnis
,
deleteUnitBisnis
,
deleteParameter
deleteParameter
,
deletePerusahaan
,
deleteReportItems
}
}
}
}
...
...
src/container/EmailVerification.js
View file @
a4779251
...
@@ -12,6 +12,10 @@ class EmailVerification extends Component {
...
@@ -12,6 +12,10 @@ class EmailVerification extends Component {
}
}
}
}
componentDidMount
(){
console
.
log
(
"forgot-password"
)
}
handleChange
(
e
)
{
handleChange
(
e
)
{
let
data
=
this
.
state
let
data
=
this
.
state
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
...
...
src/container/ForgotPassword.js
View file @
a4779251
...
@@ -22,6 +22,10 @@ class ForgotPassword extends Component {
...
@@ -22,6 +22,10 @@ class ForgotPassword extends Component {
}
}
}
}
componentDidMount
(){
console
.
log
(
"forgot-password"
)
}
handleChange
(
e
)
{
handleChange
(
e
)
{
let
data
=
this
.
state
let
data
=
this
.
state
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
...
...
src/container/MasterData/Perusahaan/CreatePerusahaan.js
View file @
a4779251
...
@@ -53,12 +53,12 @@ export default class CreatePerusahaan extends Component {
...
@@ -53,12 +53,12 @@ export default class CreatePerusahaan extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getCompanyActive
()
this
.
getAllUnitBisnis
()
if
(
this
.
props
.
type
===
'edit'
)
{
if
(
this
.
props
.
type
===
'edit'
)
{
this
.
getDetailPerusahaan
()
this
.
getDetailPerusahaan
()
// console.log(this.props.data);
// console.log(this.props.data);
}
else
{
}
else
{
this
.
getCompanyActive
()
this
.
getAllUnitBisnis
()
let
date
=
format
(
new
Date
,
'yyyy-MM-dd'
)
let
date
=
format
(
new
Date
,
'yyyy-MM-dd'
)
// console.log(date);
// console.log(date);
this
.
setState
({
this
.
setState
({
...
@@ -86,7 +86,12 @@ export default class CreatePerusahaan extends Component {
...
@@ -86,7 +86,12 @@ export default class CreatePerusahaan extends Component {
totalReport
:
response
.
data
.
data
.
total_report
,
totalReport
:
response
.
data
.
data
.
total_report
,
created
:
response
.
data
.
data
.
created
,
created
:
response
.
data
.
data
.
created
,
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
},
()
=>
this
.
getAllUnitBisnis
(),
this
.
getCompanyActive
())
},
()
=>
{
// setTimeout(() => {
this
.
getAllUnitBisnis
()
this
.
getCompanyActive
()
// }, 1000);
})
}
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"
))
{
...
@@ -107,6 +112,7 @@ export default class CreatePerusahaan extends Component {
...
@@ -107,6 +112,7 @@ export default class CreatePerusahaan extends Component {
}
}
getCompanyActive
()
{
getCompanyActive
()
{
console
.
log
(
this
.
state
.
company
)
if
(
this
.
state
.
company
!==
null
)
{
if
(
this
.
state
.
company
!==
null
)
{
console
.
log
(
this
.
state
.
company
)
console
.
log
(
this
.
state
.
company
)
let
payload
=
{
let
payload
=
{
...
@@ -118,12 +124,20 @@ export default class CreatePerusahaan extends Component {
...
@@ -118,12 +124,20 @@ export default class CreatePerusahaan extends Component {
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
perusahaanData
=
data
.
map
((
item
)
=>
{
let
currentIndex
=
null
let
perusahaanData
=
data
.
map
((
item
,
index
)
=>
{
if
(
this
.
state
.
companyID
!==
item
.
company_id
)
{
return
{
return
{
company_id
:
item
.
company_id
,
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
company_name
:
item
.
company_name
}
}
}
else
{
currentIndex
=
index
}
})
})
if
(
currentIndex
!==
null
)
{
perusahaanData
.
splice
(
currentIndex
,
1
)
}
let
index
=
perusahaanData
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
parentID
)
let
index
=
perusahaanData
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
parentID
)
let
typeProps
=
{
let
typeProps
=
{
options
:
perusahaanData
,
options
:
perusahaanData
,
...
...
src/container/MasterData/Perusahaan/DeletePerusahaan.js
0 → 100644
View file @
a4779251
import
React
,
{
Component
}
from
'react'
;
import
Images
from
'../../../assets/Images'
;
import
{
Typography
}
from
'@material-ui/core'
;
import
api
from
"../../../api"
;
import
Constant
from
'../../../library/Constant'
;
export
default
class
DeletePerusahaan
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
companyID
:
''
,
company
:
null
,
}
}
componentDidMount
()
{
if
(
this
.
props
.
type
===
'delete'
)
{
this
.
getDetailPerusahaan
()
}
}
getDetailPerusahaan
()
{
api
.
create
().
getDetailPerusahaan
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
this
.
setState
({
companyID
:
data
.
company_id
,
company
:
data
.
company_name
,
})
}
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'
})
}
})
}
delete
()
{
if
(
this
.
props
.
type
==
'delete'
)
{
let
payload
=
this
.
state
.
id
this
.
props
.
deleteCompany
(
payload
)
}
}
render
()
{
return
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
,
padding
:
50
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
img
src
=
{
Images
.
failedCopy
}
/
>
<
/div
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'center'
,
marginTop
:
20
}}
>
<
span
style
=
{{
textAlign
:
'center'
,
fontSize
:
14
,
fontWeight
:
'bold'
}}
>
Delete
{
this
.
state
.
company
}
?
<
/span
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
24
}}
>
<
button
className
=
{
"btn-save"
}
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Cancel
<
/span
>
<
/button
>
<
button
className
=
{
"btn-save"
}
style
=
{{
marginLeft
:
50
}}
onClick
=
{()
=>
this
.
delete
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Delete
<
/span
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
);
}
}
src/container/MasterData/Perusahaan/Perusahaan.js
View file @
a4779251
...
@@ -14,7 +14,9 @@ import api from "../../../api";
...
@@ -14,7 +14,9 @@ import api from "../../../api";
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
// import DeletePerusahaan from "./DeletePerusahaan";
import
PopUpFailedSave
from
'../../../library/PopUpFailedSave'
;
import
PopUpFailedSave
from
'../../../library/PopUpFailedSave'
;
import
PopUpDelete
from
"../../../library/PopUpDelete"
;
import
Constant
from
'../../../library/Constant'
;
import
Constant
from
'../../../library/Constant'
;
var
ct
=
require
(
"../../../library/CustomTable"
);
var
ct
=
require
(
"../../../library/CustomTable"
);
...
@@ -32,6 +34,7 @@ export default class Perusahaan extends Component {
...
@@ -32,6 +34,7 @@ export default class Perusahaan extends Component {
visibleCreate
:
false
,
visibleCreate
:
false
,
visibleEdit
:
false
,
visibleEdit
:
false
,
visibleVisual
:
false
,
visibleVisual
:
false
,
visibleDelete
:
false
,
dataTable
:
[],
dataTable
:
[],
listData
:
[],
listData
:
[],
data
:
[],
data
:
[],
...
@@ -47,7 +50,10 @@ export default class Perusahaan extends Component {
...
@@ -47,7 +50,10 @@ export default class Perusahaan extends Component {
create
:
false
,
create
:
false
,
edit
:
false
,
edit
:
false
,
load
:
false
,
load
:
false
,
judul
:
''
judul
:
''
,
rowData
:
[],
companyName
:
''
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -85,12 +91,12 @@ export default class Perusahaan extends Component {
...
@@ -85,12 +91,12 @@ export default class Perusahaan extends Component {
checkUpload
()
{
checkUpload
()
{
api
.
create
().
checkUploadPerusahaan
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
checkUploadPerusahaan
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
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
,
item
.
company_name
,
item
.
company_name
,
item
.
company_parent
,
item
.
company_parent
,
item
.
unit_bisnis
,
item
.
unit_bisnis
,
...
@@ -100,7 +106,6 @@ export default class Perusahaan extends Component {
...
@@ -100,7 +106,6 @@ export default class Perusahaan extends Component {
]
]
})
})
let
columns
=
[
let
columns
=
[
"Data"
,
{
{
name
:
"Company Name"
,
name
:
"Company Name"
,
options
:
{
options
:
{
...
@@ -116,9 +121,9 @@ export default class Perusahaan extends Component {
...
@@ -116,9 +121,9 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"company_name"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"company_name"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"company_name"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"company_name"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -141,9 +146,9 @@ export default class Perusahaan extends Component {
...
@@ -141,9 +146,9 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"company_parent"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"company_parent"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"company_parent"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"company_parent"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -166,9 +171,9 @@ export default class Perusahaan extends Component {
...
@@ -166,9 +171,9 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"unit_bisnis"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"unit_bisnis"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"unit_bisnis"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"unit_bisnis"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -191,9 +196,9 @@ export default class Perusahaan extends Component {
...
@@ -191,9 +196,9 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -216,9 +221,9 @@ export default class Perusahaan extends Component {
...
@@ -216,9 +221,9 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"Empty"
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -323,6 +328,12 @@ export default class Perusahaan extends Component {
...
@@ -323,6 +328,12 @@ export default class Perusahaan extends Component {
rowData
:
rowData
,
rowData
:
rowData
,
visibleEdit
:
true
visibleEdit
:
true
})
})
}
else
if
(
type
===
'delete'
)
{
this
.
setState
({
rowData
:
rowData
,
companyName
:
String
(
rowData
[
2
]),
visibleDelete
:
true
})
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
rowData
:
rowData
,
rowData
:
rowData
,
...
@@ -475,6 +486,33 @@ export default class Perusahaan extends Component {
...
@@ -475,6 +486,33 @@ export default class Perusahaan extends Component {
})
})
}
}
deleteCompany
=
(
payload
)
=>
{
let
id
=
String
(
payload
[
1
])
api
.
create
().
deletePerusahaan
(
id
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
visibleDelete
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
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'
})
}
})
}
closeAlert
()
{
closeAlert
()
{
this
.
setState
({
alert
:
false
})
this
.
setState
({
alert
:
false
})
}
}
...
@@ -498,7 +536,26 @@ export default class Perusahaan extends Component {
...
@@ -498,7 +536,26 @@ export default class Perusahaan extends Component {
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'edit'
)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'edit'
)}
>
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
!
tableMeta
.
rowData
[
2
].
includes
(
"TIA"
)
?
<
img
src
=
{
Images
.
editCopy
}
/>
:
null
}
<
/div
>
<
/button
>
)}
{
this
.
state
.
edit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
10
}}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'delete'
)}
>
<
img
src
=
{
Images
.
delete
}
/
>
<
/button
>
<
/button
>
)}
)}
<
/div
>
<
/div
>
...
@@ -759,6 +816,15 @@ export default class Perusahaan extends Component {
...
@@ -759,6 +816,15 @@ export default class Perusahaan extends Component {
/>
/>
)} */
}
)} */
}
{
/* {this.state.visibleDelete && (
<DeletePerusahaan
type={"delete"}
onClickClose={() => this.setState({ visibleDelete: false })}
data={this.state.rowData}
deleteCompany={this.deleteCompany.bind(this)}
/>
)} */
}
{
this
.
state
.
popupError
&&
(
{
this
.
state
.
popupError
&&
(
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
)}
)}
...
@@ -800,6 +866,16 @@ export default class Perusahaan extends Component {
...
@@ -800,6 +866,16 @@ export default class Perusahaan extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
)}
{
this
.
state
.
visibleDelete
&&
(
<
PopUpDelete
rowData
=
{
this
.
state
.
rowData
}
name
=
{
this
.
state
.
companyName
}
onClickClose
=
{()
=>
this
.
setState
({
visibleDelete
:
false
})}
onClickDelete
=
{
this
.
deleteCompany
.
bind
(
this
)}
/
>
)}
<
/div
>
<
/div
>
);
);
}
}
...
...
src/container/MasterData/ReportItems.js
View file @
a4779251
...
@@ -13,6 +13,7 @@ import api from "../../api";
...
@@ -13,6 +13,7 @@ import api from "../../api";
import
ReactTooltip
from
"react-tooltip"
;
import
ReactTooltip
from
"react-tooltip"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
Constant
from
"../../library/Constant"
;
import
Constant
from
"../../library/Constant"
;
import
PopUpDelete
from
"../../library/PopUpDelete"
;
var
ct
=
require
(
"../../library/CustomTable"
);
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -44,7 +45,9 @@ export default class ReportItems extends Component {
...
@@ -44,7 +45,9 @@ export default class ReportItems extends Component {
buttonCreate
:
false
,
buttonCreate
:
false
,
buttonEdit
:
false
,
buttonEdit
:
false
,
load
:
false
,
load
:
false
,
judul
:
''
judul
:
''
,
reportNameDelete
:
''
,
visibleDelete
:
false
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
@@ -75,8 +78,11 @@ export default class ReportItems extends Component {
...
@@ -75,8 +78,11 @@ export default class ReportItems extends Component {
formula
:
item
[
8
],
formula
:
item
[
8
],
condition_it_should_be
:
item
[
9
]
===
undefined
?
null
:
item
[
9
],
condition_it_should_be
:
item
[
9
]
===
undefined
?
null
:
item
[
9
],
condition_if_wrong
:
item
[
10
]
===
undefined
?
null
:
item
[
10
],
condition_if_wrong
:
item
[
10
]
===
undefined
?
null
:
item
[
10
],
start_date
:
item
[
11
],
kpi_type
:
item
[
11
]
===
undefined
?
""
:
item
[
11
],
end_date
:
item
[
12
],
max_ach
:
item
[
12
]
===
undefined
?
""
:
item
[
12
],
formula_ytd
:
item
[
13
]
===
undefined
?
""
:
item
[
13
],
start_date
:
item
[
14
],
end_date
:
item
[
15
],
})
})
}
}
})
})
...
@@ -110,6 +116,9 @@ export default class ReportItems extends Component {
...
@@ -110,6 +116,9 @@ export default class ReportItems extends Component {
item
.
formula
,
item
.
formula
,
item
.
condition_it_should_be
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
condition_if_wrong
,
item
.
kpi_type
,
item
.
max_ach
,
item
.
formula_ytd
,
item
.
start_date
,
item
.
start_date
,
item
.
end_date
,
item
.
end_date
,
item
.
error
item
.
error
...
@@ -121,16 +130,16 @@ export default class ReportItems extends Component {
...
@@ -121,16 +130,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'report'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'report'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"reportname"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"reportname"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -146,16 +155,16 @@ export default class ReportItems extends Component {
...
@@ -146,16 +155,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"companyname"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"companyname"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -171,16 +180,16 @@ export default class ReportItems extends Component {
...
@@ -171,16 +180,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'orders'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'orders'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"order"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"order"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -196,16 +205,16 @@ export default class ReportItems extends Component {
...
@@ -196,16 +205,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"desc"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"desc"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -221,16 +230,16 @@ export default class ReportItems extends Component {
...
@@ -221,16 +230,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parent'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parent'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"parents"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"parents"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -246,16 +255,16 @@ export default class ReportItems extends Component {
...
@@ -246,16 +255,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'uom'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'uom'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"uoms"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"uoms"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -271,16 +280,16 @@ export default class ReportItems extends Component {
...
@@ -271,16 +280,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'weight'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'weight'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"weights"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"weights"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -296,16 +305,16 @@ export default class ReportItems extends Component {
...
@@ -296,16 +305,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'type_report'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'type_report'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"datatype"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"datatype"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -321,16 +330,16 @@ export default class ReportItems extends Component {
...
@@ -321,16 +330,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'formula'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'formula'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"formulas"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"formulas"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -346,16 +355,16 @@ export default class ReportItems extends Component {
...
@@ -346,16 +355,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_it_should_be'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_it_should_be'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"values"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"values"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -371,16 +380,16 @@ export default class ReportItems extends Component {
...
@@ -371,16 +380,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_if_wrong'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_if_wrong'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"conditions"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"conditions"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -391,21 +400,96 @@ export default class ReportItems extends Component {
...
@@ -391,21 +400,96 @@ export default class ReportItems extends Component {
}
}
}
}
},
},
{
name
:
"KPI Type"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
16
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
16
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'kpi_type'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
16
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
16
][
check
].
message
}
data
-
for
=
"kpi_type"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"kpi_type"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Max Achievement"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
16
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
16
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'max_ach'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
16
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
16
][
check
].
message
}
data
-
for
=
"max_ach"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"max_ach"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Formula YTD"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
16
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
16
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'formula_ytd'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
16
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
16
][
check
].
message
}
data
-
for
=
"formula_ytd"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"formula_ytd"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
{
name
:
"Valid From"
,
name
:
"Valid From"
,
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"startdate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -421,16 +505,16 @@ export default class ReportItems extends Component {
...
@@ -421,16 +505,16 @@ export default class ReportItems extends Component {
options
:
{
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
let
check
=
null
if
(
tableMeta
.
rowData
[
1
3
]
!=
null
)
{
if
(
tableMeta
.
rowData
[
1
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
1
3
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
check
=
tableMeta
.
rowData
[
1
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
1
3
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
1
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
3
][
check
].
message
}
data
-
for
=
"enddate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
1
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
===
""
?
"-"
:
val
}
<
/span
>
...
@@ -535,12 +619,46 @@ export default class ReportItems extends Component {
...
@@ -535,12 +619,46 @@ export default class ReportItems extends Component {
})
})
}
}
deleteReport
(
payload
)
{
console
.
log
(
payload
);
let
id
=
String
(
payload
[
1
])
api
.
create
().
deleteReportItems
(
id
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getData
()
this
.
setState
({
visibleDelete
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
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'
})
}
})
}
openPopUp
(
index
,
type
)
{
openPopUp
(
index
,
type
)
{
if
(
type
===
'edit'
)
{
if
(
type
===
'edit'
)
{
this
.
setState
({
this
.
setState
({
rowData
:
index
,
rowData
:
index
,
edit
:
true
edit
:
true
})
})
}
else
if
(
type
===
'delete'
)
{
this
.
setState
({
rowData
:
index
,
reportNameDelete
:
"["
+
String
(
index
[
2
])
+
" - "
+
String
(
index
[
3
])
+
" - "
+
String
(
index
[
5
])
+
"]"
,
visibleDelete
:
true
})
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
add
:
true
add
:
true
...
@@ -704,8 +822,9 @@ export default class ReportItems extends Component {
...
@@ -704,8 +822,9 @@ export default class ReportItems extends Component {
sort
:
false
,
sort
:
false
,
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
this
.
state
.
buttonEdit
&&
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
buttonEdit
&&
(
<
a
data
-
tip
=
{
'Edit'
}
data
-
for
=
"edit"
>
<
button
<
button
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
...
@@ -717,8 +836,25 @@ export default class ReportItems extends Component {
...
@@ -717,8 +836,25 @@ export default class ReportItems extends Component {
>
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
<
/button
>
)}
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"edit"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Delete'
}
data
-
for
=
"delete"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
15
}}
// onClick={() => console.log(tableMeta)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'delete'
)}
>
<
img
src
=
{
Images
.
delete
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"delete"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
)
);
);
}
}
}
}
...
@@ -920,7 +1056,7 @@ export default class ReportItems extends Component {
...
@@ -920,7 +1056,7 @@ export default class ReportItems extends Component {
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/button
>
<
/a
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"
visualisasi
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"
download
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Visualization'
}
data
-
for
=
"visualisasi"
>
<
a
data
-
tip
=
{
'Visualization'
}
data
-
for
=
"visualisasi"
>
<
button
<
button
style
=
{{
style
=
{{
...
@@ -934,7 +1070,7 @@ export default class ReportItems extends Component {
...
@@ -934,7 +1070,7 @@ export default class ReportItems extends Component {
<
img
src
=
{
Images
.
visualisasi
}
/
>
<
img
src
=
{
Images
.
visualisasi
}
/
>
<
/button
>
<
/button
>
<
/a
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"
tambah
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"
visualisasi
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
buttonCreate
&&
(
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Add New'
}
data
-
for
=
"tambah"
>
<
a
data
-
tip
=
{
'Add New'
}
data
-
for
=
"tambah"
>
<
button
<
button
...
@@ -1069,6 +1205,14 @@ export default class ReportItems extends Component {
...
@@ -1069,6 +1205,14 @@ export default class ReportItems extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
)}
{
this
.
state
.
visibleDelete
&&
(
<
PopUpDelete
rowData
=
{
this
.
state
.
rowData
}
name
=
{
this
.
state
.
reportNameDelete
}
onClickClose
=
{()
=>
this
.
setState
({
visibleDelete
:
false
})}
onClickDelete
=
{
this
.
deleteReport
.
bind
(
this
)}
/
>
)}
<
/div
>
<
/div
>
);
);
}
}
...
...
src/container/MasterData/formReportItems/CreateReportItems.js
View file @
a4779251
...
@@ -60,8 +60,13 @@ export default class CreateReportItems extends Component {
...
@@ -60,8 +60,13 @@ export default class CreateReportItems extends Component {
options
:
[
'WARNING'
,
'STOPPER'
],
options
:
[
'WARNING'
,
'STOPPER'
],
alert
:
false
,
alert
:
false
,
tipeAlert
:
''
,
tipeAlert
:
''
,
messageAlert
:
''
messageAlert
:
''
,
kpiType
:
[
'HIG'
,
'HIB'
],
maxAch
:
[
'50%'
,
'100%'
,
'Unlimited'
],
formulaYtd
:
[
'SUM'
,
'AVG'
,
'MIN'
,
'MAX'
],
kpiTypeValue
:
null
,
maxAchValue
:
null
,
formulaYTDValue
:
null
}
}
}
}
...
@@ -194,6 +199,9 @@ export default class CreateReportItems extends Component {
...
@@ -194,6 +199,9 @@ export default class CreateReportItems extends Component {
"weight"
:
this
.
state
.
weight
,
"weight"
:
this
.
state
.
weight
,
"condition_if_wrong"
:
this
.
state
.
condition
,
"condition_if_wrong"
:
this
.
state
.
condition
,
"condition_it_should_be"
:
this
.
state
.
realVal
,
"condition_it_should_be"
:
this
.
state
.
realVal
,
"type_kpi"
:
this
.
state
.
kpiTypeValue
,
"max_ach"
:
this
.
state
.
maxAchValue
,
"formula_ytd"
:
this
.
state
.
formulaYTDValue
,
"start_date"
:
this
.
state
.
startDate
,
"start_date"
:
this
.
state
.
startDate
,
"end_date"
:
this
.
state
.
endDate
"end_date"
:
this
.
state
.
endDate
}
}
...
@@ -442,7 +450,10 @@ export default class CreateReportItems extends Component {
...
@@ -442,7 +450,10 @@ export default class CreateReportItems extends Component {
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listReportType
}
{...
this
.
state
.
listReportType
}
id
=
"reportType"
id
=
"reportType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
{
newInputValue
==
null
||
(
newInputValue
.
report_name
!==
'CAT'
)
?
this
.
setState
({
kpiTypeValue
:
null
,
maxAchValue
:
null
,
formulaYTDValue
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
clearMessage
();
})}
debug
debug
renderInput
=
{(
params
)
=>
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
<
TextField
{...
params
}
...
@@ -778,6 +789,90 @@ export default class CreateReportItems extends Component {
...
@@ -778,6 +789,90 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
this
.
state
.
reportType
!==
null
&&
(
this
.
state
.
reportType
.
report_name
===
'CAT'
&&
(
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
kpiTypeValue
}
id
=
"kpiType"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
kpiTypeValue
:
newValue
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
kpiType
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"KPI Type"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
maxAchValue
}
id
=
"maxAch"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
maxAchValue
:
newValue
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
maxAch
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Max Achievement"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
/div
>
))}
{
this
.
state
.
reportType
!==
null
&&
(
this
.
state
.
reportType
.
report_name
===
'CAT'
&&
(
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
formulaYTDValue
}
id
=
"formulaYTD"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
formulaYTDValue
:
newValue
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
formulaYtd
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Formula YTD"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
/div
>
))}
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
...
...
src/container/MasterData/formReportItems/EditReportItems.js
View file @
a4779251
...
@@ -62,7 +62,13 @@ export default class EditReportItems extends Component {
...
@@ -62,7 +62,13 @@ export default class EditReportItems extends Component {
options
:
[
'WARNING'
,
'STOPPER'
],
options
:
[
'WARNING'
,
'STOPPER'
],
alert
:
false
,
alert
:
false
,
tipeAlert
:
''
,
tipeAlert
:
''
,
messageAlert
:
''
messageAlert
:
''
,
kpiType
:
[
'HIG'
,
'HIB'
],
maxAch
:
[
'50%'
,
'100%'
,
'Unlimited'
],
formulaYtd
:
[
'SUM'
,
'AVG'
,
'MIN'
,
'MAX'
],
kpiTypeValue
:
null
,
maxAchValue
:
null
,
formulaYTDValue
:
null
}
}
}
}
...
@@ -169,6 +175,9 @@ export default class EditReportItems extends Component {
...
@@ -169,6 +175,9 @@ export default class EditReportItems extends Component {
"weight"
:
this
.
state
.
tempData
.
weight
==
null
?
""
:
this
.
state
.
tempData
.
weight
,
"weight"
:
this
.
state
.
tempData
.
weight
==
null
?
""
:
this
.
state
.
tempData
.
weight
,
"condition_if_wrong"
:
this
.
state
.
tempData
.
condition_if_wrong
,
"condition_if_wrong"
:
this
.
state
.
tempData
.
condition_if_wrong
,
"condition_it_should_be"
:
this
.
state
.
tempData
.
condition_it_should_be
,
"condition_it_should_be"
:
this
.
state
.
tempData
.
condition_it_should_be
,
"type_kpi"
:
this
.
state
.
tempData
.
kpi_type
,
"max_ach"
:
this
.
state
.
tempData
.
max_ach
,
"formula_ytd"
:
this
.
state
.
tempData
.
formula_ytd
,
"start_date"
:
this
.
state
.
tempData
.
start_date
,
"start_date"
:
this
.
state
.
tempData
.
start_date
,
"end_date"
:
this
.
state
.
tempData
.
end_date
"end_date"
:
this
.
state
.
tempData
.
end_date
}
}
...
@@ -456,7 +465,10 @@ export default class EditReportItems extends Component {
...
@@ -456,7 +465,10 @@ export default class EditReportItems extends Component {
<
Autocomplete
<
Autocomplete
{...
this
.
state
.
listReportType
}
{...
this
.
state
.
listReportType
}
id
=
"reportType"
id
=
"reportType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
this
.
getParent
(),
this
.
clearMessage
()
)}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
newInputValue
==
null
||
(
newInputValue
.
report_name
!==
'CAT'
)
?
this
.
setState
({
tempData
:
{
...
this
.
state
.
tempData
,
kpi_type
:
null
,
max_ach
:
null
,
formula_ytd
:
null
}
},
()
=>
this
.
getParent
(),
this
.
clearMessage
())
:
this
.
getParent
(),
this
.
clearMessage
()
)}
debug
debug
renderInput
=
{(
params
)
=>
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
<
TextField
{...
params
}
...
@@ -760,6 +772,91 @@ export default class EditReportItems extends Component {
...
@@ -760,6 +772,91 @@ export default class EditReportItems extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
this
.
state
.
reportType
!==
null
&&
(
this
.
state
.
reportType
.
report_name
===
'CAT'
&&
(
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
kpi_type
}
id
=
"kpiType"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
tempData
:
{
...
this
.
state
.
tempData
,
kpi_type
:
newValue
}
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
kpiType
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"KPI Type"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
max_ach
}
id
=
"maxAch"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
tempData
:
{
...
this
.
state
.
tempData
,
max_ach
:
newValue
}
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
maxAch
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Max Achievement"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
/div
>
))}
{
this
.
state
.
reportType
!==
null
&&
(
this
.
state
.
reportType
.
report_name
===
'CAT'
&&
(
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
formula_ytd
}
id
=
"kpiType"
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
tempData
:
{
...
this
.
state
.
tempData
,
formula_ytd
:
newValue
}
},
()
=>
this
.
clearMessage
());
}}
options
=
{
this
.
state
.
formulaYtd
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Formula YTD"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
<
/div
>
<
/div
>
))}
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
...
...
src/container/Otorisasi/User.js
View file @
a4779251
...
@@ -15,6 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
...
@@ -15,6 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import
ReactTooltip
from
"react-tooltip"
;
import
ReactTooltip
from
"react-tooltip"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
Constant
from
"../../library/Constant"
;
import
Constant
from
"../../library/Constant"
;
import
PopUpDelete
from
"../ApprovalMatrix/PopUpDelete"
;
var
ct
=
require
(
"../../library/CustomTable"
);
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -31,6 +32,7 @@ export default class UserRole extends Component {
...
@@ -31,6 +32,7 @@ export default class UserRole extends Component {
indexData
:
{},
indexData
:
{},
add
:
false
,
add
:
false
,
edit
:
false
,
edit
:
false
,
popupDel
:
false
,
visibleUser
:
true
,
visibleUser
:
true
,
buttonError
:
false
,
buttonError
:
false
,
alert
:
false
,
alert
:
false
,
...
@@ -153,11 +155,11 @@ export default class UserRole extends Component {
...
@@ -153,11 +155,11 @@ export default class UserRole extends Component {
if
(
item
.
length
>
0
)
{
if
(
item
.
length
>
0
)
{
payload
.
push
({
payload
.
push
({
id
:
index
+
1
,
id
:
index
+
1
,
fullname
:
item
[
0
],
fullname
:
item
[
0
]
==
undefined
?
''
:
item
[
0
]
,
email
:
item
[
1
],
email
:
item
[
1
]
==
undefined
?
''
:
item
[
1
]
,
role
:
item
[
2
],
role
:
item
[
2
]
==
undefined
?
''
:
item
[
2
]
,
start_date
:
item
[
3
],
start_date
:
item
[
3
]
==
undefined
?
''
:
item
[
3
]
,
end_date
:
item
[
4
],
end_date
:
item
[
4
]
==
undefined
?
''
:
item
[
4
]
,
})
})
}
}
})
})
...
@@ -170,6 +172,14 @@ export default class UserRole extends Component {
...
@@ -170,6 +172,14 @@ export default class UserRole extends Component {
});
});
}
}
deleteUser
()
{
let
data
=
this
.
state
.
rowData
api
.
create
().
deleteUser
(
data
[
1
]).
then
((
response
)
=>
{
this
.
setState
({
popupDel
:
false
})
this
.
getUser
()
})
}
checkUpload
(){
checkUpload
(){
api
.
create
().
checkUploadUser
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
checkUploadUser
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
...
@@ -190,7 +200,31 @@ export default class UserRole extends Component {
...
@@ -190,7 +200,31 @@ export default class UserRole extends Component {
let
columns
=
[
let
columns
=
[
"Data"
,
"Data"
,
"Full Name"
,
{
name
:
"Full Name"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'fullname'
))
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
=
"fullname"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"fullname"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}},
{
{
name
:
"Email"
,
name
:
"Email"
,
options
:
{
options
:
{
...
@@ -207,9 +241,9 @@ export default class UserRole extends Component {
...
@@ -207,9 +241,9 @@ export default class UserRole extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -226,16 +260,16 @@ export default class UserRole extends Component {
...
@@ -226,16 +260,16 @@ export default class UserRole extends Component {
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
if
(
check
>
-
1
)
{
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
console
.
log
(
tableMeta
.
rowData
[
6
]
)
}
}
}
}
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -259,9 +293,9 @@ export default class UserRole extends Component {
...
@@ -259,9 +293,9 @@ export default class UserRole extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -285,9 +319,9 @@ export default class UserRole extends Component {
...
@@ -285,9 +319,9 @@ export default class UserRole extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
==
''
?
'Empty'
:
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
...
@@ -387,13 +421,14 @@ export default class UserRole extends Component {
...
@@ -387,13 +421,14 @@ export default class UserRole extends Component {
}
}
createUser
(
payload
)
{
createUser
(
payload
)
{
console
.
log
(
'Mode Create'
)
api
.
create
().
createUser
(
payload
).
then
((
response
)
=>
{
api
.
create
().
createUser
(
payload
).
then
((
response
)
=>
{
// console.log(response
)
console
.
log
(
response
.
data
)
// if (String(response.data.status).toLocaleUpperCase === 'Success' || String(response.data.status).toLocaleUpperCase === 'success') {
// if (String(response.data.status).toLocaleUpperCase === 'Success' || String(response.data.status).toLocaleUpperCase === 'success') {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'
s
uccess'
)
{
if
(
response
.
data
.
status
===
'
S
uccess'
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
create
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
add
:
false
})
this
.
getUser
()
this
.
getUser
()
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
@@ -483,6 +518,19 @@ export default class UserRole extends Component {
...
@@ -483,6 +518,19 @@ export default class UserRole extends Component {
<
img
src
=
{
Images
.
editCopy
}
/
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
<
/button
>
)}
)}
{
this
.
state
.
buttonEdit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
10
}}
onClick
=
{()
=>
this
.
setState
({
popupDel
:
true
,
rowData
:
tableMeta
.
rowData
})}
>
<
img
src
=
{
Images
.
delete
}
/
>
<
/button
>
)}
{
/* :
{
/* :
null
null
} */
}
} */
}
...
@@ -665,7 +713,7 @@ export default class UserRole extends Component {
...
@@ -665,7 +713,7 @@ export default class UserRole extends Component {
<
/a
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
buttonCreate
&&
(
{
this
.
state
.
buttonCreate
&&
(
<
a
data
-
tip
=
{
'Add New'
}
data
-
for
=
"
create
"
>
<
a
data
-
tip
=
{
'Add New'
}
data
-
for
=
"
add
"
>
<
button
<
button
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
...
@@ -680,7 +728,7 @@ export default class UserRole extends Component {
...
@@ -680,7 +728,7 @@ export default class UserRole extends Component {
<
/button
>
<
/button
>
<
/a
>
<
/a
>
)}
)}
<
ReactTooltip
border
=
{
true
}
id
=
"
create
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"
add
"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
)}
...
@@ -749,6 +797,38 @@ export default class UserRole extends Component {
...
@@ -749,6 +797,38 @@ export default class UserRole extends Component {
data
=
{
this
.
state
.
indexData
}
data
=
{
this
.
state
.
indexData
}
/
>
/
>
)}
)}
{
this
.
state
.
popupDel
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
,
padding
:
50
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
img
src
=
{
Images
.
failedCopy
}
/
>
<
/div
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'center'
,
marginTop
:
20
}}
>
<
span
style
=
{{
textAlign
:
'center'
,
fontSize
:
14
,
fontWeight
:
'bold'
}}
>
Delete
{
this
.
state
.
rowData
[
2
]}
?
<
/span
>
{
/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
</span> */
}
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
24
}}
>
<
button
className
=
{
"btn-save"
}
onClick
=
{()
=>
this
.
setState
({
popupDel
:
false
})}
>
<
span
style
=
{{
color
:
'white'
}}
>
Cancel
<
/span
>
<
/button
>
<
button
className
=
{
"btn-save"
}
style
=
{{
marginLeft
:
50
}}
onClick
=
{()
=>
this
.
deleteUser
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Delete
<
/span
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
)}
{
this
.
state
.
popupError
&&
(
{
this
.
state
.
popupError
&&
(
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
)}
)}
...
...
src/container/Otorisasi/User/AddUser.js
View file @
a4779251
...
@@ -139,6 +139,33 @@ export default class AddUser extends Component {
...
@@ -139,6 +139,33 @@ export default class AddUser extends Component {
}
}
clearError
()
{
clearError
()
{
let
listCompany
=
this
.
state
.
listCompany
let
company
=
this
.
state
.
company
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
company
.
push
(
item
.
id
)
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
listCompany
.
map
((
item
,
index
)
=>
{
company
.
push
(
item
.
id
)
handlePushChild
(
item
)
})
let
uniqueCompany
=
company
.
filter
((
val
,
id
,
array
)
=>
{
return
array
.
indexOf
(
val
)
==
id
;
});
company
=
this
.
state
.
role
.
role_id
===
1
?
uniqueCompany
:
[]
// console.log(uniqueCompany)
this
.
setState
({
this
.
setState
({
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
...
@@ -150,6 +177,9 @@ export default class AddUser extends Component {
...
@@ -150,6 +177,9 @@ export default class AddUser extends Component {
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
company
},
()
=>
{
console
.
log
(
this
.
state
.
company
)
})
})
}
}
...
@@ -262,41 +292,58 @@ export default class AddUser extends Component {
...
@@ -262,41 +292,58 @@ export default class AddUser extends Component {
handleItemClick
(
item
)
{
handleItemClick
(
item
)
{
let
indexID
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
let
indexID
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
let
listCompany
=
this
.
state
.
listCompany
let
company
=
this
.
state
.
company
let
company
=
this
.
state
.
company
if
(
indexID
===
-
1
)
{
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
company
.
push
(
item
.
id
)
company
.
push
(
item
.
id
)
if
(
item
.
parent
!==
null
)
{
}
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
if
(
item
.
children
!==
null
)
{
if
(
indexIDs
===
-
1
)
{
if
(
item
.
children
.
length
>
0
)
{
company
.
push
(
item
.
parent
)
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
}
}
const
handleSpliceChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
!==
-
1
)
{
company
.
splice
(
indexIDzz
,
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
)
handleSpliceChild
(
items
)
})
})
}
}
}
}
}
else
{
company
.
splice
(
indexID
,
1
)
if
(
item
.
parent
!==
null
)
{
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
if
(
indexIDs
!==
-
1
)
{
company
.
splice
(
indexIDs
,
1
)
}
}
if
(
indexID
===
-
1
)
{
company
.
push
(
item
.
id
)
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
)
handlePushChild
(
items
)
})
})
}
}
}
}
}
else
{
company
.
splice
(
indexID
,
1
)
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handleSpliceChild
(
items
)
})
}
}
}
}
this
.
setState
({
company
})
}
// console.log(company)
this
.
setState
({
company
})
}
}
renderChildren
=
(
item
,
pad
)
=>
{
renderChildren
=
(
item
,
pad
)
=>
{
...
@@ -570,7 +617,7 @@ export default class AddUser extends Component {
...
@@ -570,7 +617,7 @@ export default class AddUser extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"startDate"
id
=
"startDate"
label
=
"Valid From"
label
=
"Valid From"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
startDate
}
value
=
{
this
.
state
.
startDate
}
error
=
{
this
.
state
.
errorStartDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
helperText
=
{
this
.
state
.
msgErrorSD
}
...
@@ -603,7 +650,7 @@ export default class AddUser extends Component {
...
@@ -603,7 +650,7 @@ export default class AddUser extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"endDate"
id
=
"endDate"
label
=
"Valid To"
label
=
"Valid To"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
endDate
}
value
=
{
this
.
state
.
endDate
}
error
=
{
this
.
state
.
errorEndDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
helperText
=
{
this
.
state
.
msgErrorED
}
...
...
src/container/Otorisasi/User/EditUser.js
View file @
a4779251
...
@@ -123,6 +123,33 @@ export default class EditUser extends Component {
...
@@ -123,6 +123,33 @@ export default class EditUser extends Component {
}
}
clearError
()
{
clearError
()
{
let
listCompany
=
this
.
state
.
listCompany
let
company
=
this
.
state
.
company
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
company
.
push
(
item
.
id
)
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
listCompany
.
map
((
item
,
index
)
=>
{
company
.
push
(
item
.
id
)
handlePushChild
(
item
)
})
let
uniqueCompany
=
company
.
filter
((
val
,
id
,
array
)
=>
{
return
array
.
indexOf
(
val
)
==
id
;
});
company
=
this
.
state
.
role
.
role_id
===
1
?
uniqueCompany
:
[]
// console.log(uniqueCompany)
this
.
setState
({
this
.
setState
({
errorFullname
:
false
,
errorFullname
:
false
,
errorEmail
:
false
,
errorEmail
:
false
,
...
@@ -134,6 +161,7 @@ export default class EditUser extends Component {
...
@@ -134,6 +161,7 @@ export default class EditUser extends Component {
msgErrorRN
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorED
:
''
,
company
})
})
}
}
...
@@ -251,7 +279,10 @@ export default class EditUser extends Component {
...
@@ -251,7 +279,10 @@ export default class EditUser extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
listCompany
:
response
.
data
.
data
})
let
dataBaru
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
{...
item
,
check
:
false
}
})
this
.
setState
({
listCompany
:
dataBaru
})
}
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"
))
{
...
@@ -279,40 +310,57 @@ export default class EditUser extends Component {
...
@@ -279,40 +310,57 @@ export default class EditUser extends Component {
handleItemClick
(
item
)
{
handleItemClick
(
item
)
{
let
indexID
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
let
indexID
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
let
company
=
this
.
state
.
company
let
company
=
this
.
state
.
company
if
(
indexID
===
-
1
)
{
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
company
.
push
(
item
.
id
)
company
.
push
(
item
.
id
)
if
(
item
.
parent
!==
null
)
{
}
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
if
(
item
.
children
!==
null
)
{
if
(
indexIDs
===
-
1
)
{
if
(
item
.
children
.
length
>
0
)
{
company
.
push
(
item
.
parent
)
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
}
}
const
handleSpliceChild
=
(
item
)
=>
{
let
indexIDzz
=
company
.
findIndex
((
val
)
=>
val
===
item
.
id
)
if
(
indexIDzz
!==
-
1
)
{
company
.
splice
(
indexIDzz
,
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
)
handleSpliceChild
(
items
)
})
})
}
}
}
}
}
else
{
}
company
.
splice
(
indexID
,
1
)
if
(
item
.
parent
!==
null
)
{
if
(
indexID
===
-
1
)
{
let
indexIDs
=
this
.
state
.
company
.
findIndex
((
val
)
=>
val
===
item
.
parent
)
company
.
push
(
item
.
id
)
if
(
indexIDs
!==
-
1
)
{
if
(
item
.
children
!==
null
)
{
company
.
splice
(
indexIDs
,
1
)
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
}
}
else
{
company
.
splice
(
indexID
,
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
)
handleSpliceChild
(
items
)
})
})
}
}
}
}
}
}
this
.
setState
({
company
})
// console.log(company)
this
.
setState
({
company
})
}
}
renderChildren
=
(
item
,
pad
)
=>
{
renderChildren
=
(
item
,
pad
)
=>
{
...
@@ -583,7 +631,7 @@ export default class EditUser extends Component {
...
@@ -583,7 +631,7 @@ export default class EditUser extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"startDate"
id
=
"startDate"
label
=
"Valid From"
label
=
"Valid From"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
start_date
}
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
start_date
}
error
=
{
this
.
state
.
errorStartDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
helperText
=
{
this
.
state
.
msgErrorSD
}
...
@@ -615,7 +663,7 @@ export default class EditUser extends Component {
...
@@ -615,7 +663,7 @@ export default class EditUser extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"endDate"
id
=
"endDate"
label
=
"Valid To"
label
=
"Valid To"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
end_date
}
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
end_date
}
error
=
{
this
.
state
.
errorEndDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
helperText
=
{
this
.
state
.
msgErrorED
}
...
...
src/container/Otorisasi/UserRole.js
View file @
a4779251
...
@@ -152,7 +152,7 @@ class UserRole extends Component {
...
@@ -152,7 +152,7 @@ class UserRole extends Component {
handleChange
(
e
)
{
handleChange
(
e
)
{
let
data
=
this
.
state
let
data
=
this
.
state
window
.
requestIdleCallback
((
e
)
=>
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
},
()
=>
{
window
.
requestIdleCallback
((
e
)
=>
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
},
()
=>
{
alert
(
'asdk'
)
//
alert('asdk')
}))
}))
}
}
...
@@ -161,6 +161,33 @@ class UserRole extends Component {
...
@@ -161,6 +161,33 @@ class UserRole extends Component {
this
.
setState
({
alert
:
false
})
this
.
setState
({
alert
:
false
})
}
}
deleteRole
()
{
let
data
=
this
.
state
.
rowData
api
.
create
().
deleteRole
(
data
[
1
]).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
popupDel
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
popupDel
:
false
},
()
=>
{
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'
,
popupDel
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
popupDel
:
false
})
}
this
.
getRole
()
})
}
render
()
{
render
()
{
const
columns
=
[{
const
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -186,7 +213,22 @@ class UserRole extends Component {
...
@@ -186,7 +213,22 @@ class UserRole extends Component {
null
null
}
}
<
/div
>
<
/div
>
<
/button
>
)}
{
this
.
state
.
buttonEdit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
10
}}
onClick
=
{()
=>
this
.
setState
({
popupDel
:
true
,
rowData
:
tableMeta
.
rowData
})}
>
{
tableMeta
.
rowData
[
2
]
!==
"superadmin"
?
<
img
src
=
{
Images
.
delete
}
/>
:
null
}
<
/button
>
<
/button
>
)}
)}
<
/div
>
<
/div
>
...
@@ -317,6 +359,38 @@ class UserRole extends Component {
...
@@ -317,6 +359,38 @@ class UserRole extends Component {
data
=
{
this
.
state
.
indexData
}
data
=
{
this
.
state
.
indexData
}
/
>
/
>
)}
)}
{
this
.
state
.
popupDel
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
,
padding
:
50
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
img
src
=
{
Images
.
failedCopy
}
/
>
<
/div
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'center'
,
marginTop
:
20
}}
>
<
span
style
=
{{
textAlign
:
'center'
,
fontSize
:
14
,
fontWeight
:
'bold'
}}
>
Delete
{
this
.
state
.
rowData
[
2
]}
?
<
/span
>
{
/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
</span> */
}
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
24
}}
>
<
button
className
=
{
"btn-save"
}
onClick
=
{()
=>
this
.
setState
({
popupDel
:
false
})}
>
<
span
style
=
{{
color
:
'white'
}}
>
Cancel
<
/span
>
<
/button
>
<
button
className
=
{
"btn-save"
}
style
=
{{
marginLeft
:
50
}}
onClick
=
{()
=>
this
.
deleteRole
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Delete
<
/span
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
)}
<
/div
>
<
/div
>
);
);
}
}
...
...
src/container/Otorisasi/UserRole/AddRole.js
View file @
a4779251
...
@@ -111,7 +111,7 @@ export default class AddRole extends Component {
...
@@ -111,7 +111,7 @@ export default class AddRole extends Component {
validasi
()
{
validasi
()
{
if
(
R
.
isEmpty
(
this
.
state
.
roleName
))
{
if
(
R
.
isEmpty
(
this
.
state
.
roleName
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'
User
Role 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
))
{
...
@@ -225,7 +225,7 @@ export default class AddRole extends Component {
...
@@ -225,7 +225,7 @@ export default class AddRole extends Component {
if
(
indexID
===
-
1
)
{
if
(
indexID
===
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
item
.
menu_id
,
menu_id
:
item
.
menu_id
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
if
(
item
.
sub_menu
.
length
>
0
)
{
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -233,7 +233,7 @@ export default class AddRole extends Component {
...
@@ -233,7 +233,7 @@ export default class AddRole extends Component {
if
(
indexIDs
===
-
1
)
{
if
(
indexIDs
===
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
items
.
menu_id
,
menu_id
:
items
.
menu_id
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
}
}
})
})
...
@@ -255,7 +255,7 @@ export default class AddRole extends Component {
...
@@ -255,7 +255,7 @@ export default class AddRole extends Component {
if
(
indexIDref
==
-
1
)
{
if
(
indexIDref
==
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
item
.
reference
,
menu_id
:
item
.
reference
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
}
else
{
}
else
{
if
(
total
<
1
)
{
if
(
total
<
1
)
{
...
@@ -289,7 +289,7 @@ export default class AddRole extends Component {
...
@@ -289,7 +289,7 @@ export default class AddRole extends Component {
if
(
indexIDref
==
-
1
)
{
if
(
indexIDref
==
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
item
.
reference
,
menu_id
:
item
.
reference
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
}
else
{
}
else
{
if
(
total
<
1
)
{
if
(
total
<
1
)
{
...
@@ -298,7 +298,9 @@ export default class AddRole extends Component {
...
@@ -298,7 +298,9 @@ export default class AddRole extends Component {
}
}
}
}
}
}
this
.
setState
({
privileges
})
this
.
setState
({
privileges
},
()
=>
{
console
.
log
(
this
.
state
.
privileges
)
})
}
}
handleSubItemChecked
(
item
,
index
)
{
handleSubItemChecked
(
item
,
index
)
{
...
@@ -322,16 +324,87 @@ export default class AddRole extends Component {
...
@@ -322,16 +324,87 @@ export default class AddRole extends Component {
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
privileges
=
this
.
state
.
privileges
let
privileges
=
this
.
state
.
privileges
let
button_id
=
privileges
[
indexID
].
button_id
let
button_id
=
privileges
[
indexID
].
button_id
if
(
indexButtonID
===
-
1
)
{
if
(
indexButtonID
===
-
1
)
{
button_id
.
push
(
index
)
button_id
.
push
(
index
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
===
-
1
)
{
console
.
log
(
'masuk pa eko'
,
subIndexID
)
privileges
.
push
({
menu_id
:
items
.
menu_id
,
button_id
:
[
index
]
})
}
else
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
===
-
1
)
{
subButton_id
.
push
(
index
)
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
if
(
refIndexButtonID
===
-
1
)
{
refButton_id
.
push
(
index
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
else
{
}
else
{
button_id
.
splice
(
indexButtonID
,
1
)
button_id
.
splice
(
indexButtonID
,
1
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
!==
-
1
)
{
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
if
(
privileges
[
subIndexID
].
button_id
.
length
<
1
)
{
privileges
.
splice
(
subIndexID
,
1
)
}
}
privileges
[
indexID
].
button_id
=
button_id
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
let
indexIDapp
=
this
.
state
.
application
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDset
=
this
.
state
.
setting
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDs
=
indexIDapp
==
-
1
?
indexIDset
:
indexIDapp
let
array
=
indexIDapp
==
-
1
?
this
.
state
.
setting
:
this
.
state
.
application
let
splicer
=
0
array
[
indexIDs
].
sub_menu
.
map
((
refItem
,
refIndex
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
refItem
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
if
(
subIndexButtonID
!==
-
1
)
{
splicer
+=
1
}
}
})
if
(
refIndexButtonID
!==
-
1
&&
splicer
<
1
)
{
refButton_id
.
splice
(
refIndexButtonID
,
1
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
privileges
[
indexID
].
button_id
=
button_id
.
sort
((
a
,
b
)
=>
a
-
b
)
if
(
button_id
.
length
===
0
)
{
if
(
button_id
.
length
===
0
)
{
privileges
.
splice
(
indexID
,
1
)
privileges
.
splice
(
indexID
,
1
)
}
}
this
.
setState
({
privileges
})
this
.
setState
({
privileges
:
privileges
.
sort
((
a
,
b
)
=>
a
.
menu_id
-
b
.
menu_id
)
})
}
}
handleDate
(
item
)
{
handleDate
(
item
)
{
...
@@ -456,7 +529,7 @@ export default class AddRole extends Component {
...
@@ -456,7 +529,7 @@ export default class AddRole extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"startDate"
id
=
"startDate"
label
=
"Valid From"
label
=
"Valid From"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
startDate
}
value
=
{
this
.
state
.
startDate
}
error
=
{
this
.
state
.
errorStartDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
helperText
=
{
this
.
state
.
msgErrorSD
}
...
@@ -489,7 +562,7 @@ export default class AddRole extends Component {
...
@@ -489,7 +562,7 @@ export default class AddRole extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"endDate"
id
=
"endDate"
label
=
"Valid To"
label
=
"Valid To"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
endDate
}
value
=
{
this
.
state
.
endDate
}
error
=
{
this
.
state
.
errorEndDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
helperText
=
{
this
.
state
.
msgErrorED
}
...
@@ -564,7 +637,7 @@ export default class AddRole extends Component {
...
@@ -564,7 +637,7 @@ export default class AddRole extends Component {
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Authorization
Module
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Authorization
Module
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
View
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
View
<
/Typography
>
<
/div
>
<
/div
>
...
@@ -574,6 +647,9 @@ export default class AddRole extends Component {
...
@@ -574,6 +647,9 @@ export default class AddRole extends Component {
<
div
className
=
"column 3"
>
<
div
className
=
"column 3"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Edit
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Edit
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Delete
<
/Typography
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -594,7 +670,7 @@ export default class AddRole extends Component {
...
@@ -594,7 +670,7 @@ export default class AddRole extends Component {
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
...
@@ -618,6 +694,14 @@ export default class AddRole extends Component {
...
@@ -618,6 +694,14 @@ export default class AddRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
// disabled
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
checked
=
{
this
.
handleSubItemChecked
(
item
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -631,7 +715,7 @@ export default class AddRole extends Component {
...
@@ -631,7 +715,7 @@ export default class AddRole extends Component {
/
>
/
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
...
@@ -653,6 +737,13 @@ export default class AddRole extends Component {
...
@@ -653,6 +737,13 @@ export default class AddRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
checked
=
{
this
.
handleSubItemChecked
(
items
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Collapse
>
<
/Collapse
>
...
@@ -677,7 +768,7 @@ export default class AddRole extends Component {
...
@@ -677,7 +768,7 @@ export default class AddRole extends Component {
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
...
@@ -701,6 +792,14 @@ export default class AddRole extends Component {
...
@@ -701,6 +792,14 @@ export default class AddRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
// disabled
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
checked
=
{
this
.
handleSubItemChecked
(
item
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div>
}
<
/div>
}
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -714,7 +813,7 @@ export default class AddRole extends Component {
...
@@ -714,7 +813,7 @@ export default class AddRole extends Component {
/
>
/
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
...
@@ -736,6 +835,13 @@ export default class AddRole extends Component {
...
@@ -736,6 +835,13 @@ export default class AddRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
checked
=
{
this
.
handleSubItemChecked
(
items
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Collapse
>
<
/Collapse
>
...
...
src/container/Otorisasi/UserRole/EditRole.js
View file @
a4779251
...
@@ -124,7 +124,7 @@ export default class EditRole extends Component {
...
@@ -124,7 +124,7 @@ export default class EditRole extends Component {
validasi
()
{
validasi
()
{
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
role_name
))
{
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
role_name
))
{
this
.
setState
({
errorRoleName
:
true
,
msgErrorRN
:
'
User
Role 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
))
{
...
@@ -142,15 +142,15 @@ export default class EditRole extends Component {
...
@@ -142,15 +142,15 @@ export default class EditRole extends Component {
let
privileges
=
this
.
state
.
privileges
let
privileges
=
this
.
state
.
privileges
privileges
.
push
({
privileges
.
push
({
menu_id
:
23
,
menu_id
:
23
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
privileges
.
push
({
privileges
.
push
({
menu_id
:
24
,
menu_id
:
24
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
privileges
.
push
({
privileges
.
push
({
menu_id
:
25
,
menu_id
:
25
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
let
payload
=
{
let
payload
=
{
"role_id"
:
this
.
state
.
tempData
.
role_id
,
"role_id"
:
this
.
state
.
tempData
.
role_id
,
...
@@ -253,7 +253,7 @@ export default class EditRole extends Component {
...
@@ -253,7 +253,7 @@ export default class EditRole extends Component {
if
(
indexID
===
-
1
)
{
if
(
indexID
===
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
item
.
menu_id
,
menu_id
:
item
.
menu_id
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
if
(
item
.
sub_menu
.
length
>
0
)
{
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -261,7 +261,7 @@ export default class EditRole extends Component {
...
@@ -261,7 +261,7 @@ export default class EditRole extends Component {
if
(
indexIDs
===
-
1
)
{
if
(
indexIDs
===
-
1
)
{
privileges
.
push
({
privileges
.
push
({
menu_id
:
items
.
menu_id
,
menu_id
:
items
.
menu_id
,
button_id
:
[
1
,
2
,
3
]
button_id
:
[
1
,
2
,
3
,
4
]
})
})
}
}
})
})
...
@@ -299,16 +299,87 @@ export default class EditRole extends Component {
...
@@ -299,16 +299,87 @@ export default class EditRole extends Component {
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
privileges
=
this
.
state
.
privileges
let
privileges
=
this
.
state
.
privileges
let
button_id
=
privileges
[
indexID
].
button_id
let
button_id
=
privileges
[
indexID
].
button_id
if
(
indexButtonID
===
-
1
)
{
if
(
indexButtonID
===
-
1
)
{
button_id
.
push
(
index
)
button_id
.
push
(
index
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
===
-
1
)
{
console
.
log
(
'masuk pa eko'
,
subIndexID
)
privileges
.
push
({
menu_id
:
items
.
menu_id
,
button_id
:
[
index
]
})
}
else
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
===
-
1
)
{
subButton_id
.
push
(
index
)
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
if
(
refIndexButtonID
===
-
1
)
{
refButton_id
.
push
(
index
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
else
{
}
else
{
button_id
.
splice
(
indexButtonID
,
1
)
button_id
.
splice
(
indexButtonID
,
1
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
!==
-
1
)
{
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
if
(
privileges
[
subIndexID
].
button_id
.
length
<
1
)
{
privileges
.
splice
(
subIndexID
,
1
)
}
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
let
indexIDapp
=
this
.
state
.
application
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDset
=
this
.
state
.
setting
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDs
=
indexIDapp
==
-
1
?
indexIDset
:
indexIDapp
let
array
=
indexIDapp
==
-
1
?
this
.
state
.
setting
:
this
.
state
.
application
let
splicer
=
0
array
[
indexIDs
].
sub_menu
.
map
((
refItem
,
refIndex
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
refItem
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
if
(
subIndexButtonID
!==
-
1
)
{
splicer
+=
1
}
}
}
privileges
[
indexID
].
button_id
=
button_id
})
if
(
refIndexButtonID
!==
-
1
&&
splicer
<
1
)
{
refButton_id
.
splice
(
refIndexButtonID
,
1
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
privileges
[
indexID
].
button_id
=
button_id
.
sort
((
a
,
b
)
=>
a
-
b
)
if
(
button_id
.
length
===
0
)
{
if
(
button_id
.
length
===
0
)
{
privileges
.
splice
(
indexID
,
1
)
privileges
.
splice
(
indexID
,
1
)
}
}
this
.
setState
({
privileges
})
this
.
setState
({
privileges
:
privileges
.
sort
((
a
,
b
)
=>
a
.
menu_id
-
b
.
menu_id
)
})
}
}
handleCollapse
(
item
)
{
handleCollapse
(
item
)
{
...
@@ -433,7 +504,7 @@ export default class EditRole extends Component {
...
@@ -433,7 +504,7 @@ export default class EditRole extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"startDate"
id
=
"startDate"
label
=
"Valid From"
label
=
"Valid From"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
start_date
}
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
start_date
}
error
=
{
this
.
state
.
errorStartDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
helperText
=
{
this
.
state
.
msgErrorSD
}
...
@@ -466,7 +537,7 @@ export default class EditRole extends Component {
...
@@ -466,7 +537,7 @@ export default class EditRole extends Component {
margin
=
"normal"
margin
=
"normal"
id
=
"endDate"
id
=
"endDate"
label
=
"Valid To"
label
=
"Valid To"
format
=
"dd
MMMM
yyyy"
format
=
"dd
-MM-
yyyy"
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
end_date
}
value
=
{
this
.
state
.
tempData
===
null
?
null
:
this
.
state
.
tempData
.
end_date
}
error
=
{
this
.
state
.
errorEndDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
helperText
=
{
this
.
state
.
msgErrorED
}
...
@@ -540,7 +611,7 @@ export default class EditRole extends Component {
...
@@ -540,7 +611,7 @@ export default class EditRole extends Component {
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Authorization
Module
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
Authorization
Module
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
View
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
color
:
'white'
}}
>
View
<
/Typography
>
<
/div
>
<
/div
>
...
@@ -570,7 +641,7 @@ export default class EditRole extends Component {
...
@@ -570,7 +641,7 @@ export default class EditRole extends Component {
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
...
@@ -594,6 +665,13 @@ export default class EditRole extends Component {
...
@@ -594,6 +665,13 @@ export default class EditRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
checked
=
{
this
.
handleSubItemChecked
(
item
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -607,7 +685,7 @@ export default class EditRole extends Component {
...
@@ -607,7 +685,7 @@ export default class EditRole extends Component {
/
>
/
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
...
@@ -629,6 +707,13 @@ export default class EditRole extends Component {
...
@@ -629,6 +707,13 @@ export default class EditRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
checked
=
{
this
.
handleSubItemChecked
(
items
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Collapse
>
<
/Collapse
>
...
@@ -653,7 +738,7 @@ export default class EditRole extends Component {
...
@@ -653,7 +738,7 @@ export default class EditRole extends Component {
<
/span
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
marginLeft
:
5
}}
>
{
item
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
...
@@ -677,6 +762,13 @@ export default class EditRole extends Component {
...
@@ -677,6 +762,13 @@ export default class EditRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
item
)}
checked
=
{
this
.
handleSubItemChecked
(
item
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
item
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div>
}
<
/div>
}
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
{
item
.
sub_menu
.
length
>
0
&&
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
...
@@ -690,7 +782,7 @@ export default class EditRole extends Component {
...
@@ -690,7 +782,7 @@ export default class EditRole extends Component {
/
>
/
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
maxWidth
:
'100%'
,
marginLeft
:
5
}}
>
{
items
.
label
}
<
/Typography
>
<
/div
>
<
/div
>
<
div
className
=
"column-2 grid grid-
3
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-2 grid grid-
4
x content-center grid-mobile-none gap-15px margin-left-10px"
>
<
div
className
=
"column-1"
>
<
div
className
=
"column-1"
>
<
CustomCheckbox
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
...
@@ -712,6 +804,13 @@ export default class EditRole extends Component {
...
@@ -712,6 +804,13 @@ export default class EditRole extends Component {
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
3
)}
/
>
/
>
<
/div
>
<
/div
>
<
div
className
=
"column 4"
>
<
CustomCheckbox
disabled
=
{
!
this
.
handleItemChecked
(
items
)}
checked
=
{
this
.
handleSubItemChecked
(
items
,
4
)}
onChange
=
{()
=>
this
.
handleSubItemClick
(
items
,
4
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Collapse
>
<
/Collapse
>
...
...
src/container/Profile.js
View file @
a4779251
...
@@ -94,7 +94,7 @@ export default class Profile extends Component {
...
@@ -94,7 +94,7 @@ export default class Profile extends Component {
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password Must be a Combination of Characters, Letters and Numbers.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password Must be a Combination of Characters, Letters and Numbers.'
})
}
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
:
'
Repeat Password
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 Match.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Password Does Not Match.'
})
}
else
{
}
else
{
...
...
src/container/ResetPassword.js
View file @
a4779251
...
@@ -190,7 +190,7 @@ class ResetPassword extends Component {
...
@@ -190,7 +190,7 @@ class ResetPassword extends Component {
}}
}}
/
>
/
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
5
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
6
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Reset
Password
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Reset
Password
<
/Typography
>
<
/Button
>
<
/Button
>
<
/div
>
<
/div
>
...
...
src/container/SetPassword.js
View file @
a4779251
...
@@ -76,7 +76,7 @@ class SetPassword extends Component {
...
@@ -76,7 +76,7 @@ class SetPassword extends Component {
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Invalid password. Must using combination of characters, letters and numbers.'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Invalid password. Must using combination of characters, letters and numbers.'
})
}
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
:
'
Repeat Password
Cannot be Empty.'
})
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'The password and password confirmation do not match.'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'The password and password confirmation do not match.'
})
}
else
{
}
else
{
...
@@ -190,7 +190,7 @@ class SetPassword extends Component {
...
@@ -190,7 +190,7 @@ class SetPassword extends Component {
}}
}}
/
>
/
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
5
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
6
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Next
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Next
<
/Typography
>
<
/Button
>
<
/Button
>
<
/div
>
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment