Commit 5d40cd59 authored by Riri Novita's avatar Riri Novita

Update banyak

parent 19a6b4da
...@@ -343,6 +343,7 @@ const create = (type = "") => { ...@@ -343,6 +343,7 @@ const create = (type = "") => {
//CASH FLOW //CASH FLOW
const getDetailReportCF = (body) => api.post('/transaction/cash_flow/master_budget/get_report_hierarki', body) const getDetailReportCF = (body) => api.post('/transaction/cash_flow/master_budget/get_report_hierarki', body)
const createReportCF = (body) => api.post('transaction/cash_flow/master_budget/create_submission_report', body) const createReportCF = (body) => api.post('transaction/cash_flow/master_budget/create_submission_report', body)
const createReportCFSimulasi = (body) => api.post('transaction/cash_flow/master_budget/create_submission_report/other_currency', body)
//OUTLOOK PA //OUTLOOK PA
const getOutlookPAID = (body) => api.post('transaction/outlook_pa/get_outlook_pa_id', body) const getOutlookPAID = (body) => api.post('transaction/outlook_pa/get_outlook_pa_id', body)
...@@ -759,6 +760,7 @@ const create = (type = "") => { ...@@ -759,6 +760,7 @@ const create = (type = "") => {
getReportCFSumaMB, getReportCFSumaMB,
getReportCFSumaMR, getReportCFSumaMR,
createReportCF, createReportCF,
createReportCFSimulasi,
getReportCFSuma, getReportCFSuma,
getReportPLSuma, getReportPLSuma,
getReportPLSummary, getReportPLSummary,
......
...@@ -1320,37 +1320,57 @@ export default class BudgetTahunan extends Component { ...@@ -1320,37 +1320,57 @@ export default class BudgetTahunan extends Component {
}) })
} }
createCashFlow(payload) { createCashFlow(payload, trigger) {
api.create().createReportCF(payload).then((res) => { console.log(trigger);
console.log(res) if (trigger === "simulasi") {
// this.getSubmission() api.create().createReportCFSimulasi(payload).then((res) => {
if (res.data) { console.log(res)
if (res.data.status === "success") { // this.getSubmission()
this.setState({ visibleCF: false, visibleBudgetTahunan: true }) if (res.data) {
this.getSubmission() if (res.data.status === "success") {
} else { this.setState({ visibleCF: false, visibleBudgetTahunan: true })
if (res.data.message == "Please Set Up Rate Currency First") { this.getSubmission()
this.setState({ visibleAlertSave: true })
} else { } else {
this.setState({ alert: true, messageAlert: res.data.message, tipeAlert: 'warning', loading: false }) if (res.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: res.data.message, tipeAlert: 'warning', loading: false })
}
} }
} }
} })
// if (response.data) { } else {
// if (response.data.status === "success") { api.create().createReportCF(payload).then((res) => {
// this.props.saveToMonthlyReport() console.log(res)
// } else { // this.getSubmission()
// this.setState({ loading: false }, () => { if (res.data) {
// this.props.saveToMonthlyReport() if (res.data.status === "success") {
// }) this.setState({ visibleCF: false, visibleBudgetTahunan: true })
// } this.getSubmission()
// } else { } else {
// this.setState({ loading: false }, () => { if (res.data.message == "Please Set Up Rate Currency First") {
// // this.getSubmission() this.setState({ visibleAlertSave: true })
// document.body.style.overflow = 'unset'; } else {
// }) this.setState({ alert: true, messageAlert: res.data.message, tipeAlert: 'warning', loading: false })
// } }
}) }
}
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
} }
getPL(type, trigger) { getPL(type, trigger) {
......
...@@ -336,7 +336,7 @@ export default class CashFlow extends Component { ...@@ -336,7 +336,7 @@ export default class CashFlow extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
olahDataCashFlow(dataTable2) { olahDataCashFlow(dataTable2, trigger) {
console.log(dataTable2) console.log(dataTable2)
let listCF = [] let listCF = []
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -373,10 +373,10 @@ export default class CashFlow extends Component { ...@@ -373,10 +373,10 @@ export default class CashFlow extends Component {
}) })
console.log(listCF) console.log(listCF)
this.createCashFlow(listCF) this.createCashFlow(listCF, trigger)
} }
createCashFlow(dbcf) { createCashFlow(dbcf, trigger) {
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -388,7 +388,7 @@ export default class CashFlow extends Component { ...@@ -388,7 +388,7 @@ export default class CashFlow extends Component {
} }
console.log(dbcf) console.log(dbcf)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
this.props.createCashFlow(payload) this.props.createCashFlow(payload, trigger)
// this.props.onClickClose() // this.props.onClickClose()
} }
...@@ -3339,9 +3339,32 @@ export default class CashFlow extends Component { ...@@ -3339,9 +3339,32 @@ export default class CashFlow extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.props.isApprover === true || dataTable2.length == 0 ? null : <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? <button
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> type="button"
// disabled={this.state.buttonError}
onClick={() =>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2, "simulasi")
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 15
}}
>
<div style={{ backgroundColor: '#cd5c5c', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data Simulasi</Typography>
</div>
</button>
{this.props.isApprover === true || dataTable2.length == 0 ? null :
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
...@@ -3364,8 +3387,8 @@ export default class CashFlow extends Component { ...@@ -3364,8 +3387,8 @@ export default class CashFlow extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> : null}
: null} </div>
</div> </div>
</div> </div>
</Paper> </Paper>
......
This diff is collapsed.
...@@ -214,7 +214,7 @@ export default class CashFlowMR extends Component { ...@@ -214,7 +214,7 @@ export default class CashFlowMR extends Component {
} }
} }
payloadCF(dataTable2) { payloadCF(dataTable2, trigger) {
let listCF = [] let listCF = []
console.log(dataTable2) console.log(dataTable2)
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -232,10 +232,10 @@ export default class CashFlowMR extends Component { ...@@ -232,10 +232,10 @@ export default class CashFlowMR extends Component {
// } // }
}) })
this.createCashFlow(listCF) this.createCashFlow(listCF, trigger)
} }
createCashFlow(listCF) { createCashFlow(listCF, trigger) {
let payload = { let payload = {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -246,7 +246,7 @@ export default class CashFlowMR extends Component { ...@@ -246,7 +246,7 @@ export default class CashFlowMR extends Component {
"currency_id": this.props.defaultCurrency.id, "currency_id": this.props.defaultCurrency.id,
"cash_flow": listCF "cash_flow": listCF
} }
this.props.createCashFlow(payload) this.props.createCashFlow(payload, trigger)
} }
render() { render() {
...@@ -765,8 +765,30 @@ export default class CashFlowMR extends Component { ...@@ -765,8 +765,30 @@ export default class CashFlowMR extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.state.viewOnly && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.payloadCF(dataTable2, "simulasi")
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
{this.state.viewOnly &&
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
...@@ -789,8 +811,8 @@ export default class CashFlowMR extends Component { ...@@ -789,8 +811,8 @@ export default class CashFlowMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> }
} </div>
</div> </div>
</div> </div>
</Paper> </Paper>
......
...@@ -1529,12 +1529,16 @@ export default class MonthlyReport extends Component { ...@@ -1529,12 +1529,16 @@ export default class MonthlyReport extends Component {
}) })
} }
createCashFlow(payload) { createCashFlow(payload, trigger) {
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
api.create().createMonthlyReportCF(payload).then((res) => { if (trigger === "simulasi") {
this.saveToMonthlyReport()
console.log(res) } else {
}) api.create().createMonthlyReportCF(payload).then((res) => {
this.saveToMonthlyReport()
console.log(res)
})
}
} }
getPL(type, trigger) { getPL(type, trigger) {
......
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