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

apdet

parent 4ad98e6e
...@@ -63,7 +63,14 @@ export default class RollingOutlook extends Component { ...@@ -63,7 +63,14 @@ export default class RollingOutlook extends Component {
latestPeriode: '', latestPeriode: '',
minDateRevision: new Date(), minDateRevision: new Date(),
maxDateRevision: 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.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -327,12 +334,18 @@ export default class RollingOutlook extends Component { ...@@ -327,12 +334,18 @@ export default class RollingOutlook extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, 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)) 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(data)
console.log(this.state.lastPeriod) console.log(this.state.lastPeriod)
// console.log(periodeData) // console.log(periodeData)
// console.log(index) // 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) { if (this.state.isApprover === true) {
this.getCompanySubmitted() this.getCompanySubmitted()
} else { } else {
...@@ -378,20 +391,20 @@ export default class RollingOutlook extends Component { ...@@ -378,20 +391,20 @@ export default class RollingOutlook extends Component {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"is_approver": this.state.isApprover "is_approver": this.state.isApprover
} }
api.create().getRollingOutlookID(payload).then(response => { // api.create().getRollingOutlookID(payload).then(response => {
console.log(response) // console.log(response)
if (response) { // if (response) {
if (response.data.status === "success") { // if (response.data.status === "success") {
this.setState({ // this.setState({
rollingOutlookID: response.data.data.rolling_outlook_id, // rollingOutlookID: response.data.data.rolling_outlook_id,
submitter: response.data.data.submitter, // submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver, // 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, // lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false, // loading: false,
lastRevision: response.data.data.last_revision, // lastRevision: response.data.data.last_revision,
btnApprove: response.data.data.is_submit // btnApprove: response.data.data.is_submit
}, () => { // }, () => {
console.log(this.state.lastStatus); // console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
...@@ -403,12 +416,12 @@ export default class RollingOutlook extends Component { ...@@ -403,12 +416,12 @@ export default class RollingOutlook extends Component {
} }
}) })
}) // })
} else { // } else {
this.setState({ rollingOutlookID: null, loading: false }) // this.setState({ rollingOutlookID: null, loading: false })
} // }
} // }
}) // })
} }
historyApproval() { historyApproval() {
...@@ -434,7 +447,7 @@ export default class RollingOutlook extends Component { ...@@ -434,7 +447,7 @@ export default class RollingOutlook extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.scrollToMyRef() // 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,
...@@ -920,6 +933,21 @@ export default class RollingOutlook extends Component { ...@@ -920,6 +933,21 @@ export default class RollingOutlook extends Component {
value={this.state.periode} value={this.state.periode}
/> />
</div> </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 }}> <div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
...@@ -1210,6 +1238,7 @@ export default class RollingOutlook extends Component { ...@@ -1210,6 +1238,7 @@ export default class RollingOutlook extends Component {
rollingOutlookID={this.state.rollingOutlookID} rollingOutlookID={this.state.rollingOutlookID}
onClickClose={() => this.setState({ visibleBS: false, visibleRollingOutlook: true })} onClickClose={() => this.setState({ visibleBS: false, visibleRollingOutlook: true })}
isApprover={'false'} isApprover={'false'}
quarter={this.state.quarter}
/> />
)} )}
...@@ -1224,6 +1253,7 @@ export default class RollingOutlook extends Component { ...@@ -1224,6 +1253,7 @@ export default class RollingOutlook extends Component {
periode={this.state.periode.periode} periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID} rollingOutlookID={this.state.rollingOutlookID}
onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })} onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })}
quarter={this.state.quarter}
isApprover={'false'} isApprover={'false'}
/> />
)} )}
...@@ -1241,6 +1271,7 @@ export default class RollingOutlook extends Component { ...@@ -1241,6 +1271,7 @@ export default class RollingOutlook extends Component {
onClickClose={() => this.setState({ visibleTP: false, visibleRollingOutlook: true })} onClickClose={() => this.setState({ visibleTP: false, visibleRollingOutlook: true })}
status={this.state.status} status={this.state.status}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
quarter={this.state.quarter}
isApprover={'false'} isApprover={'false'}
/> />
)} )}
......
...@@ -107,6 +107,7 @@ export default class BalanceSheetRO extends Component { ...@@ -107,6 +107,7 @@ export default class BalanceSheetRO extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"quartal": this.props.quarter.value,
"rolling_outlook_id": this.props.rollingOutlookID "rolling_outlook_id": this.props.rollingOutlookID
} }
api.create().getRollingOutlookBS(payload).then(response => { api.create().getRollingOutlookBS(payload).then(response => {
...@@ -125,7 +126,7 @@ export default class BalanceSheetRO extends Component { ...@@ -125,7 +126,7 @@ export default class BalanceSheetRO extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, 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.january === "" ? "0" : item.balance_sheet.january,
item.balance_sheet.february === "" ? "0" : item.balance_sheet.february, item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
item.balance_sheet.march === "" ? "0" : item.balance_sheet.march, item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
...@@ -138,7 +139,7 @@ export default class BalanceSheetRO extends Component { ...@@ -138,7 +139,7 @@ export default class BalanceSheetRO extends Component {
item.balance_sheet.october === "" ? "0" : item.balance_sheet.october, item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
item.balance_sheet.november === "" ? "0" : item.balance_sheet.november, item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
item.balance_sheet.december === "" ? "0" : item.balance_sheet.december, 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.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong item.condition_if_wrong
...@@ -160,7 +161,7 @@ export default class BalanceSheetRO extends Component { ...@@ -160,7 +161,7 @@ export default class BalanceSheetRO extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, 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.january === "" ? "0" : item.balance_sheet.january,
item.balance_sheet.february === "" ? "0" : item.balance_sheet.february, item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
item.balance_sheet.march === "" ? "0" : item.balance_sheet.march, item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
...@@ -173,7 +174,7 @@ export default class BalanceSheetRO extends Component { ...@@ -173,7 +174,7 @@ export default class BalanceSheetRO extends Component {
item.balance_sheet.october === "" ? "0" : item.balance_sheet.october, item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
item.balance_sheet.november === "" ? "0" : item.balance_sheet.november, item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
item.balance_sheet.december === "" ? "0" : item.balance_sheet.december, 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.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong 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