Commit 1fe95ff0 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

Ggmac

See merge request !1299
parents d1d278d9 6f85f133
......@@ -254,8 +254,12 @@ const create = (type = "") => {
const importRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/import_rolling_outlook', body)
const createRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/create_rolling_outlook', body)
const getRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/get_report_hierarki', body)
const createRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/create_rolling_outlook', body)
const checkImportRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/check_import', body)
const importRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/import_rolling_outlook', body)
const getRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/get_report_hierarki', body)
const createRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/store_ro_tax_planning', body)
const getSubmitRollingOutlook = (body) => api.post('transaction/rolling_outlook/get_latest_periode_submit', body)
const getRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_operating_indicator_id', body)
const getHierarkiRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_report_hierarki', body)
const createRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/create_rolling_outlook', body)
......@@ -734,11 +738,14 @@ const create = (type = "") => {
getRollingOutlookIsApprover,
checkImportRollingOutlookBS,
importRollingOutlookBS,
createRollingOutlookPL,
checkImportRollingOutlookPL,
importRollingOutlookPL,
getSubmitRollingOutlook,
getRollingOI,
getHierarkiRollingOI,
createRollingOI,
getLastestUpdateROOI
}
}
......
......@@ -212,13 +212,15 @@ export default class RollingOutlook extends Component {
getLatestPeriodSubmit() {
let body = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
"periode": this.state.periode.periode,
"is_approver": this.state.isApprover,
"quartal": this.state.quarter.value
}
api.create().getSubmitMasterBudget(body).then(response => {
api.create().getSubmitRollingOutlook(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: true }, () => {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
this.getReport()
this.getReportAttachment()
})
......@@ -760,9 +762,9 @@ export default class RollingOutlook extends Component {
borderColor: 'transparent'
}}
onClick={() =>
// tableMeta.rowData[5] == true ?
tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
: null
}
>
{/* {this.state.isApprover == true ?
......@@ -1251,8 +1253,9 @@ export default class RollingOutlook extends Component {
rollingOutlookID={this.state.rollingOutlookID}
refresh={this.getRollingOutlookID.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleRollingOutlook: true })}
isApprover={'false'}
isApprover={this.state.isApprover}
quarter={this.state.quarter.value}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -1269,7 +1272,8 @@ export default class RollingOutlook extends Component {
onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })}
refresh={this.getRollingOutlookID.bind(this)}
quarter={this.state.quarter.value}
isApprover={'false'}
isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -1288,7 +1292,8 @@ export default class RollingOutlook extends Component {
status={this.state.status}
lastStatus={this.state.lastStatus}
quarter={this.state.quarter.value}
isApprover={'false'}
isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......
......@@ -64,6 +64,40 @@ export default class BalanceSheetRO extends Component {
componentDidMount() {
// this.getItemHierarki()
this.getSettingControl()
this.handleViewOnly()
}
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
let checkPrevRev = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
if (this.props.prevRevision) {
checkPrevRev = true
} else {
checkPrevRev = false
}
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true
} else {
checkStatus = false
}
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
}
getSettingControl() {
......@@ -212,7 +246,7 @@ export default class BalanceSheetRO extends Component {
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
)
res = await res.blob()
// console.log(res)
console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......
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