Commit e4f3690e authored by EKSAD's avatar EKSAD

dah ah ngantuk

parent 36983554
...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -45,7 +46,9 @@ export default class ProfitLoss extends Component { ...@@ -45,7 +46,9 @@ export default class ProfitLoss extends Component {
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null,
updateBy: '-' updateBy: '-',
buttonDraft: true,
handleTekTekTek: 0
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -230,7 +233,7 @@ export default class ProfitLoss extends Component { ...@@ -230,7 +233,7 @@ export default class ProfitLoss extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
// console.log(data); console.log(data);
this.setState({ loading: false }) this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
...@@ -555,7 +558,7 @@ export default class ProfitLoss extends Component { ...@@ -555,7 +558,7 @@ export default class ProfitLoss extends Component {
} else if (opt == "kali") { } else if (opt == "kali") {
total = Number(total) * Number(item) total = Number(total) * Number(item)
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = Number(total) / Number(item) total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
} else { } else {
total += item total += item
} }
...@@ -642,7 +645,7 @@ export default class ProfitLoss extends Component { ...@@ -642,7 +645,7 @@ export default class ProfitLoss extends Component {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : {tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
...@@ -668,7 +671,7 @@ export default class ProfitLoss extends Component { ...@@ -668,7 +671,7 @@ export default class ProfitLoss extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[2] : `31 Dec ${Number(this.props.periode) - 1} Actual`, name: this.state.judulColumn !== null ? this.state.judulColumn[3] : `31 Dec ${Number(this.props.periode) - 1} Actual`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -821,7 +824,7 @@ export default class ProfitLoss extends Component { ...@@ -821,7 +824,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -2151,7 +2154,7 @@ export default class ProfitLoss extends Component { ...@@ -2151,7 +2154,7 @@ export default class ProfitLoss extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false}, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
}, 100); }, 100);
...@@ -2172,13 +2175,20 @@ export default class ProfitLoss extends Component { ...@@ -2172,13 +2175,20 @@ export default class ProfitLoss extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.editable === true ? disabled={this.state.buttonDraft}
null : onClick={() =>
this.setState({ loading: true }, () => { this.state.handleTekTekTek == 1? null :
setTimeout(() => { this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('draft') this.backToMasterBudget('draft')
}, 100); })
})} }
// onClick={() => this.state.editable === true ?
// null :
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.backToMasterBudget('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>
...@@ -2187,17 +2197,24 @@ export default class ProfitLoss extends Component { ...@@ -2187,17 +2197,24 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => { // onClick={() => {
this.state.buttonError ? // this.state.buttonError ?
this.setState({ loading: true }, () => { // this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) // this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100); // }, 100);
}) // })
: this.setState({ loading: true }, () => { // : this.setState({ loading: true }, () => {
this.backToMasterBudget('submitted') // this.backToMasterBudget('submitted')
}) // })
}} // }}
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.backToMasterBudget('submitted')
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
...@@ -2279,12 +2296,22 @@ export default class ProfitLoss extends Component { ...@@ -2279,12 +2296,22 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadProfitLoss('draft') // this.uploadProfitLoss('draft')
}, 100); // }, 100);
})} // })}
style={{ marginRight: 20 }} onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadProfitLoss("draft")
}, 100);
})
)}
style={{
marginRight: 20
}}
> >
<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>
...@@ -2293,11 +2320,19 @@ export default class ProfitLoss extends Component { ...@@ -2293,11 +2320,19 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadProfitLoss('submitted') // this.uploadProfitLoss('submitted')
}, 100); // }, 100);
})} // })}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
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