Commit 9ab25df9 authored by d.arizona's avatar d.arizona

apdet

parent 4ad98e6e
......@@ -63,7 +63,14 @@ export default class RollingOutlook extends Component {
latestPeriode: '',
minDateRevision: new Date(),
maxDateRevision: new Date(),
btnApprove: false
btnApprove: false,
quarterList: [
{value: 'q1', name: 'Q1'},
{value: 'q2', name: 'Q2'},
{value: 'q3', name: 'Q3'},
{value: 'ol_pa', name: 'OL PA'},
],
quarter: null
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -327,12 +334,18 @@ export default class RollingOutlook extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let defaultPropsQuarter = {
options: this.state.quarterList,
getOptionLabel: (option) => option.name
}
let index = data.sort((a, b) => a - b).findIndex((val) => val === (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.latestPeriode))
// console.log(data)
console.log(this.state.lastPeriod)
// console.log(periodeData)
// console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.setState({ listQuarter: defaultPropsQuarter, quarter: this.state.quarterList[0], listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
......@@ -378,20 +391,20 @@ export default class RollingOutlook extends Component {
"periode": this.state.periode.periode,
"is_approver": this.state.isApprover
}
api.create().getRollingOutlookID(payload).then(response => {
console.log(response)
if (response) {
if (response.data.status === "success") {
this.setState({
rollingOutlookID: response.data.data.rolling_outlook_id,
submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false,
lastRevision: response.data.data.last_revision,
btnApprove: response.data.data.is_submit
}, () => {
console.log(this.state.lastStatus);
// api.create().getRollingOutlookID(payload).then(response => {
// console.log(response)
// if (response) {
// if (response.data.status === "success") {
// this.setState({
// rollingOutlookID: response.data.data.rolling_outlook_id,
// submitter: response.data.data.submitter,
// approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
// lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
// loading: false,
// lastRevision: response.data.data.last_revision,
// btnApprove: response.data.data.is_submit
// }, () => {
// console.log(this.state.lastStatus);
this.historyApproval()
this.getLatestPeriodSubmit()
api.create().checkApprover().then(response => {
......@@ -403,12 +416,12 @@ export default class RollingOutlook extends Component {
}
})
})
} else {
this.setState({ rollingOutlookID: null, loading: false })
}
}
})
// })
// } else {
// this.setState({ rollingOutlookID: null, loading: false })
// }
// }
// })
}
historyApproval() {
......@@ -434,7 +447,7 @@ export default class RollingOutlook extends Component {
}
approvalSubmission(type) {
this.scrollToMyRef()
// this.scrollToMyRef()
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
......@@ -920,6 +933,21 @@ export default class RollingOutlook extends Component {
value={this.state.periode}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listQuarter}
id="company"
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ quarter: newInputValue }, () => {
this.setState({ visibleTableHistory: false })
this.getRevision()
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.quarter}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listCompany}
......@@ -1210,6 +1238,7 @@ export default class RollingOutlook extends Component {
rollingOutlookID={this.state.rollingOutlookID}
onClickClose={() => this.setState({ visibleBS: false, visibleRollingOutlook: true })}
isApprover={'false'}
quarter={this.state.quarter}
/>
)}
......@@ -1224,6 +1253,7 @@ export default class RollingOutlook extends Component {
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })}
quarter={this.state.quarter}
isApprover={'false'}
/>
)}
......@@ -1241,6 +1271,7 @@ export default class RollingOutlook extends Component {
onClickClose={() => this.setState({ visibleTP: false, visibleRollingOutlook: true })}
status={this.state.status}
lastStatus={this.state.lastStatus}
quarter={this.state.quarter}
isApprover={'false'}
/>
)}
......
......@@ -107,6 +107,7 @@ export default class BalanceSheetRO extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"quartal": this.props.quarter.value,
"rolling_outlook_id": this.props.rollingOutlookID
}
api.create().getRollingOutlookBS(payload).then(response => {
......@@ -125,7 +126,7 @@ export default class BalanceSheetRO extends Component {
item.formula,
item.level,
item.description,
item.balance_sheet.total_december_last_year === "" ? "0" : item.balance_sheet.total_december_last_year,
item.balance_sheet.total_last_year === "" ? "0" : item.balance_sheet.total_last_year,
item.balance_sheet.january === "" ? "0" : item.balance_sheet.january,
item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
......@@ -138,7 +139,7 @@ export default class BalanceSheetRO extends Component {
item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
item.balance_sheet.december === "" ? "0" : item.balance_sheet.december,
item.balance_sheet.total_december_year === "" ? "0" : item.balance_sheet.total_december_year,
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong
......@@ -160,7 +161,7 @@ export default class BalanceSheetRO extends Component {
item.formula,
item.level,
item.description,
item.balance_sheet.total_december_last_year === "" ? "0" : item.balance_sheet.total_december_last_year,
item.balance_sheet.total_last_year === "" ? "0" : item.balance_sheet.total_last_year,
item.balance_sheet.january === "" ? "0" : item.balance_sheet.january,
item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
......@@ -173,7 +174,7 @@ export default class BalanceSheetRO extends Component {
item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
item.balance_sheet.december === "" ? "0" : item.balance_sheet.december,
item.balance_sheet.total_december_year === "" ? "0" : item.balance_sheet.total_december_year,
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong
......
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