Commit 29d09dcd authored by EKSAD's avatar EKSAD

butto button

parent b0268411
...@@ -339,11 +339,11 @@ export default class ProfitLoss extends Component { ...@@ -339,11 +339,11 @@ export default class ProfitLoss extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[24].length > 0) { if (item[24].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
...@@ -2270,10 +2270,10 @@ export default class ProfitLoss extends Component { ...@@ -2270,10 +2270,10 @@ export default class ProfitLoss extends Component {
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
className="button" className="button"
type="button" type="button"
// disabled={this.state.buttonError} disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
...@@ -2284,7 +2284,7 @@ export default class ProfitLoss extends Component { ...@@ -2284,7 +2284,7 @@ export default class ProfitLoss extends Component {
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false }) this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 100); }, 100);
}) })
}} }}
...@@ -2295,23 +2295,23 @@ export default class ProfitLoss extends Component { ...@@ -2295,23 +2295,23 @@ export default class ProfitLoss extends Component {
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.buttonError}
// onClick={() => this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.uploadProfitLoss('draft')
// }, 100);
// })}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadProfitLoss("draft")
}, 100);
})
)}
style={{ style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadProfitLoss('draft')
}, 100);
})
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
...@@ -2319,20 +2319,22 @@ export default class ProfitLoss extends Component { ...@@ -2319,20 +2319,22 @@ export default class ProfitLoss extends Component {
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.buttonError} style={{
// onClick={() => this.setState({ loading: true }, () => { backgroundColor: 'transparent',
// setTimeout(() => { cursor: this.state.editable !== true ? 'pointer' : 'default',
// this.uploadProfitLoss('submitted') borderColor: 'transparent',
// }, 100); outline: 'none',
// })} }}
onClick={() => this.setState({ loading: true }, () => onClick={() =>
this.state.handleTekTekTek == 1? null : this.state.editable === true ?
this.setState({handleTekTekTek: 1}, () => { null :
setTimeout(() => { this.state.handleTekTekTek == 1 ? null :
this.uploadProfitLoss("submitted") this.setState({ handleTekTekTek: 1 }, () => {
}, 100); setTimeout(() => {
}) this.uploadProfitLoss('submitted')
)} }, 100);
})
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
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