Commit b1a25c48 authored by d.arizona's avatar d.arizona

update

parent 2dcba2e2
...@@ -68,9 +68,12 @@ export default class BudgetTahunan extends Component { ...@@ -68,9 +68,12 @@ export default class BudgetTahunan extends Component {
maxDateRevision: new Date(), maxDateRevision: new Date(),
btnApprove: false btnApprove: false
} }
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
scrollToMyRef = () => window.scrollTo(0, this.myRef.current.offsetTop)
componentDidMount() { componentDidMount() {
this.setState({ loading: true }) this.setState({ loading: true })
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
...@@ -422,6 +425,7 @@ export default class BudgetTahunan extends Component { ...@@ -422,6 +425,7 @@ export default class BudgetTahunan extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.scrollToMyRef()
this.setState({ loading: true }) this.setState({ loading: true })
let body = { let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id, "approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
...@@ -671,6 +675,10 @@ export default class BudgetTahunan extends Component { ...@@ -671,6 +675,10 @@ export default class BudgetTahunan extends Component {
} }
render() { render() {
const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
return handleDate < 0? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
}
const columns = ["#", "Report Type", const columns = ["#", "Report Type",
{ {
name: "Revision", name: "Revision",
...@@ -892,7 +900,7 @@ export default class BudgetTahunan extends Component { ...@@ -892,7 +900,7 @@ export default class BudgetTahunan extends Component {
</div> </div>
); );
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert} {this.state.messageAlert}
...@@ -1360,7 +1368,7 @@ export default class BudgetTahunan extends Component { ...@@ -1360,7 +1368,7 @@ export default class BudgetTahunan extends Component {
id="startDate" id="startDate"
label="Valid From" label="Valid From"
format="dd-MM-yyyy" format="dd-MM-yyyy"
onChange={(e) => this.setState({minDateRevision: moment(e).format('YYYY/MM/DD')})} onChange={(e) => this.setState({minDateRevision: moment(e).format('YYYY/MM/DD')}, () => this.setState({maxDateRevision: handleMaxDate()}))}
value={moment(this.state.minDateRevision).format('YYYY/MM/DD')} value={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
......
...@@ -264,10 +264,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -264,10 +264,11 @@ export default class CorporateAnnualTarget extends Component {
nilaiTotal = i[6] == 'SUM'? total : i[6] == 'AVG'? total/12 : lastValz nilaiTotal = i[6] == 'SUM'? total : i[6] == 'AVG'? total/12 : lastValz
} }
console.log(nilaiTotal) console.log(nilaiTotal)
// console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2]*100) +'%'), weight: i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%',
uom: i[3] === undefined ? "" : String(i[3]).trim(), uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(), kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5]*100) + '%') : String(i[5]).trim(), max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5]*100) + '%') : String(i[5]).trim(),
......
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