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

update issue

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