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
61b32313
Commit
61b32313
authored
Sep 02, 2020
by
EKSAD
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solve issue report item
parent
0f26e4a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
348 additions
and
344 deletions
+348
-344
ReportItems.js
src/container/MasterData/ReportItems.js
+348
-344
No files found.
src/container/MasterData/ReportItems.js
View file @
61b32313
...
@@ -53,6 +53,7 @@ export default class ReportItems extends Component {
...
@@ -53,6 +53,7 @@ export default class ReportItems 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
);
}
}
...
@@ -82,397 +83,400 @@ export default class ReportItems extends Component {
...
@@ -82,397 +83,400 @@ export default class ReportItems extends Component {
let
body
=
{
let
body
=
{
item_report
:
payload
item_report
:
payload
}
}
// console.log(JSON.stringify(body))
console
.
log
(
resp
.
rows
[
1
])
console
.
log
(
resp
.
rows
[
1
])
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
api
.
create
().
checkUploadReportItems
(
body
).
then
(
response
=>
{
}
console
.
log
(
response
)
});
let
dataRow
=
[]
}
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
checkUpload
(){
if
(
response
.
data
.
status
===
"success"
)
{
api
.
create
().
checkUploadReportItems
(
this
.
state
.
payload
).
then
(
response
=>
{
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
console
.
log
(
response
)
return
[
let
dataRow
=
[]
index
+
1
,
if
(
response
.
data
)
{
item
.
report
,
if
(
response
.
ok
)
{
item
.
company
,
if
(
response
.
data
.
status
===
"success"
)
{
item
.
orders
,
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
item
.
description
,
return
[
item
.
parent
,
index
+
1
,
item
.
uom
,
item
.
report
,
item
.
weight
,
item
.
company
,
item
.
type_report
,
item
.
orders
,
item
.
formula
,
item
.
description
,
item
.
condition_it_should_be
,
item
.
parent
,
item
.
condition_if_wrong
,
item
.
uom
,
item
.
start_date
,
item
.
weight
,
item
.
end_date
,
item
.
type_report
,
item
.
error
item
.
formula
,
]
item
.
condition_it_should_be
,
})
item
.
condition_if_wrong
,
let
columns
=
[
item
.
start_date
,
"Data"
,
item
.
end_date
,
{
item
.
error
name
:
"Report Type"
,
]
options
:
{
})
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
columns
=
[
let
check
=
null
"Data"
,
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'report'
))
name
:
"Report Type"
,
if
(
check
>
-
1
)
{
options
:
{
this
.
setState
({
buttonError
:
true
})
customBodyRender
:
(
val
,
tableMeta
)
=>
{
}
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'report'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"reportname"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"reportname"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Company Name"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"reportname"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"reportname"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Company Name"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"companyname"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"companyname"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Order"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"companyname"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'orders'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"companyname"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Order"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'orders'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"order"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"order"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Description"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"order"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"order"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Description"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"desc"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"desc"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Parent ID"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"desc"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parent'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"desc"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Parent ID"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parent'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"parents"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"parents"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"UOM"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"parents"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'uom'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"parents"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"UOM"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'uom'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"uoms"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"uoms"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Weight"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"uoms"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'weight'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"uoms"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Weight"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'weight'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"weights"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"weights"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Data Type"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"weights"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'type_report'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"weights"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Data Type"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'type_report'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"datatype"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"datatype"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Formula"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"datatype"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'formula'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"datatype"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Formula"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'formula'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"formulas"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"formulas"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"True Value"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"formulas"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_it_should_be'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"formulas"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"True Value"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_it_should_be'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"values"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"values"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"False Condition"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"values"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_if_wrong'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"values"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"False Condition"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'condition_if_wrong'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"conditions"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"conditions"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Valid From"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"conditions"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"conditions"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Valid From"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"startdate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
"Valid To"
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"startdate"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
/a>
:
let
check
=
null
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
},
{
name
:
"Valid To"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
check
=
null
if
(
tableMeta
.
rowData
[
14
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
14
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"enddate"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
return
(
},
<
div
style
=
{{
display
:
'flex'
}}
>
{
{
tableMeta
.
rowData
[
14
]
!=
null
&&
check
>
-
1
?
name
:
""
,
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
14
][
check
].
message
}
data
-
for
=
"enddate"
>
options
:
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
display
:
false
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
}
]
},
{
console
.
log
(
dataRow
);
name
:
""
,
this
.
setState
({
options
:
{
dataLoaded
:
true
,
display
:
false
cols
:
columns
,
rows
:
dataRow
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
}
})
}
}
]
// console.log(dataRow);
this
.
setState
({
dataLoaded
:
true
,
cols
:
columns
,
rows
:
dataRow
,
visibleUpload
:
false
,
itemReport
:
false
});
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
dataLoaded
:
false
,
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
console
.
log
(
response
);
}
else
{
})
this
.
setState
({
dataLoaded
:
false
,
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
});
}
}
})
;
})
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -1057,7 +1061,7 @@ export default class ReportItems extends Component {
...
@@ -1057,7 +1061,7 @@ export default class ReportItems extends Component {
}}
}}
onUpload
=
{()
=>
{
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MASTER DATA - REPORT ITEMS"
?
this
.
state
.
judul
===
"MASTER DATA - REPORT ITEMS"
?
this
.
setState
({
visibleUpload
:
false
,
itemReport
:
false
}
)
:
this
.
checkUpload
(
)
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
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