Commit 84381cfe authored by EKSAD's avatar EKSAD

report items

parent 2cdd4bfe
...@@ -595,13 +595,27 @@ export default class ReportItems extends Component { ...@@ -595,13 +595,27 @@ export default class ReportItems extends Component {
getData() { getData() {
this.setState({ loading: true }) this.setState({ loading: true })
api.create().getReportItems().then((response) => { api.create().getReportItems().then((response) => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.sort((a, b) => a.item_report_id - b.item_report_id).map((item, index) => { 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_item_report_name, item.kpi_type, item.max_ach, item.formula_ytd, item.status] return [
index,
item.item_report_id,
item.report_name,
item.company_name,
item.order,
item.description,
item.parent !== null ? `${item.parent} - ${item.parent_name}` : "" ,
item.uom,
item.weight,
item.type_item_report_name,
item.kpi_type,
item.max_ach,
item.formula_ytd,
item.status]
}) })
this.setState({ dataTable: listData, listData: response.data.data }, () => { this.setState({ dataTable: listData, listData: response.data.data }, () => {
setTimeout(() => { setTimeout(() => {
......
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