Commit 1af5e764 authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents fb0d0178 e8785c76
......@@ -71,11 +71,11 @@ export default class Perusahaan extends Component {
if (item.length > 0) {
payload.push({
"id": index + 1,
"company_name": item[0],
"company_parent": item[1] === undefined ? null : item[1],
"unit_bisnis": item[2],
"startDate": item[3],
"endDate": item[4],
"company_name": item[0] === undefined ? "" : item[0],
"company_parent": item[1] === undefined ? "" : item[1],
"unit_bisnis": item[2] === undefined ? "" : item[2],
"startDate": item[3] === undefined ? "" : item[3],
"endDate": item[4] === undefined ? "" :item[4],
})
}
})
......@@ -111,16 +111,16 @@ export default class Perusahaan extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_name'))
if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[5].findIndex((val) => val.field.includes('company_name'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_name">
{tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[5][check].message} data-for="company_name">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -136,16 +136,16 @@ export default class Perusahaan extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_parent'))
if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[5].findIndex((val) => val.field.includes('company_parent'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_parent">
{tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[5][check].message} data-for="company_parent">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -161,16 +161,16 @@ export default class Perusahaan extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('unit_bisnis'))
if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[5].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="unit_bisnis">
{tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[5][check].message} data-for="unit_bisnis">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -186,16 +186,16 @@ export default class Perusahaan extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[5].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate">
{tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[5][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -211,16 +211,16 @@ export default class Perusahaan extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[5].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate">
{tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[5][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -239,7 +239,7 @@ export default class Perusahaan extends Component {
}
]
// console.log(dataRow);
console.log(dataRow);
this.setState({
dataLoaded: true,
cols: columns,
......@@ -525,40 +525,49 @@ export default class Perusahaan extends Component {
sort: false,
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{this.state.edit && (
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<div style={{ display: 'flex' }}>
{!tableMeta.rowData[2].includes("TIA") ?
<img src={Images.editCopy} /> :
null
}
</div >
</button>
)}
{this.state.edit && (
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 10
}}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
>
<img src={Images.delete} />
</button>
)}
</div >
this.state.edit && (
<div style={{ display: 'flex' }}>
<a data-tip={'Edit'} data-for="edit">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<div style={{ display: 'flex' }}>
{!tableMeta.rowData[2].includes("TIA") ?
<img src={Images.editCopy} /> :
null
}
</div >
</button>
</a>
<ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
<a data-tip={'Delete'} data-for="delete">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 10
}}
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
>
<div style={{ display: 'flex' }}>
{!tableMeta.rowData[2].includes("TIA") ?
<img src={Images.delete} /> :
null
}
</div >
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</div>
)
);
}
}
......
......@@ -107,6 +107,7 @@ export default class VisualPerusahaan extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => {
setTimeout(() => {
this.props.onClickClose()
window.location.reload();
}, 1000);
})
} else {
......
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