Commit e73dc962 authored by r.kurnia's avatar r.kurnia

cat olpa

parent ad5fb4b5
......@@ -127,7 +127,8 @@ export default class CorporateAnnualTargetRO extends Component {
"periode": this.props.periode,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID
// "rolling_outlook_id": this.props.rollingOutlookID,
"outlook_pa_id": this.props.outlook_pa_id,
}
console.log(payload);
api.create().getDetailReportOLPACAT(payload).then(response => {
......@@ -338,23 +339,23 @@ export default class CorporateAnnualTargetRO extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/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}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Outlook Performance Appraisal & CAT Revision - Corporate Annual Target.xlsx';
a.download = 'Template Outlook Performance Appraisal - Corporate Annual Target.xlsx';
a.click();
}
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID === null ? "" : this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
)
res = await res.blob()
this.setState({ loading: false })
......@@ -362,12 +363,12 @@ export default class CorporateAnnualTargetRO extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Outlook Performance Appraisal & CAT Revision - Corporate Annual Target.xlsx';
a.download = 'Outlook Performance Appraisal - Corporate Annual Target.xlsx';
a.click();
}
}
backToRollingOutlook(type) {
backToOutlookPA(type) {
let data = []
let stateFR = false
console.log(this.state.dataTable)
......@@ -421,7 +422,7 @@ export default class CorporateAnnualTargetRO extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
// "quartal": this.props.quarter,
"quartal": 'q1',
"status": type,
"cat": data
}
......@@ -429,11 +430,11 @@ export default class CorporateAnnualTargetRO extends Component {
api.create('UPLOAD').createCATOLPA(payload).then(response => {
console.log(payload);
console.log(response);
// console.log(JSON.stringify(payload))
console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.refresh()
// this.props.refresh()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
document.body.style.overflow = 'unset';
......@@ -503,8 +504,9 @@ export default class CorporateAnnualTargetRO extends Component {
periode: this.props.periode,
report_id: this.props.report_id,
cat: payload,
rolling_outlook_id: this.props.rollingOutlookID,
quartal: this.props.quarter,
// rolling_outlook_id: this.props.rollingOutlookID,
outlook_pa_id: this.props.outlook_pa_id,
quartal: 'q1',
status: 'submitted'
}
console.log(body)
......@@ -515,7 +517,7 @@ export default class CorporateAnnualTargetRO extends Component {
checkUpload() {
this.setState({ loading: true, dataTable: [] })
api.create().checkImportRollingOutlookCAT(this.state.payload).then(response => {
api.create().checkUploadOLPA(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
......@@ -629,17 +631,18 @@ export default class CorporateAnnualTargetRO extends Component {
})
})
let payload = {
"rolling_outlook_id": this.props.rollingOutlookID,
"outlook_pa_id": this.props.outlook_pa_id,
// "rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"quartal": 'q1',
"status": type,
"cat": data
}
// console.log(data);
// console.log(JSON.stringify(body))
api.create('UPLOAD').importRollingOutlookCAT(payload).then(response => {
api.create('UPLOAD').uploadOLPA(payload).then(response => {
console.log(payload);
console.log(response);
if (response.data) {
......@@ -2245,7 +2248,7 @@ export default class CorporateAnnualTargetRO extends Component {
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToRollingOutlook('draft')
this.backToOutlookPA('draft')
})
}
>
......@@ -2262,7 +2265,7 @@ export default class CorporateAnnualTargetRO extends Component {
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToRollingOutlook('submitted')
this.backToOutlookPA('submitted')
})}
style={{
backgroundColor: 'transparent',
......@@ -2450,7 +2453,7 @@ export default class CorporateAnnualTargetRO extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") ?
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("CAT") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
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