Commit 672e1044 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents 14fabc65 05a0c2a1
......@@ -204,6 +204,7 @@ const create = (type = "") => {
const checkApprover = () => api.get('transaction/master_budget/is_approver')
const approvalSubmission = (body) => api.post('transaction/master_budget/approval_submission', body)
const getCompanySubmitted = (body) => api.post('transaction/get_company_submitted', body)
const getLastPeriod = (idCompany) => api.get(`transaction/get_last_periode/${idCompany}`)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
......@@ -367,7 +368,8 @@ const create = (type = "") => {
historyApproval,
checkApprover,
approvalSubmission,
getCompanySubmitted
getCompanySubmitted,
getLastPeriod
}
}
......
......@@ -70,7 +70,7 @@ export default class BudgetTahunan extends Component {
this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) {
console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', rawData: this.props.location.state.rawData }, () => {
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData }, () => {
this.checkApprover()
})
} else {
......@@ -231,8 +231,8 @@ export default class BudgetTahunan extends Component {
getOptionLabel: (option) => titleCase(option.company_name),
};
let index = arrayBaru.findIndex((val) => val.company_id == comID)
this.setState({ listCompany: defaultProps, company: index == -1 ? arrayBaru[0] : arrayBaru[index] }, () => {
this.getPeriode()
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => {
this.getLastPeriod()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -250,10 +250,21 @@ export default class BudgetTahunan extends Component {
})
}
getLastPeriod(){
api.create().getLastPeriod(this.state.company.company_id).then(response => {
console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod : response.data.data.last_periode}, ()=> {
this.getPeriode()
})
}
})
}
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
// let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
......@@ -266,7 +277,7 @@ export default class BudgetTahunan extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val === year)
let index = data.sort((a, b) => a - b).findIndex((val) => val === this.state.lastPeriod)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
......@@ -1162,6 +1173,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
/>
)}
......@@ -1181,6 +1193,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
/>
)}
{this.state.visibleFAM && (
......@@ -1199,6 +1212,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
/>
)}
{this.state.visibleCAT && (
......@@ -1216,6 +1230,7 @@ export default class BudgetTahunan extends Component {
getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.prevRevision}
/>
)}
{this.state.visibleCF && (
......@@ -1231,6 +1246,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })}
getReport={this.getSubmission.bind(this)}
prevRevision={this.state.prevRevision}
/>
)}
......
This diff is collapsed.
......@@ -128,7 +128,7 @@ export default class OperatingIndicator extends Component {
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1? companyData[0] : arrayBaru[0] }, () => {
this.getPeriode()
})
} else {
......
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