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
0a3222dc
Commit
0a3222dc
authored
Aug 20, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-dev(pc)' into 'master'
toast AM See merge request
!138
parents
430da4df
217cae5a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
182 additions
and
132 deletions
+182
-132
ApprovalMatrix.js
src/container/ApprovalMatrix/ApprovalMatrix.js
+134
-96
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+47
-34
Parameter.js
src/container/MasterData/Parameter/Parameter.js
+1
-2
No files found.
src/container/ApprovalMatrix/ApprovalMatrix.js
View file @
0a3222dc
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'
)
{
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
]
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
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
...
...
@@ -299,6 +304,7 @@ export default class ApprovalMatrix extends Component {
}
api
.
create
().
searchAM
(
body
).
then
(
response
=>
{
// console.log(response.data);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
...
...
@@ -306,7 +312,10 @@ export default class ApprovalMatrix extends Component {
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
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
)
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
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
)
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
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
)
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
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
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
// console.log(this.state.payload)
this
.
getData
()
this
.
setState
({
visibleAM
:
true
})
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"
,
...
...
@@ -494,7 +527,12 @@ 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%'
}}
/
>
<
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
>
...
...
@@ -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
>
...
...
@@ -591,7 +629,7 @@ export default class ApprovalMatrix extends Component {
this
.
state
.
visibleVisual
==
true
?
<
VisualisasiAM
onClickClose
=
{()
=>
this
.
setState
({
visibleVisual
:
false
,
visibleAM
:
true
})}
height
=
{
this
.
props
.
height
}
height
=
{
this
.
props
.
height
}
updateVAM
=
{
this
.
updateVAM
.
bind
(
this
)}
/
>
:
...
...
@@ -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
>
...
...
src/container/MasterData/Parameter/CreateParameter.js
View file @
0a3222dc
...
...
@@ -328,10 +328,10 @@ 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)) {
...
...
@@ -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
}
...
...
@@ -625,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
>
...
...
@@ -635,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
>
...
...
@@ -801,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
}
...
...
@@ -951,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
}
...
...
@@ -969,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
}
...
...
src/container/MasterData/Parameter/Parameter.js
View file @
0a3222dc
...
...
@@ -522,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'
})
}
...
...
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