Commit 5ba24ef4 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !922
parents 101714ff 5cd6d168
...@@ -207,6 +207,7 @@ const create = (type = "") => { ...@@ -207,6 +207,7 @@ const create = (type = "") => {
const getCompanySubmitted = (body) => api.post('transaction/master_budget/get_company_submitted', body) const getCompanySubmitted = (body) => api.post('transaction/master_budget/get_company_submitted', body)
const getLastPeriod = (idCompany) => api.get(`transaction/master_budget/get_last_periode/${idCompany}`) const getLastPeriod = (idCompany) => api.get(`transaction/master_budget/get_last_periode/${idCompany}`)
const getSubmitMasterBudget = (body) => api.post('transaction/master_budget/get_latest_periode_submit', body) const getSubmitMasterBudget = (body) => api.post('transaction/master_budget/get_latest_periode_submit', body)
const getSubmitMonthlyReport = (body) => api.post('transaction/monthly_report/get_latest_periode_submit', body)
const createPeriodeRevision = (body) => api.post('transaction/master_budget/create_periode_revision', body) const createPeriodeRevision = (body) => api.post('transaction/master_budget/create_periode_revision', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard') const getDashboard = (body) => api.get('transaction/get_dashboard')
...@@ -553,7 +554,8 @@ const create = (type = "") => { ...@@ -553,7 +554,8 @@ const create = (type = "") => {
uploadMonthlyReportLOCF, uploadMonthlyReportLOCF,
validateSubmitReportOI, validateSubmitReportOI,
getMonthlyOI, getMonthlyOI,
getParameterByGroupName getParameterByGroupName,
getSubmitMonthlyReport
} }
} }
......
...@@ -59,7 +59,9 @@ export default class MonthlyReport extends Component { ...@@ -59,7 +59,9 @@ export default class MonthlyReport extends Component {
submittedOnly: false, submittedOnly: false,
company_active: null, company_active: null,
company_submit: null, company_submit: null,
still_approver: false still_approver: false,
status: '',
lastStatus: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -177,7 +179,7 @@ export default class MonthlyReport extends Component { ...@@ -177,7 +179,7 @@ export default class MonthlyReport extends Component {
item.number, item.number,
item.report_name == "CAT"? "Corporate Annual Target" : item.report_name, item.report_name == "CAT"? "Corporate Annual Target" : item.report_name,
item.revision, item.revision,
item.current_status, this.state.lastStatus === 'APPROVED' ? 'CLOSED' : this.state.isSubmit === false ? "CLOSED" : item.current_status,
item.report_id, item.report_id,
item.is_can_upload, item.is_can_upload,
item.revision item.revision
...@@ -472,9 +474,9 @@ export default class MonthlyReport extends Component { ...@@ -472,9 +474,9 @@ export default class MonthlyReport extends Component {
}, () => { }, () => {
// // console.log(this.state.lastStatus); // // console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
// this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
this.getReport() // this.getReport()
this.getReportAttachment() // this.getReportAttachment()
api.create().checkApproverMonthly().then(response => { api.create().checkApproverMonthly().then(response => {
if (this.state.btnCreate === true && this.state.btnEdit === true) { if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable'); console.log('editable');
...@@ -501,6 +503,25 @@ export default class MonthlyReport extends Component { ...@@ -501,6 +503,25 @@ export default class MonthlyReport extends Component {
}) })
} }
getLatestPeriodSubmit() {
let body = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"months" : this.state.month.month_id
}
api.create().getSubmitMonthlyReport(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
this.getReport()
this.getReportAttachment()
})
}
}
})
}
historyApproval() { historyApproval() {
let body = { let body = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -548,6 +569,7 @@ export default class MonthlyReport extends Component { ...@@ -548,6 +569,7 @@ export default class MonthlyReport extends Component {
revisionTable: revision, revisionTable: revision,
status: status status: status
}, () => { }, () => {
console.log(status)
if (item === 'Balance Sheet') { if (item === 'Balance Sheet') {
this.setState({ this.setState({
visibleMonthlyReport: false, visibleMonthlyReport: false,
...@@ -1209,6 +1231,8 @@ export default class MonthlyReport extends Component { ...@@ -1209,6 +1231,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)} // getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
...@@ -1226,6 +1250,8 @@ export default class MonthlyReport extends Component { ...@@ -1226,6 +1250,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)} // getReport={this.getCompanyActive.bind(this)}
/> />
...@@ -1246,6 +1272,8 @@ export default class MonthlyReport extends Component { ...@@ -1246,6 +1272,8 @@ export default class MonthlyReport extends Component {
btnCreate={this.state.btnCreate} btnCreate={this.state.btnCreate}
loadview={this.state.loadview} loadview={this.state.loadview}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)} // getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
...@@ -1263,6 +1291,8 @@ export default class MonthlyReport extends Component { ...@@ -1263,6 +1291,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleFAM: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleFAM: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
{this.state.visibleCAT && ( {this.state.visibleCAT && (
...@@ -1279,6 +1309,8 @@ export default class MonthlyReport extends Component { ...@@ -1279,6 +1309,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleCAT: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleCAT: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
{this.state.visibleLOCF && ( {this.state.visibleLOCF && (
...@@ -1295,6 +1327,9 @@ export default class MonthlyReport extends Component { ...@@ -1295,6 +1327,9 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleLOCF: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleLOCF: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
...@@ -1310,6 +1345,8 @@ export default class MonthlyReport extends Component { ...@@ -1310,6 +1345,8 @@ export default class MonthlyReport extends Component {
monthlyReportId={this.state.monthlyReportId} monthlyReportId={this.state.monthlyReportId}
month={this.state.month} month={this.state.month}
onClickClose={() => this.setState({ visibleOI: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleOI: false, visibleMonthlyReport: true })}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
...@@ -1325,6 +1362,8 @@ export default class MonthlyReport extends Component { ...@@ -1325,6 +1362,8 @@ export default class MonthlyReport extends Component {
monthlyReportId={this.state.monthlyReportId} monthlyReportId={this.state.monthlyReportId}
month={this.state.month} month={this.state.month}
onClickClose={() => this.setState({ visibleCF: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleCF: false, visibleMonthlyReport: true })}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
</div > </div >
......
...@@ -72,7 +72,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -72,7 +72,8 @@ export default class CorporateAnnualTargetMR extends Component {
parameterScore: [], parameterScore: [],
totalScore: 0, totalScore: 0,
perfomanceScore: '', perfomanceScore: '',
buttonError: true buttonError: true,
viewOnly : true
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -83,6 +84,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -83,6 +84,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
this.getParameterGroup() this.getParameterGroup()
this.handleViewOnly()
} }
handleGetFor(type) { handleGetFor(type) {
...@@ -93,6 +95,35 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -93,6 +95,35 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
} }
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
// else if (this.props.prevRevision) {
// viewOnly = 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})
}
getParameterGroup() { getParameterGroup() {
api.create().getParameterByGroupName({ api.create().getParameterByGroupName({
"group_name" : 'ACHIEVEMENT_KPI' "group_name" : 'ACHIEVEMENT_KPI'
...@@ -1721,7 +1752,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1721,7 +1752,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div className="col-2"></div> <div className="col-2"></div>
: :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{this.state.get_for == 'view' && <button {this.state.get_for == 'view' && this.state.viewOnly && <button
className="button" className="button"
type="button" type="button"
style={{ style={{
......
...@@ -116,6 +116,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -116,6 +116,7 @@ export default class ListOfCreditFacilities extends Component {
get_for: 'view', get_for: 'view',
updateBy: '-', updateBy: '-',
notes: "", notes: "",
viewOnly: true,
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -125,6 +126,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -125,6 +126,7 @@ export default class ListOfCreditFacilities extends Component {
this.getTypeOfCredit() this.getTypeOfCredit()
this.getSubmission() this.getSubmission()
this.getLatestUpdate() this.getLatestUpdate()
this.handleViewOnly()
} }
handleGetFor(type) { handleGetFor(type) {
...@@ -136,6 +138,35 @@ export default class ListOfCreditFacilities extends Component { ...@@ -136,6 +138,35 @@ export default class ListOfCreditFacilities extends Component {
}) })
} }
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
// else if (this.props.prevRevision) {
// viewOnly = 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})
}
getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -621,46 +652,46 @@ export default class ListOfCreditFacilities extends Component { ...@@ -621,46 +652,46 @@ export default class ListOfCreditFacilities extends Component {
data.push({ data.push({
"item_report_id": i[1], "item_report_id": i[1],
"borrower_comp_name": i[5], "borrower_comp_name": i[5],
"bank_name": i[6] == null? i[6] : i[6].value, "bank_name": i[6] == null? [6] : i[6].value,
"type_of_credit": i[7] == null? i[7] : i[7].value, "type_of_credit": i[7] == null? i[7] : i[7].value,
"remarks": i[8], "remarks": i[8],
"loan_maturity_date": i[9], "loan_maturity_date": i[9],
"interest": i[10], "interest": i[10] == ""? "0.00" : i[10],
"currency": i[11], "currency": i[11],
"loan_plafond_amount_ori": i[12], "loan_plafond_amount_ori": i[12] == ""? "0.0" : i[12],
"loan_plafond_amount_idr": i[13], "loan_plafond_amount_idr": i[13] == ""? "0.0" : i[13],
"out_loan_ki_amount_ori": i[14], "out_loan_ki_amount_ori": i[14] == ""? "0.0" : i[14],
"out_loan_ki_amount_idr": i[15], "out_loan_ki_amount_idr": i[15] == ""? "0.0" : i[15],
"out_loan_kmk_amount_ori": i[16], "out_loan_kmk_amount_ori": i[16] == ""? "0.0" : i[16],
"out_loan_kmk_amount_idr": i[17], "out_loan_kmk_amount_idr": i[17] == ""? "0.0" : i[17],
// "mtd_vs_previous_month": i[18], // "mtd_vs_previous_month": i[18],
"out_loan_other_type": i[18], "out_loan_other_type": i[18] == ""? "0.0" : i[18],
"out_loan_other_amount_ori": i[19], "out_loan_other_amount_ori": i[19] == ""? "0.0" : i[19],
"out_loan_other_amount_idr": i[20], "out_loan_other_amount_idr": i[20] == ""? "0.0" : i[20],
"total_out_loan_ori": i[21], "total_out_loan_ori": i[21] == ""? "0.0" : i[21],
"total_out_loan_idr": i[22], "total_out_loan_idr": i[22] == ""? "0.0" : i[22],
"remaining_plafond_ori": i[23], "remaining_plafond_ori": i[23] == ""? "0.0" : i[23],
"remaining_plafond_idr": i[24], "remaining_plafond_idr": i[24] == ""? "0.0" : i[24],
"current_ratio_financial": i[25], "current_ratio_financial": i[25] == ""? "0.00" : i[25],
"current_ratio_current": i[26], "current_ratio_current": i[26] == ""? "0.00" : i[26],
"der_financial": i[27], "der_financial": i[27] == ""? "0.00" : i[27],
"der_current": i[28], "der_current": i[28] == ""? "0.00" : i[28],
"debt_to_ebitda_financial": i[29], "debt_to_ebitda_financial": i[29] == ""? "0.00" : i[29],
"debt_to_ebitda_current": i[30], "debt_to_ebitda_current": i[30] == ""? "0.00" : i[30],
"ebitda_to_interest_financial": i[31], "ebitda_to_interest_financial": i[31] == ""? "0.00" : i[31],
"ebitda_to_interest_current": i[32], "ebitda_to_interest_current": i[32] == ""? "0.00" : i[32],
"other_ratio1_ratio_name": i[33], "other_ratio1_ratio_name": i[33],
"other_ratio1_financial": i[34], "other_ratio1_financial": i[34] == ""? "0.00" : i[34],
"other_ratio1_current": i[35], "other_ratio1_current": i[35] == ""? "0.00" : i[35],
"other_ratio2_ratio_name": i[36], "other_ratio2_ratio_name": i[36],
"other_ratio2_financial": i[37], "other_ratio2_financial": i[37] == ""? "0.00" : i[36],
"other_ratio2_current": i[38], "other_ratio2_current": i[38] == ""? "0.00" : i[37],
"other_ratio3_ratio_name": i[39], "other_ratio3_ratio_name": i[39],
"other_ratio3_financial": i[40], "other_ratio3_financial": i[40] == ""? "0.00" : i[39],
"other_ratio3_current": i[41], "other_ratio3_current": i[41] == ""? "0.00" : i[40],
"other_ratio4_ratio_name": i[42], "other_ratio4_ratio_name": i[42],
"other_ratio4_financial": i[43], "other_ratio4_financial": i[43] == ""? "0.00" : i[43],
"other_ratio4_current": i[44], "other_ratio4_current": i[44] == ""? "0.00" : i[44],
"notes": i[45], "notes": i[45],
}) })
} }
...@@ -1008,42 +1039,42 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1008,42 +1039,42 @@ export default class ListOfCreditFacilities extends Component {
"type_of_credit": i[7] == null? i[7] : i[7].value, "type_of_credit": i[7] == null? i[7] : i[7].value,
"remarks": i[8], "remarks": i[8],
"loan_maturity_date": i[9], "loan_maturity_date": i[9],
"interest": i[10], "interest": i[10] == ""? "0.00" : i[10],
"currency": i[11], "currency": i[11],
"loan_plafond_amount_ori": i[12], "loan_plafond_amount_ori": i[12] == ""? "0.0" : i[12],
"loan_plafond_amount_idr": i[13], "loan_plafond_amount_idr": i[13] == ""? "0.0" : i[13],
"out_loan_ki_amount_ori": i[14], "out_loan_ki_amount_ori": i[14] == ""? "0.0" : i[14],
"out_loan_ki_amount_idr": i[15], "out_loan_ki_amount_idr": i[15] == ""? "0.0" : i[15],
"out_loan_kmk_amount_ori": i[16], "out_loan_kmk_amount_ori": i[16] == ""? "0.0" : i[16],
"out_loan_kmk_amount_idr": i[17], "out_loan_kmk_amount_idr": i[17] == ""? "0.0" : i[17],
// "mtd_vs_previous_month": i[18], // "mtd_vs_previous_month": i[18],
"out_loan_other_type": i[18], "out_loan_other_type": i[18] == ""? "0.0" : i[18],
"out_loan_other_amount_ori": i[19], "out_loan_other_amount_ori": i[19] == ""? "0.0" : i[19],
"out_loan_other_amount_idr": i[20], "out_loan_other_amount_idr": i[20] == ""? "0.0" : i[20],
"total_out_loan_ori": i[21], "total_out_loan_ori": i[21] == ""? "0.0" : i[21],
"total_out_loan_idr": i[22], "total_out_loan_idr": i[22] == ""? "0.0" : i[22],
"remaining_plafond_ori": i[23], "remaining_plafond_ori": i[23] == ""? "0.0" : i[23],
"remaining_plafond_idr": i[24], "remaining_plafond_idr": i[24] == ""? "0.0" : i[24],
"current_ratio_financial": i[25], "current_ratio_financial": i[25] == ""? "0.00" : i[25],
"current_ratio_current": i[26], "current_ratio_current": i[26] == ""? "0.00" : i[26],
"der_financial": i[27], "der_financial": i[27] == ""? "0.00" : i[27],
"der_current": i[28], "der_current": i[28] == ""? "0.00" : i[28],
"debt_to_ebitda_financial": i[29], "debt_to_ebitda_financial": i[29] == ""? "0.00" : i[29],
"debt_to_ebitda_current": i[30], "debt_to_ebitda_current": i[30] == ""? "0.00" : i[30],
"ebitda_to_interest_financial": i[31], "ebitda_to_interest_financial": i[31] == ""? "0.00" : i[31],
"ebitda_to_interest_current": i[32], "ebitda_to_interest_current": i[32] == ""? "0.00" : i[32],
"other_ratio1_ratio_name": i[33], "other_ratio1_ratio_name": i[33],
"other_ratio1_financial": i[34], "other_ratio1_financial": i[34] == ""? "0.00" : i[34],
"other_ratio1_current": i[35], "other_ratio1_current": i[35] == ""? "0.00" : i[35],
"other_ratio2_ratio_name": i[36], "other_ratio2_ratio_name": i[36],
"other_ratio2_financial": i[37], "other_ratio2_financial": i[37] == ""? "0.00" : i[36],
"other_ratio2_current": i[38], "other_ratio2_current": i[38] == ""? "0.00" : i[37],
"other_ratio3_ratio_name": i[39], "other_ratio3_ratio_name": i[39],
"other_ratio3_financial": i[40], "other_ratio3_financial": i[40] == ""? "0.00" : i[39],
"other_ratio3_current": i[41], "other_ratio3_current": i[41] == ""? "0.00" : i[40],
"other_ratio4_ratio_name": i[42], "other_ratio4_ratio_name": i[42],
"other_ratio4_financial": i[43], "other_ratio4_financial": i[43] == ""? "0.00" : i[43],
"other_ratio4_current": i[44], "other_ratio4_current": i[44] == ""? "0.00" : i[44],
"notes": i[45], "notes": i[45],
}) })
} }
...@@ -3824,7 +3855,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3824,7 +3855,7 @@ export default class ListOfCreditFacilities extends Component {
{this.props.isApprover === true ? null : {this.props.isApprover === true ? null :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{this.state.get_for == 'view' && <button {this.state.get_for == 'view' && this.state.viewOnly && <button
className="button" className="button"
type="button" type="button"
style={{ style={{
......
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