Commit 9384300e authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'faisal' into 'master'

OLPA PL

See merge request !474
parents 54217f96 d9c23444
...@@ -66,7 +66,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -66,7 +66,7 @@ export default class ProfitLossOLPA extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "outlook_pa_id": this.props.outlook_pa_id
} }
api.create().getLastestUpdateMB(payload).then(response => { api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) { if (response.data) {
...@@ -79,19 +79,19 @@ export default class ProfitLossOLPA extends Component { ...@@ -79,19 +79,19 @@ export default class ProfitLossOLPA extends Component {
}) })
} }
getItemHierarki() { async getItemHierarki() {
this.setState({ loading: true, judulColumn: null }) this.setState({ loading: true, judulColumn: null })
let payload = { let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": this.props.revision,
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id
"submission_id": this.props.submissionID
} }
api.create().getDetailReportMB(payload).then(response => { console.log(payload)
let response = await api.create().getDetailReportOLPA(payload)
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
this.setState({visibleProfitLoss: true})
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
...@@ -172,8 +172,6 @@ export default class ProfitLossOLPA extends Component { ...@@ -172,8 +172,6 @@ export default class ProfitLossOLPA extends Component {
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} }
})
} }
handleValue(data) { handleValue(data) {
...@@ -203,7 +201,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -203,7 +201,7 @@ export default class ProfitLossOLPA extends Component {
} }
} }
backToMasterBudget(type) { backToOLPA(type) {
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
...@@ -228,7 +226,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -228,7 +226,7 @@ export default class ProfitLossOLPA extends Component {
}) })
}) })
let payload = { let payload = {
"submission_id": this.props.submissionID, "outlook_pa_id": this.props.outlook_pa_id,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -237,13 +235,13 @@ export default class ProfitLossOLPA extends Component { ...@@ -237,13 +235,13 @@ export default class ProfitLossOLPA extends Component {
} }
console.log(data); console.log(data);
this.setState({ loading: false }) this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToOLPA(payload)
this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/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() res = await res.blob()
console.log(res) console.log(res)
...@@ -306,7 +304,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -306,7 +304,7 @@ export default class ProfitLossOLPA extends Component {
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadOLPA(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -380,15 +378,15 @@ export default class ProfitLossOLPA extends Component { ...@@ -380,15 +378,15 @@ export default class ProfitLossOLPA extends Component {
}) })
}) })
let body = { let body = {
submission_id: this.props.submissionID, outlook_pa_id: this.props.outlook_pa_id,
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
profit_loss: data, profit_loss: data,
status: type status: type
} }
console.log(data); console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadOLPA(body).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -400,18 +398,16 @@ export default class ProfitLossOLPA extends Component { ...@@ -400,18 +398,16 @@ export default class ProfitLossOLPA extends Component {
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
alert(response.problem) alert(response.problem)
// this.props.onClickClose()
// this.props.getReport()
} }
}) })
} }
async downloadAllData() { async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let url = `https://tia.eksad.com/tia-reporting-dev/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}`
let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/outlook_pa/export_outlook_pa?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); console.log(url);
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? sub_null : url this.props.outlook_pa_id == null ? sub_null : url
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -450,15 +446,15 @@ export default class ProfitLossOLPA extends Component { ...@@ -450,15 +446,15 @@ export default class ProfitLossOLPA extends Component {
}) })
}) })
let payload = { let payload = {
"submission_id": this.props.submissionID, "outlook_pa_id": this.props.outlook_pa_id,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"profit_loss": data, "profit_loss": data,
"status": "submitted" "status": "submitted"
} }
console.log(payload) // console.log(payload)
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReportOLPA(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false }) this.setState({ loading: false, buttonError: false, editable: false })
...@@ -2158,7 +2154,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -2158,7 +2154,7 @@ export default class ProfitLossOLPA extends Component {
</button> </button>
</div> </div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? (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') ?
<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 <button
className="button" className="button"
...@@ -2196,7 +2192,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -2196,7 +2192,7 @@ export default class ProfitLossOLPA extends Component {
onClick={() => onClick={() =>
this.state.handleTekTekTek == 1? null : this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => { this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('draft') this.backToOLPA('draft')
}) })
} }
> >
...@@ -2212,7 +2208,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -2212,7 +2208,7 @@ export default class ProfitLossOLPA extends Component {
: :
this.state.handleTekTekTek == 1? null : this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => { this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('submitted') this.backToOLPA('submitted')
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
......
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