Commit c7d908bf authored by r.kurnia's avatar r.kurnia

belum ada handle control should be nil di upload BS OLPA

parent f6fa444c
...@@ -560,6 +560,7 @@ export default class BalanceSheetOLPA extends Component { ...@@ -560,6 +560,7 @@ export default class BalanceSheetOLPA extends Component {
dataTable.map((i, index) => { dataTable.map((i, index) => {
if (String(i[5]) == "Control (should be nil)") { if (String(i[5]) == "Control (should be nil)") {
if (Number(i[17].value) < this.state.minValue || Number(i[17].value) > this.state.maxValue) { if (Number(i[17].value) < this.state.minValue || Number(i[17].value) > this.state.maxValue) {
console.log("masuk selisih control")
err = true err = true
} else if (Number(i[18].value) < this.state.minValue || Number(i[18].value) > this.state.maxValue) { } else if (Number(i[18].value) < this.state.minValue || Number(i[18].value) > this.state.maxValue) {
err = true err = true
...@@ -2045,7 +2046,8 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2045,7 +2046,8 @@ export default class BalanceSheetOLPA extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div> </div>
</button>} </button>}
{this.state.get_for == 'edit' && <button {this.state.get_for == 'edit' &&
<button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.state.buttonError ? onClick={() => this.state.buttonError ?
...@@ -2110,21 +2112,20 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2110,21 +2112,20 @@ export default class BalanceSheetOLPA 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 {this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false }) this.handleValidate()
}, 100); }, 100);
}) })
}} }}
...@@ -2132,8 +2133,9 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2132,8 +2133,9 @@ export default class BalanceSheetOLPA extends Component {
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>}
<button {this.state.get_for == 'edit' && <button
className="button"
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2143,47 +2145,41 @@ export default class BalanceSheetOLPA extends Component { ...@@ -2143,47 +2145,41 @@ export default class BalanceSheetOLPA extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.saveDraft ?
null : this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
this.setState({ loading: true }, () => :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { this.uploadBalanceSheet('draft')
this.uploadBalanceSheet('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>
</div> </div>
</button> </button>}
{this.state.get_for == 'edit' &&
<button <button
type="button" type="button"
// disabled={this.state.buttonError}
onClick={() => this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('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>
</div> </div>
</button> </button>}
</div> </div>
</div> </div>
</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