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
d2afc224
Commit
d2afc224
authored
Sep 02, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apprv matrix
parent
32966a92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
204 additions
and
189 deletions
+204
-189
ApprovalMatrix.js
src/container/ApprovalMatrix/ApprovalMatrix.js
+204
-189
No files found.
src/container/ApprovalMatrix/ApprovalMatrix.js
View file @
d2afc224
...
@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component {
btncreate
:
false
,
btncreate
:
false
,
btnedit
:
false
,
btnedit
:
false
,
load
:
false
,
load
:
false
,
judul
:
''
,
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -52,11 +53,11 @@ export default class ApprovalMatrix extends Component {
...
@@ -52,11 +53,11 @@ export default class ApprovalMatrix extends Component {
fileHandler
=
(
event
)
=>
{
fileHandler
=
(
event
)
=>
{
let
fileObj
=
event
let
fileObj
=
event
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
// console.log(resp)
if
(
err
)
{
if
(
err
)
{
//
console.log(err);
console
.
log
(
err
);
}
}
else
{
else
{
let
judul
=
resp
.
rows
[
2
]
let
isi
=
resp
.
rows
.
slice
(
3
)
let
isi
=
resp
.
rows
.
slice
(
3
)
let
payload
=
[]
let
payload
=
[]
isi
.
map
((
item
,
index
)
=>
{
isi
.
map
((
item
,
index
)
=>
{
...
@@ -75,11 +76,17 @@ export default class ApprovalMatrix extends Component {
...
@@ -75,11 +76,17 @@ export default class ApprovalMatrix extends Component {
let
body
=
{
let
body
=
{
approval_matrix
:
payload
approval_matrix
:
payload
}
}
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
console
.
log
(
resp
.
rows
[
1
])
api
.
create
().
checkUploadAM
(
body
).
then
(
response
=>
{
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
// console.log(response.data)
}
});
}
checkUpload
(){
api
.
create
().
checkUploadAM
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
)
let
dataRow
=
[]
let
dataRow
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
...
@@ -110,12 +117,12 @@ export default class ApprovalMatrix extends Component {
...
@@ -110,12 +117,12 @@ export default class ApprovalMatrix extends Component {
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
7
]
!=
null
&&
check
>
-
1
?
{
tableMeta
.
rowData
[
7
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
7
][
check
].
message
}
data
-
for
=
"typenam
e"
>
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
7
][
check
].
message
}
data
-
for
=
"approvaltyp
e"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"typenam
e"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
ReactTooltip
border
=
{
true
}
id
=
"approvaltyp
e"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
<
/div
>
);
);
}
}
...
@@ -258,7 +265,8 @@ export default class ApprovalMatrix extends Component {
...
@@ -258,7 +265,8 @@ export default class ApprovalMatrix extends Component {
this
.
setState
({
this
.
setState
({
dataLoaded
:
true
,
dataLoaded
:
true
,
cols
:
columns
,
cols
:
columns
,
rows
:
dataRow
rows
:
dataRow
,
visibleUpload
:
false
,
visibleAM
:
false
});
});
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
@@ -281,8 +289,6 @@ export default class ApprovalMatrix extends Component {
...
@@ -281,8 +289,6 @@ export default class ApprovalMatrix extends Component {
}
}
})
})
}
}
});
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getData
()
this
.
getData
()
...
@@ -537,6 +543,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -537,6 +543,7 @@ export default class ApprovalMatrix extends Component {
const
columns
=
[{
const
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
options
:
{
options
:
{
sort
:
false
,
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
...
@@ -775,7 +782,7 @@ export default class ApprovalMatrix extends Component {
...
@@ -775,7 +782,7 @@ export default class ApprovalMatrix extends Component {
theme
=
{
getMuiTheme
()}
theme
=
{
getMuiTheme
()}
data
=
{
this
.
state
.
rows
}
data
=
{
this
.
state
.
rows
}
columns
=
{
this
.
state
.
cols
}
columns
=
{
this
.
state
.
cols
}
options
=
{
options
}
options
=
{
options
2
}
/
>
/
>
<
/MuiThemeProvider
>
<
/MuiThemeProvider
>
)}
)}
...
@@ -792,7 +799,10 @@ export default class ApprovalMatrix extends Component {
...
@@ -792,7 +799,10 @@ export default class ApprovalMatrix extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadAM
()}
// disabled={this.state.buttonError == true ? { buttonError: true, cursor: 'none' } : false}
disabled
=
{
this
.
state
.
buttonError
==
true
?
true
:
false
}
// onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadAM()}
onClick
=
{()
=>
this
.
uploadAM
()}
style
=
{{}}
style
=
{{}}
>
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
@@ -851,7 +861,12 @@ export default class ApprovalMatrix extends Component {
...
@@ -851,7 +861,12 @@ export default class ApprovalMatrix extends Component {
this
.
fileHandler
(
dt
)
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
}}
onUpload
=
{()
=>
this
.
setState
({
visibleUpload
:
false
,
visibleAM
:
false
})}
// onUpload={() => this.setState({ visibleUpload: false, visibleAM: false })}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"APPROVAL MATRIX"
?
this
.
checkUpload
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment