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={{
......
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