Commit e9162c5d authored by rifkaki's avatar rifkaki

delete master data cat

parent cc3294c7
...@@ -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 deleteMasterDataCat = (idCompany, years) => api.post(`item_report_company/delete_item_report_company/${idCompany}/${years}`)
//Transaction //Transaction
const getReportTypeBody = (body) => api.post('transaction/master_budget/get_all_report', body) const getReportTypeBody = (body) => api.post('transaction/master_budget/get_all_report', body)
...@@ -691,7 +692,8 @@ const create = (type = "") => { ...@@ -691,7 +692,8 @@ const create = (type = "") => {
getRollingOutlookBS, getRollingOutlookBS,
getAllMasterDataCat, getAllMasterDataCat,
getParentItemReport, getParentItemReport,
saveMasterDataCat saveMasterDataCat,
deleteMasterDataCat
} }
} }
......
...@@ -609,7 +609,9 @@ export default class MasterDataCAT extends Component { ...@@ -609,7 +609,9 @@ export default class MasterDataCAT extends Component {
item.report_name, item.report_name,
item.weight, item.weight,
item.years, item.years,
item.status] item.status,
item.item_report_company_id
]
}) })
this.setState({ dataTable: listData, listData: response.data.data }, () => { this.setState({ dataTable: listData, listData: response.data.data }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -637,9 +639,11 @@ export default class MasterDataCAT extends Component { ...@@ -637,9 +639,11 @@ export default class MasterDataCAT extends Component {
} }
deleteReport(payload) { deleteReport(payload) {
// console.log(payload); console.log(payload);
let id = String(payload[1]) let idCompany = payload[8]
api.create().deleteReportItems(id).then(response => { let years = payload[6]
api.create().deleteMasterDataCat(idCompany, years).then(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") {
...@@ -673,7 +677,7 @@ export default class MasterDataCAT extends Component { ...@@ -673,7 +677,7 @@ export default class MasterDataCAT extends Component {
} else if (type === 'delete') { } else if (type === 'delete') {
this.setState({ this.setState({
rowData: index, rowData: index,
reportNameDelete: "[" + String(index[2]) + " - " + String(index[3]) + " - " + String(index[5]) + "]", reportNameDelete: "[" + String(index[3]) + " - " + String(index[6]) + "] ",
visibleDelete: true visibleDelete: true
}) })
} else { } else {
...@@ -968,6 +972,12 @@ export default class MasterDataCAT extends Component { ...@@ -968,6 +972,12 @@ export default class MasterDataCAT extends Component {
); );
} }
} }
},
{
name: "company id",
options: {
display: false
}
} }
] ]
const data = [ const data = [
...@@ -1013,7 +1023,7 @@ export default class MasterDataCAT extends Component { ...@@ -1013,7 +1023,7 @@ export default class MasterDataCAT extends Component {
/> />
</div> */} </div> */}
<div style={{ width: '50%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '50%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> {/* <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1026,8 +1036,8 @@ export default class MasterDataCAT extends Component { ...@@ -1026,8 +1036,8 @@ export default class MasterDataCAT extends Component {
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> */}
{this.state.buttonCreate && ( {/* {this.state.buttonCreate && (
<a data-tip={'Upload'} data-for="upload"> <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
...@@ -1042,7 +1052,7 @@ export default class MasterDataCAT extends Component { ...@@ -1042,7 +1052,7 @@ export default class MasterDataCAT extends Component {
</button> </button>
</a> </a>
)} )}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> */}
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
...@@ -1057,7 +1067,7 @@ export default class MasterDataCAT extends Component { ...@@ -1057,7 +1067,7 @@ export default class MasterDataCAT extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualization'} data-for="visualisasi"> {/* <a data-tip={'Visualization'} data-for="visualisasi">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1070,7 +1080,7 @@ export default class MasterDataCAT extends Component { ...@@ -1070,7 +1080,7 @@ export default class MasterDataCAT extends Component {
<img src={Images.visualisasi} /> <img src={Images.visualisasi} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" /> */}
{this.state.buttonCreate && ( {this.state.buttonCreate && (
<a data-tip={'Add New'} data-for="tambah"> <a data-tip={'Add New'} data-for="tambah">
<button <button
......
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