Commit 851b6cfb authored by rifkaki's avatar rifkaki

create & list master data cat

parent 6d12fce3
......@@ -186,7 +186,9 @@ const create = (type = "") => {
const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`)
// MASTER DATA - CAT
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company')
const getParentItemReport = (body) => api.post('item_report/get_parent_item_report_default', body)
const saveMasterDataCat = (body) => api.post('item_report_company/create_item_report_company', body)
//Transaction
const getReportTypeBody = (body) => api.post('transaction/master_budget/get_all_report', body)
......@@ -687,7 +689,9 @@ const create = (type = "") => {
getHierarkiCronJobMRRatio,
getRollingOutlookID,
getRollingOutlookBS,
getParentItemReport
getAllMasterDataCat,
getParentItemReport,
saveMasterDataCat
}
}
......
......@@ -594,8 +594,8 @@ export default class MasterDataCAT extends Component {
getData() {
this.setState({ loading: true })
api.create().getReportItems().then((response) => {
// console.log(response)
api.create().getAllMasterDataCat().then((response) => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......@@ -604,17 +604,11 @@ export default class MasterDataCAT extends Component {
return [
index,
item.item_report_id,
item.report_name,
item.report_name,
item.company_name,
item.order,
item.description,
item.parent !== null ? `${item.parent} - ${item.parent_name}` : "" ,
item.uom,
item.report_name,
item.weight,
item.type_item_report_name,
item.kpi_type,
item.max_ach,
item.formula_ytd,
item.years,
item.status]
})
this.setState({ dataTable: listData, listData: response.data.data }, () => {
......@@ -622,6 +616,7 @@ export default class MasterDataCAT extends Component {
this.setState({ loading: false })
}, 2000);
})
console.log(this.state.dataTable)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -724,7 +719,7 @@ export default class MasterDataCAT extends Component {
createReportItems = (payload) => {
this.setState({ add: false })
api.create().createReportItems(payload).then(response => {
api.create().saveMasterDataCat(payload).then(response => {
// console.log(response);
if (response.data) {
if (response.ok) {
......@@ -896,7 +891,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -908,7 +903,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -920,7 +915,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -932,7 +927,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -944,7 +939,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -956,7 +951,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......@@ -968,7 +963,7 @@ export default class MasterDataCAT extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[13] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
<span style={{ color: tableMeta.rowData[7] === "Active" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
......
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