Commit 4f280285 authored by a.bairuha's avatar a.bairuha

update issue

parent 00211b29
......@@ -53,12 +53,12 @@ export default class CreatePerusahaan extends Component {
}
componentDidMount() {
this.getCompanyActive()
this.getAllUnitBisnis()
if(this.props.type === 'edit') {
this.getDetailPerusahaan()
// console.log(this.props.data);
} else {
this.getCompanyActive()
this.getAllUnitBisnis()
let date = format(new Date, 'yyyy-MM-dd')
// console.log(date);
this.setState({
......@@ -86,7 +86,12 @@ export default class CreatePerusahaan extends Component {
totalReport: response.data.data.total_report,
created: response.data.data.created,
updated: response.data.data.updated === null ? "" : response.data.data.updated
}, () => this.getAllUnitBisnis(), this.getCompanyActive())
}, () => {
// setTimeout(() => {
this.getAllUnitBisnis()
this.getCompanyActive()
// }, 1000);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
......@@ -107,6 +112,7 @@ export default class CreatePerusahaan extends Component {
}
getCompanyActive() {
console.log(this.state.company)
if (this.state.company !== null) {
console.log(this.state.company)
let payload = {
......@@ -118,12 +124,20 @@ export default class CreatePerusahaan extends Component {
if (response.ok) {
if (response.data.status == 'success') {
let data = response.data.data
let perusahaanData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name
let currentIndex = null
let perusahaanData = data.map((item, index) => {
if (this.state.companyID !== item.company_id) {
return {
company_id: item.company_id,
company_name: item.company_name
}
} else {
currentIndex = index
}
})
if (currentIndex !== null) {
perusahaanData.splice(currentIndex, 1)
}
let index = perusahaanData.sort((a, b) => a.company_id - b.company_id).findIndex((val) => val.company_id == this.state.parentID)
let typeProps = {
options: perusahaanData,
......
......@@ -496,7 +496,12 @@ export default class Perusahaan extends Component {
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.editCopy} />
<div style={{ display: 'flex' }}>
{!tableMeta.rowData[2].includes("TIA") ?
<img src={Images.editCopy} /> :
null
}
</div >
</button>
)}
</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