Commit a9dbf53e authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'faisal' into 'master'

update kumpeni

See merge request !277
parents 5b5d61a0 a3b1109e
......@@ -143,7 +143,11 @@ export default class CreatePerusahaan extends Component {
options: perusahaanData,
getOptionLabel: (option) => option.company_name,
};
if (this.props.type === 'edit') {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPC: index === -1 ? 'Company has been Inactive' : "", errorPC: index === -1 ? true : false })
} else {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -183,7 +187,11 @@ export default class CreatePerusahaan extends Component {
options: typeData,
getOptionLabel: (option) => option.business_unit_name,
};
if (this.props.type === 'edit') {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index], msgErrorUB: index === -1 ? 'Business Unit has been Inactive' : "", errorUB: index === -1 ? true : false })
} else {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......
......@@ -439,6 +439,33 @@ export default class Perusahaan extends Component {
})
}
updateHierarchy = (payload) => {
this.setState({ visibleVisual: false, visiblePerusahaan: true })
api.create().saveVisualisasiPerusahaan(payload).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
downloadFile = async () => {
let res = await fetch(
"https://tia.eksad.com/tia-reporting-dev/public/attachment/download_file?fileName=CompanyTemplate&&fileType=xlsx"
......@@ -737,9 +764,9 @@ export default class Perusahaan extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })}
>
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })} />
<img src={Images.visualisasi} />
</button>
</a>
<ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" />
......@@ -783,6 +810,7 @@ export default class Perusahaan extends Component {
buttonEdit={this.state.edit}
onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })}
height={this.props.height}
updateHierarchy={this.updateHierarchy.bind(this)}
/>
:
<div>
......
......@@ -100,7 +100,9 @@ export default class VisualPerusahaan extends Component {
let payload = {
"company": this.state.items
}
api.create().saveVisualisasiPerusahaan(payload).then((response) => {
this.props.updateHierarchy(payload)
/* api.create().saveVisualisasiPerusahaan(payload).then((response) => {
// console.log(response.data)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......@@ -129,7 +131,7 @@ export default class VisualPerusahaan extends Component {
// } else {
// alert(response.data.message)
// }
})
}) */
}
renderItem = ({ item, collapseIcon }) => {
......
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