Commit 6903d5b6 authored by EKSAD's avatar EKSAD

update edit report item

parent e535953b
......@@ -286,6 +286,7 @@ export default class EditReportItems extends Component {
getParent() {
if (this.state.reportType !== null && this.state.company !== null) {
console.log(this.state.tempData.item_report_id)
let payload = {
"report_id": this.state.reportType.report_id,
"company_id": this.state.company.company_id
......@@ -295,12 +296,21 @@ export default class EditReportItems extends Component {
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 currentIndex = null
let parentData = data.map((item, index) => {
if (this.state.tempData.item_report_id !== item.item_report_id) {
return {
item_report_id: item.item_report_id,
description: item.description
}
} else {
currentIndex = index
}
})
if (currentIndex !== null) {
parentData.splice(currentIndex, 1)
}
console.log(parentData)
let defaultProps = {
options: parentData,
getOptionLabel: (option) => titleCase(option.description),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment