Commit a4df4555 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

editMasterDataCat

See merge request !1212
parents 3c6dfd0e 1da99a2c
...@@ -189,6 +189,7 @@ const create = (type = "") => { ...@@ -189,6 +189,7 @@ const create = (type = "") => {
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company') 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 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) const saveMasterDataCat = (body) => api.post('item_report_company/create_item_report_company', body)
// const getDetailMasterDataCat = (id) => api.get(`item_report_company/create_item_report_company/${id}`)
const deleteMasterDataCat = (idCompany, years) => api.post(`item_report_company/delete_item_report_company/${idCompany}/${years}`) const deleteMasterDataCat = (idCompany, years) => api.post(`item_report_company/delete_item_report_company/${idCompany}/${years}`)
//Transaction //Transaction
...@@ -693,6 +694,7 @@ const create = (type = "") => { ...@@ -693,6 +694,7 @@ const create = (type = "") => {
getAllMasterDataCat, getAllMasterDataCat,
getParentItemReport, getParentItemReport,
saveMasterDataCat, saveMasterDataCat,
// getDetailMasterDataCat,
deleteMasterDataCat deleteMasterDataCat
} }
} }
......
...@@ -781,32 +781,32 @@ export default class MasterDataCAT extends Component { ...@@ -781,32 +781,32 @@ export default class MasterDataCAT extends Component {
} }
} }
updateReportItems = (payload) => { // updateReportItems = (payload) => {
this.setState({ edit: false }) // this.setState({ edit: false })
api.create().updateReportItems(payload).then(response => { // api.create().updateReportItems(payload).then(response => {
if (response.data) { // if (response.data) {
if (response.ok) { // if (response.ok) {
if (response.data.status == 'success') { // if (response.data.status == 'success') {
this.getData() // this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) // this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { // } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { // this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { // if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { // setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) // localStorage.removeItem(Constant.TOKEN)
window.location.reload(); // window.location.reload();
}, 1000); // }, 1000);
} // }
}) // })
} // }
} else { // } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) // this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} // }
} else { // } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) // this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} // }
}) // })
} // }
uploadReportItems() { uploadReportItems() {
api.create().uploadReportItems(this.state.payload).then(response => { api.create().uploadReportItems(this.state.payload).then(response => {
...@@ -1175,7 +1175,7 @@ export default class MasterDataCAT extends Component { ...@@ -1175,7 +1175,7 @@ export default class MasterDataCAT extends Component {
onClickClose={() => this.setState({ edit: false })} onClickClose={() => this.setState({ edit: false })}
data={this.state.rowData} data={this.state.rowData}
refresh={this.getData.bind(this)} refresh={this.getData.bind(this)}
updateReportItems={this.updateReportItems.bind(this)} updateReportItems={this.createReportItems.bind(this)}
/> />
)} )}
{this.state.popupError && ( {this.state.popupError && (
......
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