Commit 5881855d authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

rolling in the deep

See merge request !1264
parents 9c5cf7fb 76316088
......@@ -12,6 +12,7 @@ import UploadFile from "../../library/Upload";
import { format } from 'date-fns';
import Constant from '../../library/Constant';
import OperatingIndicatorMR from '../MonthlyReport/OperatingIndicatorMR';
import OperatingIndicatorRO from '../RollingOutlook/OperatingIndicatorRO';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -341,6 +342,16 @@ export default class OperatingIndicator extends Component {
})
} else if (String(item[1]).toLocaleLowerCase().includes("rolling outlook")) {
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
visibleOperatingIndicator: false,
visibleDetailOpt: false,
visibleDetailMonthly: false,
visibleDetailRolling: true
})
} else {
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
......@@ -409,6 +420,14 @@ export default class OperatingIndicator extends Component {
})
}
saveRollingOI(payload) {
api.create().createMonthlyReportOI(payload).then((response) => {
console.log(response);
this.getReport()
this.getOperatingID()
})
}
render() {
const columns = ["#", "Report Type",
// {
......@@ -485,10 +504,10 @@ export default class OperatingIndicator extends Component {
borderColor: 'transparent'
}}
onClick={() =>
tableMeta.rowData[4] ?
// tableMeta.rowData[4] ?
this.clickDetail(tableMeta.rowData, tableMeta.rowData[1], tableMeta.rowData[3], tableMeta.rowData[2])
:
null
// :
// null
}
>
<Typography style={{ color: tableMeta.rowData[4] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
......@@ -644,6 +663,25 @@ export default class OperatingIndicator extends Component {
/>
}
{this.state.visibleDetailRolling &&
<OperatingIndicatorRO
open={this.props.open}
data={this.state.dataDetail}
height={this.props.height}
width={this.props.width}
months={this.state.months}
company={this.state.company}
onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
this.forceUpdate()
})}
getReport={() => this.getOperatingID()}
saveRollingOI={this.saveRollingOI.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/>
}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
......
......@@ -559,7 +559,7 @@ export default class RollingOutlook extends Component {
this.setState({ alert: false })
}
saveToMasterBudget(data) {
saveToRollingOutlook(data) {
this.setState({ loading: true })
// console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -142,7 +142,7 @@ export default class ProfitLossRO extends Component {
item.formula,
item.level,
item.description,
item.profit_loss.notes === undefined ? "" : item.profit_loss.notes,
item.profit_loss.notes,
item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
item.profit_loss.january === "" ? "0" : item.profit_loss.january,
item.profit_loss.february === "" ? "0" : item.profit_loss.february,
......@@ -179,7 +179,7 @@ export default class ProfitLossRO extends Component {
item.formula,
item.level,
item.description,
item.profit_loss.notes === undefined ? "" : item.profit_loss.notes,
item.profit_loss.notes,
item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
item.profit_loss.january === "" ? "0" : item.profit_loss.january,
item.profit_loss.february === "" ? "0" : item.profit_loss.february,
......@@ -303,6 +303,63 @@ export default class ProfitLossRO extends Component {
// })
}
backToRollingOutlook(type) {
this.setState({ loading: true })
let data = []
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"total_december_last_year": String(Number(i[6]).toFixed(1)),
"january": String(Number(i[7]).toFixed(1)),
"february": String(Number(i[8]).toFixed(1)),
"march": String(Number(i[9]).toFixed(1)),
"april": String(Number(i[10]).toFixed(1)),
"may": String(Number(i[11]).toFixed(1)),
"june": String(Number(i[12]).toFixed(1)),
"july": String(Number(i[13]).toFixed(1)),
"august": String(Number(i[14]).toFixed(1)),
"september": String(Number(i[15]).toFixed(1)),
"october": String(Number(i[16]).toFixed(1)),
"november": String(Number(i[17]).toFixed(1)),
"december": String(Number(i[18]).toFixed(1)),
"total_december_year": String(Number(i[19]).toFixed(1))
})
})
let payload = {
"rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
// "months": this.props.month.month_id,
"months": 0,
"status": type,
"balance_sheet": data
}
api.create('UPLOAD').createRollingOutlookBS(payload).then(response => {
console.log(payload);
console.log(response);
// console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
if (type == 'submitted') {
// this.props.saveToMonthlyReport('BS')
this.props.onClickClose()
} else {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
}
} else {
this.setState({ loading: false, handleTekTekTek: 0 }, () => {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
})
}
} else {
this.setState({ loading: false, handleTekTekTek: 0 })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -2121,7 +2178,7 @@ export default class ProfitLossRO extends Component {
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
this.backToRollingOutlook('draft')
})
}
>
......@@ -2138,7 +2195,7 @@ export default class ProfitLossRO extends Component {
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted')
this.backToRollingOutlook('submitted')
})}
style={{
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