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
f6c27c4e
Commit
f6c27c4e
authored
4 years ago
by
faisalhamdi
Browse files
Options
Browse Files
Download
Plain Diff
merge conflict
parents
3799d451
d534fd40
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1037 additions
and
693 deletions
+1037
-693
ApprovalMatrix.js
src/container/ApprovalMatrix/ApprovalMatrix.js
+134
-96
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+56
-34
Parameter.js
src/container/MasterData/Parameter/Parameter.js
+25
-21
CreatePerusahaan.js
src/container/MasterData/Perusahaan/CreatePerusahaan.js
+25
-13
EditPerusahaan.js
src/container/MasterData/Perusahaan/EditPerusahaan.js
+1
-1
Perusahaan.js
src/container/MasterData/Perusahaan/Perusahaan.js
+73
-58
ReportItems.js
src/container/MasterData/ReportItems.js
+63
-26
CreateReportItems.js
...container/MasterData/formReportItems/CreateReportItems.js
+224
-159
EditReportItems.js
src/container/MasterData/formReportItems/EditReportItems.js
+204
-148
AddUser.js
src/container/Otorisasi/User/AddUser.js
+62
-43
EditUser.js
src/container/Otorisasi/User/EditUser.js
+60
-41
AddRole.js
src/container/Otorisasi/UserRole/AddRole.js
+3
-3
EditRole.js
src/container/Otorisasi/UserRole/EditRole.js
+1
-1
Profile.js
src/container/Profile.js
+106
-49
No files found.
src/container/ApprovalMatrix/ApprovalMatrix.js
View file @
f6c27c4e
import
React
,
{
Component
}
from
'react'
;
import
{
Container
,
Row
,
Col
}
from
"react-bootstrap"
;
import
{
makeStyles
,
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core/styles'
;
import
{
TextField
,
InputBase
}
from
"@material-ui/core"
;
import
{
makeStyles
,
createMuiTheme
,
MuiThemeProvider
,
withStyles
}
from
'@material-ui/core/styles'
;
import
{
TextField
,
InputBase
,
Snackbar
}
from
"@material-ui/core"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
Images
from
'../../assets/Images'
;
import
MUIDataTable
from
"mui-datatables"
;
import
ReactTooltip
from
'react-tooltip'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
UploadFile
from
"../../library/Upload"
;
import
CreateApprovalMatrix
from
"./CreateApprovalMatrix"
;
import
EditApprovalMatrix
from
"./EditApprovalMatrix"
;
...
...
@@ -18,6 +19,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const
options
=
ct
.
customOptions
();
const
options2
=
ct
.
customOptions2
();
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
ApprovalMatrix
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -264,17 +268,18 @@ export default class ApprovalMatrix extends Component {
getData
()
{
api
.
create
().
getAM
().
then
((
response
)
=>
{
// console.log(response)
if
(
response
.
status
==
null
){
alert
(
response
.
problem
)
}
else
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
approval_matrix_id
-
b
.
approval_matrix_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
approval_matrix_id
,
item
.
approval_type_name
,
item
.
orders
,
item
.
fullname
,
item
.
operator_type_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
approval_matrix_id
-
b
.
approval_matrix_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
approval_matrix_id
,
item
.
approval_type_name
,
item
.
orders
,
item
.
fullname
,
item
.
operator_type_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -299,14 +304,18 @@ export default class ApprovalMatrix extends Component {
}
api
.
create
().
searchAM
(
body
).
then
(
response
=>
{
// console.log(response.data);
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
approval_matrix_id
,
item
.
approval_type_name
,
item
.
orders
,
item
.
fullname
,
item
.
operator_type_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
approval_matrix_id
,
item
.
approval_type_name
,
item
.
orders
,
item
.
fullname
,
item
.
operator_type_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -314,11 +323,15 @@ export default class ApprovalMatrix extends Component {
createAM
=
(
payload
)
=>
{
this
.
setState
({
visibleCreate
:
false
})
api
.
create
().
createAM
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -326,11 +339,15 @@ export default class ApprovalMatrix extends Component {
updateAM
=
(
payload
)
=>
{
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updateAM
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -338,11 +355,15 @@ export default class ApprovalMatrix extends Component {
updateVAM
=
(
payload
)
=>
{
this
.
setState
({
visibleVisual
:
false
,
visibleAM
:
true
})
api
.
create
().
updateVAM
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -381,12 +402,24 @@ export default class ApprovalMatrix extends Component {
uploadAM
()
{
api
.
create
().
uploadAM
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
.
data
)
// console.log(this.state.payload)
this
.
getData
()
this
.
setState
({
visibleAM
:
true
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
// console.log(this.state.payload)
this
.
getData
()
this
.
setState
({
visibleAM
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
const
columns
=
[{
name
:
"Action"
,
...
...
@@ -401,7 +434,7 @@ export default class ApprovalMatrix extends Component {
borderColor
:
'transparent'
}}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'edit'
)}
// onClick={() => this.setState({ visibleEdit: true })}
// onClick={() => this.setState({ visibleEdit: true })}
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
...
...
@@ -409,7 +442,7 @@ export default class ApprovalMatrix extends Component {
);
}
}
},
},
{
name
:
"ID"
,
options
:
{
...
...
@@ -421,7 +454,7 @@ export default class ApprovalMatrix extends Component {
);
}
}
},
},
{
name
:
"Tipe Persetujuan"
,
options
:
{
...
...
@@ -432,7 +465,7 @@ export default class ApprovalMatrix extends Component {
<
/div
>
);
}
}
}
},
{
name
:
"Order"
,
...
...
@@ -444,7 +477,7 @@ export default class ApprovalMatrix extends Component {
<
/div
>
);
}
}
}
},
{
name
:
"Nama Pemberi Persetujuan"
,
...
...
@@ -494,8 +527,13 @@ export default class ApprovalMatrix extends Component {
<
div
>
{
this
.
state
.
visibleAM
===
true
?
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
class
=
"main-color"
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
class
=
"main-color"
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
label
style
=
{{
width
:
'20%'
,
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
paddingTop
:
8
}}
>
Master
Data
-
Approval
Matrix
<
/label
>
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
...
...
@@ -519,7 +557,7 @@ export default class ApprovalMatrix extends Component {
}}
onClick
=
{()
=>
this
.
downloadFile
()}
>
<
img
src
=
{
Images
.
template
}
title
=
"Download Template"
/>
<
img
src
=
{
Images
.
template
}
title
=
"Download Template"
/>
<
/button
>
<
button
style
=
{{
...
...
@@ -527,12 +565,12 @@ export default class ApprovalMatrix extends Component {
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
16
,
padding
:
0
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
title
=
"Upload File"
/>
<
img
src
=
{
Images
.
upload
}
title
=
"Upload File"
/>
<
/button
>
<
button
style
=
{{
...
...
@@ -540,12 +578,12 @@ export default class ApprovalMatrix extends Component {
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
16
,
padding
:
0
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTable
()}
>
<
img
src
=
{
Images
.
download
}
title
=
"Download File"
/>
<
img
src
=
{
Images
.
download
}
title
=
"Download File"
/>
<
/button
>
<
button
style
=
{{
...
...
@@ -553,12 +591,12 @@ export default class ApprovalMatrix extends Component {
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
16
,
padding
:
0
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleVisual
:
true
,
visibleAM
:
false
})}
>
<
img
src
=
{
Images
.
visualisasi
}
title
=
"Visualisasi"
/>
<
img
src
=
{
Images
.
visualisasi
}
title
=
"Visualisasi"
/>
<
/button
>
<
button
style
=
{{
...
...
@@ -566,12 +604,12 @@ export default class ApprovalMatrix extends Component {
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
16
,
padding
:
0
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
})}
>
<
img
src
=
{
Images
.
add
}
title
=
"Tambah Approval Matrix"
/>
<
img
src
=
{
Images
.
add
}
title
=
"Tambah Approval Matrix"
/>
<
/button
>
<
/div
>
<
/div
>
...
...
@@ -589,54 +627,54 @@ export default class ApprovalMatrix extends Component {
<
/div
>
:
this
.
state
.
visibleVisual
==
true
?
<
VisualisasiAM
onClickClose
=
{()
=>
this
.
setState
({
visibleVisual
:
false
,
visibleAM
:
true
})}
height
=
{
this
.
props
.
height
}
updateVAM
=
{
this
.
updateVAM
.
bind
(
this
)}
/
>
:
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
class
=
"main-color"
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
div
>
<
VisualisasiAM
onClickClose
=
{()
=>
this
.
setState
({
visibleVisual
:
false
,
visibleAM
:
true
})}
height
=
{
this
.
props
.
height
}
updateVAM
=
{
this
.
updateVAM
.
bind
(
this
)}
/
>
:
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
class
=
"main-color"
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
}}
>
Preview
Data
<
/label
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
{
this
.
state
.
dataLoaded
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
theme
=
{
getMuiTheme
()}
data
=
{
this
.
state
.
rows
}
columns
=
{
this
.
state
.
cols
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
width
:
'100%'
,
placeContent
:
'flex-end'
,
padding
:
20
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleAM
:
true
})}
style
=
{{
marginRight
:
20
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Batal
<
/span
>
<
/div
>
<
/button
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadAM
()}
style
=
{{}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Simpan
<
/span
>
<
/div
>
<
/button
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
}}
>
Preview
Data
<
/label
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
{
this
.
state
.
dataLoaded
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
theme
=
{
getMuiTheme
()}
data
=
{
this
.
state
.
rows
}
columns
=
{
this
.
state
.
cols
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
width
:
'100%'
,
placeContent
:
'flex-end'
,
padding
:
20
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleAM
:
true
})}
style
=
{{
marginRight
:
20
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Batal
<
/span
>
<
/div
>
<
/button
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadAM
()}
style
=
{{}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Simpan
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
}
{
this
.
state
.
visibleCreate
&&
(
...
...
@@ -655,7 +693,7 @@ export default class ApprovalMatrix extends Component {
/
>
)}
{
this
.
state
.
popupError
&&
(
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
)}
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
...
...
@@ -672,7 +710,7 @@ export default class ApprovalMatrix extends Component {
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/Parameter/CreateParameter.js
View file @
f6c27c4e
...
...
@@ -328,22 +328,22 @@ export default class CreateParameter extends Component {
}
validasi
()
{
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
this
.
setState
({
errorParameter
:
true
,
msgErrorParameter
:
'Parameter tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
this
.
setState
({
errorGroup
:
true
,
msgErrorGroup
:
'Group tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
getParameter
))
{
this
.
setState
({
errorParameter
:
true
,
msgErrorParameter
:
'Parameter tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Perusahaan tidak boleh kosong'
})
// } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
}
else
if
(
!
R
.
isNil
(
this
.
state
.
tempData
.
max_value
)
&&
R
.
isNil
(
this
.
state
.
tempData
.
min_value
))
{
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Min Value tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorStartDate
:
'Start Date tidak boleh kosong'
})
// } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
// } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
}
else
if
(
!
R
.
isNil
(
this
.
state
.
tempData
.
min_value
)
&&
R
.
isNil
(
this
.
state
.
tempData
.
max_value
))
{
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Max Value tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
...
...
@@ -360,16 +360,16 @@ export default class CreateParameter extends Component {
this
.
setState
({
errorParameter
:
true
,
msgErrorParameter
:
'Parameter tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Perusahaan tidak boleh kosong'
})
// } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
// } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
}
else
if
(
!
R
.
isNil
(
this
.
state
.
maxValue
)
&&
R
.
isNil
(
this
.
state
.
minValue
))
{
this
.
setState
({
errorMinValue
:
true
,
msgErrorMinValue
:
'Min Value tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorStartDate
:
'Start Date tidak boleh kosong'
})
// } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
// } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
}
else
if
(
!
R
.
isNil
(
this
.
state
.
minValue
)
&&
R
.
isNil
(
this
.
state
.
maxValue
))
{
this
.
setState
({
errorMaxValue
:
true
,
msgErrorMaxValue
:
'Max Value tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
...
...
@@ -468,7 +468,7 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
parameter
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getParameter
:
newInputValue
},
()
=>
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getParameter
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -500,8 +500,8 @@ export default class CreateParameter extends Component {
}}
name
=
"description"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// error={this.state.errorDeskripsi}
// helperText={this.state.msgErrorDeskripsi}
// error={this.state.errorDeskripsi}
// helperText={this.state.msgErrorDeskripsi}
>
<
/TextField
>
<
/div
>
...
...
@@ -513,6 +513,7 @@ export default class CreateParameter extends Component {
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
value
}
type
=
{
"number"
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -525,8 +526,8 @@ export default class CreateParameter extends Component {
}}
name
=
"value"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// error={this.state.errorValue}
// helperText={this.state.msgErrorValue}
// error={this.state.errorValue}
// helperText={this.state.msgErrorValue}
>
<
/TextField
>
<
/div
>
...
...
@@ -538,6 +539,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
min_value
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -623,8 +625,15 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
getParameter
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
),
this
.
clearMessage
()
)}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Group"
/>
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
getParameter
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
),
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
error
=
{
this
.
state
.
errorGroup
}
helperText
=
{
this
.
state
.
msgErrorGroup
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Group"
/>
}
value
=
{
this
.
state
.
getTypes
}
/
>
<
/div
>
...
...
@@ -633,8 +642,14 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
perusahaan
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getPerusahaan
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Perusahaan"
/>
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getPerusahaan
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
error
=
{
this
.
state
.
errorPerusahaan
}
helperText
=
{
this
.
state
.
msgErrorPerusahaan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Perusahaan"
/>
}
value
=
{
this
.
state
.
getPerusahaan
}
/
>
<
/div
>
...
...
@@ -646,6 +661,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
order
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -658,8 +674,8 @@ export default class CreateParameter extends Component {
}}
name
=
"order"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
>
<
/TextField
>
<
/div
>
...
...
@@ -671,6 +687,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
max_value
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -797,7 +814,7 @@ export default class CreateParameter extends Component {
debug
disabled
=
{
!
this
.
state
.
enableParameter
}
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getParameter
:
newInputValue
},
()
=>
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getParameter
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -840,10 +857,12 @@ export default class CreateParameter extends Component {
value
=
{
this
.
state
.
value
===
null
?
''
:
this
.
state
.
value
}
type
=
{
"number"
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -852,8 +871,8 @@ export default class CreateParameter extends Component {
}}
name
=
"value"
onChange
=
{(
e
)
=>
this
.
handleChangeCreate
(
e
,
''
)}
// error={this.state.errorValue}
// helperText={this.state.msgErrorValue}
// error={this.state.errorValue}
// helperText={this.state.msgErrorValue}
>
<
/TextField
>
<
/div
>
...
...
@@ -865,6 +884,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
minValue
===
null
?
''
:
this
.
state
.
minValue
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -932,7 +952,7 @@ export default class CreateParameter extends Component {
/
>
<
/div
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
Dibuat
:
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
Diubah
:
<
/Typography
>
<
/div
>
...
...
@@ -944,7 +964,7 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
getParameter
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
),
this
.
clearMessage
()
)}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
enableParameter
:
false
,
getParameter
:
null
},
()
=>
this
.
clearMessage
())
:
this
.
getParameterByGroup
(
newInputValue
.
setting_group_id
),
this
.
clearMessage
()
)}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -962,7 +982,7 @@ export default class CreateParameter extends Component {
{...
this
.
state
.
perusahaan
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getPerusahaan
:
newInputValue
},
()
=>
this
.
clearMessage
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getPerusahaan
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
...
...
@@ -983,6 +1003,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
order
===
null
?
''
:
this
.
state
.
order
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
@@ -995,8 +1016,8 @@ export default class CreateParameter extends Component {
}}
name
=
"order"
onChange
=
{(
e
)
=>
this
.
handleChangeCreate
(
e
,
''
)}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
>
<
/TextField
>
<
/div
>
...
...
@@ -1008,6 +1029,7 @@ export default class CreateParameter extends Component {
type
=
{
"number"
}
value
=
{
this
.
state
.
maxValue
===
null
?
''
:
this
.
state
.
maxValue
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/Parameter/Parameter.js
View file @
f6c27c4e
...
...
@@ -42,26 +42,30 @@ export default class Parameter extends Component {
getAllParameter
()
{
api
.
create
().
getAllParameter
().
then
(
response
=>
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
);
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
setting_id
,
item
.
setting_group
,
item
.
setting_type
,
item
.
company_name
,
item
.
description
,
item
.
order
,
item
.
value
,
item
.
min_value
,
item
.
max_value
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
data
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
);
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
setting_id
,
item
.
setting_group
,
item
.
setting_type
,
item
.
company_name
,
item
.
description
,
item
.
order
,
item
.
value
,
item
.
min_value
,
item
.
max_value
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
data
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -83,6 +87,7 @@ export default class Parameter extends Component {
updateParameter
=
(
payload
)
=>
{
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updateParameter
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getAllParameter
()
...
...
@@ -517,8 +522,7 @@ export default class Parameter extends Component {
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
)
this
.
getAllParameter
()
this
.
setState
({
visibleParameter
:
true
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
visibleParameter
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/Perusahaan/CreatePerusahaan.js
View file @
f6c27c4e
...
...
@@ -96,7 +96,7 @@ export default class CreatePerusahaan extends Component {
options
:
perusahaanData
,
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
perusahaanData
[
0
]
:
perusahaanData
[
index
]
})
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
null
:
perusahaanData
[
index
]
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -120,7 +120,7 @@ export default class CreatePerusahaan extends Component {
options
:
typeData
,
getOptionLabel
:
(
option
)
=>
option
.
business_unit_name
,
};
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
typeData
[
0
]
:
typeData
[
index
]
})
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
null
:
typeData
[
index
]
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -174,19 +174,21 @@ export default class CreatePerusahaan extends Component {
errorSD
:
false
,
errorED
:
false
,
errorJL
:
false
,
errorUB
:
false
,
msgErrorNP
:
''
,
msgErrorPC
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
msgErrorJL
:
''
,
msgErrorUB
:
''
})
}
validasiEdit
()
{
if
(
R
.
isEmpty
(
this
.
state
.
company
))
{
this
.
setState
({
errorNP
:
true
,
msgErrorNP
:
'Nama perusahaan harus diisi'
})
// } else if (R.isEmpty(this.state.totalReport
)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
}
else
if
(
R
.
isNil
(
this
.
state
.
getTypes
))
{
this
.
setState
({
errorUB
:
true
,
msgErrorUB
:
'Unit Bisnis harus diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorSD
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
...
...
@@ -196,7 +198,7 @@ export default class CreatePerusahaan extends Component {
"company_id"
:
this
.
state
.
companyID
,
"company_name"
:
this
.
state
.
company
,
"business_unit_id"
:
this
.
state
.
getTypes
.
business_unit_id
,
"parent"
:
this
.
state
.
getPerusahaan
.
company_id
,
"parent"
:
this
.
state
.
getPerusahaan
==
null
?
null
:
this
.
state
.
getPerusahaan
.
company_id
,
// "total_report": this.state.totalReport,
"start_date"
:
this
.
state
.
startDate
,
"end_date"
:
this
.
state
.
endDate
...
...
@@ -209,7 +211,7 @@ export default class CreatePerusahaan extends Component {
validasi
()
{
if
(
R
.
isEmpty
(
this
.
state
.
company
))
{
this
.
setState
({
errorNP
:
true
,
msgErrorNP
:
'Nama perusahaan harus diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
t
ypes
))
{
}
else
if
(
R
.
isNil
(
this
.
state
.
getT
ypes
))
{
this
.
setState
({
errorUB
:
true
,
msgErrorUB
:
'Unit Bisnis harus diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorSD
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
...
...
@@ -217,12 +219,14 @@ export default class CreatePerusahaan extends Component {
this
.
setState
({
errorED
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
else
if
(
!
R
.
isEmpty
(
this
.
state
.
startDate
)
&&
!
R
.
isEmpty
(
this
.
state
.
endDate
)
&&
(
this
.
state
.
startDate
>
this
.
state
.
endDate
))
{
return
alert
(
"Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai"
)
// } else if (R.isEmpty(this.state.totalReport)) {
}
// else if (R.isEmpty(this.state.totalReport)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
}
else
{
// }
else
{
let
payload
=
{
"company_name"
:
this
.
state
.
company
,
"parent"
:
this
.
state
.
getPerusahaan
.
company_id
,
"parent"
:
this
.
state
.
getPerusahaan
==
null
?
null
:
this
.
state
.
getPerusahaan
.
company_id
,
"business_unit_id"
:
this
.
state
.
getTypes
.
business_unit_id
,
// "total_report": this.state.totalReport,
"start_date"
:
this
.
state
.
startDate
,
...
...
@@ -282,8 +286,17 @@ export default class CreatePerusahaan extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
})}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Unit Bisnis"
/>
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
},
()
=>
this
.
clearError
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Unit Bisnis"
error
=
{
this
.
state
.
errorUB
}
helperText
=
{
this
.
state
.
msgErrorUB
}
/
>
}
value
=
{
this
.
state
.
getTypes
}
/
>
<
/div
>
...
...
@@ -510,14 +523,13 @@ export default class CreatePerusahaan extends Component {
{...
this
.
state
.
types
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getTypes
:
newInputValue
}
,
()
=>
this
.
clearError
()
)}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Unit Bisnis"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
error
=
{
this
.
state
.
errorUB
}
helperText
=
{
this
.
state
.
msgErrorUB
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/Perusahaan/EditPerusahaan.js
View file @
f6c27c4e
...
...
@@ -138,7 +138,7 @@ export default class EditPerusahaan extends Component {
"company_id"
:
this
.
state
.
companyID
,
"company_name"
:
this
.
state
.
company
,
"business_unit_id"
:
this
.
state
.
getTypes
.
business_unit_id
,
"parent"
:
this
.
state
.
getPerusahaan
.
company_id
,
"parent"
:
this
.
state
.
getPerusahaan
==
null
?
null
:
this
.
state
.
getPerusahaan
.
company_id
,
"total_report"
:
this
.
state
.
totalReport
,
"start_date"
:
this
.
state
.
startDate
,
"end_date"
:
this
.
state
.
endDate
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/Perusahaan/Perusahaan.js
View file @
f6c27c4e
...
...
@@ -446,7 +446,7 @@ export default class Perusahaan extends Component {
{
this
.
state
.
visiblePerusahaan
===
true
?
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
}}
>
Master
Data
-
Perusahaan
<
/label
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
,
}}
>
Master
Data
-
Perusahaan
<
/label
>
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
<
img
src
=
{
Images
.
searchBlack
}
style
=
{{
marginRight
:
10
}}
/
>
<
InputBase
...
...
@@ -457,62 +457,77 @@ export default class Perusahaan extends Component {
inputProps
=
{{
'aria-label'
:
'naked'
}}
/
>
<
/div
>
<
div
style
=
{{
width
:
'20%'
,
justifyContent
:
'space-around'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadFile
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTable
()}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
null
}
>
<
img
src
=
{
Images
.
visualisasi
}
onClick
=
{()
=>
this
.
setState
({
visibleVisual
:
true
,
visiblePerusahaan
:
false
})}
/
>
<
/button
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
div
style
=
{{
width
:
'30%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadFile
()}
>
<
img
src
=
{
Images
.
template
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTable
()}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"download"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Visualisasi'
}
data
-
for
=
"visual"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
null
}
>
<
img
src
=
{
Images
.
visualisasi
}
onClick
=
{()
=>
this
.
setState
({
visibleVisual
:
true
,
visiblePerusahaan
:
false
})}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"visual"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Tambah'
}
data
-
for
=
"create"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
})}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"create"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
...
...
@@ -626,7 +641,7 @@ export default class Perusahaan extends Component {
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"
pdf
"
]}
acceptedFiles
=
{[
"
xsls
"
]}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/ReportItems.js
View file @
f6c27c4e
import
React
,
{
Component
}
from
"react"
;
import
{
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
,
withStyles
}
from
'@material-ui/core/styles'
;
import
Images
from
"../../assets/Images"
;
import
MUIDataTable
from
"mui-datatables"
;
import
{
InputBase
}
from
"@material-ui/core"
;
import
{
InputBase
,
Snackbar
}
from
"@material-ui/core"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
UploadFile
from
"../../library/Upload"
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
CreateReportItems
from
"./formReportItems/CreateReportItems"
;
import
EditReportItems
from
"./formReportItems/EditReportItems"
;
import
VisualReportItems
from
"./formReportItems/VisualReportItems"
;
...
...
@@ -17,6 +18,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const
options
=
ct
.
customOptions
();
const
options2
=
ct
.
customOptions2
();
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
ReportItems
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -32,7 +36,10 @@ export default class ReportItems extends Component {
dataLoaded
:
false
,
cols
:
null
,
rows
:
null
,
popupError
:
false
popupError
:
false
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -450,14 +457,18 @@ export default class ReportItems extends Component {
getData
()
{
api
.
create
().
getReportItems
().
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
item_report_id
-
b
.
item_report_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
item_report_id
,
item
.
report_name
,
item
.
company_name
,
item
.
order
,
item
.
description
,
item
.
parent
,
item
.
uom
,
item
.
weight
,
item
.
type_report_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
item_report_id
-
b
.
item_report_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
item_report_id
,
item
.
report_name
,
item
.
company_name
,
item
.
order
,
item
.
description
,
item
.
parent
,
item
.
uom
,
item
.
weight
,
item
.
type_report_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -482,14 +493,18 @@ export default class ReportItems extends Component {
}
api
.
create
().
searchReportItems
(
body
).
then
(
response
=>
{
// console.log(response.data);
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
item_report_id
,
item
.
report_name
,
item
.
company_name
,
item
.
order
,
item
.
description
,
item
.
parent
,
item
.
uom
,
item
.
weight
,
item
.
type_report_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
item_report_id
,
item
.
report_name
,
item
.
company_name
,
item
.
order
,
item
.
description
,
item
.
parent
,
item
.
uom
,
item
.
weight
,
item
.
type_report_name
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -497,10 +512,15 @@ export default class ReportItems extends Component {
createReportItems
=
(
payload
)
=>
{
this
.
setState
({
add
:
false
})
api
.
create
().
createReportItems
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -538,10 +558,15 @@ export default class ReportItems extends Component {
updateReportItems
=
(
payload
)
=>
{
this
.
setState
({
edit
:
false
})
api
.
create
().
updateReportItems
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -550,15 +575,22 @@ export default class ReportItems extends Component {
api
.
create
().
uploadReportItems
(
this
.
state
.
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
)
alert
(
response
.
data
.
message
)
this
.
getData
()
this
.
setState
({
itemReport
:
true
})
this
.
setState
({
itemReport
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
const
columns
=
[{
name
:
"Action"
,
...
...
@@ -716,10 +748,15 @@ export default class ReportItems extends Component {
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
{
/* <Row> */
}
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
{
this
.
state
.
itemReport
===
true
?
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
,
}}
>
Master
Data
-
Item
Report
<
/label
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
width
:
'20%'
,
}}
>
Master
Data
-
Item
Laporan
<
/label
>
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
<
img
src
=
{
Images
.
searchBlack
}
style
=
{{
marginRight
:
10
}}
/
>
<
InputBase
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/formReportItems/CreateReportItems.js
View file @
f6c27c4e
...
...
@@ -21,7 +21,7 @@ export default class CreateReportItems extends Component {
order
:
''
,
description
:
''
,
uom
:
''
,
weight
:
null
,
weight
:
''
,
formula
:
''
,
realVal
:
''
,
condition
:
null
,
...
...
@@ -36,6 +36,14 @@ export default class CreateReportItems extends Component {
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
errorJenisLaporan
:
false
,
errorPerusahaan
:
false
,
msgErrorJenisLaporan
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
...
...
@@ -45,7 +53,7 @@ export default class CreateReportItems extends Component {
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
options
:
[
'WARNING'
,
'STOPPER'
]
options
:
[
'WARNING'
,
'STOPPER'
]
}
}
...
...
@@ -56,25 +64,30 @@ export default class CreateReportItems extends Component {
this
.
getReportType
()
// this.getParent()
let
date
=
format
(
new
Date
,
'yyyy-MM-dd'
)
console
.
log
(
date
);
this
.
setState
({
startDate
:
date
,
endDate
:
date
})
console
.
log
(
date
);
this
.
setState
({
startDate
:
date
,
endDate
:
date
})
}
handleChange
(
e
,
type
)
{
let
data
=
this
.
state
let
isDate
=
type
!==
''
?
true
:
false
let
isDate
=
type
!==
''
?
true
:
false
if
(
isDate
&&
type
===
'start_date'
)
{
this
.
setState
({...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
this
.
setState
({
...
data
,
startDate
:
format
(
e
,
'yyyy-MM-dd'
),
endDate
:
null
,
errorOrder
:
false
,
errorDesc
:
false
,
errorFormula
:
false
,
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
...
...
@@ -83,13 +96,18 @@ export default class CreateReportItems extends Component {
msgErrorED
:
''
,
})
}
else
if
(
isDate
&&
type
===
'end_date'
)
{
this
.
setState
({...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
),
this
.
setState
({
...
data
,
endDate
:
format
(
e
,
'yyyy-MM-dd'
),
errorOrder
:
false
,
errorDesc
:
false
,
errorFormula
:
false
,
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
...
...
@@ -98,13 +116,18 @@ export default class CreateReportItems extends Component {
msgErrorED
:
''
,
})
}
else
{
this
.
setState
({...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
errorOrder
:
false
,
errorDesc
:
false
,
errorFormula
:
false
,
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
...
...
@@ -117,28 +140,34 @@ export default class CreateReportItems extends Component {
validasi
()
{
// alert('coba ya')
if
(
R
.
isNil
(
this
.
state
.
reportType
))
return
alert
(
"Jenis Laporan is Required."
);
if
(
R
.
isNil
(
this
.
state
.
company
))
return
alert
(
"Perusahaan is Required."
);
else
if
(
R
.
isEmpty
(
this
.
state
.
order
))
{
this
.
setState
({
errorOrder
:
true
,
msgErrorOrder
:
'Order Harus Diisi'
})
}
if
(
R
.
isNil
(
this
.
state
.
reportType
))
{
this
.
setState
({
errorJenisLaporan
:
true
,
msgErrorJenisLaporan
:
'Jenis Laporan Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
company
)){
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Perusahaan Harus Diisi'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
order
))
{
this
.
setState
({
errorOrder
:
true
,
msgErrorOrder
:
'Order Harus Diisi'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
description
))
{
this
.
setState
({
errorDesc
:
true
,
msgErrorDesc
:
'Deskripsi Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
InputType
))
return
alert
(
"Tipe Data is Required."
)
this
.
setState
({
errorDesc
:
true
,
msgErrorDesc
:
'Deskripsi Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
InputType
))
{
this
.
setState
({
errorTipeData
:
true
,
msgErrorTipeData
:
'Tipe Data Harus Diisi'
})
}
else
if
(
this
.
state
.
disabledFormula
===
false
&&
R
.
isEmpty
(
this
.
state
.
formula
))
{
this
.
setState
({
errorFormula
:
true
,
msgErrorFormula
:
'Formula Harus Diisi'
})
}
this
.
setState
({
errorFormula
:
true
,
msgErrorFormula
:
'Formula Harus Diisi'
})
}
else
if
(
this
.
state
.
disabledValue
===
false
&&
R
.
isEmpty
(
this
.
state
.
realVal
))
{
this
.
setState
({
errorRV
:
true
,
msgErrorRV
:
'Nilai Seharusnya Harus Diisi'
})
this
.
setState
({
errorRV
:
true
,
msgErrorRV
:
'Nilai Seharusnya Harus Diisi'
})
}
else
if
(
this
.
state
.
disabledCondt
===
false
&&
R
.
isEmpty
(
this
.
state
.
condition
))
{
this
.
setState
({
errorCondition
:
true
,
msgErrorCondition
:
'Kondisi Jika Salah Harus Diisi'
})
}
else
if
(
this
.
state
.
disabledCondt
===
false
&&
R
.
isEmpty
(
this
.
state
.
condition
))
return
alert
(
"Kondisi Jika Salah is Required."
)
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
}
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Start Date tidak boleh kosong'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
else
{
this
.
addReportItems
()
}
...
...
@@ -162,23 +191,13 @@ export default class CreateReportItems extends Component {
"end_date"
:
this
.
state
.
endDate
}
console
.
log
(
payload
)
api
.
create
().
createReportItems
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
props
.
onClickClose
()
this
.
props
.
refresh
()
}
else
{
alert
(
response
.
data
.
message
)
}
}
})
this
.
props
.
createReportItems
(
payload
)
}
getInputType
()
{
api
.
create
().
getInputType
().
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
inputData
=
data
.
map
((
item
)
=>
{
return
{
...
...
@@ -189,8 +208,8 @@ export default class CreateReportItems extends Component {
let
defaultProps
=
{
options
:
inputData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
type_report_name
),
};
this
.
setState
({
listInputType
:
defaultProps
,
inputData
:
response
.
data
.
data
})
};
this
.
setState
({
listInputType
:
defaultProps
,
inputData
:
response
.
data
.
data
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -200,7 +219,7 @@ export default class CreateReportItems extends Component {
getPerusahaan
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
// console.log(response)
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
companyData
=
data
.
map
((
item
)
=>
{
return
{
...
...
@@ -211,8 +230,8 @@ export default class CreateReportItems extends Component {
let
defaultProps
=
{
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
this
.
setState
({
listCompany
:
defaultProps
,
companyData
:
response
.
data
.
data
})
};
this
.
setState
({
listCompany
:
defaultProps
,
companyData
:
response
.
data
.
data
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -222,7 +241,7 @@ export default class CreateReportItems extends Component {
getReportType
()
{
api
.
create
().
getReportType
().
then
((
response
)
=>
{
// console.log(response)
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
reportTypeData
=
data
.
map
((
item
)
=>
{
return
{
...
...
@@ -233,8 +252,8 @@ export default class CreateReportItems extends Component {
let
defaultProps
=
{
options
:
reportTypeData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
report_name
),
};
this
.
setState
({
listReportType
:
defaultProps
,
reportTypeData
:
response
.
data
.
data
})
};
this
.
setState
({
listReportType
:
defaultProps
,
reportTypeData
:
response
.
data
.
data
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -242,14 +261,14 @@ export default class CreateReportItems extends Component {
}
getParent
()
{
if
(
this
.
state
.
reportType
!==
null
&&
this
.
state
.
company
!==
null
)
{
if
(
this
.
state
.
reportType
!==
null
&&
this
.
state
.
company
!==
null
)
{
let
payload
=
{
"report_id"
:
this
.
state
.
reportType
.
report_id
,
"company_id"
:
this
.
state
.
company
.
company_id
}
api
.
create
().
getReportParent
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
parentData
=
data
.
map
((
item
)
=>
{
return
{
...
...
@@ -260,8 +279,8 @@ export default class CreateReportItems extends Component {
let
defaultProps
=
{
options
:
parentData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
description
),
};
this
.
setState
({
listParent
:
defaultProps
,
parentData
:
response
.
data
.
data
})
};
this
.
setState
({
listParent
:
defaultProps
,
parentData
:
response
.
data
.
data
})
}
else
{
alert
(
response
.
data
.
message
)
}
...
...
@@ -274,6 +293,19 @@ export default class CreateReportItems extends Component {
return
value
}
clearMessage
()
{
this
.
setState
({
errorFormula
:
false
,
msgErrorFormula
:
''
,
errorTipeData
:
false
,
errorCondition
:
false
,
msgErrorTipeData
:
''
,
msgErrorCondition
:
''
,
errorRV
:
false
,
msgErrorRV
:
''
,
errorJenisLaporan
:
false
,
msgErrorJenisLaporan
:
''
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
})
}
render
()
{
return
(
...
...
@@ -291,7 +323,7 @@ export default class CreateReportItems extends Component {
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
img
src
=
{
Images
.
close
}
/
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
...
...
@@ -322,15 +354,15 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listReportType
}
id
=
"reportType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
}
)}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
this
.
clearMessage
()
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Jenis Laporan"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Jenis Laporan"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -338,6 +370,8 @@ export default class CreateReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorJenisLaporan
}
helperText
=
{
this
.
state
.
msgErrorJenisLaporan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
reportType
}
...
...
@@ -348,15 +382,15 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listCompany
}
id
=
"company"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
this
.
getParent
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
this
.
getParent
(),
this
.
clearMessage
())}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Perusahaan"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Perusahaan"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -364,6 +398,8 @@ export default class CreateReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorPerusahaan
}
helperText
=
{
this
.
state
.
msgErrorPerusahaan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
company
}
...
...
@@ -371,17 +407,19 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"orders"
name
=
"order"
label
=
"Order"
type
=
"number"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
null
)}
value
=
{
this
.
state
.
order
}
error
=
{
this
.
state
.
errorOrder
}
helperText
=
{
this
.
state
.
msgErrorOrder
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
...
...
@@ -402,7 +440,7 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"description"
...
...
@@ -431,16 +469,16 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listParent
}
id
=
"parentId"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
parent
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
parent
:
newInputValue
})}
debug
disabled
=
{
this
.
state
.
reportType
==
null
||
this
.
state
.
company
==
null
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Parent ID"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Parent ID"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -458,7 +496,7 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"uom"
...
...
@@ -484,7 +522,7 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"weight"
...
...
@@ -513,20 +551,45 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listInputType
}
id
=
"inputType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
InputType
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
})
:
newInputValue
.
type_report_name
===
'Formula'
?
this
.
setState
({
disabledFormula
:
false
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
})
:
newInputValue
.
type_report_name
===
'Validation'
?
this
.
setState
({
disabledFormula
:
false
,
disabledCondt
:
false
,
disabledValue
:
false
,
formula
:
''
,
condition
:
''
,
realVal
:
''
})
:
this
.
setState
({
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
})
)}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
InputType
:
newInputValue
},
()
=>
newInputValue
===
null
?
this
.
setState
({
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
})
:
newInputValue
.
type_report_name
===
'Formula'
?
this
.
setState
({
disabledFormula
:
false
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
},
()
=>
this
.
clearMessage
())
:
newInputValue
.
type_report_name
===
'Validation'
?
this
.
setState
({
disabledFormula
:
false
,
disabledCondt
:
false
,
disabledValue
:
false
,
formula
:
''
,
condition
:
''
,
realVal
:
''
},
()
=>
this
.
clearMessage
())
:
this
.
setState
({
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
formula
:
''
,
condition
:
''
,
realVal
:
''
},
()
=>
this
.
clearMessage
())
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Tipe Data"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Tipe Data"
error
=
{
this
.
state
.
errorTipeData
}
helperText
=
{
this
.
state
.
msgErrorTipeData
}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -534,6 +597,8 @@ export default class CreateReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorTipeData
}
helperText
=
{
this
.
state
.
msgErrorTipeData
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
InputType
}
...
...
@@ -541,7 +606,7 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"formula"
...
...
@@ -573,7 +638,7 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"realVal"
...
...
@@ -601,18 +666,20 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
value
=
{
this
.
state
.
condition
}
id
=
"isWrongCondition"
disabled
=
{
this
.
state
.
disabledCondt
}
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
condition
:
newValue
}
);
this
.
setState
({
condition
:
newValue
},
()
=>
this
.
clearMessage
()
);
}}
options
=
{
this
.
state
.
options
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Kondisi Jika Salah"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
error
=
{
this
.
state
.
errorCondition
}
helperText
=
{
this
.
state
.
msgErrorCondition
}
label
=
"Kondisi Jika Salah"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -620,7 +687,7 @@ export default class CreateReportItems extends Component {
color
:
'#7e8085'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
<
/div
>
...
...
@@ -629,67 +696,67 @@ export default class CreateReportItems extends Component {
<
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
}}
>
<
DatePicker
margin
=
"normal"
id
=
"startDate"
label
=
"Berlaku Mulai"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
startDate
==
""
?
null
:
this
.
state
.
startDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'start_date'
)}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
DatePicker
margin
=
"normal"
id
=
"startDate"
label
=
"Berlaku Mulai"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
startDate
==
""
?
null
:
this
.
state
.
startDate
}
error
=
{
this
.
state
.
errorStartDate
}
helperText
=
{
this
.
state
.
msgErrorSD
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'start_date'
)}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
/
>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
DatePicker
margin
=
"normal"
id
=
"endDate"
label
=
"Berlaku Hingga"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
endDate
==
""
?
null
:
this
.
state
.
endDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'end_date'
)}
minDate
=
{
this
.
state
.
startDate
}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
DatePicker
margin
=
"normal"
id
=
"endDate"
label
=
"Berlaku Hingga"
format
=
"dd MMMM yyyy"
value
=
{
this
.
state
.
endDate
==
""
?
null
:
this
.
state
.
endDate
}
error
=
{
this
.
state
.
errorEndDate
}
helperText
=
{
this
.
state
.
msgErrorED
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
'end_date'
)}
minDate
=
{
this
.
state
.
startDate
}
KeyboardButtonProps
=
{{
'aria-label'
:
'change date'
,
}}
inputProps
=
{{
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
,
fontFamily
:
'Nunito Sans, sans-serif'
,
}
}}
style
=
{{
padding
:
0
,
margin
:
0
,
width
:
'100%'
}}
/
>
<
/div
>
<
/div
>
...
...
@@ -697,7 +764,7 @@ export default class CreateReportItems extends Component {
<
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
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
value
=
{
'Aktif'
}
...
...
@@ -721,17 +788,15 @@ export default class CreateReportItems extends Component {
<
/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
=
{{
padding
Bottom
:
20
,
padding
Left
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
,
width
:
'20%'
}}
>
Dibuat
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
Admin
-
21
Jul
2020
,
18
:
45
<
/Typography
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
Dibuat
:
<
/Typography
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
,
width
:
'20%'
}}
>
Diubah
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
Admin
-
21
Jul
2020
,
18
:
45
<
/Typography
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
Diubah
:
<
/Typography
>
<
/div
>
<
/div
>
<
/div
>
...
...
@@ -748,8 +813,8 @@ export default class CreateReportItems extends Component {
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
button
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
validasi
()}
>
...
...
This diff is collapsed.
Click to expand it.
src/container/MasterData/formReportItems/EditReportItems.js
View file @
f6c27c4e
import
React
,
{
Component
}
from
'react'
;
import
{
TextField
,
Typography
}
from
'@material-ui/core'
;
import
{
TextField
,
Typography
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
;
import
{
DatePicker
}
from
'@material-ui/pickers'
;
import
format
from
"date-fns/format"
;
import
Autocomplete
from
'@material-ui/lab/Autocomplete'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
api
from
'../../../api'
;
import
*
as
R
from
'ramda'
import
{
titleCase
}
from
'../../../library/Utils'
;
import
Images
from
'../../../assets/Images'
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
EditReportItems
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
tempData
:
null
,
InputType
:
null
,
company
:
null
,
...
...
@@ -23,7 +26,7 @@ export default class EditReportItems extends Component {
order
:
null
,
description
:
''
,
uom
:
''
,
weight
:
null
,
weight
:
""
,
formula
:
''
,
realVal
:
''
,
condition
:
null
,
...
...
@@ -38,23 +41,34 @@ export default class EditReportItems extends Component {
errorRV
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
errorJenisLaporan
:
false
,
errorPerusahaan
:
false
,
msgErrorJenisLaporan
:
''
,
msgErrorPerusahaan
:
''
,
msgErrorOrder
:
''
,
msgErrorDesc
:
''
,
msgErrorFormula
:
''
,
errorTipeData
:
false
,
msgErrorTipeData
:
''
,
errorCondition
:
false
,
msgErrorCondition
:
''
,
msgErrorRV
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
disabledFormula
:
true
,
disabledCondt
:
true
,
disabledValue
:
true
,
options
:
[
'WARNING'
,
'STOPPER'
]
options
:
[
'WARNING'
,
'STOPPER'
],
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
}
}
componentDidMount
()
{
this
.
getDetailReportItems
();
}
handleChange
(
e
,
type
)
{
...
...
@@ -113,21 +127,23 @@ export default class EditReportItems extends Component {
validasi
()
{
// alert('coba ya')
if
(
R
.
isNil
(
this
.
state
.
reportType
))
return
alert
(
"Jenis Laporan is Required."
);
if
(
R
.
isNil
(
this
.
state
.
company
))
return
alert
(
"Perusahaan is Required."
);
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
order
))
{
this
.
setState
({
errorOrder
:
true
,
msgErrorOrder
:
'Order Harus Diisi'
})
if
(
R
.
isNil
(
this
.
state
.
reportType
)){
this
.
setState
({
errorJenisLaporan
:
true
,
msgErrorJenisLaporan
:
'Jenis Laporan Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
company
)){
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Perusahaan Harus Diisi'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
order
))
{
this
.
setState
({
errorOrder
:
true
,
msgErrorOrder
:
'Order Harus Diisi'
})
}
else
if
(
R
.
isEmpty
(
this
.
state
.
tempData
.
description
))
{
this
.
setState
({
errorDesc
:
true
,
msgErrorDesc
:
'Deskripsi Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
InputType
))
return
alert
(
"Tipe Data harus dipilih."
)
else
if
(
this
.
state
.
InputType
.
type_report_name
===
'Formula'
||
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
formula
))
{
this
.
setState
({
errorFormula
:
true
,
msgErrorFormula
:
'Formula Harus Diisi'
})
}
else
if
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
condition_it_should_be
))
{
this
.
setState
({
errorRV
:
true
,
msgErrorRV
:
'Nilai Seharusnya Harus Diisi'
})
}
else
if
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isNil
(
this
.
state
.
condition
))
return
alert
(
"Kondisi Jika Salah is Required."
);
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorDesc
:
true
,
msgErrorDesc
:
'Deskripsi Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
InputType
))
{
this
.
setState
({
errorTipeData
:
true
,
msgErrorTipeData
:
'Tipe Data Harus Diisi'
})
}
else
if
((
this
.
state
.
InputType
.
type_report_name
===
'Formula'
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
formula
))
||
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
formula
)))
{
this
.
setState
({
errorFormula
:
true
,
msgErrorFormula
:
'Formula Harus Diisi'
})
}
else
if
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isEmpty
(
this
.
state
.
tempData
.
condition_it_should_be
))
{
this
.
setState
({
errorRV
:
true
,
msgErrorRV
:
'Nilai Seharusnya Harus Diisi'
})
}
else
if
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
&&
R
.
isNil
(
this
.
state
.
tempData
.
condition_if_wrong
))
{
this
.
setState
({
errorCondition
:
true
,
msgErrorCondition
:
'Kondisi Jika Salah Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
start_date
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorSD
:
'Start Date Harus Diisi'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date Harus Diisi'
})
...
...
@@ -141,40 +157,35 @@ export default class EditReportItems extends Component {
// alert('test')
let
payload
=
{
"item_report_id"
:
this
.
state
.
tempData
.
item_report_id
,
"report_id"
:
this
.
state
.
reportType
==
null
?
this
.
state
.
tempData
.
report_id
:
this
.
state
.
reportType
.
report_id
,
"company_id"
:
this
.
state
.
company
==
null
?
this
.
state
.
tempData
.
company_id
:
this
.
state
.
company
.
company_id
,
"report_id"
:
this
.
state
.
reportType
==
null
?
this
.
state
.
tempData
.
report_id
:
this
.
state
.
reportType
.
report_id
,
"company_id"
:
this
.
state
.
company
==
null
?
this
.
state
.
tempData
.
company_id
:
this
.
state
.
company
.
company_id
,
"description"
:
this
.
state
.
tempData
.
description
,
"orders"
:
this
.
state
.
tempData
.
order
,
"parent"
:
this
.
state
.
parent
==
null
?
this
.
state
.
tempData
.
parent
:
this
.
state
.
parent
.
item_report_id
,
"type_report_id"
:
this
.
state
.
InputType
==
null
?
this
.
state
.
tempData
.
type_report_id
:
this
.
state
.
InputType
.
type_report_id
,
"parent"
:
this
.
state
.
parent
==
null
?
this
.
state
.
tempData
.
parent
:
this
.
state
.
parent
.
item_report_id
,
"type_report_id"
:
this
.
state
.
InputType
==
null
?
this
.
state
.
tempData
.
type_report_id
:
this
.
state
.
InputType
.
type_report_id
,
"formula"
:
this
.
state
.
tempData
.
formula
,
"uom"
:
this
.
state
.
tempData
.
uom
,
"weight"
:
this
.
state
.
tempData
.
weight
,
"weight"
:
this
.
state
.
tempData
.
weight
==
null
?
""
:
this
.
state
.
tempData
.
weight
,
"condition_if_wrong"
:
this
.
state
.
tempData
.
condition_if_wrong
,
"condition_it_should_be"
:
this
.
state
.
tempData
.
condition_it_should_be
,
"start_date"
:
this
.
state
.
tempData
.
start_date
,
"end_date"
:
this
.
state
.
tempData
.
end_date
}
console
.
log
(
payload
)
// api.create().updateReportItems(payload).then((response) => {
// if (response.data) {
// if (response.data.status === 'success') {
// this.props.onClickClose()
// this.props.refresh()
// } else {
// alert(response.data.message)
// }
// }
// })
this
.
props
.
updateReportItems
(
payload
)
}
getDetailReportItems
()
{
api
.
create
().
getDetailReportItems
(
this
.
props
.
data
[
1
]).
then
((
response
)
=>
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
tempData
:
response
.
data
.
data
},
()
=>
this
.
getInputType
(),
this
.
getPerusahaan
(),
this
.
getReportType
(),)
console
.
log
(
response
.
data
.
data
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
tempData
:
response
.
data
.
data
},
()
=>
this
.
getInputType
(),
this
.
getPerusahaan
(),
this
.
getReportType
(),)
console
.
log
(
response
.
data
.
data
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -182,23 +193,27 @@ export default class EditReportItems extends Component {
getInputType
()
{
api
.
create
().
getInputType
().
then
((
response
)
=>
{
// console.log(response)
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
inputData
=
data
.
map
((
item
)
=>
{
return
{
type_report_id
:
item
.
type_report_id
,
type_report_name
:
item
.
type_report_name
}
})
let
defaultProps
=
{
options
:
inputData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
type_report_name
),
};
let
index
=
inputData
.
findIndex
((
val
)
=>
val
.
type_report_id
===
this
.
state
.
tempData
.
type_report_id
)
this
.
setState
({
listInputType
:
defaultProps
,
InputType
:
index
===
-
1
?
null
:
inputData
[
index
]})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
inputData
=
data
.
map
((
item
)
=>
{
return
{
type_report_id
:
item
.
type_report_id
,
type_report_name
:
item
.
type_report_name
}
})
let
defaultProps
=
{
options
:
inputData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
type_report_name
),
};
let
index
=
inputData
.
findIndex
((
val
)
=>
val
.
type_report_id
===
this
.
state
.
tempData
.
type_report_id
)
this
.
setState
({
listInputType
:
defaultProps
,
InputType
:
index
===
-
1
?
null
:
inputData
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -206,23 +221,27 @@ export default class EditReportItems extends Component {
getPerusahaan
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
companyData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
}
})
let
defaultProps
=
{
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
let
index
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
===
this
.
state
.
tempData
.
company_id
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
index
===
-
1
?
null
:
companyData
[
index
]},
()
=>
this
.
getParent
())
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
companyData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
}
})
let
defaultProps
=
{
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
let
index
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
===
this
.
state
.
tempData
.
company_id
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
index
===
-
1
?
null
:
companyData
[
index
]
},
()
=>
this
.
getParent
())
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -230,23 +249,27 @@ export default class EditReportItems extends Component {
getReportType
()
{
api
.
create
().
getReportType
().
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
reportTypeData
=
data
.
map
((
item
)
=>
{
return
{
report_id
:
item
.
report_id
,
report_name
:
item
.
report_name
,
}
})
let
defaultProps
=
{
options
:
reportTypeData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
report_name
),
};
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
reportTypeData
=
data
.
map
((
item
)
=>
{
return
{
report_id
:
item
.
report_id
,
report_name
:
item
.
report_name
,
}
})
let
defaultProps
=
{
options
:
reportTypeData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
report_name
),
};
let
index
=
reportTypeData
.
findIndex
((
val
)
=>
val
.
report_id
===
this
.
state
.
tempData
.
report_id
)
this
.
setState
({
listReportType
:
defaultProps
,
reportType
:
index
===
-
1
?
null
:
reportTypeData
[
index
]},
()
=>
this
.
getParent
())
let
index
=
reportTypeData
.
findIndex
((
val
)
=>
val
.
report_id
===
this
.
state
.
tempData
.
report_id
)
this
.
setState
({
listReportType
:
defaultProps
,
reportType
:
index
===
-
1
?
null
:
reportTypeData
[
index
]
},
()
=>
this
.
getParent
())
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -259,27 +282,46 @@ export default class EditReportItems extends Component {
}
api
.
create
().
getReportParent
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
parentData
=
data
.
map
((
item
)
=>
{
return
{
item_report_id
:
item
.
item_report_id
,
description
:
item
.
description
}
})
let
defaultProps
=
{
options
:
parentData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
description
),
};
let
index
=
parentData
.
findIndex
((
val
)
=>
val
.
item_report_id
===
this
.
state
.
tempData
.
parent
)
this
.
setState
({
listParent
:
defaultProps
,
parent
:
index
==
-
1
?
null
:
parentData
[
index
]})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
parentData
=
data
.
map
((
item
)
=>
{
return
{
item_report_id
:
item
.
item_report_id
,
description
:
item
.
description
}
})
let
defaultProps
=
{
options
:
parentData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
description
),
};
let
index
=
parentData
.
findIndex
((
val
)
=>
val
.
item_report_id
===
this
.
state
.
tempData
.
parent
)
this
.
setState
({
listParent
:
defaultProps
,
parent
:
index
==
-
1
?
null
:
parentData
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
}
clearMessage
()
{
this
.
setState
({
errorFormula
:
false
,
msgErrorFormula
:
''
,
errorTipeData
:
false
,
msgErrorTipeData
:
''
,
errorCondition
:
false
,
msgErrorCondition
:
''
,
errorRV
:
false
,
msgErrorRV
:
''
,
errorJenisLaporan
:
false
,
msgErrorJenisLaporan
:
''
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
return
(
...
...
@@ -297,21 +339,25 @@ export default class EditReportItems extends Component {
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
img
src
=
{
Images
.
close
}
/
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
backgroundColor
:
'#e8e8e8'
,
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
item_report_id
}
id
=
"ID"
label
=
"ID"
disabled
variant
=
"filled"
onChange
=
{(
e
)
=>
null
}
inputProps
=
{{
style
:
{
...
...
@@ -330,15 +376,15 @@ export default class EditReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
Autocomplete
{...
this
.
state
.
listReportType
}
id
=
"reportType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
this
.
getParent
()
)}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
reportType
:
newInputValue
},
()
=>
this
.
getParent
(),
this
.
clearMessage
()
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Jenis Laporan"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Jenis Laporan"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -346,6 +392,8 @@ export default class EditReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorJenisLaporan
}
helperText
=
{
this
.
state
.
msgErrorJenisLaporan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
reportType
}
...
...
@@ -355,15 +403,15 @@ export default class EditReportItems extends Component {
<
/div
>
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
Autocomplete
{...
this
.
state
.
listCompany
}
id
=
"company"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
this
.
getParent
())}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
this
.
getParent
(),
this
.
clearMessage
())}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Perusahaan"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Perusahaan"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -371,6 +419,8 @@ export default class EditReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorPerusahaan
}
helperText
=
{
this
.
state
.
msgErrorPerusahaan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
company
}
...
...
@@ -384,11 +434,13 @@ export default class EditReportItems extends Component {
id
=
"order"
label
=
"Order"
name
=
"order"
type
=
"number"
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
order
}
error
=
{
this
.
state
.
errorOrder
}
helperText
=
{
this
.
state
.
msgErrorOrder
}
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
...
...
@@ -408,7 +460,7 @@ export default class EditReportItems extends Component {
<
/div
>
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"description"
...
...
@@ -436,16 +488,16 @@ export default class EditReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
Autocomplete
{...
this
.
state
.
listParent
}
id
=
"parentId"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
parent
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
parent
:
newInputValue
})}
disabled
=
{
this
.
state
.
reportType
==
null
||
this
.
state
.
company
==
null
}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Parent ID"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Parent ID"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -462,7 +514,7 @@ export default class EditReportItems extends Component {
<
/div
>
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"uom"
...
...
@@ -488,7 +540,7 @@ export default class EditReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"weight"
...
...
@@ -516,20 +568,20 @@ export default class EditReportItems extends Component {
<
/div
>
<
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
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
Autocomplete
{...
this
.
state
.
listInputType
}
id
=
"inputType"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
InputType
:
newInputValue
,
tempData
:
{...
this
.
state
.
tempData
,
formula
:
''
,
condition_it_should_be
:
''
,
condition_if_wrong
:
''
},
errorFormula
:
false
,
msgErrorFormula
:
''
,
errorRV
:
false
,
msgErrorRV
:
''
},
()
=>
console
.
log
(
this
.
state
.
InputType
))}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
InputType
:
newInputValue
,
tempData
:
{
...
this
.
state
.
tempData
,
formula
:
''
,
condition_it_should_be
:
''
,
condition_if_wrong
:
''
}
,
},
()
=>
console
.
log
(
this
.
state
.
InputType
)
,
this
.
clearMessage
()
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Tipe Data"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Tipe Data"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -537,6 +589,8 @@ export default class EditReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorTipeData
}
helperText
=
{
this
.
state
.
msgErrorTipeData
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
value
=
{
this
.
state
.
InputType
}
...
...
@@ -549,7 +603,7 @@ export default class EditReportItems extends Component {
style
=
{{
width
:
'100%'
}}
id
=
"formula"
label
=
"Formula"
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Formula'
||
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Formula'
||
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
name
=
"formula"
error
=
{
this
.
state
.
errorFormula
}
helperText
=
{
this
.
state
.
msgErrorFormula
}
...
...
@@ -582,9 +636,9 @@ export default class EditReportItems extends Component {
label
=
"Nilai Seharusnya"
error
=
{
this
.
state
.
errorRV
}
helperText
=
{
this
.
state
.
msgErrorRV
}
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
name
=
"condition_it_should_be"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
name
=
"condition_it_should_be"
onChange
=
{(
e
)
=>
this
.
handleChange
(
e
,
''
)}
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
condition_it_should_be
}
inputProps
=
{{
style
:
{
...
...
@@ -603,18 +657,18 @@ export default class EditReportItems extends Component {
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
}}
>
<
Autocomplete
value
=
{
this
.
state
.
tempData
===
null
?
''
:
this
.
state
.
tempData
.
condition
}
value
=
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
condition_if_wrong
}
id
=
"isWrongCondition"
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
disabled
=
{
this
.
state
.
InputType
==
null
?
true
:
(
this
.
state
.
InputType
.
type_report_name
===
'Validation'
?
false
:
true
)}
onChange
=
{(
event
,
newValue
)
=>
{
this
.
setState
({
condition
:
newValue
}
);
this
.
setState
({
tempData
:
{
...
this
.
state
.
tempData
,
condition_if_wrong
:
newValue
}
},
()
=>
this
.
clearMessage
()
);
}}
options
=
{
this
.
state
.
options
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Kondisi Jika Salah"
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Kondisi Jika Salah"
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
...
...
@@ -622,6 +676,8 @@ export default class EditReportItems extends Component {
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorCondition
}
helperText
=
{
this
.
state
.
msgErrorCondition
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
,
fontFamily
:
'Nunito Sans, sans-serif'
}
}}
/>
}
/>
...
...
@@ -694,16 +750,16 @@ export default class EditReportItems extends Component {
<
/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
=
{{
padding
Bottom
:
20
,
padding
Left
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
>
<
div
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
,
width
:
'20%'
}}
>
Dibuat
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
Admin
-
21
Jul
2020
,
18
:
45
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
created
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
fontSize
:
11
,
width
:
'20%'
}}
>
Diubah
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
Admin
-
21
Jul
2020
,
18
:
45
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
11
}}
>
:
{
this
.
state
.
tempData
===
null
?
""
:
this
.
state
.
tempData
.
updated
}
<
/Typography
>
<
/div
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/User/AddUser.js
View file @
f6c27c4e
...
...
@@ -134,6 +134,21 @@ export default class AddUser extends Component {
}
}
clearError
()
{
this
.
setState
({
errorFullname
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
isEmail
(
email
)
{
const
re
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
return
re
.
test
(
String
(
email
).
toLowerCase
());
...
...
@@ -272,47 +287,51 @@ export default class AddUser extends Component {
padding
=
20
}
return
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
data
.
children
.
length
<
1
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
div
>
{
item
.
children
.
length
>
0
&&
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
data
.
children
.
length
<
1
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span
>
}
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/
>
}
<
/span
>
}
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/
>
}
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
)}
<
/div
>
)
}
...
...
@@ -498,7 +517,7 @@ export default class AddUser extends Component {
<
Autocomplete
{...
this
.
state
.
listRole
}
id
=
"role"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
}
,
()
=>
this
.
clearError
()
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
...
...
@@ -662,8 +681,8 @@ export default class AddUser extends Component {
<
/div
>
<
/div
>
<
div
style
=
{{
flexDirection
:
'column'
,
display
:
'flex'
,
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Dibuat
:
${
format
(
this
.
state
.
date
,
'dd MMMM yyyy'
,
{
locale
:
localeID
})}
`
}
<
/Typography
>
{
/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === null? '' : this.state.tempData.updated}`}</Typography> */
}
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Dibuat
:
`
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Diubah: `
}
<
/Typography
>
<
/div
>
<
Divider
style
=
{{
margin
:
20
}}
/
>
<
div
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
...
...
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/User/EditUser.js
View file @
f6c27c4e
...
...
@@ -121,6 +121,21 @@ export default class EditUser extends Component {
}
}
clearError
()
{
this
.
setState
({
errorFullname
:
false
,
errorEmail
:
false
,
errorRoleName
:
false
,
errorStartDate
:
false
,
errorEndDate
:
false
,
msgErrorFN
:
''
,
msgErrorEM
:
''
,
msgErrorRN
:
''
,
msgErrorSD
:
''
,
msgErrorED
:
''
,
})
}
getDetailUser
()
{
api
.
create
().
getDetailUser
(
this
.
state
.
paramsId
).
then
((
response
)
=>
{
this
.
getRole
()
...
...
@@ -274,47 +289,51 @@ export default class EditUser extends Component {
padding
=
20
}
return
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
data
.
children
.
length
<
1
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
div
>
{
item
.
children
.
length
>
0
&&
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
data
.
children
.
length
<
1
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span
>
}
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/
>
}
<
/span
>
}
<
span
>
{
this
.
state
.
role
?
this
.
state
.
role
.
role_id
===
1
?
<
CustomCheckboxDisabled
disabled
=
{
true
}
checked
=
{
true
}
// onChange={() => this.handleItemClick(item)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/>
:
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
this
.
handleItemClick
(
data
)}
/
>
}
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
)}
<
/div
>
)
}
...
...
@@ -497,7 +516,7 @@ export default class EditUser extends Component {
<
Autocomplete
{...
this
.
state
.
listRole
}
id
=
"role"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
})}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
role
:
newInputValue
}
,
()
=>
this
.
clearError
()
)}
debug
renderInput
=
{(
params
)
=>
<
TextField
...
...
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/UserRole/AddRole.js
View file @
f6c27c4e
...
...
@@ -116,7 +116,7 @@ export default class AddRole extends Component {
}
else
if
(
R
.
isNil
(
this
.
state
.
endDate
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
else
if
(
this
.
state
.
privileges
.
length
<
1
)
{
alert
(
'Hak Akses belum di pilih !!'
)
this
.
setState
({
alert
:
true
,
messageAlert
:
'Hak Akses belum di pilih !!'
,
tipeAlert
:
'warning'
}
)
}
else
{
this
.
addRole
()
}
...
...
@@ -468,8 +468,8 @@ export default class AddRole extends Component {
<
/div
>
<
/div
>
<
div
style
=
{{
flexDirection
:
'column'
,
display
:
'flex'
,
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Dibuat
:
${
format
(
this
.
state
.
date
,
'dd MMMM yyyy'
,
{
locale
:
localeID
})}
`
}
<
/Typography
>
{
/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === null? '' : this.state.tempData.updated}`}</Typography> */
}
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Dibuat
:
`
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
`Diubah: `
}
<
/Typography
>
<
/div
>
<
Divider
style
=
{{
margin
:
20
}}
/
>
<
div
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
}}
>
...
...
This diff is collapsed.
Click to expand it.
src/container/Otorisasi/UserRole/EditRole.js
View file @
f6c27c4e
...
...
@@ -122,7 +122,7 @@ export default class EditRole extends Component {
}
else
if
(
R
.
isNil
(
this
.
state
.
tempData
.
end_date
))
{
this
.
setState
({
errorEndDate
:
true
,
msgErrorED
:
'End Date tidak boleh kosong'
})
}
else
if
(
this
.
state
.
privileges
.
length
<
1
)
{
alert
(
'Hak Akses belum di pilih !!'
)
this
.
setState
({
alert
:
true
,
messageAlert
:
'Hak Akses belum di pilih !!'
,
tipeAlert
:
'warning'
}
)
}
else
{
this
.
updateRole
()
}
...
...
This diff is collapsed.
Click to expand it.
src/container/Profile.js
View file @
f6c27c4e
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
AppBar
,
Tabs
,
Tab
,
TextField
,
Collapse
,
withStyles
,
Checkbox
,
InputAdornment
,
IconButton
}
from
'@material-ui/core'
;
import
{
Typography
,
AppBar
,
Tabs
,
Tab
,
TextField
,
Snackbar
,
Collapse
,
withStyles
,
Checkbox
,
InputAdornment
,
IconButton
}
from
'@material-ui/core'
;
import
Visibility
from
'@material-ui/icons/Visibility'
;
import
VisibilityOff
from
'@material-ui/icons/VisibilityOff'
;
import
HomePage
from
'./HomePage
'
;
import
MuiAlert
from
'@material-ui/lab/Alert
'
;
import
Images
from
'../assets/Images'
;
import
api
from
'../api'
;
import
Constant
from
'../library/Constant'
;
...
...
@@ -22,6 +22,9 @@ const CustomCheckbox = withStyles({
checked
:
{},
})((
props
)
=>
<
Checkbox
color
=
"default"
{...
props
}
/>
)
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
Profile
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -43,7 +46,10 @@ export default class Profile extends Component {
showPass2
:
false
,
showPass3
:
false
,
pictures
:
[],
name
:
""
name
:
""
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
}
this
.
onDrop
=
this
.
onDrop
.
bind
(
this
);
}
...
...
@@ -111,12 +117,22 @@ export default class Profile extends Component {
api
.
create
().
changePassword
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
oldPassword
:
""
,
password
:
""
,
confirmPassword
:
""
})
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
oldPassword
:
""
,
password
:
""
,
confirmPassword
:
""
})
localStorage
.
removeItem
(
Constant
.
TOKEN
)
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
1000
);
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
alert
(
response
.
data
.
message
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
...
...
@@ -136,11 +152,20 @@ export default class Profile extends Component {
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
company
:
response
.
data
.
data
.
company
,
photo
:
response
.
data
.
data
.
photo
,
name
:
response
.
data
.
data
.
fullname
})
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
company
:
response
.
data
.
data
.
company
,
photo
:
response
.
data
.
data
.
photo
,
name
:
response
.
data
.
data
.
fullname
})
console
.
log
(
response
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
...
...
@@ -148,10 +173,18 @@ export default class Profile extends Component {
api
.
create
().
getPerusahaanHierarki
().
then
((
response
)
=>
{
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
listCompany
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
listCompany
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
...
...
@@ -169,36 +202,40 @@ export default class Profile extends Component {
padding
=
20
}
return
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
data
.
children
.
length
<
1
?
<
div
>
{
item
.
children
.
length
>
0
&&
(
<
ul
>
{
item
.
children
.
map
((
data
,
index
)
=>
{
return
(
// <li>
<
Collapse
key
=
{
index
}
timeout
=
"auto"
unmountOnExit
in
=
{
item
.
collapse
}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-start'
,
paddingLeft
:
R
.
isNil
(
data
.
children
)
?
(
padding
+
20
)
:
padding
}}
>
{
R
.
isNil
(
data
.
children
)
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span
>
}
<
span
>
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
null
}
/
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
data
.
children
.
length
<
1
?
null
:
<
span
onClick
=
{()
=>
this
.
handleCollapse
(
data
)}
style
=
{{
marginLeft
:
7
,
marginRight
:
2
}}
>
{
data
.
collapse
?
<
RemoveIcon
color
=
{
'action'
}
fontSize
=
{
'small'
}
/> : <AddIcon color={'action'} fontSize={'small'} /
>
}
<
/span
>
}
<
span
>
<
CustomCheckbox
checked
=
{
this
.
handleItemChecked
(
data
)}
onChange
=
{()
=>
null
}
/
>
<
/span
>
<
Typography
style
=
{{
fontSize
:
12
}}
>
{
titleCase
(
data
.
company_name
)}
<
/Typography
>
<
/div
>
{
!
R
.
isNil
(
data
.
children
)
&&
this
.
renderChildren
(
data
,
padding
+
20
)}
<
/Collapse
>
// </li>
)
})}
<
/ul
>
)}
<
/div
>
)
}
...
...
@@ -269,20 +306,40 @@ export default class Profile extends Component {
api
.
create
().
uploadFoto
(
formData
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
uploadVisible
:
false
},
()
=>
{
alert
(
response
.
data
.
message
)
this
.
getUser
()
window
.
location
.
reload
()
})
if
(
response
.
ok
){
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
uploadVisible
:
false
},
()
=>
{
this
.
getUser
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
},
()
=>
{
setTimeout
(()
=>
{
window
.
location
.
reload
()
},
1000
);
})
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
,
marginBottom
:
100
,
minHeight
:
1000
}}
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
203
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'flex-end'
,
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
width
:
'100%'
}}
>
<
div
style
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
...
...
This diff is collapsed.
Click to expand it.
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