Commit 65a9e327 authored by d.arizona's avatar d.arizona

yuk bisa

parent 0e135d8d
......@@ -207,6 +207,7 @@ const create = (type = "") => {
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 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 getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard')
......@@ -549,7 +550,8 @@ const create = (type = "") => {
uploadMonthlyReportLOCF,
validateSubmitReportOI,
getMonthlyOI,
getParameterByGroupName
getParameterByGroupName,
getSubmitMonthlyReport
}
}
......
......@@ -59,7 +59,9 @@ export default class MonthlyReport extends Component {
submittedOnly: false,
company_active: null,
company_submit: null,
still_approver: false
still_approver: false,
status: '',
lastStatus: ''
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -177,7 +179,7 @@ export default class MonthlyReport extends Component {
item.number,
item.report_name == "CAT"? "Corporate Annual Target" : item.report_name,
item.revision,
item.current_status,
this.state.lastStatus === 'APPROVED' ? 'CLOSED' : this.state.isSubmit === false ? "CLOSED" : item.current_status,
item.report_id,
item.is_can_upload,
item.revision
......@@ -472,9 +474,9 @@ export default class MonthlyReport extends Component {
}, () => {
// // console.log(this.state.lastStatus);
this.historyApproval()
// this.getLatestPeriodSubmit()
this.getReport()
this.getReportAttachment()
this.getLatestPeriodSubmit()
// this.getReport()
// this.getReportAttachment()
api.create().checkApproverMonthly().then(response => {
if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable');
......@@ -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() {
let body = {
"company_id": this.state.company.company_id,
......@@ -548,6 +569,7 @@ export default class MonthlyReport extends Component {
revisionTable: revision,
status: status
}, () => {
console.log(status)
if (item === 'Balance Sheet') {
this.setState({
visibleMonthlyReport: false,
......@@ -1209,6 +1231,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
......@@ -1226,6 +1250,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)}
/>
......@@ -1246,6 +1272,8 @@ export default class MonthlyReport extends Component {
btnCreate={this.state.btnCreate}
loadview={this.state.loadview}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
......@@ -1263,6 +1291,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleFAM: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/>
)}
{this.state.visibleCAT && (
......@@ -1279,6 +1309,8 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleCAT: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/>
)}
{this.state.visibleLOCF && (
......@@ -1295,6 +1327,9 @@ export default class MonthlyReport extends Component {
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleLOCF: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
/>
)}
......@@ -1310,6 +1345,8 @@ export default class MonthlyReport extends Component {
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
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 {
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
onClickClose={() => this.setState({ visibleCF: false, visibleMonthlyReport: true })}
status={this.state.status}
lastStatus={this.state.lastStatus}
/>
)}
</div >
......
......@@ -72,7 +72,8 @@ export default class CorporateAnnualTargetMR extends Component {
parameterScore: [],
totalScore: 0,
perfomanceScore: '',
buttonError: true
buttonError: true,
viewOnly : true
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -83,6 +84,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.getKPIType()
this.getMaxAch()
this.getParameterGroup()
this.handleViewOnly()
}
handleGetFor(type) {
......@@ -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() {
api.create().getParameterByGroupName({
"group_name" : 'ACHIEVEMENT_KPI'
......@@ -1721,7 +1752,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div className="col-2"></div>
:
<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"
type="button"
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